mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-12 14:37:03 +03:00
feat: add createInitActionButton function to ButtonFactory
This commit is contained in:
@@ -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) {
|
createModalButton: function (config) {
|
||||||
return this.createButton({
|
return this.createButton({
|
||||||
label: config.label,
|
label: config.label,
|
||||||
@@ -668,7 +678,7 @@ let createStatusSection = function (podkopStatus, singboxStatus, podkop, luci, s
|
|||||||
action: 'restart',
|
action: 'restart',
|
||||||
reload: true
|
reload: true
|
||||||
}),
|
}),
|
||||||
ButtonFactory.createActionButton({
|
ButtonFactory.createInitActionButton({
|
||||||
label: podkopStatus.enabled ? 'Disable Podkop' : 'Enable Podkop',
|
label: podkopStatus.enabled ? 'Disable Podkop' : 'Enable Podkop',
|
||||||
type: podkopStatus.enabled ? 'remove' : 'apply',
|
type: podkopStatus.enabled ? 'remove' : 'apply',
|
||||||
action: podkopStatus.enabled ? 'disable' : 'enable',
|
action: podkopStatus.enabled ? 'disable' : 'enable',
|
||||||
|
|||||||
@@ -1965,18 +1965,6 @@ sing_box_add_secure_dns_probe_domain() {
|
|||||||
log "DNS probe domain ${domain} configured with override to port ${override_port}"
|
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
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
start
|
start
|
||||||
@@ -1988,12 +1976,6 @@ case "$1" in
|
|||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
;;
|
;;
|
||||||
enable)
|
|
||||||
enable
|
|
||||||
;;
|
|
||||||
disable)
|
|
||||||
disable
|
|
||||||
;;
|
|
||||||
main)
|
main)
|
||||||
main
|
main
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user