dev
This commit is contained in:
693
server/app.js
Normal file
693
server/app.js
Normal file
@@ -0,0 +1,693 @@
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const app = express();
|
||||
const PORT = 3007;
|
||||
|
||||
// 初始连接映射数据
|
||||
const initialConnectionMap = {
|
||||
pass: {
|
||||
//---Copper连接检查---
|
||||
"main-permanent": {
|
||||
type: "copper",
|
||||
connectedTo: "remote-channel",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"remote-channel": {
|
||||
type: "copper",
|
||||
connectedTo: "main-channel",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"main-channel": {
|
||||
type: "copper",
|
||||
connectedTo: "remote-permanent",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
//---CFP连接检查---
|
||||
"main-cfp-sm-out": {
|
||||
type: "fiber",
|
||||
connectedTo: "remote-cfp-in",
|
||||
fiberstatus: "ref-pass"
|
||||
},
|
||||
"main-cfp-mm-out": {
|
||||
type: "fiber",
|
||||
connectedTo: "remote-cfp-in",
|
||||
fiberstatus: "ref-pass"
|
||||
},
|
||||
|
||||
"remote-cfp-sm-out": {
|
||||
type: "fiber",
|
||||
connectedTo: "main-cfp-in",
|
||||
fiberstatus: "ref-pass"
|
||||
},
|
||||
"remote-cfp-mm-out": {
|
||||
type: "fiber",
|
||||
connectedTo: "main-cfp-in",
|
||||
fiberstatus: "ref-pass"
|
||||
},
|
||||
|
||||
},
|
||||
Office: {
|
||||
"Room1-TO-1": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1A-1",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room1-TO-2": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1A-2",
|
||||
wiremapstatus: "open",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room2-TO-1": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1A-3",
|
||||
wiremapstatus: "short",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room2-TO-2": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1A-4",
|
||||
wiremapstatus: "cross",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room3-TO-1": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1A-5",
|
||||
wiremapstatus: "reversed",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room3-TO-2": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1A-6",
|
||||
wiremapstatus: "miswire",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room4-CAM": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1A-7",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "return-loss-fail"
|
||||
},
|
||||
"1B-1": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1B-5",
|
||||
fiberstatus: "sm-pass"
|
||||
},
|
||||
"1B-2": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1B-6",
|
||||
fiberstatus: "connector-fail-start"
|
||||
},
|
||||
"1B-3": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1B-7",
|
||||
fiberstatus: "splice-fail"
|
||||
},
|
||||
"1B-4": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1B-8",
|
||||
fiberstatus: "bend"
|
||||
}
|
||||
},
|
||||
Industry: {
|
||||
"Device1-1": {
|
||||
type: "copper",
|
||||
apitype:"workshop",
|
||||
connectedTo: "Cabinet-A1",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Device1-2": {
|
||||
type: "copper",
|
||||
apitype:"workshop",
|
||||
connectedTo: "Cabinet-A2",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Device2-1": {
|
||||
type: "copper",
|
||||
apitype:"workshop",
|
||||
connectedTo: "Cabinet-A3",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Device2-2": {
|
||||
type: "copper",
|
||||
apitype:"workshop",
|
||||
connectedTo: "Cabinet-A4",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Device3-1": {
|
||||
type: "copper",
|
||||
apitype:"workshop",
|
||||
connectedTo: "Cabinet-R1",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Device3-2": {
|
||||
type: "copper",
|
||||
apitype:"workshop",
|
||||
connectedTo: "Cabinet-R2",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Device4-1": {
|
||||
type: "copper",
|
||||
apitype:"workshop",
|
||||
connectedTo: "Cabinet-R3",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Device4-2": {
|
||||
type: "copper",
|
||||
apitype:"workshop",
|
||||
connectedTo: "Cabinet-R4",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
}
|
||||
},
|
||||
DataCenter: {
|
||||
"CA-1A-1-port1": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "CB-1A-1-port1",
|
||||
fiberstatus: "mm-pass"
|
||||
},
|
||||
"CA-1A-1-port2": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "CB-1A-1-port2",
|
||||
fiberstatus: "mm-pass"
|
||||
},
|
||||
"CA-1A-1-port3": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "CB-1A-1-port3",
|
||||
fiberstatus: "mm-pass"
|
||||
},
|
||||
"CA-1A-1-port4": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "CB-1A-1-port4",
|
||||
fiberstatus: "mm-pass"
|
||||
},
|
||||
"CA-1A-1-port5": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "CB-1A-1-port6",
|
||||
fiberstatus: "mm-pass"
|
||||
},
|
||||
"CA-1A-1-port6": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "CB-1A-1-port6",
|
||||
fiberstatus: "mm-pass"
|
||||
},
|
||||
},
|
||||
SkillCompetition: {
|
||||
"Room1-1": {
|
||||
type: "copper",
|
||||
connectedTo: "1A-1",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room1-2": {
|
||||
type: "copper",
|
||||
connectedTo: "1A-2",
|
||||
wiremapstatus: "open",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room2-1": {
|
||||
type: "copper",
|
||||
connectedTo: "1A-11",
|
||||
wiremapstatus: "short",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room2-2": {
|
||||
type: "copper",
|
||||
connectedTo: "1A-12",
|
||||
wiremapstatus: "cross",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room3-1": {
|
||||
type: "copper",
|
||||
connectedTo: "1B-5",
|
||||
wiremapstatus: "reversed",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room3-2": {
|
||||
type: "copper",
|
||||
connectedTo: "1B-6",
|
||||
wiremapstatus: "miswire",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
},
|
||||
WorldSkill: {
|
||||
"Room1-TO-1": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1F-RackA-1A-1",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "lengthfail"
|
||||
},
|
||||
"Room1-TO-2": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1F-RackA-1A-2",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "return-loss-fail"
|
||||
},
|
||||
"Room3-TO-1": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1F-RackA-1A-5",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "next-fail"
|
||||
},
|
||||
"Room3-TO-2": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1F-RackA-1A-6",
|
||||
wiremapstatus: "open2",
|
||||
performancestatus: "pass"
|
||||
},
|
||||
"Room4-CAM": {
|
||||
type: "copper",
|
||||
apitype:"t568b",
|
||||
connectedTo: "1F-RackA-1A-12",
|
||||
wiremapstatus: "pass",
|
||||
performancestatus: "mptl-nextfail"
|
||||
},
|
||||
// OLTS
|
||||
"2F-RackA-1A-1": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1F-RackA-1B-1",
|
||||
fiberstatus: "sm-pass"
|
||||
},
|
||||
"2F-RackA-1A-2": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1F-RackA-1B-2",
|
||||
fiberstatus: "sm-pass"
|
||||
},
|
||||
"2F-RackA-1A-3": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1F-RackA-1B-3",
|
||||
fiberstatus: "sm-pass"
|
||||
},
|
||||
"2F-RackA-1A-4": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1F-RackA-1B-4",
|
||||
fiberstatus: "sm-fail"
|
||||
},
|
||||
"2F-RackA-1A-5": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1F-RackA-1B-6",
|
||||
fiberstatus: "sm-pass"
|
||||
},
|
||||
"2F-RackA-1A-6": {
|
||||
type: "fiber",
|
||||
apitype:"olts",
|
||||
connectedTo: "1F-RackA-1B-5",
|
||||
fiberstatus: "sm-pass"
|
||||
},
|
||||
// OTDR
|
||||
"1F-RackA-1C-1": {
|
||||
type: "fiber",
|
||||
apitype:"otdr",
|
||||
connectedTo: "x",
|
||||
fiberstatus: "sm-pass"
|
||||
},
|
||||
"1F-RackA-1C-2": {
|
||||
type: "fiber",
|
||||
apitype:"otdr",
|
||||
connectedTo: "x",
|
||||
fiberstatus: "connector-fail-start"
|
||||
},
|
||||
"1F-RackA-1C-3": {
|
||||
type: "fiber",
|
||||
apitype:"otdr",
|
||||
connectedTo: "x",
|
||||
fiberstatus: "splice-fail"
|
||||
},
|
||||
"1F-RackA-1C-4": {
|
||||
type: "fiber",
|
||||
apitype:"otdr",
|
||||
connectedTo: "x",
|
||||
fiberstatus: "bend"
|
||||
},
|
||||
// 车间
|
||||
"RMA-1": {
|
||||
type: "copper",
|
||||
apitype:"workshop-m12",
|
||||
connectedTo: "PLC-Rack-1A-1",
|
||||
wiremapstatus: "pass-2pair",
|
||||
performancestatus: "workshop-m12-pass-30m"
|
||||
},
|
||||
"RMA-2": {
|
||||
type: "copper",
|
||||
apitype:"workshop-m12",
|
||||
connectedTo: "PLC-Rack-1A-2",
|
||||
wiremapstatus: "sopen",
|
||||
performancestatus: "workshop-m12-pass-30m"
|
||||
},
|
||||
"PLC-Rack-1B-1": {
|
||||
type: "copper",
|
||||
apitype:"workshop-2p",
|
||||
connectedTo: "1F-RackA-1A-1",
|
||||
wiremapstatus: "pass-2pair",
|
||||
performancestatus: "workshop-2p-pass-80m"
|
||||
},
|
||||
"PLC-Rack-1B-2": {
|
||||
type: "copper",
|
||||
apitype:"workshop-2p",
|
||||
connectedTo: "1F-RackA-1A-2",
|
||||
wiremapstatus: "pass-2pair",
|
||||
performancestatus: "workshop-2p-lengthfail"
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 初始化连接映射数据
|
||||
let connectionMap;
|
||||
const connectionMapPath = path.join(__dirname, 'connection_maps', 'connectionMap.json');
|
||||
|
||||
try {
|
||||
if (fs.existsSync(connectionMapPath)) {
|
||||
const data = fs.readFileSync(connectionMapPath, 'utf8');
|
||||
connectionMap = JSON.parse(data);
|
||||
//console.log('从connectionMap.json加载连接映射数据');
|
||||
} else {
|
||||
connectionMap = JSON.parse(JSON.stringify(initialConnectionMap));
|
||||
//console.log('使用默认初始连接映射数据');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('加载连接映射数据时出错:', err);
|
||||
connectionMap = JSON.parse(JSON.stringify(initialConnectionMap));
|
||||
}
|
||||
|
||||
// 中间件
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// 获取连接映射的API
|
||||
app.get('/api/connectionMap', (req, res) => {
|
||||
const scene = req.query.scene;
|
||||
|
||||
if (!scene) {
|
||||
//console.log('[ERROR] 获取连接映射失败: 缺少scene参数');
|
||||
return res.status(400).json({ error: '缺少scene参数' });
|
||||
}
|
||||
|
||||
if (!connectionMap[scene]) {
|
||||
//console.log(`[ERROR] 获取连接映射失败: 无效的场景 (${scene})`);
|
||||
return res.status(404).json({ error: '无效的场景' });
|
||||
}
|
||||
|
||||
// 合并pass场景和当前场景的数据
|
||||
const mergedConnectionMap = Object.assign({}, connectionMap['pass'], connectionMap[scene]);
|
||||
//console.log(`[GET] 获取连接映射 - 场景: ${scene}`);
|
||||
res.json(mergedConnectionMap);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 更新整个连接映射的API
|
||||
app.post('/api/connectionMap', (req, res) => {
|
||||
const scene = Object.keys(req.body)[0];
|
||||
let newConnectionMap = req.body[scene];
|
||||
|
||||
// 验证数据格式
|
||||
if (!scene || !newConnectionMap || typeof newConnectionMap !== 'object') {
|
||||
//console.log('[ERROR] 更新连接映射失败: 无效的数据格式');
|
||||
return res.status(400).json({ error: '无效的数据格式' });
|
||||
}
|
||||
|
||||
// 禁止修改pass场景
|
||||
if (scene === 'pass') {
|
||||
//console.log('[ERROR] 更新连接映射失败: 不允许修改pass场景');
|
||||
return res.status(403).json({ error: '不允许修改pass场景' });
|
||||
}
|
||||
|
||||
// 移除与pass场景重复的数据
|
||||
const passKeys = Object.keys(connectionMap.pass);
|
||||
newConnectionMap = Object.fromEntries(
|
||||
Object.entries(newConnectionMap).filter(([key]) => !passKeys.includes(key))
|
||||
);
|
||||
|
||||
// 更新连接映射
|
||||
const oldConnectionMap = JSON.stringify(connectionMap[scene]);
|
||||
connectionMap[scene] = newConnectionMap;
|
||||
//console.log(`[UPDATE] 连接映射已更新 - 场景: ${scene}`);
|
||||
//console.log(`[DIFF] 旧数据: ${oldConnectionMap}`);
|
||||
//console.log(`[DIFF] 新数据: ${JSON.stringify(connectionMap[scene])}`);
|
||||
|
||||
res.json({ success: true, message: '连接映射已更新' });
|
||||
// 持久化存储连接映射
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const dirPath = path.join(__dirname, 'connection_maps');
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath);
|
||||
}
|
||||
fs.writeFileSync(path.join(dirPath, `connectionMap.json`), JSON.stringify(connectionMap, null, 2));
|
||||
//console.log(`[SAVE] 连接映射已持久化存储`);
|
||||
});
|
||||
|
||||
// 初始化连接映射的API
|
||||
app.post('/api/initConnectionMap', (req, res) => {
|
||||
connectionMap = JSON.parse(JSON.stringify(initialConnectionMap));
|
||||
|
||||
res.json({ success: true, message: '连接映射已恢复默认状态' });
|
||||
// 持久化存储连接映射
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const dirPath = path.join(__dirname, 'connection_maps');
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath);
|
||||
}
|
||||
fs.writeFileSync(path.join(dirPath, `connectionMap.json`), JSON.stringify(initialConnectionMap, null, 2));
|
||||
//console.log(`[SAVE] 连接映射已初始化并`);
|
||||
|
||||
});
|
||||
// -----------------**************--------连接映射-----------***************--------------
|
||||
|
||||
|
||||
// 比赛状态存储
|
||||
let competitionStatus = {
|
||||
UUID: null,
|
||||
isRunning: false,
|
||||
startTime: null,
|
||||
statisticsData: {}
|
||||
};
|
||||
|
||||
// 比赛开始API
|
||||
app.post('/api/competition/start', (req, res) => {
|
||||
if (competitionStatus.isRunning) {
|
||||
return res.status(400).json({ error: '比赛已在进行中' });
|
||||
}
|
||||
|
||||
competitionStatus = {
|
||||
UUID: require('crypto').randomUUID(),
|
||||
isRunning: true,
|
||||
startTime: new Date(new Date().getTime() + (8 * 60 * 60 * 1000)).toISOString(),
|
||||
statisticsData: {}
|
||||
};
|
||||
|
||||
// 创建比赛临时数据目录
|
||||
const tmpDirPath = path.join(__dirname, 'competition_tmp', competitionStatus.UUID);
|
||||
if (!fs.existsSync(path.join(__dirname, 'competition_tmp'))) {
|
||||
fs.mkdirSync(path.join(__dirname, 'competition_tmp'));
|
||||
}
|
||||
if (!fs.existsSync(tmpDirPath)) {
|
||||
fs.mkdirSync(tmpDirPath);
|
||||
}
|
||||
|
||||
// 启动定时备份
|
||||
const backupInterval = setInterval(() => {
|
||||
if (!competitionStatus.isRunning) {
|
||||
clearInterval(backupInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
const timestamp = new Date(new Date().getTime() + (8 * 60 * 60 * 1000)).toISOString().replace(/[:.]/g, '-');
|
||||
const backupData = {
|
||||
connectionMap,
|
||||
competitionStatus
|
||||
};
|
||||
|
||||
// 编码数据
|
||||
const dataStr = JSON.stringify(backupData, null, 2);
|
||||
const encodedData = encodeURIComponent(dataStr).split('').reverse().join('');
|
||||
const finalData = `EST_ENCODED_DATA:${encodedData}`;
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tmpDirPath, `backup_${timestamp}.est`),
|
||||
finalData
|
||||
);
|
||||
}, 60000); // 每分钟备份一次
|
||||
|
||||
//console.log(`[COMPETITION] 比赛开始 - UUID: ${competitionStatus.UUID}`);
|
||||
res.json({ success: true, UUID: competitionStatus.UUID });
|
||||
});
|
||||
|
||||
// 比赛结束API
|
||||
app.post('/api/competition/end', (req, res) => {
|
||||
if (!competitionStatus.isRunning) {
|
||||
return res.status(400).json({ error: '没有进行中的比赛' });
|
||||
}
|
||||
|
||||
// 持久化存储比赛数据
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const dateStr = new Date().toISOString().split('T')[0];
|
||||
const fileName = `${dateStr}_${competitionStatus.UUID}.est`;
|
||||
const dirPath = path.join(__dirname, 'competition_data');
|
||||
const saveData = {
|
||||
connectionMap,
|
||||
competitionStatus,
|
||||
};
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath);
|
||||
}
|
||||
|
||||
// 使用编码和简单的字符替换来编码数据
|
||||
const dataStr = JSON.stringify(saveData, null, 2);
|
||||
const encodedData = encodeURIComponent(dataStr).split('').reverse().join('');
|
||||
// 添加自定义头部标识,表明这是编码后的文件
|
||||
const finalData = `EST_ENCODED_DATA:${encodedData}`;
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(dirPath, fileName),
|
||||
finalData
|
||||
);
|
||||
|
||||
competitionStatus.isRunning = false;
|
||||
//console.log(`[COMPETITION] 比赛结束 - 数据已保存到 ${fileName}`);
|
||||
res.json({
|
||||
uuid: competitionStatus.UUID,
|
||||
success: true,
|
||||
data: saveData,
|
||||
});
|
||||
competitionStatus.statisticsData = {};
|
||||
});
|
||||
|
||||
// 比赛状态查询API
|
||||
app.get('/api/competition/status', (req, res) => {
|
||||
const response = {
|
||||
isRunning: competitionStatus.isRunning
|
||||
|
||||
};
|
||||
|
||||
if (competitionStatus.isRunning) {
|
||||
response.UUID = competitionStatus.UUID;
|
||||
response.startTime = competitionStatus.startTime;
|
||||
|
||||
}
|
||||
|
||||
res.json(response);
|
||||
});
|
||||
|
||||
// 比赛数据上传API
|
||||
app.post('/api/competition/data', (req, res) => {
|
||||
const { UUID, fingerprint, timestamp, data } = req.body;
|
||||
|
||||
// 验证比赛状态
|
||||
if (!competitionStatus.isRunning) {
|
||||
return res.status(400).json({ error: '没有进行中的比赛' });
|
||||
}
|
||||
|
||||
// 验证UUID
|
||||
if (!UUID || UUID !== competitionStatus.UUID) {
|
||||
return res.status(400).json({ error: '无效的UUID或UUID不匹配当前比赛' });
|
||||
}
|
||||
|
||||
// 验证数据完整性
|
||||
if (!data || !fingerprint) {
|
||||
return res.status(400).json({ error: '缺少必要数据' });
|
||||
}
|
||||
|
||||
try {
|
||||
// 使用指纹作为键,存储最新的数据
|
||||
competitionStatus.statisticsData[fingerprint] = {
|
||||
...data,
|
||||
lastUpdate: timestamp
|
||||
};
|
||||
|
||||
// 比赛数据查询API (根据UUID和fingerprint)
|
||||
app.get('/api/competition/data', (req, res) => {
|
||||
const { UUID, fingerprint } = req.query;
|
||||
|
||||
// 验证参数
|
||||
if (!UUID || !fingerprint) {
|
||||
//console.log('[ERROR] 查询比赛数据失败: 缺少UUID或fingerprint参数');
|
||||
return res.status(400).json({ error: '缺少UUID或fingerprint参数' });
|
||||
}
|
||||
|
||||
// 检查比赛状态
|
||||
if (!competitionStatus.isRunning || competitionStatus.UUID !== UUID) {
|
||||
//console.log('[ERROR] 查询比赛数据失败: 无效的比赛UUID或比赛未进行');
|
||||
return res.status(404).json({ error: '无效的比赛UUID或比赛未进行' });
|
||||
}
|
||||
|
||||
// 获取指定指纹的数据
|
||||
const data = competitionStatus.statisticsData[fingerprint];
|
||||
if (!data) {
|
||||
//console.log(`[WARN] 未找到指纹 ${fingerprint} 的比赛数据`);
|
||||
return res.status(404).json({ error: '未找到指定指纹的比赛数据' });
|
||||
}
|
||||
|
||||
//console.log(`[GET] 获取比赛数据 - UUID: ${UUID}, 指纹: ${fingerprint}`);
|
||||
res.json({
|
||||
success: true,
|
||||
data: {
|
||||
projects: data.projects || []
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
res.json({ success: true });
|
||||
} catch (error) {
|
||||
console.error('保存比赛数据失败:', error);
|
||||
res.status(500).json({ error: '服务器内部错误' });
|
||||
}
|
||||
});
|
||||
|
||||
// 比赛数据查询API
|
||||
app.get('/api/competition/data', (req, res) => {
|
||||
res.json(competitionStatus.statisticsData);
|
||||
});
|
||||
|
||||
// 启动服务器
|
||||
app.listen(PORT, () => {
|
||||
console.log(`[SERVER] 服务器运行在 http://localhost:${PORT}`);
|
||||
console.log('\x1b[31m%s\x1b[0m', '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
|
||||
console.log('\x1b[31m\x1b[1m%s\x1b[0m', '!! 比赛期间请勿关闭此窗口 !!');
|
||||
console.log('\x1b[31m\x1b[1m%s\x1b[0m', '!! 比赛期间避免键盘操作 如Ctrl+C等 !!');
|
||||
console.log('\x1b[31m\x1b[1m%s\x1b[0m', '!! 关闭后比赛数据将会丢失 !!');
|
||||
console.log('\x1b[31m%s\x1b[0m', '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
|
||||
});
|
||||
795
server/package-lock.json
generated
Normal file
795
server/package-lock.json
generated
Normal file
@@ -0,0 +1,795 @@
|
||||
{
|
||||
"name": "server",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "server",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/accepts/-/accepts-2.0.0.tgz",
|
||||
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
|
||||
"dependencies": {
|
||||
"mime-types": "^3.0.0",
|
||||
"negotiator": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-2.2.0.tgz",
|
||||
"integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==",
|
||||
"dependencies": {
|
||||
"bytes": "^3.1.2",
|
||||
"content-type": "^1.0.5",
|
||||
"debug": "^4.4.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"qs": "^6.14.0",
|
||||
"raw-body": "^3.0.0",
|
||||
"type-is": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz",
|
||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bound": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/content-disposition/-/content-disposition-1.0.0.tgz",
|
||||
"integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmmirror.com/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmmirror.com/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-signature": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmmirror.com/cookie-signature/-/cookie-signature-1.2.2.tgz",
|
||||
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
|
||||
"engines": {
|
||||
"node": ">=6.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmmirror.com/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.1.tgz",
|
||||
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz",
|
||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmmirror.com/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/express/-/express-5.1.0.tgz",
|
||||
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.0",
|
||||
"content-disposition": "^1.0.0",
|
||||
"content-type": "^1.0.5",
|
||||
"cookie": "^0.7.1",
|
||||
"cookie-signature": "^1.2.1",
|
||||
"debug": "^4.4.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"finalhandler": "^2.1.0",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"merge-descriptors": "^2.0.0",
|
||||
"mime-types": "^3.0.0",
|
||||
"on-finished": "^2.4.1",
|
||||
"once": "^1.4.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"qs": "^6.14.0",
|
||||
"range-parser": "^1.2.1",
|
||||
"router": "^2.2.0",
|
||||
"send": "^1.1.0",
|
||||
"serve-static": "^2.2.0",
|
||||
"statuses": "^2.0.1",
|
||||
"type-is": "^2.0.1",
|
||||
"vary": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/finalhandler/-/finalhandler-2.1.0.tgz",
|
||||
"integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"parseurl": "^1.3.3",
|
||||
"statuses": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fresh": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/fresh/-/fresh-2.0.0.tgz",
|
||||
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-2.0.0.tgz",
|
||||
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
||||
"dependencies": {
|
||||
"depd": "2.0.0",
|
||||
"inherits": "2.0.4",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "2.0.1",
|
||||
"toidentifier": "1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors/node_modules/statuses": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.1.tgz",
|
||||
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/is-promise": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/is-promise/-/is-promise-4.0.0.tgz",
|
||||
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/media-typer/-/media-typer-1.1.0.tgz",
|
||||
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
|
||||
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.54.0",
|
||||
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.54.0.tgz",
|
||||
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-3.0.1.tgz",
|
||||
"integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
|
||||
"dependencies": {
|
||||
"mime-db": "^1.54.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-1.0.0.tgz",
|
||||
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmmirror.com/on-finished/-/on-finished-2.4.1.tgz",
|
||||
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmmirror.com/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-8.3.0.tgz",
|
||||
"integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmmirror.com/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
"ipaddr.js": "1.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.14.0",
|
||||
"resolved": "https://registry.npmmirror.com/qs/-/qs-6.14.0.tgz",
|
||||
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/raw-body/-/raw-body-3.0.1.tgz",
|
||||
"integrity": "sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA==",
|
||||
"dependencies": {
|
||||
"bytes": "3.1.2",
|
||||
"http-errors": "2.0.0",
|
||||
"iconv-lite": "0.7.0",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body/node_modules/iconv-lite": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.7.0.tgz",
|
||||
"integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/router": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/router/-/router-2.2.0.tgz",
|
||||
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.0",
|
||||
"depd": "^2.0.0",
|
||||
"is-promise": "^4.0.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"path-to-regexp": "^8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/send/-/send-1.2.0.tgz",
|
||||
"integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.5",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"mime-types": "^3.0.1",
|
||||
"ms": "^2.1.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"range-parser": "^1.2.1",
|
||||
"statuses": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/serve-static/-/serve-static-2.2.0.tgz",
|
||||
"integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
|
||||
"dependencies": {
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"parseurl": "^1.3.3",
|
||||
"send": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz",
|
||||
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-list": "^1.0.0",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-list/-/side-channel-list-1.0.0.tgz",
|
||||
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-map": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-weakmap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-map": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.2.tgz",
|
||||
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/type-is/-/type-is-2.0.1.tgz",
|
||||
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
|
||||
"dependencies": {
|
||||
"content-type": "^1.0.5",
|
||||
"media-typer": "^1.1.0",
|
||||
"mime-types": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
16
server/package.json
Normal file
16
server/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "server",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.1.0"
|
||||
}
|
||||
}
|
||||
60
server/server.js
Normal file
60
server/server.js
Normal file
@@ -0,0 +1,60 @@
|
||||
const express = require('express');
|
||||
const path = require('path');
|
||||
const app = express();
|
||||
|
||||
// 设置静态文件目录
|
||||
app.use(express.static(path.join(__dirname)));
|
||||
|
||||
// 下载路由
|
||||
app.get('/download', (req, res) => {
|
||||
const filePath = path.join(__dirname, 'EST-DSX Setup 1.2.0.exe');
|
||||
res.download(filePath, (err) => {
|
||||
if (err) {
|
||||
res.status(500).send('下载文件时发生错误');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 主页
|
||||
app.get('/', (req, res) => {
|
||||
res.send(`
|
||||
<html>
|
||||
<head>
|
||||
<title>文件下载</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.download-btn {
|
||||
padding: 15px 30px;
|
||||
font-size: 18px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
.download-btn:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="/download" class="download-btn">下载 EST-DSX Setup</a>
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
});
|
||||
|
||||
// 启动服务器
|
||||
const PORT = 3000;
|
||||
app.listen(PORT, () => {
|
||||
console.log(`服务器运行在 http://localhost:${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user