release: v1.0.9 — 插件一键升级、百炼模型列表扩充

This commit is contained in:
10000ge10000
2026-03-07 12:27:09 +08:00
parent 4489fe3e02
commit 67f04e6bd0
9 changed files with 313 additions and 55 deletions

View File

@@ -252,10 +252,12 @@ function handleUpgrade(req, socket, head) {
if (req.url !== '/ws' && !req.url.startsWith('/ws?')) { socket.destroy(); return; }
// 认证: 验证查询参数中的 token
if (AUTH_TOKEN) {
// 每次连接时实时读取 UCI token (安装/升级可能重新生成 token)
const currentToken = loadAuthToken() || AUTH_TOKEN;
if (currentToken) {
const url = new URL(req.url, `http://${req.headers.host || 'localhost'}`);
const clientToken = url.searchParams.get('token') || '';
if (clientToken !== AUTH_TOKEN) {
if (clientToken !== currentToken) {
console.log(`[oc-config] WS auth failed from ${socket.remoteAddress}`);
socket.write('HTTP/1.1 403 Forbidden\r\n\r\n');
socket.destroy();