AuthShield = $AuthShield; $this->container=(null!==$container) ? $container : $AuthShield->getAppShield()->getContainer(); } public function auth(\UMA\JsonRpc\Request $request){ return 'admin' === $this->container->get('webfan.app.fsm.user')->getCurrentState()->getName(); } /** * {@inheritdoc} */ public function __invoke(\UMA\JsonRpc\Request $request): \UMA\JsonRpc\Response { $params = $request->params(); set_time_limit(300); $AppShield = $this->AuthShield->getAppShield(); $config = $AppShield->config->export(); if(!property_exists($params, 'dir')){ return new \UMA\JsonRpc\Error($request->id(), 'No `dir` specified'); } $path = str_replace('//', '/', $params->dir); $path = str_replace('/', \DIRECTORY_SEPARATOR, $path); $path = str_replace('composer.json', '', $path); $original_path=$path; if(!is_dir($path)){ $path = $config['wsdir'] . $original_path; } if(!is_dir($path)){ $path = $config['wsdir'] . \DIRECTORY_SEPARATOR . $original_path; } if(!is_dir($path)){ $path = $config['wsdir'] . 'frdl-projects' . $original_path; } if(!is_dir($path)){ $path = $config['wsdir'] . 'frdl-projects' . \DIRECTORY_SEPARATOR . $original_path; } if(!is_dir($path)){ return new \UMA\JsonRpc\Error($request->id(), '`dir` does not exist'); } $this->container->get('emitter')->emit('before.compile', ['container'=>$this->container, 'AppShield'=>$AppShield]); $mutex = $this->container->get('webfan.app.mutex.lock.stub'); $container = $this->container; $result = $mutex->synchronized(function () use ($path, $container ) { return $container->get('pipeline.bundlejs')->process($path, $container); }); if(!(is_object($result) && $result instanceof \Exception)){ return new \UMA\JsonRpc\Success($request->id(), $result); }else{ return new \UMA\JsonRpc\Error($request->id(), $result->getMessage()); } } public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.org/draft-07/schema#", "type": ["object"], "properties": { "dir" : { type : ["string"] } }, "required" : ["dir"], "additionalProperties": true } JSON ); } } __halt_compiler();----SIGNATURE:----XF1sJPiq+mgrQ2dQK1/q01QoGpe78VE4/0mPvtk20ZaVmJQrfW8zj/ABbXTcECV1n2lMUQ2Mgdf5leL39oUMV3xXdBjnoRoQ20j1sXshTW95ZZpxgp9Wshl+MADs9gRKDSLcAVT8M6Z9wzeh6UDlPtzx0LLgEdW1vy5Yvs54Udd98uddQQcmv0Rf79bPug3qnZO7WZuOjtJ3BK0TX9Ju6aP/4l7bA2KqJrwSUML9hE4n+CJHhMOKrkOV0leAyrjVTOiLk+OStMBfcr7L5f9UK7QrRs4iDE15gP9n3A+uWTHhEabqJntWGT6wwOxK9lEeTWif4tuQF6YM00nMU/iqGCXZ+zXNpd3CCOtEn0QMRe5Bt5z0QtbKT8SHDm67M+mjpZZoTp3pcwZ6GxQwPo+BtrGsH94+C8Eaxz1QwKqdshQ8AptBIIxq0bfY7M3y32RlTCrfvJuN2aNEyEPKqaYgwzx936MPRHDXPb/y+GljMJxI82Y2WrBxcKmdfr/B7BIXrW4403B0e28VCF58u3UKGzHc8k/JNnxpi4jgIjOsV+Qi/NfjnMBmQOSAk5yq49O/7OJkcIx5p+rNcASyYEb+qVL+5soDPkfqT50oGEK5GhbkvIuUEQW4qvDWR01RVa7mz2NPJMdaM20ZiIkN1na8WTUJeyh2GhW+A3tsI1sYL5c=----ATTACHMENT:----MjIyMDIwOTY2NTgyMzgyMCA4MzQxMjEzOTMwMjkwNzQ5IDU2MTU4NjYyOTc1Mzc5MTg=