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(); } */ public function __invoke(\UMA\JsonRpc\Request $request): \UMA\JsonRpc\Response { $config = $this->AuthShield->getAppShield()->config->export(); $params = $request->params(); $path=$params[0]; $path = str_replace('//', '/', $path); $path = str_replace('/', \DIRECTORY_SEPARATOR, $path); $original_path=$path; if(!file_exists($path)){ $path = $config['wsdir'] . $original_path; } if(!file_exists($path)){ $path = $config['wsdir'] . \DIRECTORY_SEPARATOR . $original_path; } if(!file_exists($path)){ $path = $config['wsdir'] . 'frdl-projects' . $original_path; } if(!file_exists($path)){ $path = $config['wsdir'] . 'frdl-projects' . \DIRECTORY_SEPARATOR . $original_path; } if(!file_exists($path)){ return new \UMA\JsonRpc\Error($request->id(), sprintf('`%s` does not exist', $path)); } $contents = file_get_contents($path); $sha1 = sha1($contents); $result = [ 'sha1' => $sha1, 'contents' => base64_encode($contents), 'encoding' => 'base64', 'size' => filesize($path), 'time' => filemtime($path), ]; return new \UMA\JsonRpc\Success($request->id(), $result); } public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.org/draft-07/schema#", "type": ["array"], "minItems": 1, "maxItems": 1, "items": { "type": ["string"] } } JSON ); } } __halt_compiler();----SIGNATURE:----H6FwCN2GnPc8KfmPEFkIcrAmQ9OetxQa+ykJzFerbWO6teu0AssqOEudswvM5IBJ/179WPmnZsH9gEPAohT/woy8sYIPDw4UDKJCBmVaZ7T3UkB23IXGaXOzf4hTlaGXqHDDcPoh9mGgnuo6YfJQQZ8RgpMijDP1sryga9M/cCO5BT/gpc2J4at6DcEdsI+YgF/6Uu3rVyhfjatSr4FQSXwQhYdxryG+i/FknOY58yNG0VikXyGeWAL5ProNyRm8DdGEx+LCvpInbAY5RmeAh3n5cJ4++Bz2pDLPCkOlORrm2h410U0IwBww69cutFIWIhEoHd06aVaZw6mSfHp67Gzcw8ZJvyRc1mZYBWA24rhQ/21IFOsocjsqb2XxIKDomir97sdO4V9TG/cUbrJVeInQiJl26jgnqR5SxO484SRGsi/H85UcdTYmFvsEL7ETEwHEMcEZHRKgO82boCpzxHoa/smS4jg2aytlUkUweVZDHYJNfuUnWnaEQIQ5FY9IzG52XYcX6xcZ28l6xAdGPMekDcOHhEPiU6h9gozzX1xO0GdDe4O+wCqzOMKEziIhgcGLBG9IupWQNUg3O0tbuZPKLXcuH4i/TtTdXD/RfU2Dp/S94Jsxs+izTD+19C1rPxZhIGdWok7ZZmk1D8YkDfr3RPv4WLxds7NHkJt7uww=----ATTACHMENT:----Mzc0NzA5NDMyNTAyMjAxNiA4Mjg4Nzg0NzIzODMxNjM1IDkxODc4NDk2MjI3NzEyMjE=