dsh-mobile 0.8.6 → 0.8.7
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/CHANGELOG.md +20 -2
- package/CONTRIBUTORS.md +7 -1
- package/README.en.md +19 -14
- package/README.md +15 -12
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/apps/mobile/README.md +13 -7
- package/apps/mobile/README.zh-CN.md +13 -7
- package/apps/mobile/release.json +3 -3
- package/assets/brand/plugin-icon.png +0 -0
- package/docs/ATTACH_EXISTING_FRPS.en.md +2 -2
- package/docs/CPOLAR_SUBDOMAIN.en.md +1 -1
- package/docs/CPOLAR_SUBDOMAIN.md +1 -1
- package/docs/IROH.en.md +5 -5
- package/docs/IROH.md +6 -6
- package/docs/MOBILE_COMPOSER_TOOLBAR.en.md +2 -2
- package/docs/MOBILE_COMPOSER_TOOLBAR.md +2 -2
- package/docs/MOBILE_PLUGIN_ADAPTATION.en.md +9 -0
- package/docs/MOBILE_PLUGIN_ADAPTATION.md +9 -0
- package/docs/MOBILE_PLUGIN_BASELINE.en.md +1 -1
- package/docs/MOBILE_PLUGIN_BASELINE.md +1 -1
- package/docs/WEB_PUSH.en.md +2 -2
- package/docs/WEB_PUSH.md +2 -2
- package/index.mjs +6 -0
- package/lib/client.js +203 -6
- package/lib/client.js.map +1 -1
- package/lib/index.mjs +31 -4
- package/lib/index.mjs.map +1 -1
- package/lib/mobile-layout.js +177 -0
- package/lib/mobile-layout.js.map +1 -1
- package/native/iroh-host/README.md +10 -4
- package/package.json +8 -4
- package/packages/question-fixes/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -2156,6 +2156,8 @@ function requestPathCategory(path) {
|
|
|
2156
2156
|
case "/mobile-access/events": return path;
|
|
2157
2157
|
default:
|
|
2158
2158
|
if (path.startsWith("/api/")) return "/api/*";
|
|
2159
|
+
if (path.startsWith("/plugins/")) return "/plugins/*";
|
|
2160
|
+
if (path.startsWith("/assets/")) return "/assets/*";
|
|
2159
2161
|
if (path.startsWith("/mobile-access/extensions/")) return "/mobile-access/extensions/*";
|
|
2160
2162
|
if (/^\/mobile-access\/compat-[a-f\d]{64}\.js$/u.test(path)) return "/mobile-access/compat.js";
|
|
2161
2163
|
if (path.startsWith("/mobile-access/")) return "/mobile-access/*";
|
|
@@ -3278,7 +3280,7 @@ function forwardableClose(code) {
|
|
|
3278
3280
|
* @param upstreamCookie - gateway's signed upstream cookie; browser cookies are discarded.
|
|
3279
3281
|
* @param options - resolved message, queue, and compression limits.
|
|
3280
3282
|
* @param handshakeTimeoutMs - maximum handshake and close-handshake duration.
|
|
3281
|
-
* @returns
|
|
3283
|
+
* @returns the close handle after both HTTP upgrades are accepted, or rejection before acceptance.
|
|
3282
3284
|
*/
|
|
3283
3285
|
function bridgeCompressedWebSocket(request, client, upstream, head, target, upstreamCookie, options, handshakeTimeoutMs) {
|
|
3284
3286
|
return new Promise((resolve, reject) => {
|
|
@@ -3467,7 +3469,7 @@ function bridgeCompressedWebSocket(request, client, upstream, head, target, upst
|
|
|
3467
3469
|
accepted = true;
|
|
3468
3470
|
clearTimeout(handshakeTimer);
|
|
3469
3471
|
incoming.resume();
|
|
3470
|
-
resolve();
|
|
3472
|
+
resolve({ close: beginClose });
|
|
3471
3473
|
});
|
|
3472
3474
|
} catch (error) {
|
|
3473
3475
|
stop(error instanceof Error ? error : /* @__PURE__ */ new Error("Client WebSocket upgrade failed"));
|
|
@@ -9623,9 +9625,31 @@ var MobileAccessGateway = class {
|
|
|
9623
9625
|
client.destroy();
|
|
9624
9626
|
upstream.destroy();
|
|
9625
9627
|
};
|
|
9628
|
+
let closeCompressedBridge;
|
|
9629
|
+
const finishGracefully = () => {
|
|
9630
|
+
if (closeCompressedBridge !== void 0) closeCompressedBridge(1e3, "session expired");
|
|
9631
|
+
else {
|
|
9632
|
+
upstream.unpipe(client);
|
|
9633
|
+
client.unpipe(upstream);
|
|
9634
|
+
upstream.pause();
|
|
9635
|
+
const sendCloseFrame = (socket) => {
|
|
9636
|
+
if (socket.destroyed || !socket.writable) return;
|
|
9637
|
+
try {
|
|
9638
|
+
socket.write(Buffer.from([
|
|
9639
|
+
136,
|
|
9640
|
+
2,
|
|
9641
|
+
3,
|
|
9642
|
+
232
|
|
9643
|
+
]));
|
|
9644
|
+
} catch {}
|
|
9645
|
+
};
|
|
9646
|
+
sendCloseFrame(client);
|
|
9647
|
+
}
|
|
9648
|
+
setTimeout(closeBoth, 50).unref();
|
|
9649
|
+
};
|
|
9626
9650
|
client.on("error", closeBoth);
|
|
9627
9651
|
upstream.on("error", closeBoth);
|
|
9628
|
-
const timer = setTimeout(
|
|
9652
|
+
const timer = setTimeout(finishGracefully, Math.max(1, authorization.expiresAt - Date.now()));
|
|
9629
9653
|
timer.unref();
|
|
9630
9654
|
const record = Object.freeze({
|
|
9631
9655
|
...authorization,
|
|
@@ -9654,7 +9678,10 @@ var MobileAccessGateway = class {
|
|
|
9654
9678
|
const compressionTarget = new URL(this.config.upstreamOrigin.href);
|
|
9655
9679
|
compressionTarget.pathname = target.pathname;
|
|
9656
9680
|
compressionTarget.search = target.search;
|
|
9657
|
-
await bridgeCompressedWebSocket(request, client, upstream, head, compressionTarget, upstreamCookie, this.config.websocketCompression, this.config.upstreamTimeoutMs);
|
|
9681
|
+
const bridge = await bridgeCompressedWebSocket(request, client, upstream, head, compressionTarget, upstreamCookie, this.config.websocketCompression, this.config.upstreamTimeoutMs);
|
|
9682
|
+
closeCompressedBridge = (code, reason) => {
|
|
9683
|
+
bridge.close(code, reason);
|
|
9684
|
+
};
|
|
9658
9685
|
return;
|
|
9659
9686
|
}
|
|
9660
9687
|
await new Promise((resolve, reject) => {
|