omo-web 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/launcher-settings.js +0 -1
- package/bin/omo-web.js +2 -2
- package/bin/tui.js +0 -3
- package/dist/server.js +15 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ omo-web
|
|
|
15
15
|
|
|
16
16
|
Open the printed URL (normally `http://127.0.0.1:4317`). The local browser connects to OmO on the host. `omo-web --help` lists startup commands.
|
|
17
17
|
|
|
18
|
-
In an interactive terminal, `omo-web` opens a keyboard-driven launcher. Use ↑/↓ and Enter to choose working directories or open **Access settings**. There you can change or disable the password, toggle HTTPS, generate a self-signed certificate (requires OpenSSL 1.1.1+ on `PATH`), bind to an IPv4 interface, or set the HTTPS origin of a reverse proxy. Changes apply on the next start.
|
|
18
|
+
In an interactive terminal, `omo-web` opens a keyboard-driven launcher. Use ↑/↓ and Enter to choose working directories or open **Access settings**. There you can change or disable the password, toggle HTTPS, generate a self-signed certificate (requires OpenSSL 1.1.1+ on `PATH`), bind to an IPv4 interface, or set the HTTPS origin of a reverse proxy. Changes apply on the next start. Remote HTTP shows a warning. Passwordless remote access needs confirmation. The browser sign-in page asks only for the password.
|
|
19
19
|
|
|
20
20
|
For a local proxy or tunnel that handles HTTPS, keep the default upstream `http://127.0.0.1:4317`, preserve the original `Host`, and set the exact public origin (for example `https://web.example.com`) in **Proxy origin** or `OMO_WEB_PROXY_ORIGIN`.
|
|
21
21
|
|
package/bin/launcher-settings.js
CHANGED
|
@@ -84,7 +84,6 @@ export async function loadLauncherSettings(base) {
|
|
|
84
84
|
|
|
85
85
|
return {
|
|
86
86
|
directory, warning, prepare, save, effectiveEnv,
|
|
87
|
-
get hasListenerOverride() { return overrides.OMO_WEB_HOST !== undefined || overrides.httpsEnabled !== undefined; },
|
|
88
87
|
async changePassword(password) {
|
|
89
88
|
await prepare();
|
|
90
89
|
const path = join(directory, "password.txt");
|
package/bin/omo-web.js
CHANGED
|
@@ -28,8 +28,8 @@ ${cliTr("在「访问设置」中选择网卡、设置密码和生成 SSL 自签
|
|
|
28
28
|
"Use Access settings in the launcher to choose an interface, set a password, or generate an SSL certificate.")}
|
|
29
29
|
${cliTr("内网穿透或反代可设置 OMO_WEB_PROXY_ORIGIN;代理需保留浏览器的 Host。",
|
|
30
30
|
"Set OMO_WEB_PROXY_ORIGIN for a tunnel or reverse proxy. Preserve the browser's Host.")}
|
|
31
|
-
${cliTr("
|
|
32
|
-
"
|
|
31
|
+
${cliTr("HTTPS 可关闭;远程使用明文 HTTP 时会提示。",
|
|
32
|
+
"HTTPS is optional. Remote plaintext HTTP shows a warning.")}
|
|
33
33
|
${cliTr("仅在受限私网或 VPN 使用无密码模式;脚本需显式设置 OMO_WEB_ALLOW_UNAUTHENTICATED=1。",
|
|
34
34
|
"Use password-free access only on a restricted private network or VPN. Scripts must set OMO_WEB_ALLOW_UNAUTHENTICATED=1.")}
|
|
35
35
|
https://github.com/NekoCCN/OmO-Web/blob/main/docs/usage.md`);
|
package/bin/tui.js
CHANGED
|
@@ -514,9 +514,6 @@ export async function startTui({ entry, version }) {
|
|
|
514
514
|
function requestStart() {
|
|
515
515
|
if (settings.warning) {
|
|
516
516
|
notice = settings.warning;
|
|
517
|
-
} else if (settings.hasListenerOverride && isRemoteAddress(address()) && !hasHttps()) {
|
|
518
|
-
notice = cliTr("非本机监听必须启用 HTTPS。请在访问设置中启用或生成证书。",
|
|
519
|
-
"Remote listening requires HTTPS. Enable it or generate a certificate in Access settings.");
|
|
520
517
|
} else if (unprotected() && !optedIn()) {
|
|
521
518
|
phase = "confirming";
|
|
522
519
|
selected = 0;
|
package/dist/server.js
CHANGED
|
@@ -14910,7 +14910,6 @@ function readWindowsPasswordFile(path) {
|
|
|
14910
14910
|
var headers = {
|
|
14911
14911
|
"Cache-Control": "no-store",
|
|
14912
14912
|
"Content-Security-Policy": "default-src 'none'; script-src 'self'; style-src 'self' 'sha256-PRkCmUvPlOG4zuGb5RMOg4JNxOnUv7s4ZwOqAp874Fw='; img-src 'self' data: blob:; connect-src 'self'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'",
|
|
14913
|
-
"Cross-Origin-Resource-Policy": "same-origin",
|
|
14914
14913
|
"Referrer-Policy": "no-referrer",
|
|
14915
14914
|
"X-Content-Type-Options": "nosniff",
|
|
14916
14915
|
"X-Frame-Options": "DENY",
|
|
@@ -15080,7 +15079,7 @@ async function loadWebAccess(env, port) {
|
|
|
15080
15079
|
}
|
|
15081
15080
|
let origin;
|
|
15082
15081
|
let tls;
|
|
15083
|
-
if (
|
|
15082
|
+
if (originSetting !== undefined || certFile !== undefined || keyFile !== undefined) {
|
|
15084
15083
|
if (port === 0)
|
|
15085
15084
|
throw new WebAccessConfigError("OMO_WEB_PORT", cliTr("HTTPS \u76D1\u542C\u9700\u8981\u56FA\u5B9A\u7684\u975E\u96F6\u7AEF\u53E3\u3002", "HTTPS requires a fixed, nonzero port."));
|
|
15086
15085
|
const url = originSetting === undefined ? null : URL.parse(originSetting);
|
|
@@ -15116,14 +15115,17 @@ async function loadWebAccess(env, port) {
|
|
|
15116
15115
|
disconnect();
|
|
15117
15116
|
}
|
|
15118
15117
|
function requestAuthority(request, expected) {
|
|
15119
|
-
const requestOrigin = request.headers.get("Origin");
|
|
15120
15118
|
const authority = request.headers.get("Host");
|
|
15121
|
-
|
|
15122
|
-
|
|
15123
|
-
if (
|
|
15124
|
-
|
|
15119
|
+
if (authority === expected.host)
|
|
15120
|
+
return expected;
|
|
15121
|
+
if (proxyOrigin && authority === proxyOrigin.host)
|
|
15122
|
+
return proxyOrigin;
|
|
15123
|
+
if (publicBinding && !tls && authority) {
|
|
15124
|
+
const target = URL.parse(`http://${authority}`);
|
|
15125
|
+
if (target && target.host === authority && target.port === expected.port)
|
|
15126
|
+
return target;
|
|
15125
15127
|
}
|
|
15126
|
-
|
|
15128
|
+
throw new WebError(403, "origin_refused", "\u8BF7\u6C42\u7684 Host \u4E0E\u76D1\u542C\u5730\u5740\u4E0D\u5339\u914D\u3002");
|
|
15127
15129
|
}
|
|
15128
15130
|
function findCookie(request, authority) {
|
|
15129
15131
|
const prefix = `${cookieName(authority)}=`;
|
|
@@ -15145,7 +15147,7 @@ async function loadWebAccess(env, port) {
|
|
|
15145
15147
|
function checkWrite(request, token) {
|
|
15146
15148
|
const provided = request.headers.get("X-OmO-Token") ?? "";
|
|
15147
15149
|
const bytes = provided.length === token.length ? Buffer.from(provided) : undefined;
|
|
15148
|
-
if (
|
|
15150
|
+
if (bytes?.length !== token.length || !timingSafeEqual4(bytes, token)) {
|
|
15149
15151
|
throw new WebError(403, "token_refused", "\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5\u3002");
|
|
15150
15152
|
}
|
|
15151
15153
|
}
|
|
@@ -15156,14 +15158,13 @@ async function loadWebAccess(env, port) {
|
|
|
15156
15158
|
hostname: host,
|
|
15157
15159
|
origin,
|
|
15158
15160
|
tls,
|
|
15161
|
+
remotePlaintext: publicBinding && !tls,
|
|
15159
15162
|
unprotected,
|
|
15160
15163
|
weakPassword,
|
|
15161
15164
|
proxyOrigin,
|
|
15162
15165
|
protected: digest !== undefined,
|
|
15163
15166
|
requestAuthority,
|
|
15164
15167
|
async login(request, authority, address) {
|
|
15165
|
-
if (!request.headers.has("Origin"))
|
|
15166
|
-
throw new WebError(403, "origin_refused", "\u53EA\u63A5\u53D7\u540C\u6E90\u8BF7\u6C42\u3002");
|
|
15167
15168
|
const form = await loginFields(request);
|
|
15168
15169
|
const retryAfter = limiter.check(address);
|
|
15169
15170
|
if (retryAfter !== undefined)
|
|
@@ -15938,6 +15939,7 @@ data: {}
|
|
|
15938
15939
|
url: new URL(url),
|
|
15939
15940
|
unprotected: access.unprotected,
|
|
15940
15941
|
weakPassword: access.weakPassword,
|
|
15942
|
+
remotePlaintext: access.remotePlaintext,
|
|
15941
15943
|
proxyOrigin: access.proxyOrigin?.origin,
|
|
15942
15944
|
fetch,
|
|
15943
15945
|
stop() {
|
|
@@ -16000,6 +16002,8 @@ if (app.unprotected)
|
|
|
16000
16002
|
console.warn(cliTr("\u8B66\u544A\uFF1A\u975E\u672C\u673A\u5165\u53E3\u672A\u8BBE\u5BC6\u7801\u3002\u80FD\u8BBF\u95EE\u6B64\u5730\u5740\u7684\u4EBA\u90FD\u80FD\u8BFB\u53D6\u4F1A\u8BDD\u5E76\u901A\u8FC7 OmO \u64CD\u4F5C\u672C\u673A\u3002\u4EC5\u5728\u53D7\u9650\u79C1\u7F51\u6216 VPN \u5185\u4F7F\u7528\u3002", "Warning: remote access without a password. Anyone who can reach this address can read sessions and run tools through OmO. Use only on a restricted private network or VPN."));
|
|
16001
16003
|
if (app.weakPassword)
|
|
16002
16004
|
console.warn(cliTr("OmO Web warning: \u5BC6\u7801\u8F83\u77ED\uFF0C\u5EFA\u8BAE\u4F7F\u7528\u81F3\u5C11 20 \u4E2A\u5B57\u7B26\u3002", "OmO Web warning: short password. Use at least 20 characters for better protection."));
|
|
16005
|
+
if (app.remotePlaintext)
|
|
16006
|
+
console.warn(cliTr("OmO Web warning: HTTPS \u5DF2\u5173\u95ED\uFF0C\u8FDC\u7A0B\u8FDE\u63A5\u4F7F\u7528\u660E\u6587 HTTP\u3002", "OmO Web warning: HTTPS is off. Remote connections use plain HTTP."));
|
|
16003
16007
|
console.log(`OmO Web: ${app.url.href}`);
|
|
16004
16008
|
if (app.proxyOrigin)
|
|
16005
16009
|
console.log(`${cliTr("\u4EE3\u7406\u5165\u53E3", "Proxy origin")}: ${app.proxyOrigin}`);
|
package/package.json
CHANGED