@vandenberghinc/volt 1.1.8 → 1.1.10
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/backend/dist/cjs/server.d.ts +3 -4
- package/backend/dist/cjs/server.js +31 -32
- package/backend/dist/esm/server.d.ts +3 -4
- package/backend/dist/esm/server.js +31 -32
- package/backend/dist/esm-dev/server.d.ts +3 -4
- package/backend/dist/esm-dev/server.js +31 -32
- package/backend/src/server.ts +29 -32
- package/package.json +1 -1
|
@@ -96,6 +96,7 @@ export declare class Server {
|
|
|
96
96
|
static compressed_extensions: string[];
|
|
97
97
|
ip: string;
|
|
98
98
|
port: number;
|
|
99
|
+
https_port: number;
|
|
99
100
|
domain: string;
|
|
100
101
|
full_domain: string;
|
|
101
102
|
source: vlib.Path;
|
|
@@ -108,7 +109,6 @@ export declare class Server {
|
|
|
108
109
|
token_expiration: number;
|
|
109
110
|
google_tag?: string;
|
|
110
111
|
production: boolean;
|
|
111
|
-
localhost: boolean;
|
|
112
112
|
multiprocessing: boolean;
|
|
113
113
|
processes: number;
|
|
114
114
|
company: CompanyInfo;
|
|
@@ -146,8 +146,8 @@ export declare class Server {
|
|
|
146
146
|
status: typeof Status;
|
|
147
147
|
rate_limits: typeof RateLimits;
|
|
148
148
|
logger: typeof logger;
|
|
149
|
-
constructor({ ip, // leave undefined for blank detection.
|
|
150
|
-
|
|
149
|
+
constructor({ ip, port, // leave undefined for blank detection.
|
|
150
|
+
domain, is_primary, source, database, statics, favicon, company, meta, tls, smtp, mail_style, rate_limit, keys, payments, default_headers, google_tag, token_expiration, enable_2fa, enable_account_activation, production, multiprocessing, processes, offline, additional_sitemap_endpoints, log_level, daemon, lightweight, }: {
|
|
151
151
|
ip?: string;
|
|
152
152
|
port?: number;
|
|
153
153
|
domain: string;
|
|
@@ -173,7 +173,6 @@ export declare class Server {
|
|
|
173
173
|
enable_2fa?: boolean;
|
|
174
174
|
enable_account_activation?: boolean;
|
|
175
175
|
production?: boolean;
|
|
176
|
-
localhost?: boolean;
|
|
177
176
|
multiprocessing?: boolean;
|
|
178
177
|
processes?: number | null;
|
|
179
178
|
offline?: boolean;
|
|
@@ -694,6 +694,7 @@ class Server {
|
|
|
694
694
|
// Instance properties
|
|
695
695
|
ip;
|
|
696
696
|
port;
|
|
697
|
+
https_port;
|
|
697
698
|
domain;
|
|
698
699
|
full_domain;
|
|
699
700
|
source; // vlib.Path type
|
|
@@ -706,7 +707,7 @@ class Server {
|
|
|
706
707
|
token_expiration;
|
|
707
708
|
google_tag;
|
|
708
709
|
production;
|
|
709
|
-
localhost;
|
|
710
|
+
// public localhost: boolean;
|
|
710
711
|
multiprocessing;
|
|
711
712
|
processes;
|
|
712
713
|
company;
|
|
@@ -751,8 +752,8 @@ class Server {
|
|
|
751
752
|
status;
|
|
752
753
|
rate_limits;
|
|
753
754
|
logger;
|
|
754
|
-
constructor({ ip, // leave undefined for blank detection.
|
|
755
|
-
|
|
755
|
+
constructor({ ip = "*", port, // leave undefined for blank detection.
|
|
756
|
+
domain, is_primary = true, source, database = "mongodb://localhost:27017/main", statics = [], favicon = undefined, company, meta = new meta_js_1.Meta(), tls = undefined, smtp = undefined, mail_style = {
|
|
756
757
|
font: '"Helvetica", sans-serif',
|
|
757
758
|
title_fg: "#121B23",
|
|
758
759
|
subtitle_fg: "#121B23",
|
|
@@ -777,7 +778,9 @@ class Server {
|
|
|
777
778
|
},
|
|
778
779
|
}, keys = [], payments = null, default_headers = null, google_tag = undefined, token_expiration = 86400, enable_2fa = false, enable_account_activation = true,
|
|
779
780
|
// honey_pot_key = null,
|
|
780
|
-
production = false,
|
|
781
|
+
production = false,
|
|
782
|
+
// localhost = true,
|
|
783
|
+
multiprocessing = true, processes = null,
|
|
781
784
|
// file_watcher = false,
|
|
782
785
|
offline = false, additional_sitemap_endpoints = [], log_level = 0, daemon = {},
|
|
783
786
|
// admin = {
|
|
@@ -909,7 +912,7 @@ class Server {
|
|
|
909
912
|
enable_2fa: { type: "boolean", required: false },
|
|
910
913
|
enable_account_activation: { type: "boolean", required: false },
|
|
911
914
|
production: { type: "boolean", required: false },
|
|
912
|
-
localhost: { type: "boolean", required: false },
|
|
915
|
+
// localhost: { type: "boolean", required: false },
|
|
913
916
|
multiprocessing: { type: "boolean", required: false, default: true },
|
|
914
917
|
processes: { type: "number", required: false, default: null },
|
|
915
918
|
// file_watcher: {type: ["null", "boolean", "object", FileWatcher], required: false},
|
|
@@ -936,8 +939,15 @@ class Server {
|
|
|
936
939
|
lightweight: { type: "boolean", required: false },
|
|
937
940
|
} });
|
|
938
941
|
// Assign attributes directly.
|
|
939
|
-
|
|
940
|
-
|
|
942
|
+
if (production || port == null) {
|
|
943
|
+
this.port = 80;
|
|
944
|
+
this.https_port = 443;
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
this.port = port;
|
|
948
|
+
this.https_port = port + 1;
|
|
949
|
+
}
|
|
950
|
+
this.ip = ip ?? "*"; // ?? "127.0.0.1";
|
|
941
951
|
this.is_primary = is_primary && cluster_1.default.isPrimary;
|
|
942
952
|
this.source = new _vinc_1.vlib.Path(source);
|
|
943
953
|
this.favicon = favicon;
|
|
@@ -946,7 +956,7 @@ class Server {
|
|
|
946
956
|
this.token_expiration = token_expiration;
|
|
947
957
|
this.google_tag = google_tag;
|
|
948
958
|
this.production = production;
|
|
949
|
-
this.localhost = localhost;
|
|
959
|
+
// this.localhost = localhost;
|
|
950
960
|
this.lightweight = lightweight;
|
|
951
961
|
this.multiprocessing = multiprocessing;
|
|
952
962
|
this.processes = processes == null ? os.cpus().length : processes;
|
|
@@ -965,14 +975,13 @@ class Server {
|
|
|
965
975
|
this.endpoints = new Map();
|
|
966
976
|
this.err_endpoints = new Map();
|
|
967
977
|
// Assign based on localhost.
|
|
968
|
-
if (localhost) {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
}
|
|
978
|
+
// if (localhost) {
|
|
979
|
+
// this.ip = "127.0.0.1";
|
|
980
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
981
|
+
// } else if (!production && !localhost && ip == null) { // use argument ip not attr since that already has a default.
|
|
982
|
+
// this.ip = vlib.Network.private_ip();
|
|
983
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
984
|
+
// }
|
|
976
985
|
/* @performance */ this.performance = new _vinc_1.vlib.Performance("Server performance");
|
|
977
986
|
// Assign objects to server so it is easy to access.
|
|
978
987
|
this.status = status_js_1.Status;
|
|
@@ -1315,10 +1324,10 @@ class Server {
|
|
|
1315
1324
|
const status = {};
|
|
1316
1325
|
status.ip = this.ip;
|
|
1317
1326
|
if (this.http) {
|
|
1318
|
-
status.http_port = this.port
|
|
1327
|
+
status.http_port = this.port;
|
|
1319
1328
|
}
|
|
1320
1329
|
if (this.https) {
|
|
1321
|
-
status.https_port = this.
|
|
1330
|
+
status.https_port = this.https_port;
|
|
1322
1331
|
}
|
|
1323
1332
|
// Load data.
|
|
1324
1333
|
const data = await this._sys_db.load("status", {
|
|
@@ -2235,26 +2244,16 @@ class Server {
|
|
|
2235
2244
|
// const worker = new WorkerClass();
|
|
2236
2245
|
// worker.start();
|
|
2237
2246
|
// }
|
|
2238
|
-
// Set default port.
|
|
2239
|
-
let http_port, https_port;
|
|
2240
|
-
if (this.port == null) {
|
|
2241
|
-
http_port = 80;
|
|
2242
|
-
https_port = 443;
|
|
2243
|
-
}
|
|
2244
|
-
else {
|
|
2245
|
-
http_port = this.port;
|
|
2246
|
-
https_port = this.port + 1;
|
|
2247
|
-
}
|
|
2248
2247
|
// Callbacks.
|
|
2249
2248
|
let is_running = false;
|
|
2250
2249
|
const on_running = () => {
|
|
2251
2250
|
if (!is_running) {
|
|
2252
2251
|
is_running = true;
|
|
2253
2252
|
if (this.https !== undefined) {
|
|
2254
|
-
logger_js_1.default.log(0, log_source, `Running on http://${this.ip}:${
|
|
2253
|
+
logger_js_1.default.log(0, log_source, `Running on http://${this.ip}:${this.port} and https://${this.ip}:${this.https_port}.`);
|
|
2255
2254
|
}
|
|
2256
2255
|
else {
|
|
2257
|
-
logger_js_1.default.log(0, log_source, `Running on http://${this.ip}:${
|
|
2256
|
+
logger_js_1.default.log(0, log_source, `Running on http://${this.ip}:${this.port}.`);
|
|
2258
2257
|
}
|
|
2259
2258
|
}
|
|
2260
2259
|
};
|
|
@@ -2276,10 +2275,10 @@ class Server {
|
|
|
2276
2275
|
}
|
|
2277
2276
|
};
|
|
2278
2277
|
// Listen.
|
|
2279
|
-
this.http.listen(
|
|
2278
|
+
this.http.listen(this.port, this.ip === "*" ? undefined : this.ip, on_running);
|
|
2280
2279
|
this.http.on("error", on_error);
|
|
2281
2280
|
if (this.https !== undefined) {
|
|
2282
|
-
this.https.listen(https_port, this.ip, on_running);
|
|
2281
|
+
this.https.listen(this.https_port, this.ip === "*" ? undefined : this.ip, on_running);
|
|
2283
2282
|
this.https.on("error", on_error);
|
|
2284
2283
|
}
|
|
2285
2284
|
// Set signals.
|
|
@@ -96,6 +96,7 @@ export declare class Server {
|
|
|
96
96
|
static compressed_extensions: string[];
|
|
97
97
|
ip: string;
|
|
98
98
|
port: number;
|
|
99
|
+
https_port: number;
|
|
99
100
|
domain: string;
|
|
100
101
|
full_domain: string;
|
|
101
102
|
source: vlib.Path;
|
|
@@ -108,7 +109,6 @@ export declare class Server {
|
|
|
108
109
|
token_expiration: number;
|
|
109
110
|
google_tag?: string;
|
|
110
111
|
production: boolean;
|
|
111
|
-
localhost: boolean;
|
|
112
112
|
multiprocessing: boolean;
|
|
113
113
|
processes: number;
|
|
114
114
|
company: CompanyInfo;
|
|
@@ -146,8 +146,8 @@ export declare class Server {
|
|
|
146
146
|
status: typeof Status;
|
|
147
147
|
rate_limits: typeof RateLimits;
|
|
148
148
|
logger: typeof logger;
|
|
149
|
-
constructor({ ip, // leave undefined for blank detection.
|
|
150
|
-
|
|
149
|
+
constructor({ ip, port, // leave undefined for blank detection.
|
|
150
|
+
domain, is_primary, source, database, statics, favicon, company, meta, tls, smtp, mail_style, rate_limit, keys, payments, default_headers, google_tag, token_expiration, enable_2fa, enable_account_activation, production, multiprocessing, processes, offline, additional_sitemap_endpoints, log_level, daemon, lightweight, }: {
|
|
151
151
|
ip?: string;
|
|
152
152
|
port?: number;
|
|
153
153
|
domain: string;
|
|
@@ -173,7 +173,6 @@ export declare class Server {
|
|
|
173
173
|
enable_2fa?: boolean;
|
|
174
174
|
enable_account_activation?: boolean;
|
|
175
175
|
production?: boolean;
|
|
176
|
-
localhost?: boolean;
|
|
177
176
|
multiprocessing?: boolean;
|
|
178
177
|
processes?: number | null;
|
|
179
178
|
offline?: boolean;
|
|
@@ -655,6 +655,7 @@ export class Server {
|
|
|
655
655
|
// Instance properties
|
|
656
656
|
ip;
|
|
657
657
|
port;
|
|
658
|
+
https_port;
|
|
658
659
|
domain;
|
|
659
660
|
full_domain;
|
|
660
661
|
source; // vlib.Path type
|
|
@@ -667,7 +668,7 @@ export class Server {
|
|
|
667
668
|
token_expiration;
|
|
668
669
|
google_tag;
|
|
669
670
|
production;
|
|
670
|
-
localhost;
|
|
671
|
+
// public localhost: boolean;
|
|
671
672
|
multiprocessing;
|
|
672
673
|
processes;
|
|
673
674
|
company;
|
|
@@ -712,8 +713,8 @@ export class Server {
|
|
|
712
713
|
status;
|
|
713
714
|
rate_limits;
|
|
714
715
|
logger;
|
|
715
|
-
constructor({ ip, // leave undefined for blank detection.
|
|
716
|
-
|
|
716
|
+
constructor({ ip = "*", port, // leave undefined for blank detection.
|
|
717
|
+
domain, is_primary = true, source, database = "mongodb://localhost:27017/main", statics = [], favicon = undefined, company, meta = new Meta(), tls = undefined, smtp = undefined, mail_style = {
|
|
717
718
|
font: '"Helvetica", sans-serif',
|
|
718
719
|
title_fg: "#121B23",
|
|
719
720
|
subtitle_fg: "#121B23",
|
|
@@ -738,7 +739,9 @@ export class Server {
|
|
|
738
739
|
},
|
|
739
740
|
}, keys = [], payments = null, default_headers = null, google_tag = undefined, token_expiration = 86400, enable_2fa = false, enable_account_activation = true,
|
|
740
741
|
// honey_pot_key = null,
|
|
741
|
-
production = false,
|
|
742
|
+
production = false,
|
|
743
|
+
// localhost = true,
|
|
744
|
+
multiprocessing = true, processes = null,
|
|
742
745
|
// file_watcher = false,
|
|
743
746
|
offline = false, additional_sitemap_endpoints = [], log_level = 0, daemon = {},
|
|
744
747
|
// admin = {
|
|
@@ -870,7 +873,7 @@ export class Server {
|
|
|
870
873
|
enable_2fa: { type: "boolean", required: false },
|
|
871
874
|
enable_account_activation: { type: "boolean", required: false },
|
|
872
875
|
production: { type: "boolean", required: false },
|
|
873
|
-
localhost: { type: "boolean", required: false },
|
|
876
|
+
// localhost: { type: "boolean", required: false },
|
|
874
877
|
multiprocessing: { type: "boolean", required: false, default: true },
|
|
875
878
|
processes: { type: "number", required: false, default: null },
|
|
876
879
|
// file_watcher: {type: ["null", "boolean", "object", FileWatcher], required: false},
|
|
@@ -897,8 +900,15 @@ export class Server {
|
|
|
897
900
|
lightweight: { type: "boolean", required: false },
|
|
898
901
|
} });
|
|
899
902
|
// Assign attributes directly.
|
|
900
|
-
|
|
901
|
-
|
|
903
|
+
if (production || port == null) {
|
|
904
|
+
this.port = 80;
|
|
905
|
+
this.https_port = 443;
|
|
906
|
+
}
|
|
907
|
+
else {
|
|
908
|
+
this.port = port;
|
|
909
|
+
this.https_port = port + 1;
|
|
910
|
+
}
|
|
911
|
+
this.ip = ip ?? "*"; // ?? "127.0.0.1";
|
|
902
912
|
this.is_primary = is_primary && libcluster.isPrimary;
|
|
903
913
|
this.source = new vlib.Path(source);
|
|
904
914
|
this.favicon = favicon;
|
|
@@ -907,7 +917,7 @@ export class Server {
|
|
|
907
917
|
this.token_expiration = token_expiration;
|
|
908
918
|
this.google_tag = google_tag;
|
|
909
919
|
this.production = production;
|
|
910
|
-
this.localhost = localhost;
|
|
920
|
+
// this.localhost = localhost;
|
|
911
921
|
this.lightweight = lightweight;
|
|
912
922
|
this.multiprocessing = multiprocessing;
|
|
913
923
|
this.processes = processes == null ? os.cpus().length : processes;
|
|
@@ -926,14 +936,13 @@ export class Server {
|
|
|
926
936
|
this.endpoints = new Map();
|
|
927
937
|
this.err_endpoints = new Map();
|
|
928
938
|
// Assign based on localhost.
|
|
929
|
-
if (localhost) {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
}
|
|
939
|
+
// if (localhost) {
|
|
940
|
+
// this.ip = "127.0.0.1";
|
|
941
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
942
|
+
// } else if (!production && !localhost && ip == null) { // use argument ip not attr since that already has a default.
|
|
943
|
+
// this.ip = vlib.Network.private_ip();
|
|
944
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
945
|
+
// }
|
|
937
946
|
/* @performance */ this.performance = new vlib.Performance("Server performance");
|
|
938
947
|
// Assign objects to server so it is easy to access.
|
|
939
948
|
this.status = Status;
|
|
@@ -1276,10 +1285,10 @@ export class Server {
|
|
|
1276
1285
|
const status = {};
|
|
1277
1286
|
status.ip = this.ip;
|
|
1278
1287
|
if (this.http) {
|
|
1279
|
-
status.http_port = this.port
|
|
1288
|
+
status.http_port = this.port;
|
|
1280
1289
|
}
|
|
1281
1290
|
if (this.https) {
|
|
1282
|
-
status.https_port = this.
|
|
1291
|
+
status.https_port = this.https_port;
|
|
1283
1292
|
}
|
|
1284
1293
|
// Load data.
|
|
1285
1294
|
const data = await this._sys_db.load("status", {
|
|
@@ -2196,26 +2205,16 @@ export class Server {
|
|
|
2196
2205
|
// const worker = new WorkerClass();
|
|
2197
2206
|
// worker.start();
|
|
2198
2207
|
// }
|
|
2199
|
-
// Set default port.
|
|
2200
|
-
let http_port, https_port;
|
|
2201
|
-
if (this.port == null) {
|
|
2202
|
-
http_port = 80;
|
|
2203
|
-
https_port = 443;
|
|
2204
|
-
}
|
|
2205
|
-
else {
|
|
2206
|
-
http_port = this.port;
|
|
2207
|
-
https_port = this.port + 1;
|
|
2208
|
-
}
|
|
2209
2208
|
// Callbacks.
|
|
2210
2209
|
let is_running = false;
|
|
2211
2210
|
const on_running = () => {
|
|
2212
2211
|
if (!is_running) {
|
|
2213
2212
|
is_running = true;
|
|
2214
2213
|
if (this.https !== undefined) {
|
|
2215
|
-
logger.log(0, log_source, `Running on http://${this.ip}:${
|
|
2214
|
+
logger.log(0, log_source, `Running on http://${this.ip}:${this.port} and https://${this.ip}:${this.https_port}.`);
|
|
2216
2215
|
}
|
|
2217
2216
|
else {
|
|
2218
|
-
logger.log(0, log_source, `Running on http://${this.ip}:${
|
|
2217
|
+
logger.log(0, log_source, `Running on http://${this.ip}:${this.port}.`);
|
|
2219
2218
|
}
|
|
2220
2219
|
}
|
|
2221
2220
|
};
|
|
@@ -2237,10 +2236,10 @@ export class Server {
|
|
|
2237
2236
|
}
|
|
2238
2237
|
};
|
|
2239
2238
|
// Listen.
|
|
2240
|
-
this.http.listen(
|
|
2239
|
+
this.http.listen(this.port, this.ip === "*" ? undefined : this.ip, on_running);
|
|
2241
2240
|
this.http.on("error", on_error);
|
|
2242
2241
|
if (this.https !== undefined) {
|
|
2243
|
-
this.https.listen(https_port, this.ip, on_running);
|
|
2242
|
+
this.https.listen(this.https_port, this.ip === "*" ? undefined : this.ip, on_running);
|
|
2244
2243
|
this.https.on("error", on_error);
|
|
2245
2244
|
}
|
|
2246
2245
|
// Set signals.
|
|
@@ -96,6 +96,7 @@ export declare class Server {
|
|
|
96
96
|
static compressed_extensions: string[];
|
|
97
97
|
ip: string;
|
|
98
98
|
port: number;
|
|
99
|
+
https_port: number;
|
|
99
100
|
domain: string;
|
|
100
101
|
full_domain: string;
|
|
101
102
|
source: vlib.Path;
|
|
@@ -108,7 +109,6 @@ export declare class Server {
|
|
|
108
109
|
token_expiration: number;
|
|
109
110
|
google_tag?: string;
|
|
110
111
|
production: boolean;
|
|
111
|
-
localhost: boolean;
|
|
112
112
|
multiprocessing: boolean;
|
|
113
113
|
processes: number;
|
|
114
114
|
company: CompanyInfo;
|
|
@@ -146,8 +146,8 @@ export declare class Server {
|
|
|
146
146
|
status: typeof Status;
|
|
147
147
|
rate_limits: typeof RateLimits;
|
|
148
148
|
logger: typeof logger;
|
|
149
|
-
constructor({ ip, // leave undefined for blank detection.
|
|
150
|
-
|
|
149
|
+
constructor({ ip, port, // leave undefined for blank detection.
|
|
150
|
+
domain, is_primary, source, database, statics, favicon, company, meta, tls, smtp, mail_style, rate_limit, keys, payments, default_headers, google_tag, token_expiration, enable_2fa, enable_account_activation, production, multiprocessing, processes, offline, additional_sitemap_endpoints, log_level, daemon, lightweight, }: {
|
|
151
151
|
ip?: string;
|
|
152
152
|
port?: number;
|
|
153
153
|
domain: string;
|
|
@@ -173,7 +173,6 @@ export declare class Server {
|
|
|
173
173
|
enable_2fa?: boolean;
|
|
174
174
|
enable_account_activation?: boolean;
|
|
175
175
|
production?: boolean;
|
|
176
|
-
localhost?: boolean;
|
|
177
176
|
multiprocessing?: boolean;
|
|
178
177
|
processes?: number | null;
|
|
179
178
|
offline?: boolean;
|
|
@@ -655,6 +655,7 @@ export class Server {
|
|
|
655
655
|
// Instance properties
|
|
656
656
|
ip;
|
|
657
657
|
port;
|
|
658
|
+
https_port;
|
|
658
659
|
domain;
|
|
659
660
|
full_domain;
|
|
660
661
|
source; // vlib.Path type
|
|
@@ -667,7 +668,7 @@ export class Server {
|
|
|
667
668
|
token_expiration;
|
|
668
669
|
google_tag;
|
|
669
670
|
production;
|
|
670
|
-
localhost;
|
|
671
|
+
// public localhost: boolean;
|
|
671
672
|
multiprocessing;
|
|
672
673
|
processes;
|
|
673
674
|
company;
|
|
@@ -712,8 +713,8 @@ export class Server {
|
|
|
712
713
|
status;
|
|
713
714
|
rate_limits;
|
|
714
715
|
logger;
|
|
715
|
-
constructor({ ip, // leave undefined for blank detection.
|
|
716
|
-
|
|
716
|
+
constructor({ ip = "*", port, // leave undefined for blank detection.
|
|
717
|
+
domain, is_primary = true, source, database = "mongodb://localhost:27017/main", statics = [], favicon = undefined, company, meta = new Meta(), tls = undefined, smtp = undefined, mail_style = {
|
|
717
718
|
font: '"Helvetica", sans-serif',
|
|
718
719
|
title_fg: "#121B23",
|
|
719
720
|
subtitle_fg: "#121B23",
|
|
@@ -738,7 +739,9 @@ export class Server {
|
|
|
738
739
|
},
|
|
739
740
|
}, keys = [], payments = null, default_headers = null, google_tag = undefined, token_expiration = 86400, enable_2fa = false, enable_account_activation = true,
|
|
740
741
|
// honey_pot_key = null,
|
|
741
|
-
production = false,
|
|
742
|
+
production = false,
|
|
743
|
+
// localhost = true,
|
|
744
|
+
multiprocessing = true, processes = null,
|
|
742
745
|
// file_watcher = false,
|
|
743
746
|
offline = false, additional_sitemap_endpoints = [], log_level = 0, daemon = {},
|
|
744
747
|
// admin = {
|
|
@@ -870,7 +873,7 @@ export class Server {
|
|
|
870
873
|
enable_2fa: { type: "boolean", required: false },
|
|
871
874
|
enable_account_activation: { type: "boolean", required: false },
|
|
872
875
|
production: { type: "boolean", required: false },
|
|
873
|
-
localhost: { type: "boolean", required: false },
|
|
876
|
+
// localhost: { type: "boolean", required: false },
|
|
874
877
|
multiprocessing: { type: "boolean", required: false, default: true },
|
|
875
878
|
processes: { type: "number", required: false, default: null },
|
|
876
879
|
// file_watcher: {type: ["null", "boolean", "object", FileWatcher], required: false},
|
|
@@ -897,8 +900,15 @@ export class Server {
|
|
|
897
900
|
lightweight: { type: "boolean", required: false },
|
|
898
901
|
} });
|
|
899
902
|
// Assign attributes directly.
|
|
900
|
-
|
|
901
|
-
|
|
903
|
+
if (production || port == null) {
|
|
904
|
+
this.port = 80;
|
|
905
|
+
this.https_port = 443;
|
|
906
|
+
}
|
|
907
|
+
else {
|
|
908
|
+
this.port = port;
|
|
909
|
+
this.https_port = port + 1;
|
|
910
|
+
}
|
|
911
|
+
this.ip = ip ?? "*"; // ?? "127.0.0.1";
|
|
902
912
|
this.is_primary = is_primary && libcluster.isPrimary;
|
|
903
913
|
this.source = new vlib.Path(source);
|
|
904
914
|
this.favicon = favicon;
|
|
@@ -907,7 +917,7 @@ export class Server {
|
|
|
907
917
|
this.token_expiration = token_expiration;
|
|
908
918
|
this.google_tag = google_tag;
|
|
909
919
|
this.production = production;
|
|
910
|
-
this.localhost = localhost;
|
|
920
|
+
// this.localhost = localhost;
|
|
911
921
|
this.lightweight = lightweight;
|
|
912
922
|
this.multiprocessing = multiprocessing;
|
|
913
923
|
this.processes = processes == null ? os.cpus().length : processes;
|
|
@@ -926,14 +936,13 @@ export class Server {
|
|
|
926
936
|
this.endpoints = new Map();
|
|
927
937
|
this.err_endpoints = new Map();
|
|
928
938
|
// Assign based on localhost.
|
|
929
|
-
if (localhost) {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
}
|
|
939
|
+
// if (localhost) {
|
|
940
|
+
// this.ip = "127.0.0.1";
|
|
941
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
942
|
+
// } else if (!production && !localhost && ip == null) { // use argument ip not attr since that already has a default.
|
|
943
|
+
// this.ip = vlib.Network.private_ip();
|
|
944
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
945
|
+
// }
|
|
937
946
|
/* @performance */ this.performance = new vlib.Performance("Server performance");
|
|
938
947
|
// Assign objects to server so it is easy to access.
|
|
939
948
|
this.status = Status;
|
|
@@ -1276,10 +1285,10 @@ export class Server {
|
|
|
1276
1285
|
const status = {};
|
|
1277
1286
|
status.ip = this.ip;
|
|
1278
1287
|
if (this.http) {
|
|
1279
|
-
status.http_port = this.port
|
|
1288
|
+
status.http_port = this.port;
|
|
1280
1289
|
}
|
|
1281
1290
|
if (this.https) {
|
|
1282
|
-
status.https_port = this.
|
|
1291
|
+
status.https_port = this.https_port;
|
|
1283
1292
|
}
|
|
1284
1293
|
// Load data.
|
|
1285
1294
|
const data = await this._sys_db.load("status", {
|
|
@@ -2196,26 +2205,16 @@ export class Server {
|
|
|
2196
2205
|
// const worker = new WorkerClass();
|
|
2197
2206
|
// worker.start();
|
|
2198
2207
|
// }
|
|
2199
|
-
// Set default port.
|
|
2200
|
-
let http_port, https_port;
|
|
2201
|
-
if (this.port == null) {
|
|
2202
|
-
http_port = 80;
|
|
2203
|
-
https_port = 443;
|
|
2204
|
-
}
|
|
2205
|
-
else {
|
|
2206
|
-
http_port = this.port;
|
|
2207
|
-
https_port = this.port + 1;
|
|
2208
|
-
}
|
|
2209
2208
|
// Callbacks.
|
|
2210
2209
|
let is_running = false;
|
|
2211
2210
|
const on_running = () => {
|
|
2212
2211
|
if (!is_running) {
|
|
2213
2212
|
is_running = true;
|
|
2214
2213
|
if (this.https !== undefined) {
|
|
2215
|
-
logger.log(0, log_source, `Running on http://${this.ip}:${
|
|
2214
|
+
logger.log(0, log_source, `Running on http://${this.ip}:${this.port} and https://${this.ip}:${this.https_port}.`);
|
|
2216
2215
|
}
|
|
2217
2216
|
else {
|
|
2218
|
-
logger.log(0, log_source, `Running on http://${this.ip}:${
|
|
2217
|
+
logger.log(0, log_source, `Running on http://${this.ip}:${this.port}.`);
|
|
2219
2218
|
}
|
|
2220
2219
|
}
|
|
2221
2220
|
};
|
|
@@ -2237,10 +2236,10 @@ export class Server {
|
|
|
2237
2236
|
}
|
|
2238
2237
|
};
|
|
2239
2238
|
// Listen.
|
|
2240
|
-
this.http.listen(
|
|
2239
|
+
this.http.listen(this.port, this.ip === "*" ? undefined : this.ip, on_running);
|
|
2241
2240
|
this.http.on("error", on_error);
|
|
2242
2241
|
if (this.https !== undefined) {
|
|
2243
|
-
this.https.listen(https_port, this.ip, on_running);
|
|
2242
|
+
this.https.listen(this.https_port, this.ip === "*" ? undefined : this.ip, on_running);
|
|
2244
2243
|
this.https.on("error", on_error);
|
|
2245
2244
|
}
|
|
2246
2245
|
// Set signals.
|
package/backend/src/server.ts
CHANGED
|
@@ -769,6 +769,7 @@ export class Server {
|
|
|
769
769
|
// Instance properties
|
|
770
770
|
public ip: string;
|
|
771
771
|
public port: number;
|
|
772
|
+
public https_port: number;
|
|
772
773
|
public domain: string;
|
|
773
774
|
public full_domain: string;
|
|
774
775
|
public source: vlib.Path; // vlib.Path type
|
|
@@ -781,7 +782,7 @@ export class Server {
|
|
|
781
782
|
public token_expiration: number;
|
|
782
783
|
public google_tag?: string;
|
|
783
784
|
public production: boolean;
|
|
784
|
-
public localhost: boolean;
|
|
785
|
+
// public localhost: boolean;
|
|
785
786
|
public multiprocessing: boolean;
|
|
786
787
|
public processes: number;
|
|
787
788
|
public company: CompanyInfo;
|
|
@@ -832,8 +833,8 @@ export class Server {
|
|
|
832
833
|
public logger: typeof logger;
|
|
833
834
|
|
|
834
835
|
constructor({
|
|
835
|
-
ip
|
|
836
|
-
port
|
|
836
|
+
ip = "*",
|
|
837
|
+
port, // leave undefined for blank detection.
|
|
837
838
|
domain,
|
|
838
839
|
is_primary = true,
|
|
839
840
|
source,
|
|
@@ -878,7 +879,7 @@ export class Server {
|
|
|
878
879
|
enable_account_activation = true,
|
|
879
880
|
// honey_pot_key = null,
|
|
880
881
|
production = false,
|
|
881
|
-
localhost = true,
|
|
882
|
+
// localhost = true,
|
|
882
883
|
multiprocessing = true,
|
|
883
884
|
processes = null,
|
|
884
885
|
// file_watcher = false,
|
|
@@ -920,7 +921,7 @@ export class Server {
|
|
|
920
921
|
enable_account_activation?: boolean;
|
|
921
922
|
// honey_pot_key?: string | null;
|
|
922
923
|
production?: boolean;
|
|
923
|
-
localhost?: boolean;
|
|
924
|
+
// localhost?: boolean;
|
|
924
925
|
multiprocessing?: boolean;
|
|
925
926
|
processes?: number | null;
|
|
926
927
|
// file_watcher?: FileWatcher | Record<string, any> | boolean;
|
|
@@ -1057,7 +1058,7 @@ export class Server {
|
|
|
1057
1058
|
enable_2fa: {type: "boolean", required: false},
|
|
1058
1059
|
enable_account_activation: {type: "boolean", required: false},
|
|
1059
1060
|
production: {type: "boolean", required: false},
|
|
1060
|
-
localhost: { type: "boolean", required: false },
|
|
1061
|
+
// localhost: { type: "boolean", required: false },
|
|
1061
1062
|
multiprocessing: {type: "boolean", required: false, default: true},
|
|
1062
1063
|
processes: {type: "number", required: false, default: null},
|
|
1063
1064
|
// file_watcher: {type: ["null", "boolean", "object", FileWatcher], required: false},
|
|
@@ -1085,8 +1086,14 @@ export class Server {
|
|
|
1085
1086
|
}});
|
|
1086
1087
|
|
|
1087
1088
|
// Assign attributes directly.
|
|
1088
|
-
|
|
1089
|
-
|
|
1089
|
+
if (production || port == null) {
|
|
1090
|
+
this.port = 80;
|
|
1091
|
+
this.https_port = 443;
|
|
1092
|
+
} else {
|
|
1093
|
+
this.port = port;
|
|
1094
|
+
this.https_port = port + 1;
|
|
1095
|
+
}
|
|
1096
|
+
this.ip = ip ?? "*";// ?? "127.0.0.1";
|
|
1090
1097
|
this.is_primary = is_primary && libcluster.isPrimary;
|
|
1091
1098
|
this.source = new vlib.Path(source);
|
|
1092
1099
|
this.favicon = favicon;
|
|
@@ -1095,7 +1102,7 @@ export class Server {
|
|
|
1095
1102
|
this.token_expiration = token_expiration;
|
|
1096
1103
|
this.google_tag = google_tag;
|
|
1097
1104
|
this.production = production;
|
|
1098
|
-
this.localhost = localhost;
|
|
1105
|
+
// this.localhost = localhost;
|
|
1099
1106
|
this.lightweight = lightweight;
|
|
1100
1107
|
this.multiprocessing = multiprocessing;
|
|
1101
1108
|
this.processes = processes == null ? os.cpus().length : processes;
|
|
@@ -1115,13 +1122,13 @@ export class Server {
|
|
|
1115
1122
|
this.err_endpoints = new Map();
|
|
1116
1123
|
|
|
1117
1124
|
// Assign based on localhost.
|
|
1118
|
-
if (localhost) {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
} else if (!localhost && ip == null) { // use argument ip not attr since that already has a default.
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1125
|
+
// if (localhost) {
|
|
1126
|
+
// this.ip = "127.0.0.1";
|
|
1127
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
1128
|
+
// } else if (!production && !localhost && ip == null) { // use argument ip not attr since that already has a default.
|
|
1129
|
+
// this.ip = vlib.Network.private_ip();
|
|
1130
|
+
// this.domain = this.ip + ":" + (port + (this.tls ? 1 : 0));
|
|
1131
|
+
// }
|
|
1125
1132
|
|
|
1126
1133
|
/* @performance */ this.performance = new vlib.Performance("Server performance");
|
|
1127
1134
|
|
|
@@ -1505,10 +1512,10 @@ export class Server {
|
|
|
1505
1512
|
const status: Record<string, any> = {};
|
|
1506
1513
|
status.ip = this.ip;
|
|
1507
1514
|
if (this.http) {
|
|
1508
|
-
status.http_port = this.port
|
|
1515
|
+
status.http_port = this.port;
|
|
1509
1516
|
}
|
|
1510
1517
|
if (this.https) {
|
|
1511
|
-
status.https_port = this.
|
|
1518
|
+
status.https_port = this.https_port;
|
|
1512
1519
|
}
|
|
1513
1520
|
|
|
1514
1521
|
// Load data.
|
|
@@ -2537,25 +2544,15 @@ export class Server {
|
|
|
2537
2544
|
// worker.start();
|
|
2538
2545
|
// }
|
|
2539
2546
|
|
|
2540
|
-
// Set default port.
|
|
2541
|
-
let http_port: number, https_port: number;
|
|
2542
|
-
if (this.port == null) {
|
|
2543
|
-
http_port = 80;
|
|
2544
|
-
https_port = 443;
|
|
2545
|
-
} else {
|
|
2546
|
-
http_port = this.port;
|
|
2547
|
-
https_port = this.port + 1;
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
2547
|
// Callbacks.
|
|
2551
2548
|
let is_running = false;
|
|
2552
2549
|
const on_running = () => {
|
|
2553
2550
|
if (!is_running) {
|
|
2554
2551
|
is_running = true;
|
|
2555
2552
|
if (this.https !== undefined) {
|
|
2556
|
-
logger.log(0, log_source, `Running on http://${this.ip}:${
|
|
2553
|
+
logger.log(0, log_source, `Running on http://${this.ip}:${this.port} and https://${this.ip}:${this.https_port}.`);
|
|
2557
2554
|
} else {
|
|
2558
|
-
logger.log(0, log_source, `Running on http://${this.ip}:${
|
|
2555
|
+
logger.log(0, log_source, `Running on http://${this.ip}:${this.port}.`);
|
|
2559
2556
|
}
|
|
2560
2557
|
}
|
|
2561
2558
|
};
|
|
@@ -2578,10 +2575,10 @@ export class Server {
|
|
|
2578
2575
|
};
|
|
2579
2576
|
|
|
2580
2577
|
// Listen.
|
|
2581
|
-
this.http.listen(
|
|
2578
|
+
this.http.listen(this.port, this.ip === "*" ? undefined : this.ip, on_running);
|
|
2582
2579
|
this.http.on("error", on_error);
|
|
2583
2580
|
if (this.https !== undefined) {
|
|
2584
|
-
this.https.listen(https_port, this.ip, on_running);
|
|
2581
|
+
this.https.listen(this.https_port, this.ip === "*" ? undefined : this.ip, on_running);
|
|
2585
2582
|
this.https.on("error", on_error);
|
|
2586
2583
|
}
|
|
2587
2584
|
|