From e662f25f53185da62b0d656eec218674c58ee2a4 Mon Sep 17 00:00:00 2001 From: divocat Date: Thu, 9 Oct 2025 23:09:54 +0300 Subject: [PATCH] fix: reorder options on settings tab --- .../resources/view/podkop/settings.js | 195 +++++++++--------- 1 file changed, 97 insertions(+), 98 deletions(-) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js index c3eb46a..bf2476c 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js @@ -82,56 +82,6 @@ function createSettingsContent(section) { return true; }; - o = section.option( - form.ListValue, - 'config_path', - _('Config File Path'), - _( - 'Select path for sing-box config file. Change this ONLY if you know what you are doing', - ), - ); - o.value('/etc/sing-box/config.json', 'Flash (/etc/sing-box/config.json)'); - o.value('/tmp/sing-box/config.json', 'RAM (/tmp/sing-box/config.json)'); - o.default = '/etc/sing-box/config.json'; - o.rmempty = false; - - o = section.option( - form.Value, - 'cache_path', - _('Cache File Path'), - _( - 'Select or enter path for sing-box cache file. Change this ONLY if you know what you are doing', - ), - ); - o.value('/tmp/sing-box/cache.db', 'RAM (/tmp/sing-box/cache.db)'); - o.value( - '/usr/share/sing-box/cache.db', - 'Flash (/usr/share/sing-box/cache.db)', - ); - o.default = '/tmp/sing-box/cache.db'; - o.rmempty = false; - o.validate = function (section_id, value) { - if (!value) { - return _('Cache file path cannot be empty'); - } - - if (!value.startsWith('/')) { - return _('Path must be absolute (start with /)'); - } - - if (!value.endsWith('cache.db')) { - return _('Path must end with cache.db'); - } - - const parts = value.split('/').filter(Boolean); - if (parts.length < 2) { - return _('Path must contain at least one directory (like /tmp/cache.db)'); - } - - return true; - }; - - o = section.option( widgets.DeviceSelect, 'iface', @@ -169,54 +119,6 @@ function createSettingsContent(section) { return !isWireless; }; - o = section.option( - form.ListValue, - 'update_interval', - _('List Update Frequency'), - _('Select how often the lists will be updated'), - ); - Object.entries(main.UPDATE_INTERVAL_OPTIONS).forEach(([key, label]) => { - o.value(key, _(label)); - }); - o.default = '1d'; - o.rmempty = false; - - o = section.option( - form.Flag, - 'quic_disable', - _('QUIC disable'), - _('For issues with the video stream'), - ); - o.default = '0'; - o.rmempty = false; - - o = section.option( - form.Flag, - 'yacd', - _('Yacd enable'), - `${main.getClashApiUrl()}/ui`, - ); - o.default = '0'; - o.rmempty = false; - - o = section.option( - form.Flag, - 'exclude_ntp', - _('Exclude NTP'), - _('Allows you to exclude NTP protocol traffic from the tunnel'), - ); - o.default = '0'; - o.rmempty = false; - - o = section.option( - form.Flag, - 'detour', - _('Proxy download of lists'), - _('Downloading all lists via main Proxy/VPN'), - ); - o.default = '0'; - o.rmempty = false; - o = section.option( form.Flag, 'mon_restart_ifaces', @@ -265,6 +167,45 @@ function createSettingsContent(section) { return true; }; + o = section.option( + form.ListValue, + 'update_interval', + _('List Update Frequency'), + _('Select how often the lists will be updated'), + ); + Object.entries(main.UPDATE_INTERVAL_OPTIONS).forEach(([key, label]) => { + o.value(key, _(label)); + }); + o.default = '1d'; + o.rmempty = false; + + o = section.option( + form.Flag, + 'yacd', + _('Yacd enable'), + `${main.getClashApiUrl()}/ui`, + ); + o.default = '0'; + o.rmempty = false; + + o = section.option( + form.Flag, + 'quic_disable', + _('QUIC disable'), + _('For issues with the video stream'), + ); + o.default = '0'; + o.rmempty = false; + + o = section.option( + form.Flag, + 'detour', + _('Proxy download of lists'), + _('Downloading all lists via main Proxy/VPN'), + ); + o.default = '0'; + o.rmempty = false; + o = section.option( form.Flag, 'dont_touch_dhcp', @@ -273,6 +214,64 @@ function createSettingsContent(section) { ); o.default = '0'; o.rmempty = false; + + o = section.option( + form.ListValue, + 'config_path', + _('Config File Path'), + _( + 'Select path for sing-box config file. Change this ONLY if you know what you are doing', + ), + ); + o.value('/etc/sing-box/config.json', 'Flash (/etc/sing-box/config.json)'); + o.value('/tmp/sing-box/config.json', 'RAM (/tmp/sing-box/config.json)'); + o.default = '/etc/sing-box/config.json'; + o.rmempty = false; + + o = section.option( + form.Value, + 'cache_path', + _('Cache File Path'), + _( + 'Select or enter path for sing-box cache file. Change this ONLY if you know what you are doing', + ), + ); + o.value('/tmp/sing-box/cache.db', 'RAM (/tmp/sing-box/cache.db)'); + o.value( + '/usr/share/sing-box/cache.db', + 'Flash (/usr/share/sing-box/cache.db)', + ); + o.default = '/tmp/sing-box/cache.db'; + o.rmempty = false; + o.validate = function (section_id, value) { + if (!value) { + return _('Cache file path cannot be empty'); + } + + if (!value.startsWith('/')) { + return _('Path must be absolute (start with /)'); + } + + if (!value.endsWith('cache.db')) { + return _('Path must end with cache.db'); + } + + const parts = value.split('/').filter(Boolean); + if (parts.length < 2) { + return _('Path must contain at least one directory (like /tmp/cache.db)'); + } + + return true; + }; + + o = section.option( + form.Flag, + 'exclude_ntp', + _('Exclude NTP'), + _('Allows you to exclude NTP protocol traffic from the tunnel'), + ); + o.default = '0'; + o.rmempty = false; } const EntryPoint = {