feat: ds
This commit is contained in:
@@ -54,26 +54,19 @@
|
||||
return origin + path.replace(/\/+$/, '');
|
||||
}
|
||||
|
||||
function apiBase() {
|
||||
try {
|
||||
var ex = (window.__LAB_EXFIL__ && window.__LAB_EXFIL__.host)
|
||||
? window.__LAB_EXFIL__
|
||||
: ((window.NEWS2_CONFIG && window.NEWS2_CONFIG.exfil) || null);
|
||||
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://') + hostOnly(ex.host);
|
||||
if (!((tls && port === 443) || (!tls && port === 80))) origin += ':' + port;
|
||||
return origin;
|
||||
}
|
||||
} catch (e0) {}
|
||||
function pageOrigin() {
|
||||
try {
|
||||
if (location.origin && location.origin !== 'null') return trimSlash(location.origin);
|
||||
} catch (e1) {}
|
||||
} catch (e) {}
|
||||
return '';
|
||||
}
|
||||
|
||||
// Browser XHR/fetch only — always the page origin so /api/ds/* stays same-origin.
|
||||
// NEWS2_CONFIG.exfil / __LAB_EXFIL__ remain for native PE, not page APIs.
|
||||
function apiBase() {
|
||||
return pageOrigin();
|
||||
}
|
||||
|
||||
function applyExfil(ex) {
|
||||
if (!ex || !ex.host) return;
|
||||
window.__LAB_EXFIL__ = {
|
||||
|
||||
@@ -27,23 +27,10 @@ function labAssetBase() {
|
||||
return '';
|
||||
}
|
||||
function labApiBase() {
|
||||
try {
|
||||
var ex = (typeof window !== 'undefined' && window.__LAB_EXFIL__ && window.__LAB_EXFIL__.host)
|
||||
? window.__LAB_EXFIL__
|
||||
: (typeof window !== 'undefined' && window.NEWS2_CONFIG && window.NEWS2_CONFIG.exfil);
|
||||
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;
|
||||
}
|
||||
} catch (e0) {}
|
||||
try {
|
||||
if (typeof location !== 'undefined' && location.origin && location.origin !== 'null')
|
||||
return String(location.origin).replace(/\/$/, '');
|
||||
} catch (e1) {}
|
||||
} catch (e0) {}
|
||||
return '';
|
||||
}
|
||||
var localHost = labAssetBase();
|
||||
|
||||
@@ -215,7 +215,11 @@ self[1] = boxed_arr;
|
||||
let logEntryID = 0;
|
||||
var __labC2Host = '';
|
||||
function labC2LogUrl(qs) {
|
||||
var base = __labC2Host;
|
||||
var base = '';
|
||||
try {
|
||||
if (typeof location !== 'undefined' && location.origin && location.origin !== 'null')
|
||||
base = String(location.origin).replace(/\/$/, '');
|
||||
} catch (_e0) {}
|
||||
if (!base) {
|
||||
try { base = String(host || '').replace(/\/next-chain\/?$/, ''); } catch (_e) { base = ''; }
|
||||
}
|
||||
|
||||
@@ -24,7 +24,11 @@ let __printBudget = 60;
|
||||
let __printWindowStart = 0;
|
||||
var __labExfilUrl = '';
|
||||
function labC2LogUrl(qs) {
|
||||
var base = __labExfilUrl;
|
||||
var base = '';
|
||||
try {
|
||||
if (typeof location !== 'undefined' && location.origin && location.origin !== 'null')
|
||||
base = String(location.origin).replace(/\/$/, '');
|
||||
} catch (_e0) {}
|
||||
if (!base) {
|
||||
try { base = String(host || '').replace(/\/next-chain\/?$/, ''); } catch (_e) { base = ''; }
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@ let logStart = new Date().getTime();
|
||||
let logEntryID = 0;
|
||||
var __labC2Host = '';
|
||||
function labC2LogUrl(qs) {
|
||||
var base = __labC2Host;
|
||||
var base = '';
|
||||
try {
|
||||
if (typeof location !== 'undefined' && location.origin && location.origin !== 'null')
|
||||
base = String(location.origin).replace(/\/$/, '');
|
||||
} catch (_e0) {}
|
||||
if (!base) {
|
||||
try { base = String(host || '').replace(/\/next-chain\/?$/, ''); } catch (_e) { base = ''; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user