Commit 76f7cf28 authored by Ahmad's avatar Ahmad

init

parent 32ee66a7
......@@ -166,17 +166,24 @@ async function main() {
}
async function applyChanges(newConfig) {
try {
const configFilePath = path.join('/usr/local/x-ui/', `config.json`);
await writeFile(configFilePath, newConfig);
console.log(`Config written to ${configFilePath}`);
const processExists = await xrayManager.isProcessRunning(processName);
console.log(`Process ${processName} running: ${processExists}`);
const configFilePath = path.join('/usr/local/x-ui/', `config.json`);
await writeFile(configFilePath, newConfig);
const processExists = await xrayManager.isProcessRunning(processName);
if (!processExists) {
await startProcess();
}
// Sort clients by id
if (!processExists) {
await startProcess();
}
// Log the new configuration for debugging purposes
console.log('New configuration applied:', newConfig);
} catch (error) {
console.error('Error in applyChanges:', error.message);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment