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
2f4df62c
Commit
2f4df62c
authored
Jul 01, 2024
by
Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
3010f4a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
app.js
app.js
+25
-1
No files found.
app.js
View file @
2f4df62c
...
@@ -24,7 +24,7 @@ let totalRAM = 0;
...
@@ -24,7 +24,7 @@ let totalRAM = 0;
let
usedRAM
=
0
;
let
usedRAM
=
0
;
let
freeRAM
=
0
;
let
freeRAM
=
0
;
let
networkUsage
=
{
rx
:
1
,
tx
:
1
}
let
networkUsage
=
{
rx
:
1
,
tx
:
1
}
let
ip
=
null
let
uptime
let
uptime
const
child_process
=
require
(
'
child_process
'
);
const
child_process
=
require
(
'
child_process
'
);
const
BASE_URL
=
"
http://server2.vpsl.xyz
"
;
const
BASE_URL
=
"
http://server2.vpsl.xyz
"
;
...
@@ -126,6 +126,14 @@ app.get('/uptime', async (req, res) => {
...
@@ -126,6 +126,14 @@ app.get('/uptime', async (req, res) => {
}
}
});
});
app
.
get
(
'
/ip
'
,
async
(
req
,
res
)
=>
{
try
{
res
.
json
(
ip
);
}
catch
(
error
)
{
res
.
status
(
500
).
json
({
error
:
error
.
message
});
}
});
app
.
get
(
'
/users
'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'
/users
'
,
async
(
req
,
res
)
=>
{
try
{
try
{
...
@@ -151,6 +159,9 @@ async function main() {
...
@@ -151,6 +159,9 @@ async function main() {
console
.
log
(
'
config not been changed
'
)
console
.
log
(
'
config not been changed
'
)
}
}
if
(
ip
===
null
)
ip
=
await
getIpDetail
()
}
}
async
function
applyChanges
(
newConfig
)
{
async
function
applyChanges
(
newConfig
)
{
...
@@ -381,6 +392,19 @@ async function getConfig() {
...
@@ -381,6 +392,19 @@ async function getConfig() {
}
}
}
}
async
function
getIpDetail
()
{
try
{
const
response
=
await
axios
.
get
(
`http://ip-api.com/json/`
,
{
params
:
{
},
timeout
:
30000
});
return
response
.
data
;
}
catch
(
error
)
{
throw
error
;
}
}
...
...
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