Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
x-ui
Commits
7432e7f4
Commit
7432e7f4
authored
Jul 23, 2024
by
Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
76f7cf28
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
appcdn.js
appcdn.js
+7
-15
No files found.
appcdn.js
View file @
7432e7f4
...
@@ -148,7 +148,6 @@ async function main() {
...
@@ -148,7 +148,6 @@ async function main() {
let
newConfig
=
await
getConfig
()
let
newConfig
=
await
getConfig
()
newConfig
=
JSON
.
stringify
(
newConfig
)
newConfig
=
JSON
.
stringify
(
newConfig
)
applyChanges
(
newConfig
)
if
(
storeConfig
===
null
||
newConfig
!==
storeConfig
)
if
(
storeConfig
===
null
||
newConfig
!==
storeConfig
)
{
{
console
.
log
(
'
config has been changed
'
)
console
.
log
(
'
config has been changed
'
)
...
@@ -166,24 +165,17 @@ async function main() {
...
@@ -166,24 +165,17 @@ async function main() {
}
}
async
function
applyChanges
(
newConfig
)
{
async
function
applyChanges
(
newConfig
)
{
try
{
const
configFilePath
=
path
.
join
(
'
/usr/local/x-ui/
'
,
`config.json`
);
const
configFilePath
=
path
.
join
(
'
/usr/local/x-ui/
'
,
`config.json`
);
await
writeFile
(
configFilePath
,
newConfig
);
await
writeFile
(
configFilePath
,
newConfig
);
console
.
log
(
`Config written to
${
configFilePath
}
`
);
const
processExists
=
await
xrayManager
.
isProcessRunning
(
processName
);
const
processExists
=
await
xrayManager
.
isProcessRunning
(
processName
);
console
.
log
(
`Process
${
processName
}
running:
${
processExists
}
`
);
if
(
!
processExists
)
{
if
(
!
processExists
)
{
await
startProcess
();
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
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment