Commit 7432e7f4 authored by Ahmad's avatar Ahmad

init

parent 76f7cf28
......@@ -148,7 +148,6 @@ async function main() {
let newConfig=await getConfig()
newConfig=JSON.stringify(newConfig)
applyChanges(newConfig)
if (storeConfig === null || newConfig !==storeConfig)
{
console.log('config has been changed')
......@@ -166,24 +165,17 @@ 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}`);
if (!processExists) {
await startProcess();
}
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
// 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