Added sources
This commit is contained in:
36
nodejs/add_domain.js
Normal file
36
nodejs/add_domain.js
Normal file
@@ -0,0 +1,36 @@
|
||||
//NodeJS Script
|
||||
//You must have the axios module installed
|
||||
const axios = require('axios')
|
||||
const querystring = require('querystring');
|
||||
|
||||
//Admin Credentials
|
||||
const hst_hostname = 'server.hestiacp.com'
|
||||
const hst_port = 8083
|
||||
const hst_username = 'admin'
|
||||
const hst_password = 'p4ssw0rd'
|
||||
const hst_returncode = 'yes'
|
||||
const hst_command = 'v-add-domain'
|
||||
|
||||
//Domain details
|
||||
const username = 'demo'; //username to associate the domain
|
||||
const domain = 'domain.tld'; //domain
|
||||
|
||||
const data_json = {
|
||||
'user': hst_username,
|
||||
'password': hst_password,
|
||||
'returncode': hst_returncode,
|
||||
'cmd': hst_command,
|
||||
'arg1': username,
|
||||
'arg2': domain
|
||||
}
|
||||
|
||||
const data = querystring.stringify(data_json)
|
||||
|
||||
axios.post('https://'+hst_hostname+':'+hst_port+'/api/', data)
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
console.log("0 means successful")
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
35
nodejs/check_user_account.js
Normal file
35
nodejs/check_user_account.js
Normal file
@@ -0,0 +1,35 @@
|
||||
//NodeJS Script
|
||||
//You must have the axios module installed
|
||||
const axios = require('axios')
|
||||
const querystring = require('querystring')
|
||||
//Admin Credentials
|
||||
const hst_hostname = 'server.hestiacp.com'
|
||||
const hst_port = 8083
|
||||
const hst_username = 'admin'
|
||||
const hst_password = 'p4ssw0rd'
|
||||
const hst_returncode = 'yes'
|
||||
const hst_command = 'v-check-user-password'
|
||||
|
||||
//Account details
|
||||
const username = 'demo';
|
||||
const password = 'demopassword';
|
||||
|
||||
const data_json = {
|
||||
'user': hst_username,
|
||||
'password': hst_password,
|
||||
'returncode': hst_returncode,
|
||||
'cmd': hst_command,
|
||||
'arg1': username,
|
||||
'arg2': password
|
||||
}
|
||||
|
||||
const data = querystring.stringify(data_json)
|
||||
|
||||
axios.post('https://'+hst_hostname+':'+hst_port+'/api/', data)
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
console.log("0 means successful")
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
40
nodejs/create_database.js
Normal file
40
nodejs/create_database.js
Normal file
@@ -0,0 +1,40 @@
|
||||
//NodeJS Script
|
||||
//You must have the axios module installed
|
||||
const axios = require('axios')
|
||||
const querystring = require('querystring');
|
||||
|
||||
//Admin Credentials
|
||||
const hst_hostname = 'server.hestiacp.com'
|
||||
const hst_port = 8083
|
||||
const hst_username = 'admin'
|
||||
const hst_password = 'p4ssw0rd'
|
||||
const hst_returncode = 'yes'
|
||||
const hst_command = 'v-add-databse'
|
||||
|
||||
//Domain details
|
||||
const username = 'demo'
|
||||
const db_name = 'wordpress'
|
||||
const db_user = 'wordpress'
|
||||
const db_pass = 'wpbl0gp4s'
|
||||
|
||||
const data_json = {
|
||||
'user': hst_username,
|
||||
'password': hst_password,
|
||||
'returncode': hst_returncode,
|
||||
'cmd': hst_command,
|
||||
'arg1': username,
|
||||
'arg2': db_name,
|
||||
'arg3': db_user,
|
||||
'arg4': db_pass
|
||||
}
|
||||
|
||||
const data = querystring.stringify(data_json)
|
||||
|
||||
axios.post('https://'+hst_hostname+':'+hst_port+'/api/', data)
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
console.log("0 means successful")
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
44
nodejs/create_user.js
Normal file
44
nodejs/create_user.js
Normal file
@@ -0,0 +1,44 @@
|
||||
//NodeJS Script
|
||||
//You must have the axios module installed
|
||||
const axios = require('axios')
|
||||
const querystring = require('querystring');
|
||||
|
||||
//Admin Credentials
|
||||
const hst_hostname = 'server.hestiacp.com'
|
||||
const hst_port = 8083
|
||||
const hst_username = 'admin'
|
||||
const hst_password = 'p4ssw0rd'
|
||||
const hst_returncode = 'yes'
|
||||
const hst_command = 'v-add-user'
|
||||
|
||||
//New account details
|
||||
const username = 'demo';
|
||||
const password = 'd3m0p4ssw0rd';
|
||||
const email = 'demo@gmail.com';
|
||||
const package = 'default';
|
||||
const first_name = 'Rust';
|
||||
const last_name = 'Cohle';
|
||||
|
||||
const data_json = {
|
||||
'user': hst_username,
|
||||
'password': hst_password,
|
||||
'returncode': hst_returncode,
|
||||
'cmd': hst_command,
|
||||
'arg1': username,
|
||||
'arg2': password,
|
||||
'arg3': email,
|
||||
'arg4': package,
|
||||
'arg5': first_name,
|
||||
'arg6': last_name
|
||||
}
|
||||
|
||||
const data = querystring.stringify(data_json)
|
||||
|
||||
axios.post('https://'+hst_hostname+':'+hst_port+'/api/', data)
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
console.log("0 means successful")
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
33
nodejs/delete_user.js
Normal file
33
nodejs/delete_user.js
Normal file
@@ -0,0 +1,33 @@
|
||||
//NodeJS Script
|
||||
//You must have the axios module installed
|
||||
const axios = require('axios')
|
||||
const querystring = require('querystring')
|
||||
//Admin Credentials
|
||||
const hst_hostname = 'server.hestiacp.com'
|
||||
const hst_port = 8083
|
||||
const hst_username = 'admin'
|
||||
const hst_password = 'p4ssw0rd'
|
||||
const hst_returncode = 'yes'
|
||||
const hst_command = 'v-delete-user'
|
||||
|
||||
//Account
|
||||
const username = 'demo';
|
||||
|
||||
const data_json = {
|
||||
'user': hst_username,
|
||||
'password': hst_password,
|
||||
'returncode': hst_returncode,
|
||||
'cmd': hst_command,
|
||||
'arg1': username
|
||||
}
|
||||
|
||||
const data = querystring.stringify(data_json)
|
||||
|
||||
axios.post('https://'+hst_hostname+':'+hst_port+'/api/', data)
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
console.log("0 means successful")
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
38
nodejs/list_web_domains.js
Normal file
38
nodejs/list_web_domains.js
Normal file
@@ -0,0 +1,38 @@
|
||||
//NodeJS Script
|
||||
//You must have the axios module installed
|
||||
const axios = require('axios')
|
||||
const querystring = require('querystring');
|
||||
|
||||
//Admin Credentials
|
||||
const hst_hostname = 'server.hestiacp.com'
|
||||
const hst_port = 8083
|
||||
const hst_returncode = 'no'
|
||||
const hst_username = 'admin'
|
||||
const hst_password = 'p4ssw0rd'
|
||||
const hst_command = 'v-list-web-domain'
|
||||
|
||||
//Domain details
|
||||
const username = 'demo';
|
||||
const domain = 'demo.hestiacp.com';
|
||||
const format = 'json';
|
||||
|
||||
const data_json = {
|
||||
'user': hst_username,
|
||||
'password': hst_password,
|
||||
'returncode': hst_returncode,
|
||||
'cmd': hst_command,
|
||||
'arg1': username,
|
||||
'arg2': domain,
|
||||
'arg3': format
|
||||
}
|
||||
|
||||
const data = querystring.stringify(data_json)
|
||||
|
||||
axios.post('https://'+hst_hostname+':'+hst_port+'/api/', data)
|
||||
.then(function (response) {
|
||||
console.log(JSON.stringify(response.data));
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
Reference in New Issue
Block a user