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:----vLK6BBbiKE8OagnF9BhfJC7/ups8Djckti30QTIdL2NOq6PpIdcnjUfHjgNgg7i7AErnrMnK1P3rQm+qVTNQz18dsWxYt0vSIsvJGcy8mxK+zXGhLXVNST5fhGtifiHj/bhjIcgPSKuPb9uKRe79sh/RwiMYoF2q9B0dhgBJKNvAxD5msOq5vntQokI1s0hg5I3SufnxQXYwDKPIfybjqDTOJKNf+3PIw3ofNxr4tINccOkcLwUKkVzpOjeNGrG7vMieLQzeF/Gs3GEHOIgzGzMfdbH8rUKYBDfgwO/OJGEkXr4o3DcfxNGEIzYpmFV3wbi9qacBCB/qHme5p74mTpYZDVfvomIspGadPOYRyE+txslpdUsmVNtnMnF8jxpqibI9pKEu70CAWTsDngq4v3Mj3MqGmLOg5qY0zSmAjobrQlW8dP45K6yeXNrLbNqy2LLsK2nWXnYzXst891hhKgzCIW3F6gP5wYgSDtgyB0UzqQxRB7oGBlOZ5pCI0otxyHxyArnLHB5BZ7KZhYuo2vLd5veTGOdaudu+gJL4wjrV3piRh3ADM6fu+dTdMNsD1quRU8XISzOk+LGCcQWKs7rYEu/ZvB0Cryrv5LA/zn7gWOJ0xFbz8vZgsGxvo7xcIE+Of0s+ALSOB/5RLeMiv/W4t7xmu44skcU3CjXMXYU=----ATTACHMENT:----NzkyMTc4NzYzODI3OTUxNSA2NjQzNjMzNDYwNzA0MzI3IDQwNjQwNjEzNzAxMjYxODM=