feat: ds
This commit is contained in:
@@ -34,6 +34,7 @@ function labApiBase() {
|
||||
if (ex && ex.host) {
|
||||
var tls = !!(ex.tls || ex.prefer_https);
|
||||
var port = Number(tls ? (ex.https_port || 443) : (ex.http_port || 80)) || (tls ? 443 : 80);
|
||||
if (!tls && port === 443) { tls = true; }
|
||||
var origin = (tls ? 'https://' : 'http://') + String(ex.host).replace(/^https?:\/\//, '').split('/')[0].split(':')[0];
|
||||
if (!((tls && port === 443) || (!tls && port === 80))) origin += ':' + port;
|
||||
return origin;
|
||||
@@ -518,8 +519,9 @@ function exfilFields() {
|
||||
// Prefer explicit GitHub-style IP:4001 from /api/ds/chain-targets
|
||||
const hostRaw = String(t.host || '').replace(/^https?:\/\//, '').split('/')[0].split(':')[0];
|
||||
const isIp = /^\d+\.\d+\.\d+\.\d+$/.test(hostRaw);
|
||||
if (isIp || t.prefer_https === false || t.tls === false || (t.http_port && Number(t.http_port) === 4001)) {
|
||||
const ip = isIp ? hostRaw : '192.168.31.130';
|
||||
const labHttp = isIp || Number(t.http_port) === 4001 || Number(t.http_port) === 8080 || Number(t.http_port) === 8000;
|
||||
if (labHttp && t.tls !== true && t.prefer_https !== true) {
|
||||
const ip = isIp ? hostRaw : hostRaw;
|
||||
return {
|
||||
exfilHost: ip,
|
||||
exfilHttpPort: t.http_port != null ? Number(t.http_port) : 4001,
|
||||
@@ -527,7 +529,7 @@ function exfilFields() {
|
||||
exfilTls: false,
|
||||
exfilFallbackHost: ip,
|
||||
exfilFallbackHttpPort: 8018,
|
||||
statsUrl: t.stats_url_direct || t.stats_url || ('http://' + ip + ':4001/stats'),
|
||||
statsUrl: t.stats_url_direct || t.stats_url || ('http://' + ip + ':' + (t.http_port || 4001) + '/stats'),
|
||||
deviceUUID,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user