diff --git a/core/api_views.py b/core/api_views.py
index dfb52b44..b416cf92 100644
--- a/core/api_views.py
+++ b/core/api_views.py
@@ -203,7 +203,7 @@ def environment(request):
country_code = None
country_name = None
- # 1) Get the public IP
+ # 1) Get the public IP from ipify.org API
try:
r = requests.get("https://api64.ipify.org?format=json", timeout=5)
r.raise_for_status()
@@ -211,17 +211,17 @@ def environment(request):
except requests.RequestException as e:
public_ip = f"Error: {e}"
- # 2) Get the local IP
+ # 2) Get the local IP by connecting to a public DNS server
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- # connect to a “public” address so the OS can determine our local interface
+ # connect to a "public" address so the OS can determine our local interface
s.connect(("8.8.8.8", 80))
local_ip = s.getsockname()[0]
s.close()
except Exception as e:
local_ip = f"Error: {e}"
- # 3) If we got a valid public_ip, fetch geo info from ipapi.co or ip-api.com
+ # 3) Get geolocation data from ipapi.co or ip-api.com
if public_ip and "Error" not in public_ip:
try:
# Attempt to get geo information from ipapi.co first
@@ -250,6 +250,7 @@ def environment(request):
country_code = None
country_name = None
+ # 4) Get environment mode from system environment variable
return Response(
{
"authenticated": True,
diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsx
index ac1688e0..e471602e 100644
--- a/frontend/src/pages/Settings.jsx
+++ b/frontend/src/pages/Settings.jsx
@@ -143,15 +143,14 @@ const SettingsPage = () => {
}, {})
);
- const proxySettings = JSON.parse(
- settings['proxy-settings'].value || '{}'
- );
- proxySettingsForm.setValues(
- Object.keys(PROXY_SETTINGS_OPTIONS).reduce((acc, key) => {
- acc[key] = proxySettings[key] || '';
- return acc;
- }, {})
- );
+ if (settings['proxy-settings']?.value) {
+ try {
+ const proxySettings = JSON.parse(settings['proxy-settings'].value);
+ proxySettingsForm.setValues(proxySettings);
+ } catch (error) {
+ console.error('Error parsing proxy settings:', error);
+ }
+ }
}
}, [settings]);
@@ -246,143 +245,217 @@ const SettingsPage = () => {
defaultValue="ui-settings"
onChange={setAccordianValue}
>
- {[
-
- UI Settings
-
-
- ,
- ].concat(
- authUser.user_level == USER_LEVELS.ADMIN
- ? [
-
- Stream Settings
-
-
+
+
-
- User-Agents
-
-
-
- ,
-
-
- Stream Profiles
-
-
-
- ,
-
-
-
- Network Access
- {accordianValue == 'network-access' && (
-
- Comma-Delimited CIDR ranges
-
+
+
+ Proxy Settings
+
+
+ ,
-
-
-
- Proxy Settings
-
-
-
-
- {proxySettingsSaved && (
-
- )}
- {Object.entries(PROXY_SETTINGS_OPTIONS).map(
- ([key, config]) => {
- // Determine if this field should be a NumberInput
- const isNumericField = [
- 'buffering_timeout',
- 'redis_chunk_ttl',
- 'channel_shutdown_delay',
- 'channel_init_grace_period'
- ].includes(key);
- const isFloatField = key === 'buffering_speed';
-
- if (isNumericField) {
- return (
-
- );
- } else if (isFloatField) {
- return (
-
- );
- } else {
- return (
-
- );
- }
- }
- )}
-
-
+
-
-
-
- ,
- ]
- : []
+ Save
+
+
+
+
+
+
+ >
)}