Sfoglia il codice sorgente

Add API route for userWatchStatsSimple plugin

- Add GET /api/v2/homepage/userWatchStatsSimple route
- Route calls getUserWatchStatsSimple() method from HomepageUserWatchStatsSimple trait
- Required for plugin to function properly in settings interface and homepage display
- Ensures save button and form interactions work correctly
mgomon 9 mesi fa
parent
commit
782d45a96a
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      api/v2/routes/homepage.php

+ 8 - 0
api/v2/routes/homepage.php

@@ -629,3 +629,11 @@ $app->get('/homepage/userWatchStats', function ($request, $response, $args) {
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
 		->withStatus($GLOBALS['responseCode']);
 });
 });
+$app->get('/homepage/userWatchStatsSimple', function ($request, $response, $args) {
+	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
+	$Organizr->getUserWatchStatsSimple();
+	$response->getBody()->write(jsonE($GLOBALS['api']));
+	return $response
+		->withHeader('Content-Type', 'application/json;charset=UTF-8')
+		->withStatus($GLOBALS['responseCode']);
+});