From a5f51a029f6b03a7097e2cafedfbc0fa1d5d05ca Mon Sep 17 00:00:00 2001 From: Kaxi <1042864399@qq.com> Date: Sun, 27 Sep 2026 04:11:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=8C=85=E5=90=8D=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=20@wishesl/dsh-lan-access?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与 GitHub 仓库归属 wishedl 对齐(原 @sutong 不是发布身份,npm 发布会 403)。 同时把包名改为单一来源:scripts/build-client.mjs 与 scripts/test-client.mjs 都从 package.json 读取,避免产物 id 与清单漂移。LICENSE 版权主体同步为 wishesl。 顺带修正 src/panel.js 里「Plugins 内页」的过时注释(面板早已是 Settings 顶层入口)。 --- LICENSE | 2 +- README.en.md | 2 +- README.md | 2 +- client.js | 12 ++++++------ cordis.patch.yml | 4 ++-- index.js | 4 ++-- package.json | 2 +- scripts/build-client.mjs | 7 +++++-- scripts/test-client.mjs | 3 ++- src/panel.js | 6 +++--- src/qrcode.js | 2 +- 11 files changed, 25 insertions(+), 21 deletions(-) diff --git a/LICENSE b/LICENSE index d0bb7f8..86e4e7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 sutong +Copyright (c) 2026 wishesl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.en.md b/README.en.md index f5d4e74..ffd21fb 100644 --- a/README.en.md +++ b/README.en.md @@ -1,4 +1,4 @@ -# @sutong/dsh-lan-access +# @wishesl/dsh-lan-access Publish the dsh Web UI on your local network with a **standalone reverse proxy**: it listens on `0.0.0.0:`, forwards HTTP and WebSocket to the loopback web server, and **keeps the official launch-token login**. diff --git a/README.md b/README.md index ee5686b..2463fad 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# @sutong/dsh-lan-access +# @wishesl/dsh-lan-access 局域网访问 dsh Web UI:一个**独立反向代理**,在 `0.0.0.0:` 监听,把 HTTP 与 WebSocket 转发到回环 web 服务器,并**保留官方 launch token 登录**。 diff --git a/client.js b/client.js index 15349c8..ec6cfaf 100644 --- a/client.js +++ b/client.js @@ -1,10 +1,10 @@ /** - * @sutong/dsh-lan-access — browser half (generated by scripts/build-client.mjs). + * @wishesl/dsh-lan-access — browser half (generated by scripts/build-client.mjs). * * Do not edit this file: change src/panel.js or src/qrcode.js and rebuild. */ window.__ModuleLoader__.load({ - id: "@sutong/dsh-lan-access", + id: "@wishesl/dsh-lan-access", factory: function (require) { "use strict"; var React = require("react"); @@ -23,7 +23,7 @@ window.__ModuleLoader__.load({ * Verified against the reference `qrcode` npm package: `node scripts/test-qr.mjs` * compares every module of every version and mask. * - * @module @sutong/dsh-lan-access/qrcode + * @module @wishesl/dsh-lan-access/qrcode */ /** Error-correction level indicator bits (`M` = 0b00) and the format-info prefix. */ @@ -510,14 +510,14 @@ window.__ModuleLoader__.load({ // ── inlined src/panel.js ───────────────────────────────────────────────── /** - * Client half of @sutong/dsh-lan-access: a Plugins-settings tab that shows the - * LAN addresses the host listener publishes, with a scannable QR code for the + * Client half of @wishesl/dsh-lan-access: its own Settings page showing the LAN + * addresses the host listener publishes, with a scannable QR code for the * address you pick. * * This file is bundled into the single browser artifact `client.js` by * `scripts/build-client.mjs`; it is never loaded directly by the browser. * - * @module @sutong/dsh-lan-access/panel + * @module @wishesl/dsh-lan-access/panel */ diff --git a/cordis.patch.yml b/cordis.patch.yml index 750bce4..39754a3 100644 --- a/cordis.patch.yml +++ b/cordis.patch.yml @@ -1,4 +1,4 @@ -# @sutong/dsh-lan-access — bundle patch. +# @wishesl/dsh-lan-access — bundle patch. # # The LAN listener itself overrides no shipped row: it is a separate socket that # forwards to the loopback web server, so the official webserver bind, the @@ -12,7 +12,7 @@ # An ordinary Cordis plugin activated by package name. - insert: - id: dsh-lan-access - name: '@sutong/dsh-lan-access' + name: '@wishesl/dsh-lan-access' config: # The official client derives its `isLoopback` topology fact from # `location.hostname`, and the durable settings surface is loopback-only diff --git a/index.js b/index.js index f46d250..4e5be4c 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ /** - * @sutong/dsh-lan-access — host half. + * @wishesl/dsh-lan-access — host half. * * Publishes the loopback dsh Web UI on the LAN through a standalone reverse * proxy. `dsh web --host 0.0.0.0` is refused by the shipped CLI on purpose @@ -8,7 +8,7 @@ * it. The official browser-trust fence and the launch-token login stay in * force; nothing about the composed application is overridden. * - * @module @sutong/dsh-lan-access + * @module @wishesl/dsh-lan-access */ import { createServer, request as httpRequest } from 'node:http' diff --git a/package.json b/package.json index 735183b..bb1b575 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@sutong/dsh-lan-access", + "name": "@wishesl/dsh-lan-access", "version": "0.1.0", "description": "Expose the dsh Web UI on the LAN through a standalone reverse proxy that preserves the official launch token — HTTP and WebSocket forwarding, no Host rewrite of your trust boundary.", "type": "module", diff --git a/scripts/build-client.mjs b/scripts/build-client.mjs index 6edfdb1..99869b5 100644 --- a/scripts/build-client.mjs +++ b/scripts/build-client.mjs @@ -17,6 +17,9 @@ import { fileURLToPath } from 'node:url' const here = dirname(fileURLToPath(import.meta.url)) const root = join(here, '..') +/** The browser module id must equal the package name; read it, never restate it. */ +const packageName = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).name + /** Read a source file and turn its ESM exports into plain declarations. */ function inline(relativePath) { const source = readFileSync(join(root, relativePath), 'utf8') @@ -30,12 +33,12 @@ const qrcode = inline('src/qrcode.js') const panel = inline('src/panel.js') const artifact = `/** - * @sutong/dsh-lan-access — browser half (generated by scripts/build-client.mjs). + * ${packageName} — browser half (generated by scripts/build-client.mjs). * * Do not edit this file: change src/panel.js or src/qrcode.js and rebuild. */ window.__ModuleLoader__.load({ - id: "@sutong/dsh-lan-access", + id: ${JSON.stringify(packageName)}, factory: function (require) { "use strict"; var React = require("react"); diff --git a/scripts/test-client.mjs b/scripts/test-client.mjs index 9c0c0fd..47aa4b2 100644 --- a/scripts/test-client.mjs +++ b/scripts/test-client.mjs @@ -17,6 +17,7 @@ import { SUMMARY_PATH } from '../index.js' const root = join(dirname(fileURLToPath(import.meta.url)), '..') const source = readFileSync(join(root, 'client.js'), 'utf8') +const packageName = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).name const results = [] function check(label, condition, detail) { @@ -37,7 +38,7 @@ vm.createContext(sandbox) vm.runInContext(source, sandbox) check('artifact registers exactly once', captured !== undefined) -check('module id equals the package name', captured?.id === '@sutong/dsh-lan-access', captured?.id) +check('module id equals the package name', captured?.id === packageName, captured?.id) check('factory is a function', typeof captured?.factory === 'function') // ── stub React ────────────────────────────────────────────────────────────── diff --git a/src/panel.js b/src/panel.js index e84b2d8..5e93d90 100644 --- a/src/panel.js +++ b/src/panel.js @@ -1,12 +1,12 @@ /** - * Client half of @sutong/dsh-lan-access: a Plugins-settings tab that shows the - * LAN addresses the host listener publishes, with a scannable QR code for the + * Client half of @wishesl/dsh-lan-access: its own Settings page showing the LAN + * addresses the host listener publishes, with a scannable QR code for the * address you pick. * * This file is bundled into the single browser artifact `client.js` by * `scripts/build-client.mjs`; it is never loaded directly by the browser. * - * @module @sutong/dsh-lan-access/panel + * @module @wishesl/dsh-lan-access/panel */ import { encodeQR } from './qrcode.js' diff --git a/src/qrcode.js b/src/qrcode.js index 28734de..6bc8545 100644 --- a/src/qrcode.js +++ b/src/qrcode.js @@ -10,7 +10,7 @@ * Verified against the reference `qrcode` npm package: `node scripts/test-qr.mjs` * compares every module of every version and mask. * - * @module @sutong/dsh-lan-access/qrcode + * @module @wishesl/dsh-lan-access/qrcode */ /** Error-correction level indicator bits (`M` = 0b00) and the format-info prefix. */