mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 11:36:50 +03:00
fix: change command for enable/disable actions
This commit is contained in:
@@ -4,9 +4,10 @@ import { Podkop } from '../../types';
|
||||
export async function callBaseMethod<T>(
|
||||
method: Podkop.AvailableMethods,
|
||||
args: string[] = [],
|
||||
command: string = '/usr/bin/podkop',
|
||||
): Promise<Podkop.MethodResponse<T>> {
|
||||
const response = await executeShellCommand({
|
||||
command: '/usr/bin/podkop',
|
||||
command,
|
||||
args: [method as string, ...args],
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
@@ -47,8 +47,18 @@ export const PodkopShellMethods = {
|
||||
restart: async () => callBaseMethod<unknown>(Podkop.AvailableMethods.RESTART),
|
||||
start: async () => callBaseMethod<unknown>(Podkop.AvailableMethods.START),
|
||||
stop: async () => callBaseMethod<unknown>(Podkop.AvailableMethods.STOP),
|
||||
enable: async () => callBaseMethod<unknown>(Podkop.AvailableMethods.ENABLE),
|
||||
disable: async () => callBaseMethod<unknown>(Podkop.AvailableMethods.DISABLE),
|
||||
enable: async () =>
|
||||
callBaseMethod<unknown>(
|
||||
Podkop.AvailableMethods.ENABLE,
|
||||
[],
|
||||
'/etc/init.d/podkop',
|
||||
),
|
||||
disable: async () =>
|
||||
callBaseMethod<unknown>(
|
||||
Podkop.AvailableMethods.DISABLE,
|
||||
[],
|
||||
'/etc/init.d/podkop',
|
||||
),
|
||||
globalCheck: async () =>
|
||||
callBaseMethod<unknown>(Podkop.AvailableMethods.GLOBAL_CHECK),
|
||||
showSingBoxConfig: async () =>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user