mirror of
https://github.com/primedigitaltech/azon_seeker.git
synced 2026-10-05 15:22:59 +08:00
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
import { readdir, readFile } from 'node:fs/promises';
|
|
import { join } from 'node:path';
|
|
|
|
const background = await readFile('extension/dist/background/index.mjs', 'utf8');
|
|
async function readJavaScriptFiles(directory) {
|
|
const entries = await readdir(directory, { withFileTypes: true });
|
|
const contents = await Promise.all(
|
|
entries.map(async (entry) => {
|
|
const path = join(directory, entry.name);
|
|
if (entry.isDirectory()) return readJavaScriptFiles(path);
|
|
if (!/\.(?:m?js)$/.test(entry.name)) return '';
|
|
return readFile(path, 'utf8');
|
|
}),
|
|
);
|
|
return contents.flat().join('\n');
|
|
}
|
|
const allJavaScript = await readJavaScriptFiles('extension/dist');
|
|
|
|
if (!background.includes('amzplugin.rekeymed.com')) {
|
|
throw new Error('Production background bundle does not target the public server.');
|
|
}
|
|
if (background.includes('127.0.0.1:18000')) {
|
|
throw new Error('Production background bundle still contains the local API endpoint.');
|
|
}
|
|
if (!allJavaScript.includes('wss://') || !background.includes('https://')) {
|
|
throw new Error('Production bundle is missing secure HTTP/WebSocket protocols.');
|
|
}
|
|
|
|
console.log('Production endpoint verification passed.');
|