diff --git a/DebugPlugin/controllers/api/ServiceApiController.php b/DebugPlugin/controllers/api/ServiceApiController.php new file mode 100644 index 0000000..7aa9c48 --- /dev/null +++ b/DebugPlugin/controllers/api/ServiceApiController.php @@ -0,0 +1,44 @@ +permission('Garden.Settings.Manage'); + + if (file_exists($path)) { + //Get file type and set it as Content Type + $finfo = finfo_open(FILEINFO_MIME_TYPE); + header('Content-Type: ' . finfo_file($finfo, $path)); + finfo_close($finfo); + + header('Content-Description: File Transfer'); + header('Content-Disposition: attachment; filename='.basename($path)); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + header('Content-Length: ' . filesize($path)); + ob_clean(); + flush(); + readfile($path); + exit; + } else { + throw notFoundException('File'); + } + } + +} \ No newline at end of file diff --git a/DebugPlugin/openapi/service.yml b/DebugPlugin/openapi/service.yml new file mode 100644 index 0000000..f4aff48 --- /dev/null +++ b/DebugPlugin/openapi/service.yml @@ -0,0 +1,15 @@ +openapi: 3.0.2 +info: Vanilla Service API +paths: + /service/tidewayslog: + get: + responses: + '200': + content: + 'text/plain': + schema: + type: string + description: Success + tags: + - Services + summary: File.