Explorar o código

Add dual URL support for JellyStat - internal API, external posters

- Added optional Internal JellyStat URL setting for server-side API calls
- Backend now uses internal URL (e.g., http://192.168.80.77:3000) for API requests
- Frontend continues to use external URL (e.g., https://jellystat.glassnetworks.net) for poster images
- This resolves mixed content issues while maintaining SSL certificate compatibility
- If internal URL is not set, falls back to main URL for backwards compatibility
mgomon hai 9 meses
pai
achega
7709b171f3
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      api/homepage/jellystat.php

+ 8 - 2
api/homepage/jellystat.php

@@ -34,6 +34,7 @@ trait JellyStatHomepageItem
                 ],
                 'Connection' => [
                     $this->settingsOption('url', 'jellyStatURL', ['label' => 'JellyStat URL', 'help' => 'URL to your JellyStat instance']),
+                    $this->settingsOption('url', 'jellyStatInternalURL', ['label' => 'Internal JellyStat URL (optional)', 'help' => 'Internal URL for server-side API calls (e.g., http://192.168.80.77:3000). If not set, uses main URL.']),
                     $this->settingsOption('token', 'jellyStatApikey', ['label' => 'JellyStat API Key', 'help' => 'API key for JellyStat (required for native mode)']),
                     $this->settingsOption('disable-cert-check', 'jellyStatDisableCertCheck'),
                     $this->settingsOption('use-custom-certificate', 'jellyStatUseCustomCertificate'),
@@ -791,8 +792,13 @@ trait JellyStatHomepageItem
     {
         $disableCert = $this->config['jellyStatDisableCertCheck'] ?? false;
         $customCert = $this->config['jellyStatUseCustomCertificate'] ?? false;
-        $options = $this->requestOptions($url, null, $disableCert, $customCert);
-        $baseUrl = $this->qualifyURL($url);
+        
+        // Use internal URL for server-side API calls if configured, otherwise use main URL
+        $internalUrl = $this->config['jellyStatInternalURL'] ?? '';
+        $apiUrl = !empty($internalUrl) ? $internalUrl : $url;
+        
+        $options = $this->requestOptions($apiUrl, null, $disableCert, $customCert);
+        $baseUrl = $this->qualifyURL($apiUrl);
         
         $stats = [
             'period' => "{$days} days",