godprotocol 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Objects/Manager.js +13 -5
- package/html/create.js +2 -2
- package/html/index.js +1 -1
- package/html/load.js +2 -2
- package/html/run.js +1 -1
- package/package.json +1 -1
- package/utils/create_server.js +8 -19
package/Objects/Manager.js
CHANGED
|
@@ -323,17 +323,25 @@ class Manager {
|
|
|
323
323
|
|
|
324
324
|
this.ds = new GDS(this)
|
|
325
325
|
await this.ds.sync()
|
|
326
|
+
let create_serv;
|
|
326
327
|
if (this.options.server){
|
|
327
328
|
this.server = this.options.server
|
|
328
329
|
if (this.options.server.port)
|
|
329
330
|
this.options.server_domain = `${this.options.server.hostname}:${this.options.server.port}`
|
|
330
331
|
else this.options.server_domain = this.options.hostname
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
332
|
+
this.handler = (req, res)=>{
|
|
333
|
+
let handle = create_server({manager: this, ...this.options.server, app: this.options.app })
|
|
334
|
+
|
|
335
|
+
handle(req,res)
|
|
336
|
+
|
|
337
|
+
if (this.options.oracle){
|
|
338
|
+
this.oracle = this.options.oracle;
|
|
339
|
+
this.oracle.set_manager(this)
|
|
340
|
+
}
|
|
341
|
+
}
|
|
336
342
|
}
|
|
343
|
+
|
|
344
|
+
return create_serv;
|
|
337
345
|
}
|
|
338
346
|
|
|
339
347
|
get_account = async(name) => {
|
package/html/create.js
CHANGED
|
@@ -13,7 +13,7 @@ const account_id_el = document.getElementById('account_id'), account_password_el
|
|
|
13
13
|
|
|
14
14
|
create_account.addEventListener('click', e=>{
|
|
15
15
|
e.preventDefault();
|
|
16
|
-
console.log('click click', "
|
|
16
|
+
console.log('click click', "${manager.options.server_domain}")
|
|
17
17
|
|
|
18
18
|
let name = account_id_el.value.trim(), password = account_password_el.value.trim();
|
|
19
19
|
|
|
@@ -26,7 +26,7 @@ const account_id_el = document.getElementById('account_id'), account_password_el
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
fetch("
|
|
29
|
+
fetch("${manager.options.server_domain.concat('/create_account')}", {
|
|
30
30
|
method: 'POST',
|
|
31
31
|
header: {
|
|
32
32
|
'Content-Type': 'application/json',
|
package/html/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const forms = (route, manager)=>{
|
|
|
20
20
|
|
|
21
21
|
const header_script = (manager)=>{
|
|
22
22
|
return ` let ftch = async(path, body)=>{
|
|
23
|
-
let fch = await fetch("
|
|
23
|
+
let fch = await fetch("${manager.options.server_domain}".concat(path), {
|
|
24
24
|
method: 'POST',
|
|
25
25
|
header: {
|
|
26
26
|
'Content-Type': 'application/json',
|
package/html/load.js
CHANGED
|
@@ -22,7 +22,7 @@ id_el = document.getElementById('ID'),
|
|
|
22
22
|
console.log(account)
|
|
23
23
|
|
|
24
24
|
if (!account){
|
|
25
|
-
message_box.innerHTML = 'Provide an account, or <a href="
|
|
25
|
+
message_box.innerHTML = 'Provide an account, or <a href="${manager.options.server_domain}/create_account">create one here</a>'
|
|
26
26
|
|
|
27
27
|
setTimeout(() => {
|
|
28
28
|
message_box.textContent = ''
|
|
@@ -72,7 +72,7 @@ load.addEventListener('click', e=>{
|
|
|
72
72
|
let id = id_el.value.trim(), address = address_el.value.trim(), sequence = sequence_el.value.trim(), account = account_selection_el.selectedIndex, compiler = should_compile.checked;
|
|
73
73
|
|
|
74
74
|
if (!account){
|
|
75
|
-
message_box.innerHTML = 'Provide an account, or <a href="
|
|
75
|
+
message_box.innerHTML = 'Provide an account, or <a href="${manager.options.server_domain}/create_account">create one here</a>'
|
|
76
76
|
|
|
77
77
|
setTimeout(() => {
|
|
78
78
|
message_box.textContent = ''
|
package/html/run.js
CHANGED
|
@@ -42,7 +42,7 @@ run.addEventListener('click', e=>{
|
|
|
42
42
|
let id = id_el.value.trim(), address = address_el.value.trim(), config = config_el.value.trim(), account = account_selection_el.selectedIndex, callback = callback_el.value.trim();
|
|
43
43
|
|
|
44
44
|
if (!account){
|
|
45
|
-
message_box.innerHTML = 'Provide an account, or <a href="
|
|
45
|
+
message_box.innerHTML = 'Provide an account, or <a href="${manager.options.server_domain}/create_account">create one here</a>'
|
|
46
46
|
|
|
47
47
|
setTimeout(() => {
|
|
48
48
|
message_box.textContent = ''
|
package/package.json
CHANGED
package/utils/create_server.js
CHANGED
|
@@ -106,27 +106,16 @@ const handle_routes = async(req, res, manager, app) => {
|
|
|
106
106
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
const create_server =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
let { port, manager } = settings;
|
|
109
|
+
const create_server = (settings) => {
|
|
110
|
+
settings = settings || {};
|
|
111
|
+
let { port, manager } = settings;
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// {
|
|
118
|
-
// key: fs.readFileSync(`${__dirname}/server.key`),
|
|
119
|
-
// cert: fs.readFileSync(`${__dirname}/server.cert`),
|
|
120
|
-
// },
|
|
121
|
-
async(req, res) => await handle_routes(req, res, manager, manager.options.app)
|
|
122
|
-
);
|
|
113
|
+
port = port || PORT;
|
|
114
|
+
|
|
115
|
+
let handler = async(req, res) => await handle_routes(req, res, manager, manager.options.app)
|
|
123
116
|
|
|
124
|
-
|
|
125
|
-
console.log(`\n...GOD PROTOCOL RUNNING :${port}`);
|
|
126
|
-
resolve(server);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
117
|
+
return handler;
|
|
129
118
|
};
|
|
130
119
|
|
|
131
120
|
export default create_server;
|
|
132
|
-
export { PORT };
|
|
121
|
+
export { PORT };
|