Просмотр исходного кода

Fix PHP parse error in JellyStat plugin

- Fix JavaScript variable injection using json_encode() for safe escaping
- Remove problematic apostrophes in JavaScript comments within PHP strings
- Maintain dual URL support (external HTTPS for frontend, internal HTTP for backend)
- Preserve JellyStat image proxy integration with proper endpoint format
- All functionality retained while resolving syntax validation errors
mgomon 11 месяцев назад
Родитель
Сommit
a92bbee0dc
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      api/homepage/jellystat.php

+ 3 - 3
api/homepage/jellystat.php

@@ -334,7 +334,7 @@ trait JellyStatHomepageItem
         function getPosterUrl(posterPath, itemId, serverId) {
             console.log("getPosterUrl called with:", {posterPath, itemId, serverId});
             // Use external URL for frontend poster display to avoid mixed content issues
-            var jellyStatUrl = "' . $jellyStatUrl . '";
+            var jellyStatUrl = ' . json_encode($jellyStatUrl) . ';
             console.log("JellyStat URL from config:", jellyStatUrl);
             
             if (!posterPath && !itemId) {
@@ -345,12 +345,12 @@ trait JellyStatHomepageItem
             // If we have a poster path, process it
             if (posterPath) {
                 console.log("Processing poster path:", posterPath);
-                // If it's already an absolute URL, use it directly
+                // If its already an absolute URL, use it directly
                 if (posterPath.indexOf("http://") === 0 || posterPath.indexOf("https://") === 0) {
                     console.log("Poster path is absolute URL:", posterPath);
                     return posterPath;
                 }
-                // If it's a relative path starting with /, prepend the JellyStat URL
+                // If its a relative path starting with /, prepend the JellyStat URL
                 if (jellyStatUrl && posterPath.indexOf("/") === 0) {
                     var fullUrl = jellyStatUrl + posterPath;
                     console.log("Generated full URL from relative path:", fullUrl);