15 lines
582 B
JavaScript
15 lines
582 B
JavaScript
/* Shared URL boundary for userscript injection and same-page navigation. */
|
|
const YianSiteScope = (function () {
|
|
'use strict';
|
|
const origin = 'http://10.119.67.7';
|
|
const basePath = '/clientcn/';
|
|
function isAllowedURL(value) {
|
|
try {
|
|
const url = new URL(String(value));
|
|
return url.origin === origin && url.pathname.startsWith(basePath);
|
|
} catch (_) { return false; }
|
|
}
|
|
return Object.freeze({ origin, basePath, isAllowedURL });
|
|
})();
|
|
if (typeof window === 'undefined' && typeof module !== 'undefined' && module.exports) module.exports = YianSiteScope;
|