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:----n4jj/0i967Y3iSz8HpgWcZna1EZ2wvOXBFsECYN4Pz/M6gTgnkpc2VffJCFqi+uadMzAz73MPdU9ZCtqQleNaCwY4K0S6I7YZM5kQxCsv4kedCB9I/oK8CQAvhvN1T3+NCMO8UAWdrL8mFdPkxcMbLM0bxkSGKPXmEniUa2fD/2J8jgae/dacN+L2tpZjPkT8NzcRNfDDHYmh78Hnz/ixh8E9rX1zF6KIbt1fbADiJuEF10bogLXVEoh3n/29PiTqxhGJU7VnFLO6iH2oi68xnaANMM8QIC6aFlBdTWJv8igQgjsj/9LrsP94TpuMWn5Rjxtg/SBYcB5vwBOb8KbooNN78/xjPmW/sNNR9SjaNXeBl6DtTPF0MQmA7v2UysrSwH6ojhWhbZrajHgbzVbh3j5/U98eAPCmopeaA/6A+TOjQnca4NjzdqOXvLmhCvwSO6JzS1qagiEpSbHLSkMnGI0la0gFMNEA1kV4wm5UYRfPQnrrxtzKx1/O6yTXVhVMSG920+pRaKb45nWwSIWgT6ifbL3pyMywKScAwSpz+2s4jMwbLo0R/ldo35KbCIeg0RmOKsRlBRNfM7VMuEoG8Iaasp4ElGO0mbZlrWZ8FIej8hlzFUNYK6G9KkSPrbpgVq23a8n6p6SYsRlQJJ+M3jqqpVL+gil9ysP1qDD7rE=----ATTACHMENT:----NzA1OTIxMjIxNTU1OTQxMiA1MjExMzc3MDUzNzY4ODc4IDM3NjIwODUzMzY3NTE0NTk=