mirror of
https://github.com/Silentely/eSIM-Tools.git
synced 2026-09-03 06:24:20 +08:00
✨ feat: 移除遗留页面及相关配置,新增运行时公共函数库
- 从 netlify.toml 中移除 `/giffgaff-legacy` 和 `/simyo-legacy` 重定向规则,清理不再使用的旧版页面路由 - 新增 runtime-common.sh 文件,提供跨语言(中英文)共享的运行时函数,包括 JSON 转义、安全检测、系统信息缓存等核心功能 - 更新 legacy-freeze.json,清空冻结文件列表,反映不再需要保护旧版页面文件的状态 - 修改多个脚本文件(pre-commit-check.js、pre-push-check.js、security-check.js),移除对已弃用页面的保护逻辑 - 调整服务入口文件(server.js、simyo_proxy_server.js)和 Service Worker(sw.js),删除对旧版 HTML 文件的引用和服务逻辑
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
{
|
||||
"algorithm": "sha256",
|
||||
"files": {
|
||||
"src/giffgaff/giffgaff_complete_esim.html": "5cabb824254441d4dce3e3b4f1cb8b37870c95a7a422583b84691d15959a4f7a",
|
||||
"src/simyo/simyo_complete_esim.html": "f7ca167f6fa07d4c2dbc2630d6edf9e8ea247023b9ebd45ea4e2093d7edbc576"
|
||||
}
|
||||
"files": {}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,7 @@ const TEXT_EXTENSIONS = new Set([
|
||||
|
||||
const JS_EXTENSIONS = new Set(['.js', '.mjs', '.cjs']);
|
||||
const SMART_QUOTES_RE = /[\u2018\u2019\u201C\u201D]/u;
|
||||
const PROTECTED_FILES = [
|
||||
'src/giffgaff/giffgaff_complete_esim.html',
|
||||
'src/simyo/simyo_complete_esim.html'
|
||||
];
|
||||
const PROTECTED_FILES = [];
|
||||
|
||||
function git(args, options = {}) {
|
||||
return execFileSync('git', args, {
|
||||
@@ -214,7 +211,7 @@ function runChecks(stagedFiles) {
|
||||
}
|
||||
|
||||
function main() {
|
||||
const touchedProtectedFiles = getTouchedProtectedFiles();
|
||||
const touchedProtectedFiles = PROTECTED_FILES.length > 0 ? getTouchedProtectedFiles() : [];
|
||||
if (touchedProtectedFiles.length > 0) {
|
||||
console.error('\n❌ pre-commit 检查失败:');
|
||||
for (const relPath of touchedProtectedFiles) {
|
||||
|
||||
@@ -11,10 +11,7 @@ const { execFileSync, spawnSync } = require('child_process');
|
||||
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
|
||||
const RELATED_EXTENSIONS = new Set(['.js', '.mjs', '.cjs', '.json']);
|
||||
const PROTECTED_FILES = [
|
||||
'src/giffgaff/giffgaff_complete_esim.html',
|
||||
'src/simyo/simyo_complete_esim.html'
|
||||
];
|
||||
const PROTECTED_FILES = [];
|
||||
|
||||
function runGit(args) {
|
||||
return execFileSync('git', args, {
|
||||
@@ -82,6 +79,7 @@ function getRelatedFiles() {
|
||||
}
|
||||
|
||||
function getTouchedProtectedFiles() {
|
||||
if (PROTECTED_FILES.length === 0) return [];
|
||||
const range = getDiffRange();
|
||||
if (!range) {
|
||||
return [];
|
||||
|
||||
@@ -143,8 +143,8 @@ function checkSecurityConfig() {
|
||||
// 检查Content Security Policy
|
||||
const htmlFiles = [
|
||||
'index.html',
|
||||
'src/giffgaff/giffgaff_complete_esim.html',
|
||||
'src/simyo/simyo_complete_esim.html'
|
||||
'src/giffgaff/giffgaff_modular.html',
|
||||
'src/simyo/simyo_modular.html'
|
||||
];
|
||||
|
||||
htmlFiles.forEach(file => {
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
/**
|
||||
* Legacy 页面冻结校验
|
||||
*
|
||||
* 目标:确保 /giffgaff-legacy 与 /simyo-legacy 对应的「旧页面源文件」不会被误改动。
|
||||
* - /giffgaff-legacy -> src/giffgaff/giffgaff_complete_esim.html
|
||||
* - /simyo-legacy -> src/simyo/simyo_complete_esim.html
|
||||
* 校验 legacy-freeze.json 中声明的冻结文件是否被修改。
|
||||
*
|
||||
* 用法:
|
||||
* - 校验(默认):node scripts/verify-legacy-frozen.js
|
||||
@@ -64,8 +62,7 @@ function main() {
|
||||
const fileMap = baseline.files || {};
|
||||
const fileEntries = Object.entries(fileMap);
|
||||
if (fileEntries.length === 0) {
|
||||
console.error('[Legacy Freeze] ✗ 基线 files 为空,无法校验');
|
||||
process.exitCode = 1;
|
||||
console.log('[Legacy Freeze] ✓ 无 legacy 冻结文件,跳过校验');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user