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:----nldpa1lPXcY2qNHgWQHJOeUzk5/w1K2qCkp0FyrA7CKN3WqV7VKY6DbJMEDUsJ6modz1NJ3NY/LCUnIqZtz83E53iq7xpp8cDqvjWD7JNBo63McE+/RhbTgCqrItoyq9I4lERHOchyklSnXRG3w3AvyrpBHBbde7lMnKNvp2lbzVu4d4Qu9yQwCxWj4TqxHia0fsAPkBl/FUtj5V/m+WXdivp8tyNSM5zV327XJJ2wuZhR/cuGLaEuSY+ToA1m2vLvw4RE6Tflkh3oe/jWt+idOv+Ew4UTCkaw4lx7FRqZAGBV63LP17eBsqDMgYp/0+9urGkolEBuMZDMhbqK4853usQ26t2EyQOHZ67TqeZG/6/IJ5wz2TC5i0+042MyYBZzGdyIVSpHaMzuWRMra8GP2pZ6KqmC7MBb/ZWTdtBjROlYCYQxbhWGGL33E/KNx8U8XlysVMiUv07SMsotDyegGN23AVGIkVVfRVzMlUAQXBLXo31WedKxOPzGxZyAW+SN4YtPIyxou80BfxAHKVNB2/XNLBnxzF2xs54WGKPszbXJ6VS7sqRcfrK7HUEh1H5QQkF3+m0HdUgO7PKLhv+5ErHlVuJ0KkYbYLZV6+4JqG35tyrUCYw7uOblz/5vrujjMIzEISu3Kb7Mxhm1IKwUmmfyY6bTaoDlDb6HtZvnA=----ATTACHMENT:----ODYyMDg3NTgyMTY3MDIzNiAyNzk5NjYyNDk0NDcxNjMyIDU4OTQ2Mzc1MDc1MDIwNDQ=