api.php 979 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @OA\Tag(
  4. * name="plugins-speedtest",
  5. * description="SpeedTest Plugin"
  6. * )
  7. */
  8. $app->get('/plugins/speedtest/settings', function ($request, $response, $args) {
  9. /**
  10. * @OA\Get(
  11. * tags={"plugins-speedtest"},
  12. * path="/api/v2/plugins/speedtest/settings",
  13. * summary="Get settings",
  14. * @OA\Response(
  15. * response="200",
  16. * description="Success",
  17. * @OA\JsonContent(ref="#/components/schemas/pluginSettingsPage"),
  18. * ),
  19. * @OA\Response(response="401",description="Unauthorized"),
  20. * security={{ "api_key":{} }}
  21. * )
  22. */
  23. $SpeedTest = new SpeedTest();
  24. if ($SpeedTest->checkRoute($request)) {
  25. if ($SpeedTest->qualifyRequest(1, true)) {
  26. $GLOBALS['api']['response']['data'] = $SpeedTest->speedTestGetSettings();
  27. }
  28. }
  29. $response->getBody()->write(jsonE($GLOBALS['api']));
  30. return $response
  31. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  32. ->withStatus($GLOBALS['responseCode']);
  33. });