diff --git a/fe-app-podkop/src/podkop/methods/shell/callBaseMethod.ts b/fe-app-podkop/src/podkop/methods/shell/callBaseMethod.ts index e317584..04f1ef9 100644 --- a/fe-app-podkop/src/podkop/methods/shell/callBaseMethod.ts +++ b/fe-app-podkop/src/podkop/methods/shell/callBaseMethod.ts @@ -4,9 +4,10 @@ import { Podkop } from '../../types'; export async function callBaseMethod( method: Podkop.AvailableMethods, args: string[] = [], + command: string = '/usr/bin/podkop', ): Promise> { const response = await executeShellCommand({ - command: '/usr/bin/podkop', + command, args: [method as string, ...args], timeout: 10000, }); diff --git a/fe-app-podkop/src/podkop/methods/shell/index.ts b/fe-app-podkop/src/podkop/methods/shell/index.ts index 983712c..d4f3eb4 100644 --- a/fe-app-podkop/src/podkop/methods/shell/index.ts +++ b/fe-app-podkop/src/podkop/methods/shell/index.ts @@ -47,8 +47,18 @@ export const PodkopShellMethods = { restart: async () => callBaseMethod(Podkop.AvailableMethods.RESTART), start: async () => callBaseMethod(Podkop.AvailableMethods.START), stop: async () => callBaseMethod(Podkop.AvailableMethods.STOP), - enable: async () => callBaseMethod(Podkop.AvailableMethods.ENABLE), - disable: async () => callBaseMethod(Podkop.AvailableMethods.DISABLE), + enable: async () => + callBaseMethod( + Podkop.AvailableMethods.ENABLE, + [], + '/etc/init.d/podkop', + ), + disable: async () => + callBaseMethod( + Podkop.AvailableMethods.DISABLE, + [], + '/etc/init.d/podkop', + ), globalCheck: async () => callBaseMethod(Podkop.AvailableMethods.GLOBAL_CHECK), showSingBoxConfig: async () => diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js index 6945a52..1720eee 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js @@ -404,9 +404,9 @@ async function getConfigSections() { } // src/podkop/methods/shell/callBaseMethod.ts -async function callBaseMethod(method, args = []) { +async function callBaseMethod(method, args = [], command = "/usr/bin/podkop") { const response = await executeShellCommand({ - command: "/usr/bin/podkop", + command, args: [method, ...args], timeout: 1e4 }); @@ -496,8 +496,16 @@ var PodkopShellMethods = { restart: async () => callBaseMethod(Podkop.AvailableMethods.RESTART), start: async () => callBaseMethod(Podkop.AvailableMethods.START), stop: async () => callBaseMethod(Podkop.AvailableMethods.STOP), - enable: async () => callBaseMethod(Podkop.AvailableMethods.ENABLE), - disable: async () => callBaseMethod(Podkop.AvailableMethods.DISABLE), + enable: async () => callBaseMethod( + Podkop.AvailableMethods.ENABLE, + [], + "/etc/init.d/podkop" + ), + disable: async () => callBaseMethod( + Podkop.AvailableMethods.DISABLE, + [], + "/etc/init.d/podkop" + ), globalCheck: async () => callBaseMethod(Podkop.AvailableMethods.GLOBAL_CHECK), showSingBoxConfig: async () => callBaseMethod(Podkop.AvailableMethods.SHOW_SING_BOX_CONFIG), checkLogs: async () => callBaseMethod(Podkop.AvailableMethods.CHECK_LOGS)