diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js index 030d4fb..81be69d 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js @@ -614,6 +614,16 @@ const ButtonFactory = { }); }, + createInitActionButton: function (config) { + return this.createButton({ + label: config.label, + additionalClass: `cbi-button-${config.type || ''}`, + onClick: () => safeExec('/etc/init.d/podkop', [config.action]) + .then(() => config.reload && location.reload()), + style: config.style + }); + }, + createModalButton: function (config) { return this.createButton({ label: config.label, @@ -668,7 +678,7 @@ let createStatusSection = function (podkopStatus, singboxStatus, podkop, luci, s action: 'restart', reload: true }), - ButtonFactory.createActionButton({ + ButtonFactory.createInitActionButton({ label: podkopStatus.enabled ? 'Disable Podkop' : 'Enable Podkop', type: podkopStatus.enabled ? 'remove' : 'apply', action: podkopStatus.enabled ? 'disable' : 'enable', diff --git a/podkop/files/usr/bin/podkop b/podkop/files/usr/bin/podkop index 06f1a9d..aca1f8b 100755 --- a/podkop/files/usr/bin/podkop +++ b/podkop/files/usr/bin/podkop @@ -1965,18 +1965,6 @@ sing_box_add_secure_dns_probe_domain() { log "DNS probe domain ${domain} configured with override to port ${override_port}" } -enable() { - log "Enabling podkop service" - /etc/init.d/podkop enable - log "Podkop service enabled" -} - -disable() { - log "Disabling podkop service" - /etc/init.d/podkop disable - log "Podkop service disabled" -} - case "$1" in start) start @@ -1988,12 +1976,6 @@ case "$1" in stop start ;; - enable) - enable - ;; - disable) - disable - ;; main) main ;;