Browse Source

Remove all hardcoded config values from frontend

Frontend now loads all config from backend API.
No more hardcoded IPs, ports, or default values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
root 2 weeks ago
parent
commit
a908a08c62
1 changed files with 6 additions and 86 deletions
  1. 6 86
      frontend/src/views/superadmin/DevicesView.vue

+ 6 - 86
frontend/src/views/superadmin/DevicesView.vue

@@ -522,79 +522,13 @@ const defaultConfigJson = ref('')
 const savingDefaultConfig = ref(false)
 const savingDefaultConfig = ref(false)
 const jsonError = ref(null)
 const jsonError = ref(null)
 const defaultNtpServersText = ref('')
 const defaultNtpServersText = ref('')
-const defaultConfig = ref({
-  force_cloud: false,
-  cfg_polling_timeout: 30,
-  ble: {
-    enabled: true,
-    batch_interval_ms: 2500,
-    uuid_filter_hex: '',
-    upload_endpoint: ''
-  },
-  wifi: {
-    client_enabled: false,
-    ssid: '',
-    psk: '',
-    monitor_enabled: true,
-    batch_interval_ms: 10000,
-    upload_endpoint: ''
-  },
-  ssh_tunnel: {
-    enabled: false,
-    server: 'ms.e-bash.ru',
-    port: 2223,
-    user: 'tunnel',
-    remote_port: 0,
-    keepalive_interval: 30
-  },
-  dashboard_tunnel: {
-    enabled: false,
-    server: 'ms.e-bash.ru',
-    port: 2223,
-    user: 'tunnel',
-    remote_port: 0,
-    keepalive_interval: 30
-  },
-  dashboard: {
-    enabled: true
-  },
-  net: {
-    ntp: {
-      servers: ['pool.ntp.org', 'time.google.com']
-    }
-  },
-  debug: false
-})
+// Default config is loaded from backend API, no hardcoded values
+const defaultConfig = ref({})
 let searchDebounceTimer = null
 let searchDebounceTimer = null
 let pollingInterval = null
 let pollingInterval = null
 
 
-const config = ref({
-  force_cloud: false,
-  cfg_polling_timeout: 30,
-  ble: {
-    enabled: true,
-    batch_interval_ms: 2500,
-    uuid_filter_hex: '',
-    upload_endpoint: ''
-  },
-  wifi: {
-    client_enabled: false,
-    ssid: '',
-    psk: '',
-    monitor_enabled: true,
-    batch_interval_ms: 10000,
-    upload_endpoint: ''
-  },
-  dashboard: {
-    enabled: true
-  },
-  net: {
-    ntp: {
-      servers: ['pool.ntp.org', 'time.google.com']
-    }
-  },
-  debug: false
-})
+// Device config is loaded from device data, no hardcoded values
+const config = ref({})
 
 
 const sortedDevices = computed(() => {
 const sortedDevices = computed(() => {
   let result = [...devices.value]
   let result = [...devices.value]
@@ -978,22 +912,8 @@ async function showDefaultConfigModal() {
         batch_interval_ms: configData.wifi?.batch_interval_ms ?? 10000,
         batch_interval_ms: configData.wifi?.batch_interval_ms ?? 10000,
         upload_endpoint: configData.wifi?.upload_endpoint ?? ''
         upload_endpoint: configData.wifi?.upload_endpoint ?? ''
       },
       },
-      ssh_tunnel: configData.ssh_tunnel || {
-        enabled: false,
-        server: '192.168.5.4',
-        port: 22,
-        user: 'tunnel',
-        remote_port: 0,
-        keepalive_interval: 30
-      },
-      dashboard_tunnel: configData.dashboard_tunnel || {
-        enabled: false,
-        server: '192.168.5.4',
-        port: 22,
-        user: 'tunnel',
-        remote_port: 0,
-        keepalive_interval: 30
-      },
+      ssh_tunnel: configData.ssh_tunnel || {},
+      dashboard_tunnel: configData.dashboard_tunnel || {},
       dashboard: {
       dashboard: {
         enabled: configData.dashboard?.enabled ?? true
         enabled: configData.dashboard?.enabled ?? true
       },
       },