Compare commits
9
Commits
ae871a2647
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c47047ddd | ||
|
|
1b2696b6b4 | ||
|
|
ac4d496a48 | ||
|
|
44a8a72261 | ||
|
|
870d55b44f | ||
|
|
af0a8c9fee | ||
|
|
7f4811485a | ||
|
|
b102e55495 | ||
|
|
ae1e3bef9b |
No files matched your search
@@ -14,6 +14,10 @@ size limit: the file goes directly to the other person and is never stored on a
|
|||||||
Keep both tabs open until the transfer is finished. Starting something new in a tab ends what that
|
Keep both tabs open until the transfer is finished. Starting something new in a tab ends what that
|
||||||
tab was doing.
|
tab was doing.
|
||||||
|
|
||||||
|
Both sides need the same protocol, shown at the bottom of the page. A HellCon hosted elsewhere may
|
||||||
|
run another one, the receiver then finds no sender, or with **Manual** says the sender runs another
|
||||||
|
protocol.
|
||||||
|
|
||||||
### Without a tracker
|
### Without a tracker
|
||||||
|
|
||||||
If you'd rather not use a tracker, open **Manual** on both sides. The sender creates an offer, a
|
If you'd rather not use a tracker, open **Manual** on both sides. The sender creates an offer, a
|
||||||
@@ -32,15 +36,15 @@ to the encryption keys of this very connection. Someone in between, or anyone el
|
|||||||
know the code, can't do that, and HellCon drops the connection and waits for the right one.
|
know the code, can't do that, and HellCon drops the connection and waits for the right one.
|
||||||
|
|
||||||
The manual exchange has no code, so there you compare yourselves. Once connected, both sides see two
|
The manual exchange has no code, so there you compare yourselves. Once connected, both sides see two
|
||||||
short codes: **You** and **Peer**. Compare them with the other person over a channel you already
|
codes: **You** and **Peer**. Compare them with the other person over a channel you already trust,
|
||||||
trust, ideally a call or in person:
|
ideally a call or in person:
|
||||||
|
|
||||||
- your **You** must be their **Peer**, and
|
- your **You** must be their **Peer**, and
|
||||||
- your **Peer** must be their **You**.
|
- your **Peer** must be their **You**.
|
||||||
|
|
||||||
If both match, you are connected directly to each other. If they don't, someone has placed
|
If both match, you are connected directly to each other. If they don't, someone has placed
|
||||||
themselves in between: click **Codes don't match** and nothing is sent. Nothing is transferred before
|
themselves in between: click **Codes don't match** and nothing is sent. Nothing is transferred before
|
||||||
both sides confirmed, so take the few seconds to really compare them.
|
both sides confirmed, so take the time to compare every character, not just the start and end.
|
||||||
|
|
||||||
The codes are taken from the encryption keys of the connection. Someone in between would need their
|
The codes are taken from the encryption keys of the connection. Someone in between would need their
|
||||||
own keys, which show up as different codes.
|
own keys, which show up as different codes.
|
||||||
@@ -63,8 +67,11 @@ On the receiving side, HellCon hands the incoming data to the browser's own down
|
|||||||
it arrives. That's why files larger than your memory work too, and why the download shows up in
|
it arrives. That's why files larger than your memory work too, and why the download shows up in
|
||||||
your browser's download list.
|
your browser's download list.
|
||||||
|
|
||||||
There is no relay server. If both sides are behind very strict networks, e.g. some company or mobile
|
HellCon uses no relay server. If both sides are behind very strict networks, e.g. some company or
|
||||||
networks, a direct connection may not be possible.
|
mobile networks, a direct connection may not be possible. And a connection that works isn't
|
||||||
|
necessarily direct: the other side may name a relay of its own, and a STUN server that reports a
|
||||||
|
wrong address can put itself in between. Either only passes on encrypted data. The security check
|
||||||
|
makes sure the connection ends at the two of you.
|
||||||
|
|
||||||
## Privacy
|
## Privacy
|
||||||
|
|
||||||
@@ -73,7 +80,9 @@ networks, a direct connection may not be possible.
|
|||||||
few trackers see it too, from the request itself. HellCon tries the STUN servers in order and
|
few trackers see it too, from the request itself. HellCon tries the STUN servers in order and
|
||||||
sticks with the first that answers. The sender stays on the first tracker that accepts it. The
|
sticks with the first that answers. The sender stays on the first tracker that accepts it. The
|
||||||
receiver goes down the list until it finds the sender, and the trackers it passes keep its
|
receiver goes down the list until it finds the sender, and the trackers it passes keep its
|
||||||
encrypted offer. Nobody without the code learns your address through a tracker.
|
encrypted offer. Nobody without the code learns your address through a tracker. The tracker the
|
||||||
|
two of you meet on does see which addresses share with each other, and when. If that matters,
|
||||||
|
use your own tracker and STUN server, or the manual exchange.
|
||||||
- Nothing is kept: every reload starts with the default settings.
|
- Nothing is kept: every reload starts with the default settings.
|
||||||
- Whoever hosts HellCon serves the code that runs in your browser. If you'd rather not trust that,
|
- Whoever hosts HellCon serves the code that runs in your browser. If you'd rather not trust that,
|
||||||
host your own (below).
|
host your own (below).
|
||||||
@@ -109,18 +118,56 @@ Then serve the `dist/` folder, with these requirements:
|
|||||||
- **HTTPS.** Browsers only allow the parts HellCon needs on secure pages (`localhost` is fine for
|
- **HTTPS.** Browsers only allow the parts HellCon needs on secure pages (`localhost` is fine for
|
||||||
trying it out).
|
trying it out).
|
||||||
- **`sw.js` next to `index.html`.** It streams the downloads. Requests to the `download/` path below
|
- **`sw.js` next to `index.html`.** It streams the downloads. Requests to the `download/` path below
|
||||||
HellCon must reach it unchanged, so don't rewrite them to `index.html`.
|
HellCon must reach it unchanged, so don't rewrite them to `index.html`. Any path works, e.g.
|
||||||
|
`https://example.org/hellcon/`, with the trailing slash: the page links its files relative to it,
|
||||||
|
so redirect `/hellcon` there.
|
||||||
|
|
||||||
|
Recommended, as response headers, a `<meta>` can't set them (`index.html` sets
|
||||||
|
`Referrer-Policy: no-referrer` and the rest of its Content-Security-Policy itself, which keeps out
|
||||||
|
scripts and styles from elsewhere but allows connections to any tracker):
|
||||||
|
|
||||||
|
```
|
||||||
|
Content-Security-Policy: frame-ancestors 'none'
|
||||||
|
X-Frame-Options: DENY
|
||||||
|
X-Content-Type-Options: nosniff
|
||||||
|
```
|
||||||
|
|
||||||
|
The first two keep other sites from framing HellCon and laying their own page over its buttons,
|
||||||
|
`X-Frame-Options` for older browsers.
|
||||||
|
|
||||||
Your own tracker and STUN server are optional, any public ones work. `backend/` has both as Docker
|
Your own tracker and STUN server are optional, any public ones work. `backend/` has both as Docker
|
||||||
Compose services: a tracker that only does what HellCon needs, with an Origin allowlist and limits,
|
Compose services: a tracker that only does what HellCon needs, with an Origin allowlist and limits,
|
||||||
and coturn as STUN server. `backend/compose.yaml` says how to set them up.
|
and coturn as STUN server. `backend/compose.yaml` says how to set them up.
|
||||||
|
|
||||||
|
If you change how HellCon talks to the other side, e.g. the code, the encryption or the messages,
|
||||||
|
give `PROTOCOL` in `src/core.ts` a name of your own, e.g. `yourname/1`, and count up from there.
|
||||||
|
|
||||||
|
## Not planned
|
||||||
|
|
||||||
|
These were considered and decided against, please don't ask for them without a new reason. HellCon
|
||||||
|
is copy and paste a code, with public trackers and STUN servers. Anything that puts state in the URL,
|
||||||
|
needs infrastructure of its own or only helps small files doesn't pay off.
|
||||||
|
|
||||||
|
- **The code in a share link:** the code would end up in the browser history and wherever links get
|
||||||
|
handled, for one click less.
|
||||||
|
- **Another code alphabet,** e.g. one that ignores case or uses words: most people copy and paste
|
||||||
|
the code anyway.
|
||||||
|
- **Saving without the service worker,** holding the file in memory instead: useless for files of
|
||||||
|
several GB.
|
||||||
|
- **TURN servers or a relay-only mode:** too much infrastructure to host and test.
|
||||||
|
- **A longer or extendable share,** **several files as a zip,** and **resuming in Chromium:** not
|
||||||
|
for now.
|
||||||
|
- **Keeping a phone sending in the background,** e.g. with a silent audio loop: the sender's page
|
||||||
|
has to stay in front.
|
||||||
|
|
||||||
## Known limitations
|
## Known limitations
|
||||||
|
|
||||||
- **Firefox:** if the sender disappears in the middle of a transfer, HellCon reports the failure,
|
- **Firefox:** if the sender disappears in the middle of a transfer, HellCon reports the failure,
|
||||||
but Firefox keeps showing the download as in progress until you cancel it.
|
but Firefox keeps showing the download as in progress until you cancel it.
|
||||||
- **Chromium:** notices a vanished sender only after about 16 seconds.
|
- **Chromium:** notices a vanished sender only after about 16 seconds.
|
||||||
- An interrupted transfer can't be resumed, it starts over.
|
- An interrupted transfer can't be resumed, it starts over.
|
||||||
|
- **Phones:** the sender's page has to stay in front, the connection is lost once it goes to the
|
||||||
|
background. Receiving keeps going.
|
||||||
- Private windows may not allow the background part that saves downloads. Receiving then doesn't
|
- Private windows may not allow the background part that saves downloads. Receiving then doesn't
|
||||||
work, and HellCon tells you so.
|
work, and HellCon tells you so.
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,18 @@
|
|||||||
own salt too. Open which ones to keep, and how a kept one that differs from the other side's would
|
own salt too. Open which ones to keep, and how a kept one that differs from the other side's would
|
||||||
show, instead of silently breaking a share.
|
show, instead of silently breaking a share.
|
||||||
|
|
||||||
- Version the protocol for 1.0: put a version into the key derivation, e.g. `hellcon/1 <salt>` as
|
- Revisit the screen wake lock: a browser that keeps refusing it (e.g. in a power saving mode) logs
|
||||||
the PBKDF2 salt in `secrets`. Until then any change to it silently breaks sharing between
|
"screen may lock" each time the page is visible again, open whether once per session is enough.
|
||||||
deployments on different versions, the receiver only sees "No sender with this code". Open how a
|
`awake: …` doesn't cover a session that ends in an error, nor one that ends while a request is
|
||||||
mismatch would be reported, e.g. by trying the previous version's swarm too.
|
still pending, the case the `wakeLock === request` checks in `holdWakeLock` are for.
|
||||||
|
|
||||||
## Open observations
|
## Open observations
|
||||||
|
|
||||||
|
- A phone can't send in the background: with Brave on Android (Pixel), the connection is lost as
|
||||||
|
soon as the sender's page goes to the background. Receiving survives it, likely because the
|
||||||
|
browser's download manager runs as a foreground service while the file streams into it. The wake
|
||||||
|
lock only keeps the screen from timing out, the sender's page has to stay in front.
|
||||||
|
|
||||||
- Firefox ignores an errored service worker response stream: when the sender vanishes, the receiver
|
- Firefox ignores an errored service worker response stream: when the sender vanishes, the receiver
|
||||||
logs "download failed: connection lost", but the download stays "in progress" until the user
|
logs "download failed: connection lost", but the download stays "in progress" until the user
|
||||||
cancels it. Closing the stream instead is worse, Firefox then reports the truncated file as
|
cancels it. Closing the stream instead is worse, Firefox then reports the truncated file as
|
||||||
|
|||||||
@@ -7,3 +7,8 @@ ORIGINS=https://hellcon.example.org
|
|||||||
|
|
||||||
# The external network Caddy is on, "caddy" if unset.
|
# The external network Caddy is on, "caddy" if unset.
|
||||||
#CADDY_NETWORK=caddy
|
#CADDY_NETWORK=caddy
|
||||||
|
|
||||||
|
# Whose X-Forwarded-For the tracker believes, addresses or CIDRs separated by commas or spaces. Every
|
||||||
|
# private range if unset, see compose.yaml. Narrow it to Caddy's address in CADDY_NETWORK, but keep it
|
||||||
|
# covered: otherwise all clients count as Caddy's and share its limits, nearly all are refused.
|
||||||
|
#PROXIES=172.16.0.0/12 192.168.0.0/16 10.0.0.0/8 fd00::/8
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
FROM node:26.12.1-alpine3.23
|
FROM node:26.13.1-alpine3.23
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN npm install --no-save --omit=dev ws@8.22.0
|
RUN npm install --no-save --omit=dev ws@8.23.0
|
||||||
COPY tracker.mjs .
|
COPY tracker.mjs .
|
||||||
USER node
|
USER node
|
||||||
CMD ["node", "--max-old-space-size=48", "tracker.mjs"]
|
CMD ["node", "--max-old-space-size=48", "tracker.mjs"]
|
||||||
@@ -18,6 +18,12 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
environment:
|
environment:
|
||||||
ORIGINS: ${ORIGINS:?set ORIGINS in .env to where HellCon is served from}
|
ORIGINS: ${ORIGINS:?set ORIGINS in .env to where HellCon is served from}
|
||||||
|
# Whose X-Forwarded-For the tracker believes, addresses or CIDRs, see clientIp in tracker.mjs.
|
||||||
|
# Caddy reaches it over the shared network, whose subnet is Docker's choice, so the default
|
||||||
|
# trusts every private range: nothing public should reach the tracker besides Caddy. Set
|
||||||
|
# PROXIES in .env to narrow it, e.g. to your Caddy's address in that network. If it doesn't
|
||||||
|
# cover Caddy's address, all clients count as Caddy's and share its limits, nearly all are refused.
|
||||||
|
PROXIES: ${PROXIES:-172.16.0.0/12 192.168.0.0/16 10.0.0.0/8 fd00::/8}
|
||||||
networks:
|
networks:
|
||||||
caddy:
|
caddy:
|
||||||
aliases: [hellcon-tracker]
|
aliases: [hellcon-tracker]
|
||||||
|
|||||||
+164
-17
@@ -1,8 +1,10 @@
|
|||||||
// HellCon's tracker: the part of the WebTorrent tracker protocol that HellCon uses, nothing more. A
|
// HellCon's tracker: the part of the WebTorrent tracker protocol that HellCon uses, nothing more. A
|
||||||
// connection is one peer in one swarm, bound by its first announce. A receiver's offer goes to one
|
// connection is one peer in one swarm, bound by its first announce. A receiver's offer goes to one
|
||||||
// sender in its swarm, the sender's answer only back to whoever sent the offer it got, once. Every
|
// sender in its swarm, the sender's answer only back to whoever sent the offer it got, once. Every
|
||||||
// forwarded message is built from the checked fields, nothing else passes through. Nothing is logged.
|
// forwarded message is built from the checked fields, nothing else passes through. Nothing is logged
|
||||||
|
// but one warning about PROXIES, without any address.
|
||||||
import { createServer } from 'node:http';
|
import { createServer } from 'node:http';
|
||||||
|
import { BlockList, isIP } from 'node:net';
|
||||||
import { WebSocketServer } from 'ws';
|
import { WebSocketServer } from 'ws';
|
||||||
|
|
||||||
// Read on import, 0 picks a free one, see server.address().
|
// Read on import, 0 picks a free one, see server.address().
|
||||||
@@ -24,12 +26,36 @@ const MAX_MESSAGE = 16 * 1024;
|
|||||||
const MAX_MESSAGES = 10;
|
const MAX_MESSAGES = 10;
|
||||||
const RATE_WINDOW = 10_000;
|
const RATE_WINDOW = 10_000;
|
||||||
const MAX_FORWARDED = 64 * 1024;
|
const MAX_FORWARDED = 64 * 1024;
|
||||||
|
// A positive number from the environment, read on every use like ORIGINS, so the spec can lower it
|
||||||
|
// to a testable moment. 0 or a typo would cut every connection short, the default stands then.
|
||||||
|
const fromEnv = (name, fallback) => {
|
||||||
|
const value = Number(process.env[name]);
|
||||||
|
return value > 0 ? value : fallback;
|
||||||
|
};
|
||||||
// Bytes waiting for a peer that doesn't read, once the kernel's buffers are full. Two sealed SDPs fit,
|
// Bytes waiting for a peer that doesn't read, once the kernel's buffers are full. Two sealed SDPs fit,
|
||||||
// a peer that reads never gets near it.
|
// a peer that reads never gets near it.
|
||||||
const MAX_QUEUED = 32 * 1024;
|
const MAX_QUEUED = 32 * 1024;
|
||||||
|
// The same for all peers together: MAX_QUEUED for each of MAX_CONNECTIONS would be 32 MiB against
|
||||||
|
// mem_limit. A quarter of them can still fill theirs.
|
||||||
|
const maxQueuedAll = () => fromEnv('MAX_QUEUED_ALL', 8 * 1024 * 1024);
|
||||||
const MAX_AGE = 7 * 60_000;
|
const MAX_AGE = 7 * 60_000;
|
||||||
|
// A connection that announced nothing by then only holds a slot: 1024 of them would serve nobody
|
||||||
|
// for MAX_AGE.
|
||||||
|
const maxSilent = () => fromEnv('MAX_SILENT', 30_000);
|
||||||
const MAX_CONNECTIONS = 1024;
|
const MAX_CONNECTIONS = 1024;
|
||||||
const MAX_PER_IP = 16;
|
const MAX_PER_IP = 16;
|
||||||
|
// Per address and window, across its connections: MAX_PER_IP is only at once, MAX_FORWARDED only one
|
||||||
|
// connection, so a client that reconnects would otherwise get a fresh allowance for each. The window
|
||||||
|
// is long enough for a search to walk the trackers and to reannounce, short enough to cap a relay.
|
||||||
|
// Relaying through many addresses, e.g. the /64s of one /48, is accepted: other WebTorrent trackers
|
||||||
|
// relay anything anyway, the caps only keep one address from using this one's bandwidth.
|
||||||
|
const maxConnectsPerIp = () => fromEnv('MAX_CONNECTS_PER_IP', 120);
|
||||||
|
const maxForwardedPerIp = () => fromEnv('MAX_FORWARDED_PER_IP', 1024 * 1024);
|
||||||
|
const IP_WINDOW = 60_000;
|
||||||
|
// A record without open connections lives until its window is over, a churning client could pile up
|
||||||
|
// many: past a few thousand, the oldest closed ones go. An address dropping out only forgets its
|
||||||
|
// rate, the concurrent limit still holds.
|
||||||
|
const maxIps = () => fromEnv('MAX_IPS', 4 * MAX_CONNECTIONS);
|
||||||
// A share has one sender, receivers keep one connection per tracker.
|
// A share has one sender, receivers keep one connection per tracker.
|
||||||
const MAX_SWARM = 8;
|
const MAX_SWARM = 8;
|
||||||
// Offers a sender got and may still answer, the oldest go first.
|
// Offers a sender got and may still answer, the oldest go first.
|
||||||
@@ -37,19 +63,51 @@ const MAX_PENDING = 32;
|
|||||||
|
|
||||||
// info_hash → peer_id → peer.
|
// info_hash → peer_id → peer.
|
||||||
const swarms = new Map();
|
const swarms = new Map();
|
||||||
|
// address → { open, connects, forwarded, since }, see usage.
|
||||||
const perIp = new Map();
|
const perIp = new Map();
|
||||||
let connections = 0;
|
let connections = 0;
|
||||||
|
// Peers that were sent something and may still have it queued, see fits.
|
||||||
|
const queued = new Set();
|
||||||
|
|
||||||
// info_hash, peer_id and offer_id are 20 byte binary strings.
|
// info_hash, peer_id and offer_id are 20 byte binary strings.
|
||||||
const isId = (value) => typeof value === 'string' && value.length === 20;
|
const isId = (value) => typeof value === 'string' && value.length === 20;
|
||||||
const isSdp = (value, type) => value?.type === type && typeof value.sdp === 'string';
|
const isSdp = (value, type) => value?.type === type && typeof value.sdp === 'string';
|
||||||
|
|
||||||
// Behind Caddy, the only way in. Caddy replaces any X-Forwarded-For a client sends, the last entry is
|
// Whose X-Forwarded-For to believe, PROXIES' addresses or CIDRs. Read on every connection, like
|
||||||
// its own anyway. IPv6 counts by /64: a single host usually has a whole one, every address in it
|
// ORIGINS. An entry that is none is left out, as is an empty prefix: it would be 0, all of IPv4.
|
||||||
// would get MAX_PER_IP of its own. IPv4, also mapped to IPv6, counts as it is.
|
function proxies() {
|
||||||
|
const list = new BlockList();
|
||||||
|
for (const entry of (process.env.PROXIES ?? '').split(/[\s,]+/).filter(Boolean)) {
|
||||||
|
const [base, prefix] = entry.split('/');
|
||||||
|
const type = { 4: 'ipv4', 6: 'ipv6' }[isIP(base)];
|
||||||
|
if (!type) continue;
|
||||||
|
if (prefix === undefined) list.addAddress(base, type);
|
||||||
|
else if (/^\d+$/.test(prefix) && prefix <= (type === 'ipv4' ? 32 : 128)) list.addSubnet(base, Number(prefix), type);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Once: behind a proxy PROXIES doesn't cover, every client counts as the proxy and shares its limits.
|
||||||
|
let warned = false;
|
||||||
|
|
||||||
|
// The client's address for the per-IP limits. A client that reaches the tracker directly names any
|
||||||
|
// address it likes in X-Forwarded-For, so without a listed proxy only the socket's own counts. Behind
|
||||||
|
// a listed proxy, like Caddy on the compose file's network, the last entry is the client's, whatever
|
||||||
|
// the client put before it. IPv6 counts by /64: a single host usually has a whole one, every address
|
||||||
|
// in it would get an allowance of its own. IPv4, also mapped to IPv6, counts as it is.
|
||||||
function clientIp(req) {
|
function clientIp(req) {
|
||||||
const ip = req.headers['x-forwarded-for']?.split(',').at(-1).trim() || req.socket.remoteAddress;
|
const peer = req.socket.remoteAddress;
|
||||||
if (!ip?.includes(':') || ip.includes('.')) return ip;
|
const header = req.headers['x-forwarded-for'];
|
||||||
|
// BlockList matches IPv4 rules against IPv4-mapped addresses too.
|
||||||
|
const trusted = isIP(peer) && proxies().check(peer, isIP(peer) === 4 ? 'ipv4' : 'ipv6');
|
||||||
|
if (header && !trusted && !warned) {
|
||||||
|
warned = true;
|
||||||
|
console.warn('X-Forwarded-For from an address PROXIES does not cover, ignored. Behind a proxy, add it.');
|
||||||
|
}
|
||||||
|
const forwarded = trusted ? header?.split(',').at(-1).trim() : undefined;
|
||||||
|
const ip = isIP(forwarded) ? forwarded : peer;
|
||||||
|
if (!isIP(ip)) return 'unknown';
|
||||||
|
if (ip.includes('.')) return ip.replace(/^::ffff:/i, '');
|
||||||
const [head, tail] = ip.split('::');
|
const [head, tail] = ip.split('::');
|
||||||
const groups = head ? head.split(':') : [];
|
const groups = head ? head.split(':') : [];
|
||||||
if (tail !== undefined) {
|
if (tail !== undefined) {
|
||||||
@@ -62,16 +120,61 @@ function clientIp(req) {
|
|||||||
.join(':')}::/64`;
|
.join(':')}::/64`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The address's record for the current window. Open connections stay counted across a reset, what it
|
||||||
|
// used starts over. A record without open connections is dropped by the sweep once its window is over.
|
||||||
|
function usage(ip) {
|
||||||
|
const now = Date.now();
|
||||||
|
let record = perIp.get(ip);
|
||||||
|
if (!record) {
|
||||||
|
// Room for the new one. At most MAX_CONNECTIONS records have an open connection, so with room to
|
||||||
|
// spare above that there is always a closed one to drop.
|
||||||
|
const limit = maxIps();
|
||||||
|
for (const [old, other] of perIp) {
|
||||||
|
if (perIp.size < limit) break;
|
||||||
|
if (!other.open) perIp.delete(old);
|
||||||
|
}
|
||||||
|
record = { open: 0, connects: 0, forwarded: 0, since: now };
|
||||||
|
perIp.set(ip, record);
|
||||||
|
} else if (now - record.since >= IP_WINDOW) {
|
||||||
|
record.connects = 0;
|
||||||
|
record.forwarded = 0;
|
||||||
|
record.since = now;
|
||||||
|
}
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
function refuse(socket, status) {
|
function refuse(socket, status) {
|
||||||
socket.end(`HTTP/1.1 ${status}\r\nConnection: close\r\n\r\n`);
|
socket.end(`HTTP/1.1 ${status}\r\nConnection: close\r\n\r\n`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MAX_FORWARDED limits what each sender sends, this what a peer gets from all of them, e.g. from
|
// MAX_FORWARDED limits what each sender sends, this what a peer gets from all of them, e.g. from
|
||||||
// receivers that reconnect over and over. A peer that stopped reading is dropped at once, close would
|
// receivers that reconnect over and over. A peer that stopped reading is dropped at once, close would
|
||||||
// wait for its close frame.
|
// wait for its close frame. Past maxQueuedAll() for all of them, the largest queues go first: a peer
|
||||||
|
// that reads has next to nothing queued, so one without a queue never goes for the others'.
|
||||||
function fits(peer, bytes) {
|
function fits(peer, bytes) {
|
||||||
if (peer.ws.bufferedAmount + bytes <= MAX_QUEUED) return true;
|
if (peer.ws.readyState !== peer.ws.OPEN) return false;
|
||||||
|
if (peer.ws.bufferedAmount + bytes > MAX_QUEUED) return drop(peer);
|
||||||
|
let total = bytes;
|
||||||
|
for (const other of queued) {
|
||||||
|
if (other.ws.bufferedAmount) total += other.ws.bufferedAmount;
|
||||||
|
else queued.delete(other);
|
||||||
|
}
|
||||||
|
queued.add(peer);
|
||||||
|
if (total > maxQueuedAll()) {
|
||||||
|
for (const other of [...queued].sort((a, b) => b.ws.bufferedAmount - a.ws.bufferedAmount)) {
|
||||||
|
if (total <= maxQueuedAll() || !other.ws.bufferedAmount) break;
|
||||||
|
total -= other.ws.bufferedAmount;
|
||||||
|
drop(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return peer.ws.readyState === peer.ws.OPEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Its queue goes with the socket.
|
||||||
|
function drop(peer) {
|
||||||
peer.ws.terminate();
|
peer.ws.terminate();
|
||||||
|
queued.delete(peer);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function send(peer, message) {
|
function send(peer, message) {
|
||||||
@@ -88,6 +191,9 @@ function reject(peer, reason) {
|
|||||||
function forward(from, to, message, sdp) {
|
function forward(from, to, message, sdp) {
|
||||||
from.forwarded += sdp.length;
|
from.forwarded += sdp.length;
|
||||||
if (from.forwarded > MAX_FORWARDED) return reject(from, 'too much signaling');
|
if (from.forwarded > MAX_FORWARDED) return reject(from, 'too much signaling');
|
||||||
|
const used = usage(from.ip);
|
||||||
|
used.forwarded += sdp.length;
|
||||||
|
if (used.forwarded > maxForwardedPerIp()) return reject(from, 'too much signaling');
|
||||||
send(to, message);
|
send(to, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,6 +207,7 @@ function announce(peer, msg) {
|
|||||||
swarms.set(hash, swarm.set(id, peer));
|
swarms.set(hash, swarm.set(id, peer));
|
||||||
peer.id = id;
|
peer.id = id;
|
||||||
peer.hash = hash;
|
peer.hash = hash;
|
||||||
|
clearTimeout(peer.silent);
|
||||||
} else if (peer.id !== id || peer.hash !== hash) return reject(peer, 'one swarm per connection');
|
} else if (peer.id !== id || peer.hash !== hash) return reject(peer, 'one swarm per connection');
|
||||||
if (msg.event === 'stopped') return peer.ws.close();
|
if (msg.event === 'stopped') return peer.ws.close();
|
||||||
peer.seeder = msg.left === 0;
|
peer.seeder = msg.left === 0;
|
||||||
@@ -145,8 +252,20 @@ function announce(peer, msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function open(ws) {
|
function open(ws, ip) {
|
||||||
const peer = { ws, id: undefined, hash: undefined, seeder: false, pending: new Map(), forwarded: 0, messages: 0 };
|
const peer = {
|
||||||
|
ws,
|
||||||
|
ip,
|
||||||
|
id: undefined,
|
||||||
|
hash: undefined,
|
||||||
|
seeder: false,
|
||||||
|
pending: new Map(),
|
||||||
|
forwarded: 0,
|
||||||
|
messages: 0,
|
||||||
|
// Terminated, close would keep the slot for ws's 30 s more if the client ignores the close
|
||||||
|
// frame. A peer that never announced has nothing to say goodbye to.
|
||||||
|
silent: setTimeout(() => ws.terminate(), maxSilent()),
|
||||||
|
};
|
||||||
const rate = setInterval(() => (peer.messages = 0), RATE_WINDOW);
|
const rate = setInterval(() => (peer.messages = 0), RATE_WINDOW);
|
||||||
const age = setTimeout(() => ws.close(), MAX_AGE);
|
const age = setTimeout(() => ws.close(), MAX_AGE);
|
||||||
// E.g. a message beyond MAX_MESSAGE, the connection closes then. Unhandled, it would end the process.
|
// E.g. a message beyond MAX_MESSAGE, the connection closes then. Unhandled, it would end the process.
|
||||||
@@ -167,6 +286,8 @@ function open(ws) {
|
|||||||
ws.on('close', () => {
|
ws.on('close', () => {
|
||||||
clearInterval(rate);
|
clearInterval(rate);
|
||||||
clearTimeout(age);
|
clearTimeout(age);
|
||||||
|
clearTimeout(peer.silent);
|
||||||
|
queued.delete(peer);
|
||||||
// Held offers keep their peers alive, a chain of departed peers would grow without bound.
|
// Held offers keep their peers alive, a chain of departed peers would grow without bound.
|
||||||
peer.pending.clear();
|
peer.pending.clear();
|
||||||
const swarm = swarms.get(peer.hash);
|
const swarm = swarms.get(peer.hash);
|
||||||
@@ -181,7 +302,22 @@ function open(ws) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const wss = new WebSocketServer({ noServer: true, maxPayload: MAX_MESSAGE, clientTracking: false, autoPong: false });
|
const wss = new WebSocketServer({ noServer: true, maxPayload: MAX_MESSAGE, clientTracking: false, autoPong: false });
|
||||||
export const server = createServer((_, res) => res.writeHead(404).end());
|
// Plain requests aren't counted below, only upgraded ones are, so Node's own limits keep them from
|
||||||
|
// piling up, each one's kernel buffers against mem_limit. Node checks headersTimeout and
|
||||||
|
// requestTimeout every connectionsCheckingInterval, 30 s unless set. headersTimeout starts only once
|
||||||
|
// something arrived, the idle timeout on every connection covers one that sends nothing, cleared
|
||||||
|
// for an accepted upgrade: HellCon's peers sit out their announce interval. The 404 closes the
|
||||||
|
// socket, nothing of it stays for a keep-alive. maxConnections caps all sockets, plain ones
|
||||||
|
// included: beyond it Node drops new ones without a response, the one place a client gets a bare
|
||||||
|
// connection error instead of a 503.
|
||||||
|
export const server = createServer({ connectionsCheckingInterval: 5_000 }, (_, res) =>
|
||||||
|
res.writeHead(404, { Connection: 'close' }).end(),
|
||||||
|
);
|
||||||
|
server.on('connection', (socket) => socket.setTimeout(10_000, () => socket.destroy()));
|
||||||
|
server.headersTimeout = 10_000;
|
||||||
|
server.requestTimeout = 30_000;
|
||||||
|
server.maxHeadersCount = 100;
|
||||||
|
server.maxConnections = 2 * MAX_CONNECTIONS;
|
||||||
server.on('upgrade', (req, socket, head) => {
|
server.on('upgrade', (req, socket, head) => {
|
||||||
// Node leaves an upgraded socket without one, ws adds its own only once it takes over. Unhandled, a
|
// Node leaves an upgraded socket without one, ws adds its own only once it takes over. Unhandled, a
|
||||||
// client resetting a refused connection would end the process.
|
// client resetting a refused connection would end the process.
|
||||||
@@ -189,16 +325,27 @@ server.on('upgrade', (req, socket, head) => {
|
|||||||
const ip = clientIp(req);
|
const ip = clientIp(req);
|
||||||
if (!allowed(req.headers.origin)) return refuse(socket, '403 Forbidden');
|
if (!allowed(req.headers.origin)) return refuse(socket, '403 Forbidden');
|
||||||
if (connections >= MAX_CONNECTIONS) return refuse(socket, '503 Service Unavailable');
|
if (connections >= MAX_CONNECTIONS) return refuse(socket, '503 Service Unavailable');
|
||||||
if ((perIp.get(ip) ?? 0) >= MAX_PER_IP) return refuse(socket, '429 Too Many Requests');
|
const used = usage(ip);
|
||||||
|
if (used.open >= MAX_PER_IP) return refuse(socket, '429 Too Many Requests');
|
||||||
|
// Closing a connection doesn't give the address its allowance back.
|
||||||
|
if (used.connects >= maxConnectsPerIp()) return refuse(socket, '429 Too Many Requests');
|
||||||
// Counted on the socket, so an upgrade that fails is released too.
|
// Counted on the socket, so an upgrade that fails is released too.
|
||||||
connections++;
|
connections++;
|
||||||
perIp.set(ip, (perIp.get(ip) ?? 0) + 1);
|
used.open++;
|
||||||
|
used.connects++;
|
||||||
socket.once('close', () => {
|
socket.once('close', () => {
|
||||||
connections--;
|
connections--;
|
||||||
const left = perIp.get(ip) - 1;
|
used.open--;
|
||||||
if (left) perIp.set(ip, left);
|
|
||||||
else perIp.delete(ip);
|
|
||||||
});
|
});
|
||||||
wss.handleUpgrade(req, socket, head, open);
|
// A peer sits out its announce interval, the idle timeout is over for it.
|
||||||
|
socket.setTimeout(0);
|
||||||
|
wss.handleUpgrade(req, socket, head, (ws) => open(ws, ip));
|
||||||
});
|
});
|
||||||
|
// An address's window only matters while something of it is open or recent. Once its last connection
|
||||||
|
// is gone and its window over, the record goes: nothing else would ever delete it.
|
||||||
|
const sweep = setInterval(() => {
|
||||||
|
const now = Date.now();
|
||||||
|
for (const [ip, record] of perIp) if (!record.open && now - record.since >= IP_WINDOW) perIp.delete(ip);
|
||||||
|
}, IP_WINDOW);
|
||||||
|
sweep.unref();
|
||||||
server.listen(PORT);
|
server.listen(PORT);
|
||||||
+165
-3
@@ -7,6 +7,7 @@ import { expect, test } from '@playwright/test';
|
|||||||
import { WebSocket as ServerSocket } from 'ws';
|
import { WebSocket as ServerSocket } from 'ws';
|
||||||
|
|
||||||
const ORIGIN = 'https://hellcon.test';
|
const ORIGIN = 'https://hellcon.test';
|
||||||
|
let server;
|
||||||
let url;
|
let url;
|
||||||
// Every connection a test opened, closed after it.
|
// Every connection a test opened, closed after it.
|
||||||
let clients = [];
|
let clients = [];
|
||||||
@@ -18,11 +19,23 @@ let tests = 0;
|
|||||||
test.beforeAll(async () => {
|
test.beforeAll(async () => {
|
||||||
process.env.PORT = '0';
|
process.env.PORT = '0';
|
||||||
process.env.ORIGINS = `${process.env.ORIGINS ?? ''} ${ORIGIN}`;
|
process.env.ORIGINS = `${process.env.ORIGINS ?? ''} ${ORIGIN}`;
|
||||||
const { server } = await import('./tracker.mjs');
|
// The tracker believes this test's X-Forwarded-For like Caddy's.
|
||||||
|
process.env.PROXIES = '127.0.0.1';
|
||||||
|
// Reconnecting tests pass the per-address limits on purpose, the ones about them lower them.
|
||||||
|
process.env.MAX_CONNECTS_PER_IP = '100000';
|
||||||
|
process.env.MAX_FORWARDED_PER_IP = String(64 * 1024 * 1024);
|
||||||
|
({ server } = await import('./tracker.mjs'));
|
||||||
if (!server.listening) await once(server, 'listening');
|
if (!server.listening) await once(server, 'listening');
|
||||||
url = `ws://127.0.0.1:${server.address().port}`;
|
url = `ws://127.0.0.1:${server.address().port}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// e2e.spec.ts may run next in this worker, with the tracker as it is deployed.
|
||||||
|
test.afterAll(() => {
|
||||||
|
delete process.env.PROXIES;
|
||||||
|
delete process.env.MAX_CONNECTS_PER_IP;
|
||||||
|
delete process.env.MAX_FORWARDED_PER_IP;
|
||||||
|
});
|
||||||
|
|
||||||
test.beforeEach(() => {
|
test.beforeEach(() => {
|
||||||
ip = `198.51.100.${++tests}`;
|
ip = `198.51.100.${++tests}`;
|
||||||
});
|
});
|
||||||
@@ -33,14 +46,29 @@ test.afterEach(async () => {
|
|||||||
clients = [];
|
clients = [];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// fn with the environment variables in vars, undefined for unset, as they were again after it.
|
||||||
|
async function withEnv(vars, fn) {
|
||||||
|
const set = (name, value) => {
|
||||||
|
if (value === undefined) delete process.env[name];
|
||||||
|
else process.env[name] = value;
|
||||||
|
};
|
||||||
|
const was = Object.keys(vars).map((name) => [name, process.env[name]]);
|
||||||
|
for (const [name, value] of Object.entries(vars)) set(name, value);
|
||||||
|
try {
|
||||||
|
return await fn();
|
||||||
|
} finally {
|
||||||
|
for (const [name, value] of was) set(name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const id = () => String.fromCharCode(...crypto.getRandomValues(new Uint8Array(20)));
|
const id = () => String.fromCharCode(...crypto.getRandomValues(new Uint8Array(20)));
|
||||||
const sdp = (type, text = type) => ({ type, sdp: text });
|
const sdp = (type, text = type) => ({ type, sdp: text });
|
||||||
|
|
||||||
// A connection like HellCon's, without one if the tracker refused it. Its messages queue up in
|
// A connection like HellCon's, without one if the tracker refused it. Its messages queue up in
|
||||||
// messages, closed resolves with the close code.
|
// messages, closed resolves with the close code.
|
||||||
function open({ origin = ORIGIN } = {}) {
|
function open({ origin = ORIGIN, xff = ip } = {}) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const ws = new WebSocket(url, { headers: { origin, 'x-forwarded-for': ip } });
|
const ws = new WebSocket(url, { headers: { origin, 'x-forwarded-for': xff } });
|
||||||
const client = { ws, messages: [], closed: once(ws, 'close').then(([event]) => event.code) };
|
const client = { ws, messages: [], closed: once(ws, 'close').then(([event]) => event.code) };
|
||||||
ws.addEventListener('message', ({ data }) => client.messages.push(JSON.parse(data)));
|
ws.addEventListener('message', ({ data }) => client.messages.push(JSON.parse(data)));
|
||||||
ws.addEventListener('open', () => {
|
ws.addEventListener('open', () => {
|
||||||
@@ -278,6 +306,51 @@ test('limits the signaling forwarded per connection', async () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('limits the signaling from one address across connections', () =>
|
||||||
|
withEnv({ MAX_FORWARDED_PER_IP: '20' }, async () => {
|
||||||
|
const { hash, receiver } = await swarm();
|
||||||
|
const fields = { action: 'announce', info_hash: hash, peer_id: receiver.id, left: 1 };
|
||||||
|
// Five bytes each, four fit, the fifth is past the limit though the connection's own is far off.
|
||||||
|
const offer = { offer_id: id(), offer: sdp('offer') };
|
||||||
|
for (let i = 0; i < 4; i++) await announce(receiver, { ...fields, offers: [offer] });
|
||||||
|
await rejected(receiver, { ...fields, offers: [offer] }, 'too much signaling');
|
||||||
|
// A new connection from the same address doesn't get a fresh allowance.
|
||||||
|
const again = await open();
|
||||||
|
const second = { action: 'announce', info_hash: hash, peer_id: id(), left: 1 };
|
||||||
|
await announce(again, second);
|
||||||
|
await rejected(again, { ...second, offers: [offer] }, 'too much signaling');
|
||||||
|
}));
|
||||||
|
|
||||||
|
test('limits connections from one address over time, not only at once', () =>
|
||||||
|
withEnv({ MAX_CONNECTS_PER_IP: '3' }, async () => {
|
||||||
|
for (let i = 0; i < 3; i++) expect(await open()).toBeTruthy();
|
||||||
|
// Below MAX_PER_IP, and closing them doesn't reset the rate.
|
||||||
|
const opened = clients.splice(0);
|
||||||
|
for (const client of opened) client.ws.close();
|
||||||
|
await Promise.all(opened.map((client) => client.closed));
|
||||||
|
expect(await open()).toBeUndefined();
|
||||||
|
}));
|
||||||
|
|
||||||
|
test('forgets the oldest address once too many records pile up', () =>
|
||||||
|
withEnv({ MAX_IPS: '2', MAX_CONNECTS_PER_IP: '1' }, async () => {
|
||||||
|
const close = async (address) => {
|
||||||
|
ip = address;
|
||||||
|
const client = await open();
|
||||||
|
client.ws.close();
|
||||||
|
await client.closed;
|
||||||
|
// The tracker only evicts closed records, let it see the close first.
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||||
|
};
|
||||||
|
await close('192.0.2.1');
|
||||||
|
await close('192.0.2.2');
|
||||||
|
// The third record pushes the first out, which may connect again; the second stays limited.
|
||||||
|
await close('192.0.2.3');
|
||||||
|
ip = '192.0.2.2';
|
||||||
|
expect(await open()).toBeUndefined();
|
||||||
|
ip = '192.0.2.1';
|
||||||
|
expect(await open()).toBeTruthy();
|
||||||
|
}));
|
||||||
|
|
||||||
test('drops a peer that stops reading', async () => {
|
test('drops a peer that stops reading', async () => {
|
||||||
const hash = id();
|
const hash = id();
|
||||||
const slowId = id();
|
const slowId = id();
|
||||||
@@ -310,6 +383,42 @@ test('drops a peer that stops reading', async () => {
|
|||||||
expect(await closed).toBe(1006);
|
expect(await closed).toBe(1006);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('drops the largest queues once all of them together pass MAX_QUEUED_ALL', async () => {
|
||||||
|
// The tracker's side of the slow sender's connection: what its socket holds is queued, the kernel's
|
||||||
|
// buffers are full by then.
|
||||||
|
let queue;
|
||||||
|
const track = (_, socket) => (queue = socket);
|
||||||
|
server.on('upgrade', track);
|
||||||
|
const hash = id();
|
||||||
|
const slow = new ServerSocket(url, { headers: { origin: ORIGIN, 'x-forwarded-for': ip } });
|
||||||
|
const closed = once(slow, 'close').then(([code]) => code);
|
||||||
|
await once(slow, 'open');
|
||||||
|
server.off('upgrade', track);
|
||||||
|
slow.send(JSON.stringify({ action: 'announce', info_hash: hash, peer_id: id(), left: 0, numwant: 0 }));
|
||||||
|
await once(slow, 'message');
|
||||||
|
slow._socket.pause();
|
||||||
|
// Budget lowered first: once the kernel's buffers are full, the next offer leaves a queue, and
|
||||||
|
// the reply to the receiver right after it is past the budget. Checked later, the kernel could
|
||||||
|
// have taken the queue in by then. The slow sender's queue goes, the receiver's reply arrives.
|
||||||
|
const big = () => ({ offer_id: id(), offer: sdp('offer', 'x'.repeat(15_000)) });
|
||||||
|
await withEnv({ MAX_QUEUED_ALL: '1' }, async () => {
|
||||||
|
for (let i = 0; i < 1000 && !queue.destroyed; i++) {
|
||||||
|
const receiver = await open();
|
||||||
|
const fields = { info_hash: hash, peer_id: id(), left: 1 };
|
||||||
|
for (let j = 0; j < 4 && !queue.destroyed; j++) {
|
||||||
|
await announce(receiver, { ...fields, offers: [big()] });
|
||||||
|
// Gone with its first queue, not once it grew to MAX_QUEUED.
|
||||||
|
expect(queue.destroyed || !queue.writableLength).toBe(true);
|
||||||
|
}
|
||||||
|
receiver.ws.close();
|
||||||
|
await receiver.closed;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(queue.destroyed).toBe(true);
|
||||||
|
slow._socket.resume();
|
||||||
|
expect(await closed).toBe(1006);
|
||||||
|
});
|
||||||
|
|
||||||
test('limits a swarm to 8 peers', async () => {
|
test('limits a swarm to 8 peers', async () => {
|
||||||
const hash = id();
|
const hash = id();
|
||||||
for (let i = 0; i < 8; i++) await announce(await open(), { info_hash: hash, peer_id: id(), left: 1 });
|
for (let i = 0; i < 8; i++) await announce(await open(), { info_hash: hash, peer_id: id(), left: 1 });
|
||||||
@@ -334,6 +443,59 @@ test('counts IPv6 by /64, however it is written', async () => {
|
|||||||
expect(await open()).toBeTruthy();
|
expect(await open()).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('ignores X-Forwarded-For without a trusted proxy', () =>
|
||||||
|
// Without PROXIES the socket's address counts, a client can't hand-pick a fresh one per
|
||||||
|
// connection. All these come from 127.0.0.1.
|
||||||
|
withEnv({ PROXIES: undefined }, async () => {
|
||||||
|
for (let i = 0; i < 16; i++) expect(await open({ xff: `203.0.113.${i + 1}` })).toBeTruthy();
|
||||||
|
expect(await open({ xff: '203.0.113.250' })).toBeUndefined();
|
||||||
|
// With the peer trusted again, the forwarded address counts once more. One that is no address
|
||||||
|
// counts as the peer's, full by now.
|
||||||
|
process.env.PROXIES = '127.0.0.1';
|
||||||
|
for (const xff of ['203.0.113.250:1234', '2001:db8::1::1']) expect(await open({ xff })).toBeUndefined();
|
||||||
|
expect(await open({ xff: '203.0.113.250' })).toBeTruthy();
|
||||||
|
// Also as a CIDR, however the proxy's address is written. An IPv4 prefix counts in IPv4's 32
|
||||||
|
// bits, an empty one is no range at all.
|
||||||
|
for (const proxies of ['10.0.0.0/8', '10.0.0.0/']) {
|
||||||
|
process.env.PROXIES = proxies;
|
||||||
|
expect(await open({ xff: '203.0.113.251' })).toBeUndefined();
|
||||||
|
}
|
||||||
|
for (const [i, proxies] of ['127.0.0.0/8', '::ffff:127.0.0.0/120'].entries()) {
|
||||||
|
process.env.PROXIES = proxies;
|
||||||
|
expect(await open({ xff: `203.0.113.${251 + i}` })).toBeTruthy();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
// MAX_SILENT lowered only here: the tests holding 16 silent connections would lose the first ones
|
||||||
|
// on a busy machine.
|
||||||
|
test('closes a connection that announces nothing', () =>
|
||||||
|
// One that only holds a slot goes. Terminated, without a close frame it could ignore.
|
||||||
|
withEnv({ MAX_SILENT: '500' }, async () => {
|
||||||
|
const client = await open();
|
||||||
|
expect(await client.closed).toBe(1006);
|
||||||
|
}));
|
||||||
|
|
||||||
|
test('keeps a connection that announced', () =>
|
||||||
|
// Also past MAX_SILENT, announcing is the first thing a peer does.
|
||||||
|
withEnv({ MAX_SILENT: '500' }, async () => {
|
||||||
|
const client = await open();
|
||||||
|
const fields = { info_hash: id(), peer_id: id(), left: 0 };
|
||||||
|
await announce(client, fields);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 750));
|
||||||
|
await announce(client, fields);
|
||||||
|
}));
|
||||||
|
|
||||||
|
test('answers plain HTTP with a 404 and closes the socket', async () => {
|
||||||
|
const socket = connectTcp(new URL(url).port, '127.0.0.1');
|
||||||
|
await once(socket, 'connect');
|
||||||
|
socket.write('GET / HTTP/1.1\r\nHost: x\r\n\r\n');
|
||||||
|
const [data] = await once(socket, 'data');
|
||||||
|
expect(String(data)).toContain('404');
|
||||||
|
// Connection: close, so unlimited sequential 404s on one connection are over.
|
||||||
|
expect(String(data).toLowerCase()).toContain('connection: close');
|
||||||
|
await once(socket, 'close');
|
||||||
|
});
|
||||||
|
|
||||||
test('survives clients resetting refused connections', async () => {
|
test('survives clients resetting refused connections', async () => {
|
||||||
for (let i = 0; i < 100; i++) {
|
for (let i = 0; i < 100; i++) {
|
||||||
const socket = connectTcp(new URL(url).port, '127.0.0.1');
|
const socket = connectTcp(new URL(url).port, '127.0.0.1');
|
||||||
|
|||||||
@@ -30,6 +30,10 @@
|
|||||||
"MAX_BUFFERED",
|
"MAX_BUFFERED",
|
||||||
"WINDOW",
|
"WINDOW",
|
||||||
"TRACKER_TIMEOUT",
|
"TRACKER_TIMEOUT",
|
||||||
|
"MAX_TRACKER_MESSAGE",
|
||||||
|
"MAX_TRACKER_MESSAGES",
|
||||||
|
"MESSAGE_WINDOW",
|
||||||
|
"TRACKER_NOTES",
|
||||||
"CONNECT_TIMEOUT",
|
"CONNECT_TIMEOUT",
|
||||||
"MIN_INTERVAL",
|
"MIN_INTERVAL",
|
||||||
"PBKDF2_ITERATIONS",
|
"PBKDF2_ITERATIONS",
|
||||||
|
|||||||
+312
-12
@@ -2,7 +2,7 @@ import { createCipheriv, createDecipheriv, createHash, hkdfSync, pbkdf2Sync, ran
|
|||||||
import { createSocket, type Socket } from 'node:dgram';
|
import { createSocket, type Socket } from 'node:dgram';
|
||||||
import { once } from 'node:events';
|
import { once } from 'node:events';
|
||||||
import { createReadStream } from 'node:fs';
|
import { createReadStream } from 'node:fs';
|
||||||
import { open as openFile, readFile, writeFile } from 'node:fs/promises';
|
import { mkdir, open as openFile, readFile, writeFile } from 'node:fs/promises';
|
||||||
import type { AddressInfo } from 'node:net';
|
import type { AddressInfo } from 'node:net';
|
||||||
import { networkInterfaces } from 'node:os';
|
import { networkInterfaces } from 'node:os';
|
||||||
import {
|
import {
|
||||||
@@ -28,11 +28,13 @@ const SIZE = 5_000_000;
|
|||||||
const LARGE_SIZE = 2.5 * 2 ** 30;
|
const LARGE_SIZE = 2.5 * 2 ** 30;
|
||||||
// Big enough that the transfer still runs while a test cancels or disconnects.
|
// Big enough that the transfer still runs while a test cancels or disconnects.
|
||||||
const RUNNING_SIZE = 100_000_000;
|
const RUNNING_SIZE = 100_000_000;
|
||||||
// WINDOW, PROBE_TIMEOUT and CONNECT_TIMEOUT in src/core.ts, DOWNLOAD_GRACE in src/download.ts.
|
// WINDOW, PROBE_TIMEOUT and CONNECT_TIMEOUT in src/core.ts, DOWNLOAD_GRACE in src/download.ts, SILENCE
|
||||||
|
// in public/sw.js.
|
||||||
const WINDOW = 8 * 2 ** 20;
|
const WINDOW = 8 * 2 ** 20;
|
||||||
const PROBE_TIMEOUT = 2000;
|
const PROBE_TIMEOUT = 2000;
|
||||||
const CONNECT_TIMEOUT = 30_000;
|
const CONNECT_TIMEOUT = 30_000;
|
||||||
const DOWNLOAD_GRACE = 1000;
|
const DOWNLOAD_GRACE = 1000;
|
||||||
|
const SILENCE = 20_000;
|
||||||
// Every page's clock starts a second into the salt's window from 12:00 to 12:06 UTC unless a test
|
// Every page's clock starts a second into the salt's window from 12:00 to 12:06 UTC unless a test
|
||||||
// sets another time, so the test knows when the window of a code ends.
|
// sets another time, so the test knows when the window of a code ends.
|
||||||
const TEST_TIME = Date.UTC(2026, 0, 1, 12, 0, 1);
|
const TEST_TIME = Date.UTC(2026, 0, 1, 12, 0, 1);
|
||||||
@@ -135,11 +137,15 @@ test.afterAll(async () => {
|
|||||||
stun.close();
|
stun.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
// init runs in the page before the app. base is the app's URL, the dev server's by default. time is
|
// init runs in the page before the app, several in order. base is the app's URL, the dev server's by
|
||||||
// where the page's clock starts.
|
// default. time is where the page's clock starts.
|
||||||
async function open(
|
async function open(
|
||||||
name: string,
|
name: string,
|
||||||
{ init, base = url, time = TEST_TIME }: { init?: () => void; base?: string; time?: number } = {},
|
{
|
||||||
|
init = [],
|
||||||
|
base = url,
|
||||||
|
time = TEST_TIME,
|
||||||
|
}: { init?: (() => void) | (() => void)[]; base?: string; time?: number } = {},
|
||||||
) {
|
) {
|
||||||
browsers[name] ??= BROWSERS[name]!.launch();
|
browsers[name] ??= BROWSERS[name]!.launch();
|
||||||
const browser = await browsers[name];
|
const browser = await browsers[name];
|
||||||
@@ -152,7 +158,8 @@ async function open(
|
|||||||
page.on('websocket', (ws) => ws.url().startsWith(base.replace('http', 'ws')) || trackers.push(ws));
|
page.on('websocket', (ws) => ws.url().startsWith(base.replace('http', 'ws')) || trackers.push(ws));
|
||||||
page.on('pageerror', (error) => errors.push(`${name}: ${error.message}`));
|
page.on('pageerror', (error) => errors.push(`${name}: ${error.message}`));
|
||||||
await page.addInitScript(trackPeers);
|
await page.addInitScript(trackPeers);
|
||||||
if (init) await page.addInitScript(init);
|
await page.addInitScript(failOnCsp);
|
||||||
|
for (const script of [init].flat()) await page.addInitScript(script);
|
||||||
await page.goto(base);
|
await page.goto(base);
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
@@ -187,6 +194,14 @@ async function hash(path: string) {
|
|||||||
|
|
||||||
const log = (page: Page) => page.locator('#log').textContent();
|
const log = (page: Page) => page.locator('#log').textContent();
|
||||||
|
|
||||||
|
// Init script for every page: whatever index.html's Content-Security-Policy blocks fails the test, the
|
||||||
|
// browsers only log it.
|
||||||
|
function failOnCsp() {
|
||||||
|
document.addEventListener('securitypolicyviolation', ({ violatedDirective, blockedURI }) => {
|
||||||
|
throw new Error(`Content-Security-Policy blocked ${blockedURI || 'inline'} by ${violatedDirective}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Init script for every page: keeps its peer connections in window.peers, so a test can check that
|
// Init script for every page: keeps its peer connections in window.peers, so a test can check that
|
||||||
// they were closed. It runs in the hidden frames too, only the app's own window counts.
|
// they were closed. It runs in the hidden frames too, only the app's own window counts.
|
||||||
function trackPeers() {
|
function trackPeers() {
|
||||||
@@ -215,6 +230,24 @@ async function expectClosed(page: Page) {
|
|||||||
await expect.poll(() => sockets.get(page)!.filter((ws) => !ws.isClosed()).length).toBe(0);
|
await expect.poll(() => sockets.get(page)!.filter((ws) => !ws.isClosed()).length).toBe(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init script for a receiver: it speaks another version to its service worker than sw.js, as if one
|
||||||
|
// of them was updated. The page posts from the hidden frame's worker, the script runs there too.
|
||||||
|
function otherVersion() {
|
||||||
|
const post = ServiceWorker.prototype.postMessage as (this: ServiceWorker, ...args: unknown[]) => void;
|
||||||
|
ServiceWorker.prototype.postMessage = function (this: ServiceWorker, message: { version?: number }, ...rest) {
|
||||||
|
post.call(this, message.version ? { ...message, version: message.version + 1 } : message, ...rest);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init script for a receiver: its pings never reach its service worker, as if its timers were held
|
||||||
|
// back in the background. Like otherVersion, it runs in the hidden frame the page posts from.
|
||||||
|
function dropPings() {
|
||||||
|
const post = ServiceWorker.prototype.postMessage as (this: ServiceWorker, ...args: unknown[]) => void;
|
||||||
|
ServiceWorker.prototype.postMessage = function (this: ServiceWorker, message: { ping?: boolean }, ...rest) {
|
||||||
|
if (!message.ping) post.call(this, message, ...rest);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Init script for a receiver: holds back its { read } reports to the sender until release(), as if
|
// Init script for a receiver: holds back its { read } reports to the sender until release(), as if
|
||||||
// the download manager read nothing, and counts the bytes that arrive. It runs in the hidden frames
|
// the download manager read nothing, and counts the bytes that arrive. It runs in the hidden frames
|
||||||
// too, only the app's own window counts.
|
// too, only the app's own window counts.
|
||||||
@@ -248,6 +281,50 @@ function holdReads() {
|
|||||||
const received = (page: Page) => page.evaluate(() => (window as unknown as { received: number }).received);
|
const received = (page: Page) => page.evaluate(() => (window as unknown as { received: number }).received);
|
||||||
const release = (page: Page) => page.evaluate(() => (window as unknown as { release: () => void }).release());
|
const release = (page: Page) => page.evaluate(() => (window as unknown as { release: () => void }).release());
|
||||||
|
|
||||||
|
type FakeWakeLock = EventTarget & { released: boolean; release: () => Promise<void> };
|
||||||
|
|
||||||
|
// Init script for a page whose wake lock the test follows, a headless browser may not grant a real
|
||||||
|
// one. Like a browser, it refuses one to a hidden page and releases each once the page is hidden,
|
||||||
|
// which setHidden makes it. It runs in the hidden frames too, only the app's own window counts.
|
||||||
|
function fakeWakeLock() {
|
||||||
|
if (window !== window.top) return;
|
||||||
|
const page = window as unknown as { wakeLocks: FakeWakeLock[]; setHidden: (hidden: boolean) => void };
|
||||||
|
page.wakeLocks = [];
|
||||||
|
let hidden = false;
|
||||||
|
Object.defineProperty(document, 'hidden', { get: () => hidden });
|
||||||
|
const request = async () => {
|
||||||
|
if (hidden) throw new DOMException('page is hidden', 'NotAllowedError');
|
||||||
|
const sentinel: FakeWakeLock = Object.assign(new EventTarget(), {
|
||||||
|
released: false,
|
||||||
|
release: async () => {
|
||||||
|
if (sentinel.released) return;
|
||||||
|
sentinel.released = true;
|
||||||
|
sentinel.dispatchEvent(new Event('release'));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
page.wakeLocks.push(sentinel);
|
||||||
|
return sentinel;
|
||||||
|
};
|
||||||
|
Object.defineProperty(navigator, 'wakeLock', { value: { request } });
|
||||||
|
page.setHidden = (value) => {
|
||||||
|
hidden = value;
|
||||||
|
if (hidden) for (const sentinel of page.wakeLocks) void sentinel.release();
|
||||||
|
document.dispatchEvent(new Event('visibilitychange'));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const setHidden = (page: Page, hidden: boolean) =>
|
||||||
|
page.evaluate((hidden) => (window as unknown as { setHidden: (hidden: boolean) => void }).setHidden(hidden), hidden);
|
||||||
|
|
||||||
|
// The wake locks the page holds, and whether it would ask before a reload or a closed tab.
|
||||||
|
const awake = (page: Page) =>
|
||||||
|
page.evaluate(() => {
|
||||||
|
const leave = new Event('beforeunload', { cancelable: true });
|
||||||
|
dispatchEvent(leave);
|
||||||
|
const { wakeLocks } = window as unknown as { wakeLocks: FakeWakeLock[] };
|
||||||
|
return { locks: wakeLocks.filter((sentinel) => !sentinel.released).length, asks: leave.defaultPrevented };
|
||||||
|
});
|
||||||
|
|
||||||
// Changes sw.js and has the page's browser install it, as after a deploy while the tab is open.
|
// Changes sw.js and has the page's browser install it, as after a deploy while the tab is open.
|
||||||
async function updateWorker(page: Page) {
|
async function updateWorker(page: Page) {
|
||||||
await expect
|
await expect
|
||||||
@@ -291,9 +368,9 @@ async function connect(mode: string, sender: Page, receiver: Page, source: strin
|
|||||||
if (mode === 'tracker') return proven(sender, receiver);
|
if (mode === 'tracker') return proven(sender, receiver);
|
||||||
|
|
||||||
const check = (page: Page, side: string) => page.locator(`#check-${side}`).textContent();
|
const check = (page: Page, side: string) => page.locator(`#check-${side}`).textContent();
|
||||||
// Each side shows ? until it has that fingerprint, the remote one can come after the local one.
|
// The check shows up once both are connected, which can take a while.
|
||||||
for (const side of ['local', 'remote']) {
|
for (const side of ['local', 'remote']) {
|
||||||
await expect(sender.locator(`#check-${side}`)).toHaveText(/^([0-9A-F]{2} ){7}[0-9A-F]{2}$/, {
|
await expect(sender.locator(`#check-${side}`)).toHaveText(/^([0-9A-F]{2} ){15}[0-9A-F]{2}$/, {
|
||||||
timeout: 45_000,
|
timeout: 45_000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -383,6 +460,33 @@ async function payload(content: Buffer, name = 'payload.bin') {
|
|||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Where a man in the middle of the manual exchange may put the a=fingerprint line it claims beside
|
||||||
|
// its own: a parser may read the claimed one where the browser reads the own one. With the own one
|
||||||
|
// on a line of its own the browser connects to the middle. Or the own one where a parser may miss
|
||||||
|
// it: Chromium and Firefox don't read it there and don't connect, a browser that did must not get
|
||||||
|
// the sender's code either.
|
||||||
|
const HIDDEN: Record<string, { connects: boolean; place: (own: string, claimed: string) => string }> = {
|
||||||
|
'a line before': { connects: true, place: (own, claimed) => `${claimed}\r\n${own}` },
|
||||||
|
'a candidate line': {
|
||||||
|
connects: true,
|
||||||
|
place: (own, claimed) => `a=candidate:1 1 udp 1 127.0.0.1 9 typ host ${claimed}\r\n${own}`,
|
||||||
|
},
|
||||||
|
'another attribute': { connects: true, place: (own, claimed) => `a=x-decoy:${claimed}\r\n${own}` },
|
||||||
|
'a line after a bare CR': { connects: true, place: (own, claimed) => `a=x-decoy:\r${claimed}\r\n${own}` },
|
||||||
|
'an indented own line': { connects: false, place: (own, claimed) => `${claimed}\r\n ${own}` },
|
||||||
|
'an own line after a bare CR': { connects: false, place: (own, claimed) => `${claimed}\r\na=x-decoy:\r${own}` },
|
||||||
|
};
|
||||||
|
|
||||||
|
// The security code of the manual exchange for these fingerprints, like securityCheck in src/core.ts.
|
||||||
|
const manualCode = (fingerprints: string[]) =>
|
||||||
|
createHash('sha256')
|
||||||
|
.update(JSON.stringify(fingerprints))
|
||||||
|
.digest('hex')
|
||||||
|
.slice(0, 32)
|
||||||
|
.toUpperCase()
|
||||||
|
.match(/../g)!
|
||||||
|
.join(' ');
|
||||||
|
|
||||||
// Interoperability and data integrity between every pair, with no server involved.
|
// Interoperability and data integrity between every pair, with no server involved.
|
||||||
for (const from of Object.keys(BROWSERS)) {
|
for (const from of Object.keys(BROWSERS)) {
|
||||||
for (const to of Object.keys(BROWSERS)) {
|
for (const to of Object.keys(BROWSERS)) {
|
||||||
@@ -454,19 +558,97 @@ for (const [from, to] of [
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
test('build: chromium sends to firefox from the production build', async () => {
|
// Served below the root of the host, which the build has to work with too.
|
||||||
|
test('build: chromium sends to firefox from the production build under a path', async () => {
|
||||||
const outDir = test.info().outputPath('dist');
|
const outDir = test.info().outputPath('dist');
|
||||||
await build({ logLevel: 'silent', build: { outDir, emptyOutDir: true } });
|
await build({ logLevel: 'silent', build: { outDir, emptyOutDir: true } });
|
||||||
const site = await preview({ logLevel: 'silent', build: { outDir }, preview: { port: 0 } });
|
const site = await preview({ logLevel: 'silent', base: '/hellcon/', build: { outDir }, preview: { port: 0 } });
|
||||||
try {
|
try {
|
||||||
const base = site.resolvedUrls!.local[0]!;
|
const base = site.resolvedUrls!.local[0]!;
|
||||||
|
expect(base).toMatch(/\/hellcon\/$/);
|
||||||
const [sender, receiver] = await Promise.all([open('chromium', { base }), open('firefox', { base })]);
|
const [sender, receiver] = await Promise.all([open('chromium', { base }), open('firefox', { base })]);
|
||||||
|
for (const image of await sender.locator('img').all()) {
|
||||||
|
expect(await image.evaluate((img: HTMLImageElement) => img.naturalWidth)).toBeGreaterThan(0);
|
||||||
|
}
|
||||||
await transfer('offline', sender, receiver, await payload(randomBytes(SIZE)), SIZE);
|
await transfer('offline', sender, receiver, await payload(randomBytes(SIZE)), SIZE);
|
||||||
} finally {
|
} finally {
|
||||||
await site.close();
|
await site.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The file picker and a drag from the file manager, the way the browser itself delivers them.
|
||||||
|
// setInputFiles fires a change event of its own whatever was picked, and no page can make up a
|
||||||
|
// dropped folder. Only Chromium's protocol reaches both, and it is the one that fires no change
|
||||||
|
// event for a file its input already holds.
|
||||||
|
async function fileManager(page: Page) {
|
||||||
|
const client = await page.context().newCDPSession(page);
|
||||||
|
const zone = page.locator('label:has(> [type=file])');
|
||||||
|
return {
|
||||||
|
zone,
|
||||||
|
async pick(path: string) {
|
||||||
|
const { result } = await client.send('Runtime.evaluate', {
|
||||||
|
expression: "document.querySelector('input[type=file]')",
|
||||||
|
});
|
||||||
|
await client.send('DOM.setFileInputFiles', { files: [path], objectId: result.objectId });
|
||||||
|
},
|
||||||
|
async drop(path: string) {
|
||||||
|
const box = (await zone.boundingBox())!;
|
||||||
|
const at = { x: box.x + box.width / 2, y: box.y + box.height / 2 };
|
||||||
|
const data = { items: [], files: [path], dragOperationsMask: 1 };
|
||||||
|
for (const type of ['dragEnter', 'dragOver', 'drop'] as const) {
|
||||||
|
await client.send('Input.dispatchDragEvent', { type, ...at, data });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chromium fires no change event when the picker returns the file its input holds. The page has to
|
||||||
|
// take it anyway: the file may have changed on disk, what the page held of it can't be read anymore
|
||||||
|
// then, or the user dropped another one in between, which the input never saw.
|
||||||
|
test('pick: chromium takes a file picked again, changed on disk or after a drop', async () => {
|
||||||
|
const sender = await open('chromium');
|
||||||
|
const { zone, pick, drop } = await fileManager(sender);
|
||||||
|
const source = await payload(randomBytes(1000), 'picked.bin');
|
||||||
|
|
||||||
|
await pick(source);
|
||||||
|
await expect(zone).toHaveText('picked.bin 1000 B');
|
||||||
|
await writeFile(source, randomBytes(1536));
|
||||||
|
await pick(source);
|
||||||
|
await expect(zone).toHaveText('picked.bin 1.5 KB');
|
||||||
|
|
||||||
|
await drop(await payload(randomBytes(2048), 'dropped.bin'));
|
||||||
|
await expect(zone).toHaveText('dropped.bin 2.0 KB');
|
||||||
|
// The input stays empty, its tooltip would say no file is chosen.
|
||||||
|
await expect(zone.locator('[type=file]')).toHaveAttribute('title', 'dropped.bin');
|
||||||
|
await pick(source);
|
||||||
|
await expect(zone).toHaveText('picked.bin 1.5 KB');
|
||||||
|
});
|
||||||
|
|
||||||
|
// A folder comes as a file that can't be read. Unnoticed, it would fail only once the receiver
|
||||||
|
// downloads it.
|
||||||
|
test('pick: chromium refuses a dropped folder and keeps the file it had', async () => {
|
||||||
|
const sender = await open('chromium');
|
||||||
|
const { zone, pick, drop } = await fileManager(sender);
|
||||||
|
const folder = test.info().outputPath('holiday');
|
||||||
|
await mkdir(folder);
|
||||||
|
const refused = sender.locator('#not-a-file');
|
||||||
|
|
||||||
|
await drop(folder);
|
||||||
|
await expect(refused).toHaveText('holiday is a folder, only a single file can be sent');
|
||||||
|
await expect(zone).toContainText('Drop a file or click to choose');
|
||||||
|
await expect(sender.locator('#share')).toBeDisabled();
|
||||||
|
|
||||||
|
// A file ends the note, whether picked or dropped.
|
||||||
|
await pick(await payload(randomBytes(1000), 'picked.bin'));
|
||||||
|
await expect(zone).toHaveText('picked.bin 1000 B');
|
||||||
|
await drop(folder);
|
||||||
|
await expect(refused).toBeVisible();
|
||||||
|
await expect(zone).toContainText('picked.bin 1000 B');
|
||||||
|
await expect(sender.locator('#share')).toBeEnabled();
|
||||||
|
await drop(await payload(randomBytes(2048), 'dropped.bin'));
|
||||||
|
await expect(zone).toHaveText('dropped.bin 2.0 KB');
|
||||||
|
});
|
||||||
|
|
||||||
for (const name of Object.keys(BROWSERS)) {
|
for (const name of Object.keys(BROWSERS)) {
|
||||||
test(`servers: ${name} skips invalid lines, a reload brings back the defaults`, async () => {
|
test(`servers: ${name} skips invalid lines, a reload brings back the defaults`, async () => {
|
||||||
const page = await open(name);
|
const page = await open(name);
|
||||||
@@ -596,6 +778,21 @@ for (const name of Object.keys(BROWSERS)) {
|
|||||||
await expect.poll(() => updated(receiver)).toBe(true);
|
await expect.poll(() => updated(receiver)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test(`update: ${name} fails a download its service worker speaks another version for`, async () => {
|
||||||
|
const [sender, receiver] = await Promise.all([open(name), open(name, { init: otherVersion })]);
|
||||||
|
const source = await payload(randomBytes(1000));
|
||||||
|
|
||||||
|
await withLogs(sender, receiver, async () => {
|
||||||
|
await connect('offline', sender, receiver, source);
|
||||||
|
for (const page of [sender, receiver]) await page.click('#confirm');
|
||||||
|
await receiver.click('#download');
|
||||||
|
const reason = 'this page and its service worker are different versions, reload once no tab receives';
|
||||||
|
await expect(receiver.locator('#receive-error')).toHaveText(`download failed: ${reason}`);
|
||||||
|
await expect(sender.locator('#send-error')).toHaveText(`receiver stopped: ${reason}`);
|
||||||
|
await expect(receiver.locator('iframe')).toHaveCount(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test(`cancel: ${name} stops receiving when the download is cancelled`, async () => {
|
test(`cancel: ${name} stops receiving when the download is cancelled`, async () => {
|
||||||
const [sender, receiver] = await Promise.all([open(name), open(name)]);
|
const [sender, receiver] = await Promise.all([open(name), open(name)]);
|
||||||
const source = await payload(Buffer.alloc(RUNNING_SIZE));
|
const source = await payload(Buffer.alloc(RUNNING_SIZE));
|
||||||
@@ -728,6 +925,35 @@ for (const name of Object.keys(BROWSERS)) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// While a session runs, the screen stays on and the browser asks before a reload or a closed tab
|
||||||
|
// ends it. Hidden, the page loses the wake lock and gets a new one once visible again.
|
||||||
|
test(`awake: ${name} keeps the screen on and asks before leaving while busy`, async () => {
|
||||||
|
const [sender, receiver] = await Promise.all([
|
||||||
|
open(name, { init: fakeWakeLock }),
|
||||||
|
open(name, { init: fakeWakeLock }),
|
||||||
|
]);
|
||||||
|
const source = await payload(randomBytes(100_000));
|
||||||
|
|
||||||
|
await withLogs(sender, receiver, async () => {
|
||||||
|
for (const page of [sender, receiver]) expect(await awake(page)).toEqual({ locks: 0, asks: false });
|
||||||
|
await connect('offline', sender, receiver, source);
|
||||||
|
for (const page of [sender, receiver]) await expect.poll(() => awake(page)).toEqual({ locks: 1, asks: true });
|
||||||
|
|
||||||
|
await setHidden(sender, true);
|
||||||
|
await expect.poll(() => awake(sender)).toEqual({ locks: 0, asks: true });
|
||||||
|
await setHidden(sender, false);
|
||||||
|
await expect.poll(() => awake(sender)).toEqual({ locks: 1, asks: true });
|
||||||
|
await expect(sender.locator('#log')).toContainText(/keeping the screen on[\s\S]*keeping the screen on/);
|
||||||
|
|
||||||
|
await sender.click('#confirm');
|
||||||
|
await receiver.click('#confirm');
|
||||||
|
await receiver.click('#download');
|
||||||
|
await expect(sender.locator('[data-phase=done] #send-status')).toHaveText('Delivered');
|
||||||
|
await expect(receiver.locator('[data-phase=done] #receive-status')).toHaveText('Download complete');
|
||||||
|
for (const page of [sender, receiver]) await expect.poll(() => awake(page)).toEqual({ locks: 0, asks: false });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// The proofs hold even against a man in the middle that opens and seals the signaling. They are
|
// The proofs hold even against a man in the middle that opens and seals the signaling. They are
|
||||||
// genuine, made with the right key, only the real certificates' fingerprints they cover give the man
|
// genuine, made with the right key, only the real certificates' fingerprints they cover give the man
|
||||||
// in the middle away. Whoever verifies first ends its connection, the other side may never get the
|
// in the middle away. Whoever verifies first ends its connection, the other side may never get the
|
||||||
@@ -759,6 +985,49 @@ for (const name of Object.keys(BROWSERS)) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// A man in the middle of the manual exchange hands the receiver an offer of its own, claiming the
|
||||||
|
// certificate the sender would name beside its own one, see HIDDEN. However the browser takes that,
|
||||||
|
// the receiver never shows the sender's code: it doesn't connect, or its code covers the middle's
|
||||||
|
// certificate. Where it connects, the browser accepted the middle's, so without the check the
|
||||||
|
// middle would get the file.
|
||||||
|
for (const [variant, { connects, place }] of Object.entries(HIDDEN)) {
|
||||||
|
test(`check: ${name} manual exchange shows other codes for a certificate claimed in ${variant}`, async () => {
|
||||||
|
const [middle, receiver] = await Promise.all([open(name), open(name)]);
|
||||||
|
const claimed = `sha-256 ${Array.from(randomBytes(32), (byte) => byte.toString(16).padStart(2, '0')).join(':')}`;
|
||||||
|
|
||||||
|
await withLogs(middle, receiver, async () => {
|
||||||
|
for (const page of [middle, receiver]) await page.uncheck('#stun');
|
||||||
|
await middle.setInputFiles('input[type=file]', await payload(randomBytes(1000)));
|
||||||
|
await middle.click('#send-manual summary');
|
||||||
|
await middle.click('#create-offer');
|
||||||
|
await expect(middle.locator('#offer')).toHaveValue(/.+/);
|
||||||
|
const sdp = Buffer.from(await middle.inputValue('#offer'), 'base64').toString();
|
||||||
|
const tampered = sdp.replace(/^a=fingerprint:[^\r\n]*/gm, (line) =>
|
||||||
|
place(line, `a=fingerprint:${claimed.toUpperCase()}`),
|
||||||
|
);
|
||||||
|
expect(tampered).not.toBe(sdp);
|
||||||
|
|
||||||
|
await receiver.click('#receive-manual summary');
|
||||||
|
await receiver.fill('#offer-input', Buffer.from(tampered).toString('base64'));
|
||||||
|
await receiver.click('#create-answer');
|
||||||
|
const remote = receiver.locator('#check-remote');
|
||||||
|
const failed = (page: Page) => page.locator('#send-error, #receive-error').filter({ hasText: /.+/ });
|
||||||
|
await expect(receiver.locator('#answer').or(failed(receiver))).toBeVisible({ timeout: 15_000 });
|
||||||
|
if (!(await failed(receiver).count())) {
|
||||||
|
await middle.fill('#answer-input', await receiver.inputValue('#answer'));
|
||||||
|
await middle.click('#accept-answer');
|
||||||
|
// The middle may take the answer or not, the receiver connects or not.
|
||||||
|
const settled = async () =>
|
||||||
|
(await remote.count()) + (await failed(receiver).count()) + (await failed(middle).count());
|
||||||
|
await expect.poll(settled, { timeout: 15_000 }).toBeGreaterThan(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connects) await expect(remote).toBeVisible();
|
||||||
|
if (await remote.count()) await expect(remote).not.toHaveText(manualCode([claimed]));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
test(`protocol: ${name} manual exchange reports a broken offer and answer`, async () => {
|
test(`protocol: ${name} manual exchange reports a broken offer and answer`, async () => {
|
||||||
const [sender, receiver] = await Promise.all([open(name), open(name)]);
|
const [sender, receiver] = await Promise.all([open(name), open(name)]);
|
||||||
await sender.setInputFiles('input[type=file]', await payload(randomBytes(1000)));
|
await sender.setInputFiles('input[type=file]', await payload(randomBytes(1000)));
|
||||||
@@ -960,6 +1229,35 @@ for (const name of Object.keys(BROWSERS)) {
|
|||||||
if (name === 'chromium') expect(await download.failure()).not.toBeNull();
|
if (name === 'chromium') expect(await download.failure()).not.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Without the page, nothing keeps the worker alive. Firefox would stop it 30 s later and save what it
|
||||||
|
// had as the complete file, see SILENCE in public/sw.js.
|
||||||
|
test(`disconnect: ${name} saves no truncated file when the receiving tab closes`, async () => {
|
||||||
|
const [sender, receiver] = await Promise.all([open(name), open(name, { init: holdReads })]);
|
||||||
|
const source = await payload(randomBytes(HELD_SIZE));
|
||||||
|
|
||||||
|
const { download } = await start('offline', sender, receiver, source);
|
||||||
|
await expect.poll(() => received(receiver)).toBe(WINDOW);
|
||||||
|
await receiver.close();
|
||||||
|
// Firefox reports no failure, but removes the file.
|
||||||
|
if (!(await download.failure())) await expect(readFile(await download.path())).rejects.toThrow('ENOENT');
|
||||||
|
});
|
||||||
|
|
||||||
|
test(`disconnect: ${name} fails a download its service worker heard nothing of for too long`, async () => {
|
||||||
|
const [sender, receiver] = await Promise.all([open(name), open(name, { init: [holdReads, dropPings] })]);
|
||||||
|
const source = await payload(randomBytes(HELD_SIZE));
|
||||||
|
|
||||||
|
await withLogs(sender, receiver, async () => {
|
||||||
|
await start('offline', sender, receiver, source);
|
||||||
|
await expect.poll(() => received(receiver)).toBe(WINDOW);
|
||||||
|
const reason = 'the service worker heard nothing from this page for too long';
|
||||||
|
await expect(receiver.locator('#receive-error')).toHaveText(`download failed: ${reason}`, {
|
||||||
|
timeout: SILENCE + 10_000,
|
||||||
|
});
|
||||||
|
await expect(sender.locator('#send-error')).toHaveText(`receiver stopped: ${reason}`);
|
||||||
|
await expect(receiver.locator('iframe')).toHaveCount(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stands in for every tracker the page connects to from now on: reply answers each message the page
|
// Stands in for every tracker the page connects to from now on: reply answers each message the page
|
||||||
@@ -1019,7 +1317,7 @@ function middleman() {
|
|||||||
},
|
},
|
||||||
offer() {
|
offer() {
|
||||||
toSender = new RTCPeerConnection();
|
toSender = new RTCPeerConnection();
|
||||||
attach('sender', toSender.createDataChannel('file'), 'receiver');
|
attach('sender', toSender.createDataChannel('hellcon/1'), 'receiver');
|
||||||
return localSdp(toSender);
|
return localSdp(toSender);
|
||||||
},
|
},
|
||||||
accept: (sdp) => toSender.setRemoteDescription({ type: 'answer', sdp }),
|
accept: (sdp) => toSender.setRemoteDescription({ type: 'answer', sdp }),
|
||||||
@@ -1085,7 +1383,7 @@ async function interpose(middle: Page, code: string, toSender: Announce[], toRec
|
|||||||
// The key src/core.ts seals the signaling with, for a code made at TEST_TIME without an own salt: the
|
// The key src/core.ts seals the signaling with, for a code made at TEST_TIME without an own salt: the
|
||||||
// salt is the start of TEST_TIME's window. src/core.test.ts checks the derivation itself.
|
// salt is the start of TEST_TIME's window. src/core.test.ts checks the derivation itself.
|
||||||
function signalingKey(code: string) {
|
function signalingKey(code: string) {
|
||||||
const master = pbkdf2Sync(code, `hellcon ${new Date(TEST_TIME).toISOString().slice(0, 16)}`, 600_000, 32, 'sha256');
|
const master = pbkdf2Sync(code, `hellcon/1 ${new Date(TEST_TIME).toISOString().slice(0, 16)}`, 600_000, 32, 'sha256');
|
||||||
return Buffer.from(hkdfSync('sha256', master, '', 'signaling', 32));
|
return Buffer.from(hkdfSync('sha256', master, '', 'signaling', 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1171,7 +1469,9 @@ for (const name of Object.keys(BROWSERS)) {
|
|||||||
const [sender, receiver] = await Promise.all(profiles.map((profile) => profile.newPage()));
|
const [sender, receiver] = await Promise.all(profiles.map((profile) => profile.newPage()));
|
||||||
for (const page of [sender!, receiver!]) {
|
for (const page of [sender!, receiver!]) {
|
||||||
sockets.set(page, []);
|
sockets.set(page, []);
|
||||||
|
page.on('pageerror', (error) => errors.push(`${name}: ${error.message}`));
|
||||||
await page.addInitScript(trackPeers);
|
await page.addInitScript(trackPeers);
|
||||||
|
await page.addInitScript(failOnCsp);
|
||||||
}
|
}
|
||||||
await Promise.all([sender!.goto(url), receiver!.goto(url)]);
|
await Promise.all([sender!.goto(url), receiver!.goto(url)]);
|
||||||
await transfer('offline', sender!, receiver!, source, LARGE_SIZE);
|
await transfer('offline', sender!, receiver!, source, LARGE_SIZE);
|
||||||
|
|||||||
@@ -5,6 +5,11 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="robots" content="noindex, nofollow, noarchive, nosnippet" />
|
<meta name="robots" content="noindex, nofollow, noarchive, nosnippet" />
|
||||||
<meta name="googlebot" content="noindex, nofollow, noarchive, nosnippet" />
|
<meta name="googlebot" content="noindex, nofollow, noarchive, nosnippet" />
|
||||||
|
<meta name="referrer" content="no-referrer" />
|
||||||
|
<meta
|
||||||
|
http-equiv="Content-Security-Policy"
|
||||||
|
content="default-src 'self'; style-src 'self'; connect-src 'self' ws: wss:; object-src 'none'; base-uri 'none'; form-action 'none'"
|
||||||
|
/>
|
||||||
<link rel="icon" type="image/png" href="./HellNet_alt.png" />
|
<link rel="icon" type="image/png" href="./HellNet_alt.png" />
|
||||||
<title>HellCon</title>
|
<title>HellCon</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
+10
-10
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "hellcon",
|
"name": "hellcon",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.0",
|
"version": "1.0.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -18,21 +18,21 @@
|
|||||||
"test:large": "LARGE=1 playwright test -g large"
|
"test:large": "LARGE=1 playwright test -g large"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^3.5.44"
|
"vue": "^3.5.45"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "2.6.3",
|
"@biomejs/biome": "2.6.3",
|
||||||
"@playwright/test": "^1.64.1",
|
"@playwright/test": "^1.65.0",
|
||||||
"@types/node": "^26.6.5",
|
"@types/node": "^26.6.6",
|
||||||
"@vitejs/plugin-vue": "^6.0.10",
|
"@vitejs/plugin-vue": "^6.0.11",
|
||||||
"typescript": "~6.0.3",
|
"typescript": "~6.0.3",
|
||||||
"vite": "^8.3.5",
|
"vite": "^8.3.8",
|
||||||
"vitest": "^5.0.5",
|
"vitest": "^5.1.0",
|
||||||
"vue-tsc": "^3.3.13",
|
"vue-tsc": "^3.3.14",
|
||||||
"ws": "8.22.0"
|
"ws": "8.23.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=26.12.1"
|
"node": ">=26.13.1"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@12.16.1"
|
"packageManager": "pnpm@12.16.1"
|
||||||
}
|
}
|
||||||
Generated
+357
-201
@@ -167,36 +167,36 @@ importers:
|
|||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
vue:
|
vue:
|
||||||
specifier: ^3.5.44
|
specifier: ^3.5.45
|
||||||
version: 3.5.44(typescript@6.0.3)
|
version: 3.5.45(typescript@6.0.3)
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@biomejs/biome':
|
'@biomejs/biome':
|
||||||
specifier: 2.6.3
|
specifier: 2.6.3
|
||||||
version: 2.6.3
|
version: 2.6.3
|
||||||
'@playwright/test':
|
'@playwright/test':
|
||||||
specifier: ^1.64.1
|
specifier: ^1.65.0
|
||||||
version: 1.64.1
|
version: 1.65.0
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^26.6.5
|
specifier: ^26.6.6
|
||||||
version: 26.6.5
|
version: 26.6.6
|
||||||
'@vitejs/plugin-vue':
|
'@vitejs/plugin-vue':
|
||||||
specifier: ^6.0.10
|
specifier: ^6.0.11
|
||||||
version: 6.0.10(vite@8.3.5(@types/node@26.6.5))(vue@3.5.44(typescript@6.0.3))
|
version: 6.0.11(vite@8.3.8(@types/node@26.6.6))(vue@3.5.45(typescript@6.0.3))
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ~6.0.3
|
specifier: ~6.0.3
|
||||||
version: 6.0.3
|
version: 6.0.3
|
||||||
vite:
|
vite:
|
||||||
specifier: ^8.3.5
|
specifier: ^8.3.8
|
||||||
version: 8.3.5(@types/node@26.6.5)
|
version: 8.3.8(@types/node@26.6.6)
|
||||||
vitest:
|
vitest:
|
||||||
specifier: ^5.0.5
|
specifier: ^5.1.0
|
||||||
version: 5.0.5(@types/node@26.6.5)(vite@8.3.5(@types/node@26.6.5))
|
version: 5.1.0(@types/node@26.6.6)(vite@8.3.8(@types/node@26.6.6))
|
||||||
vue-tsc:
|
vue-tsc:
|
||||||
specifier: ^3.3.13
|
specifier: ^3.3.14
|
||||||
version: 3.3.13(typescript@6.0.3)
|
version: 3.3.14(typescript@6.0.3)
|
||||||
ws:
|
ws:
|
||||||
specifier: 8.22.0
|
specifier: 8.23.0
|
||||||
version: 8.22.0
|
version: 8.23.0
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
@@ -204,6 +204,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-snZbO7MEDOof+hvNa97EjEY7qD7h2kwvQr5AJC3ZhQudKW5dnej6k3kP9NQV88hJwaS8vDqRLFo9rivLEhle2g==}
|
resolution: {integrity: sha512-snZbO7MEDOof+hvNa97EjEY7qD7h2kwvQr5AJC3ZhQudKW5dnej6k3kP9NQV88hJwaS8vDqRLFo9rivLEhle2g==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
|
|
||||||
|
'@babel/helper-string-parser@7.29.14':
|
||||||
|
resolution: {integrity: sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ==}
|
||||||
|
engines: {node: '>=6.9.0'}
|
||||||
|
|
||||||
'@babel/helper-validator-identifier@7.29.7':
|
'@babel/helper-validator-identifier@7.29.7':
|
||||||
resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==}
|
resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
@@ -213,10 +217,19 @@ packages:
|
|||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
'@babel/parser@7.29.14':
|
||||||
|
resolution: {integrity: sha512-VL220vXuyO2z3rNIQwY7ftj9UwpqOt+33sH+sBWkOekbsSR2g7EEMnOx24ZlCH0xOA3DM/33SifVFGbnJD8r/w==}
|
||||||
|
engines: {node: '>=6.0.0'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
'@babel/types@7.29.11':
|
'@babel/types@7.29.11':
|
||||||
resolution: {integrity: sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==}
|
resolution: {integrity: sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
|
|
||||||
|
'@babel/types@7.29.14':
|
||||||
|
resolution: {integrity: sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w==}
|
||||||
|
engines: {node: '>=6.9.0'}
|
||||||
|
|
||||||
'@biomejs/biome@2.6.3':
|
'@biomejs/biome@2.6.3':
|
||||||
resolution: {integrity: sha512-va/0xPku7wnfzv+D8Zpdm5uKiGJWiV8neqoEPnRjvNQQwhl4tVXS4fETs4H0CCB2rGeqJ4cu9y4iOZOnOYKAUA==}
|
resolution: {integrity: sha512-va/0xPku7wnfzv+D8Zpdm5uKiGJWiV8neqoEPnRjvNQQwhl4tVXS4fETs4H0CCB2rGeqJ4cu9y4iOZOnOYKAUA==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
@@ -286,6 +299,15 @@ packages:
|
|||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
|
'@emnapi/core@2.0.0-beta.2':
|
||||||
|
resolution: {integrity: sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==}
|
||||||
|
|
||||||
|
'@emnapi/runtime@2.0.0-beta.2':
|
||||||
|
resolution: {integrity: sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==}
|
||||||
|
|
||||||
|
'@emnapi/wasi-threads@2.2.0':
|
||||||
|
resolution: {integrity: sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==}
|
||||||
|
|
||||||
'@jridgewell/resolve-uri@3.1.2':
|
'@jridgewell/resolve-uri@3.1.2':
|
||||||
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
|
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
@@ -296,106 +318,118 @@ packages:
|
|||||||
'@jridgewell/trace-mapping@0.3.31':
|
'@jridgewell/trace-mapping@0.3.31':
|
||||||
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
||||||
|
|
||||||
'@oxc-project/types@0.155.0':
|
'@napi-rs/wasm-runtime@1.2.6':
|
||||||
resolution: {integrity: sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==}
|
resolution: {integrity: sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==}
|
||||||
|
engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
|
||||||
|
peerDependencies:
|
||||||
|
'@emnapi/core': ^1.7.1 || 2.0.0-beta.2
|
||||||
|
'@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2
|
||||||
|
|
||||||
'@playwright/test@1.64.1':
|
'@oxc-project/types@0.156.0':
|
||||||
resolution: {integrity: sha512-IaYGml/nSOiZWROfPtuIL7neuu9qDOZ3TNvNljUIrhDMxiGTgPjzj/g9p9RxpS2tSepPDRY+UwAaEeiKtUvIAg==}
|
resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==}
|
||||||
|
|
||||||
|
'@playwright/test@1.65.0':
|
||||||
|
resolution: {integrity: sha512-iGURLGuKDLakSEl7Pgfv8h7f+XLT+V861Wfhz0zlEl5nyFuKUopdkFBPKqTllTUp06aOwPuH8iuUEb3yp3MpbQ==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
'@rolldown/binding-android-arm-eabi@1.2.15':
|
'@rolldown/binding-android-arm-eabi@1.2.19':
|
||||||
resolution: {integrity: sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==}
|
resolution: {integrity: sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@rolldown/binding-android-arm64@1.2.15':
|
'@rolldown/binding-android-arm64@1.2.19':
|
||||||
resolution: {integrity: sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg==}
|
resolution: {integrity: sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@rolldown/binding-darwin-arm64@1.2.15':
|
'@rolldown/binding-darwin-arm64@1.2.19':
|
||||||
resolution: {integrity: sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA==}
|
resolution: {integrity: sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@rolldown/binding-darwin-x64@1.2.15':
|
'@rolldown/binding-darwin-x64@1.2.19':
|
||||||
resolution: {integrity: sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A==}
|
resolution: {integrity: sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@rolldown/binding-freebsd-x64@1.2.15':
|
'@rolldown/binding-freebsd-x64@1.2.19':
|
||||||
resolution: {integrity: sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ==}
|
resolution: {integrity: sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [freebsd]
|
os: [freebsd]
|
||||||
|
|
||||||
'@rolldown/binding-linux-arm-gnueabihf@1.2.15':
|
'@rolldown/binding-linux-arm-gnueabihf@1.2.19':
|
||||||
resolution: {integrity: sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ==}
|
resolution: {integrity: sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rolldown/binding-linux-arm64-gnu@1.2.15':
|
'@rolldown/binding-linux-arm64-gnu@1.2.19':
|
||||||
resolution: {integrity: sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw==}
|
resolution: {integrity: sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
libc: [glibc]
|
libc: [glibc]
|
||||||
|
|
||||||
'@rolldown/binding-linux-arm64-musl@1.2.15':
|
'@rolldown/binding-linux-arm64-musl@1.2.19':
|
||||||
resolution: {integrity: sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ==}
|
resolution: {integrity: sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
libc: [musl]
|
libc: [musl]
|
||||||
|
|
||||||
'@rolldown/binding-linux-ppc64-gnu@1.2.15':
|
'@rolldown/binding-linux-ppc64-gnu@1.2.19':
|
||||||
resolution: {integrity: sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw==}
|
resolution: {integrity: sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [ppc64]
|
cpu: [ppc64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
libc: [glibc]
|
libc: [glibc]
|
||||||
|
|
||||||
'@rolldown/binding-linux-s390x-gnu@1.2.15':
|
'@rolldown/binding-linux-s390x-gnu@1.2.19':
|
||||||
resolution: {integrity: sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA==}
|
resolution: {integrity: sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [s390x]
|
cpu: [s390x]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
libc: [glibc]
|
libc: [glibc]
|
||||||
|
|
||||||
'@rolldown/binding-linux-x64-gnu@1.2.15':
|
'@rolldown/binding-linux-x64-gnu@1.2.19':
|
||||||
resolution: {integrity: sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw==}
|
resolution: {integrity: sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
libc: [glibc]
|
libc: [glibc]
|
||||||
|
|
||||||
'@rolldown/binding-linux-x64-musl@1.2.15':
|
'@rolldown/binding-linux-x64-musl@1.2.19':
|
||||||
resolution: {integrity: sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ==}
|
resolution: {integrity: sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
libc: [musl]
|
libc: [musl]
|
||||||
|
|
||||||
'@rolldown/binding-openharmony-arm64@1.2.15':
|
'@rolldown/binding-openharmony-arm64@1.2.19':
|
||||||
resolution: {integrity: sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w==}
|
resolution: {integrity: sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [openharmony]
|
os: [openharmony]
|
||||||
|
|
||||||
'@rolldown/binding-win32-arm64-msvc@1.2.15':
|
'@rolldown/binding-wasm32-wasi@1.2.19':
|
||||||
resolution: {integrity: sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg==}
|
resolution: {integrity: sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==}
|
||||||
|
engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
|
||||||
|
cpu: [wasm32]
|
||||||
|
|
||||||
|
'@rolldown/binding-win32-arm64-msvc@1.2.19':
|
||||||
|
resolution: {integrity: sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@rolldown/binding-win32-x64-msvc@1.2.15':
|
'@rolldown/binding-win32-x64-msvc@1.2.19':
|
||||||
resolution: {integrity: sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ==}
|
resolution: {integrity: sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
@@ -403,27 +437,30 @@ packages:
|
|||||||
'@rolldown/pluginutils@1.0.1':
|
'@rolldown/pluginutils@1.0.1':
|
||||||
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
|
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
|
||||||
|
|
||||||
|
'@tybys/wasm-util@0.10.4':
|
||||||
|
resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==}
|
||||||
|
|
||||||
'@types/chai@5.2.3':
|
'@types/chai@5.2.3':
|
||||||
resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
|
resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
|
||||||
|
|
||||||
'@types/deep-eql@4.0.2':
|
'@types/deep-eql@4.0.2':
|
||||||
resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
|
resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
|
||||||
|
|
||||||
'@types/estree@1.0.9':
|
'@types/estree@1.0.10':
|
||||||
resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==}
|
resolution: {integrity: sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==}
|
||||||
|
|
||||||
'@types/node@26.6.5':
|
'@types/node@26.6.6':
|
||||||
resolution: {integrity: sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg==}
|
resolution: {integrity: sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==}
|
||||||
|
|
||||||
'@vitejs/plugin-vue@6.0.10':
|
'@vitejs/plugin-vue@6.0.11':
|
||||||
resolution: {integrity: sha512-b80aUQh3n+qEzzZm5oQp3rT2QImeCx58K6eFl/RkJ3d65KW0kTuv5lNsLRVAjbW9YRUpo/wzmvzMgV34bTAItA==}
|
resolution: {integrity: sha512-m48lskIUJGlB6qUiYhDMI8nd2ngeidz2U4nKTjqI13cFMu5rH8JeEILPkDtK9Fk/TjBA2pkj8AlbenqDaKu+ww==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
|
vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||||
vue: ^3.2.25 || ^3.6.0-rc.10
|
vue: ^3.2.25 || ^3.6.0-rc.15
|
||||||
|
|
||||||
'@vitest/mocker@5.0.5':
|
'@vitest/mocker@5.1.0':
|
||||||
resolution: {integrity: sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==}
|
resolution: {integrity: sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
msw: ^2.4.9 || ^3.0.0
|
msw: ^2.4.9 || ^3.0.0
|
||||||
vite: ^6.0.0 || ^7.0.0 || ^8.0.0
|
vite: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||||
@@ -433,19 +470,27 @@ packages:
|
|||||||
vite:
|
vite:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@vitest/spy@5.0.5':
|
'@vitest/spy@5.1.0':
|
||||||
resolution: {integrity: sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==}
|
resolution: {integrity: sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==}
|
||||||
|
|
||||||
'@volar/language-core@2.4.28':
|
'@volar/language-core@2.4.30':
|
||||||
resolution: {integrity: sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==}
|
resolution: {integrity: sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw==}
|
||||||
|
|
||||||
'@volar/source-map@2.4.28':
|
'@volar/language-service@2.4.30':
|
||||||
resolution: {integrity: sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==}
|
resolution: {integrity: sha512-w/xDsASiqC71ggCOm7sTDXDNk/l72XEptodeRC68tgZ0e5QM4hM3zAqBGC7mBctvhrpYwKfMG+t9xcUo2hEFtA==}
|
||||||
|
|
||||||
'@volar/typescript@2.4.28':
|
|
||||||
resolution: {integrity: sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw==}
|
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '*'
|
typescript: <7
|
||||||
|
peerDependenciesMeta:
|
||||||
|
typescript:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@volar/source-map@2.4.30':
|
||||||
|
resolution: {integrity: sha512-zym1ob/KwDDyN+0jGVtxwbxJSRRnUvv5HspCtz3yEfVVdCG4/dzxJktMGPAgemqRuVs81O0o/y0q3qOUErR8kg==}
|
||||||
|
|
||||||
|
'@volar/typescript@2.4.30':
|
||||||
|
resolution: {integrity: sha512-/DgA5tgYFPfrLFuSjIMXMGHk1LQv2+P8eny6+BhGNzFJELWIW7UZlc56ZLIRFhLsPpMfIFxM8/HvOPBggrjTZg==}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: <7
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
typescript:
|
typescript:
|
||||||
optional: true
|
optional: true
|
||||||
@@ -453,33 +498,42 @@ packages:
|
|||||||
'@vue/compiler-core@3.5.44':
|
'@vue/compiler-core@3.5.44':
|
||||||
resolution: {integrity: sha512-k34nCytbK8PQ1gR2mGROYOw6Pnv/mumqIdrZ3x2tbyXZDWm7ViKGLTfdB+DRrWqEQsLgGJvn0WN9jBif5zCTLQ==}
|
resolution: {integrity: sha512-k34nCytbK8PQ1gR2mGROYOw6Pnv/mumqIdrZ3x2tbyXZDWm7ViKGLTfdB+DRrWqEQsLgGJvn0WN9jBif5zCTLQ==}
|
||||||
|
|
||||||
|
'@vue/compiler-core@3.5.45':
|
||||||
|
resolution: {integrity: sha512-XGHJrM6ufZARAc/w+tyOswStw9tdKiqCKBScI4gGaNxD+aaGu/HQWgKJ+JItjRLPqenQ7iE7G8AJC7T5ew1p+g==}
|
||||||
|
|
||||||
'@vue/compiler-dom@3.5.44':
|
'@vue/compiler-dom@3.5.44':
|
||||||
resolution: {integrity: sha512-W5AoBFWdw1lQAKiHowkfgFKFab82oSRT6sGsPfw/q1GRjsy/ZJFLHGhJyBRIFN9APLTUduDH9U2JAiPOIyKuYg==}
|
resolution: {integrity: sha512-W5AoBFWdw1lQAKiHowkfgFKFab82oSRT6sGsPfw/q1GRjsy/ZJFLHGhJyBRIFN9APLTUduDH9U2JAiPOIyKuYg==}
|
||||||
|
|
||||||
'@vue/compiler-sfc@3.5.44':
|
'@vue/compiler-dom@3.5.45':
|
||||||
resolution: {integrity: sha512-dzHmQ4jXTpdr5FjIQUeykVakN/uzqFbUo9/C5ikBFg3a3PeM6uRxeczx1ZbXBML0/zJstEh3ygYipzR5Z7b2Pw==}
|
resolution: {integrity: sha512-LbP2d19GSOYGPmvMBBCVJVlv7TKtjM1Cfeyu3cYia720pknZP+1cLX7H5MVatvruT6MuJhiPuNbQBW/MDn/EwA==}
|
||||||
|
|
||||||
'@vue/compiler-ssr@3.5.44':
|
'@vue/compiler-sfc@3.5.45':
|
||||||
resolution: {integrity: sha512-xr5gb1JVHlfXJwSlRz1FeP6uxoazdzHuMTVLE7up+4Vrqxk219CvxLPxD9NXBt47yvZW7+p4DXfyp4O1fkByIA==}
|
resolution: {integrity: sha512-MKFjb2UX0M/l/jhfzqMLrI8VM4pfvFKG3pqFZkSZFHRLtNld/O4RtUPZFWSwhro/14qP88UQEkWzHxAZAQ0tsw==}
|
||||||
|
|
||||||
'@vue/language-core@3.3.13':
|
'@vue/compiler-ssr@3.5.45':
|
||||||
resolution: {integrity: sha512-axA0Xemn5LuUKuKWob0/kVq7xQ2mJJM6VqA9Exvt35nM9yRC31goWVve/G/Zb2ZCLsXC8FHYjjfXlnshknSCew==}
|
resolution: {integrity: sha512-RF5sbZOfYz5AK00tOJUn2PwFXR2fS1u2HVzI8D9VF9rGAFxuGBqg2bB1kJ3ZHMprqSltXnT9MZE1IsqjSM8oew==}
|
||||||
|
|
||||||
'@vue/reactivity@3.5.44':
|
'@vue/language-core@3.3.14':
|
||||||
resolution: {integrity: sha512-u+QJdKeBBEADkPdevsL+6E12QlYVfBD8Zcw5qjDQKtamI6l14KyqazJMobhCKelhWN5zpyKUiEDoTyHE93cqWw==}
|
resolution: {integrity: sha512-kRB+3hHg0c+BdD1XLAvwjVMQd5pC05zijSlPDRI3ERvC/s04JlRs5upy2KjeMg/9m9oD5zuMVh9yVvkKfZqoJg==}
|
||||||
|
|
||||||
'@vue/runtime-core@3.5.44':
|
'@vue/reactivity@3.5.45':
|
||||||
resolution: {integrity: sha512-uEa/ndwjhrrhnOfb2p+sZy6zeoamJOISqaLSJGk/8R6nABT1ZldpzcJoPzKj+zHVomVBPcmQYyC2r4LtvDV6CQ==}
|
resolution: {integrity: sha512-WqkyubNWpI4OYBOipSrjIssMdJO8K1i9Zts/Wm8Er10/0msOEwCyWWWvZnAI7WW3kQsTong6DJp8Cbb+vd4cPA==}
|
||||||
|
|
||||||
'@vue/runtime-dom@3.5.44':
|
'@vue/runtime-core@3.5.45':
|
||||||
resolution: {integrity: sha512-3fc4ARcXVhVBaJ3ujWiNZJARD6pkyRcwG+ZYhMzjKtKUp7MAY0HLwr7r3Smep3Li6ZaWT6ewdmx8XqdaD5oNZg==}
|
resolution: {integrity: sha512-bzIO3+FABjpj85uIKSc+Qnj36/sxDNI3tcH9i6w6xKA1k6e0ejv0G0jMCfeJBvK3yGL5XbJ3DMZj+ClqyCHFYw==}
|
||||||
|
|
||||||
'@vue/server-renderer@3.5.44':
|
'@vue/runtime-dom@3.5.45':
|
||||||
resolution: {integrity: sha512-R4S1UoH4h5Frrauv8Z5XE5TxV9oBiUSgWIC4TyVK1FK+RocRnOLwFA5Xcmo2011RlgJp+AbZCnw6afrhlgRuUQ==}
|
resolution: {integrity: sha512-ZvRTFMDgfqTDYWvJfoVpQTJx1RN5M6l7Pyd6wfdY2NaXzbPQVh9ezeQYFbNPP6bIcRVn2SqSSR25N/jSW69BFw==}
|
||||||
|
|
||||||
|
'@vue/server-renderer@3.5.45':
|
||||||
|
resolution: {integrity: sha512-1fNXUHhhsWf4EVL4XixbGBU5mKdiIXJAB82feHRTyPPo6ZUEYWIJuEeUl3mVV6QDBp50HJOX4obLhxYXlrjrzA==}
|
||||||
|
|
||||||
'@vue/shared@3.5.44':
|
'@vue/shared@3.5.44':
|
||||||
resolution: {integrity: sha512-H82XLH0DjmSOdbEwO15x3QTo1f5PWEtv237eLpYKc0mqLu+B8hnq16lFWmuBmNurkeiG3wr+oM1FhOll/YVFRg==}
|
resolution: {integrity: sha512-H82XLH0DjmSOdbEwO15x3QTo1f5PWEtv237eLpYKc0mqLu+B8hnq16lFWmuBmNurkeiG3wr+oM1FhOll/YVFRg==}
|
||||||
|
|
||||||
|
'@vue/shared@3.5.45':
|
||||||
|
resolution: {integrity: sha512-ue9fgHmVNPlP7iW3+cxoBX/Cnlw53dHlVSw0JKGY6z1lObg8pHoj928M2nzG4/yVsMZ3NaRZ2s2z61uC16NDwQ==}
|
||||||
|
|
||||||
alien-signals@3.2.1:
|
alien-signals@3.2.1:
|
||||||
resolution: {integrity: sha512-I8FjmltrfnDFoZedi5CG8DghVYNhzb/Ijluz7tCSJH0xpd0484Kowhbb1XDYOxfJpU1p5wnM2X54dA+IfGyD1g==}
|
resolution: {integrity: sha512-I8FjmltrfnDFoZedi5CG8DghVYNhzb/Ijluz7tCSJH0xpd0484Kowhbb1XDYOxfJpU1p5wnM2X54dA+IfGyD1g==}
|
||||||
|
|
||||||
@@ -631,13 +685,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
|
resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
playwright-core@1.64.1:
|
playwright-core@1.65.0:
|
||||||
resolution: {integrity: sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==}
|
resolution: {integrity: sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
playwright@1.64.1:
|
playwright@1.65.0:
|
||||||
resolution: {integrity: sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==}
|
resolution: {integrity: sha512-F3AMWcR44qMBt4kq+6Kb6mX7bjGXshktKFOPULd7reED6ZJWevjbNRqysP7q+AATE9kdPEZBibex1BYsvpVoeA==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -645,8 +699,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==}
|
resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
rolldown@1.2.15:
|
rolldown@1.2.19:
|
||||||
resolution: {integrity: sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g==}
|
resolution: {integrity: sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -669,6 +723,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
|
resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
|
||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
|
|
||||||
|
tslib@2.9.1:
|
||||||
|
resolution: {integrity: sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==}
|
||||||
|
|
||||||
typescript@6.0.3:
|
typescript@6.0.3:
|
||||||
resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
|
resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
|
||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
@@ -677,8 +734,8 @@ packages:
|
|||||||
undici-types@8.9.0:
|
undici-types@8.9.0:
|
||||||
resolution: {integrity: sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==}
|
resolution: {integrity: sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==}
|
||||||
|
|
||||||
vite@8.3.5:
|
vite@8.3.8:
|
||||||
resolution: {integrity: sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==}
|
resolution: {integrity: sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -720,20 +777,20 @@ packages:
|
|||||||
yaml:
|
yaml:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
vitest@5.0.5:
|
vitest@5.1.0:
|
||||||
resolution: {integrity: sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==}
|
resolution: {integrity: sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==}
|
||||||
engines: {node: ^22.12.0 || ^24.0.0 || >=26.0.0}
|
engines: {node: ^22.12.0 || ^24.0.0 || >=26.0.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@edge-runtime/vm': '*'
|
'@edge-runtime/vm': '*'
|
||||||
'@opentelemetry/api': ^1.9.0
|
'@opentelemetry/api': ^1.9.0
|
||||||
'@types/node': ^22.0.0 || >=24.0.0
|
'@types/node': ^22.0.0 || >=24.0.0
|
||||||
'@vitest/browser-playwright': 5.0.5
|
'@vitest/browser-playwright': 5.1.0
|
||||||
'@vitest/browser-preview': 5.0.5
|
'@vitest/browser-preview': 5.1.0
|
||||||
'@vitest/browser-webdriverio': ^5.0.0-beta.5 || >=5.0.0
|
'@vitest/browser-webdriverio': ^5.0.0-beta.5 || >=5.0.0
|
||||||
'@vitest/coverage-istanbul': 5.0.5
|
'@vitest/coverage-istanbul': 5.1.0
|
||||||
'@vitest/coverage-v8': 5.0.5
|
'@vitest/coverage-v8': 5.1.0
|
||||||
'@vitest/ui': 5.0.5
|
'@vitest/ui': 5.1.0
|
||||||
happy-dom: '*'
|
happy-dom: '*'
|
||||||
jsdom: '*'
|
jsdom: '*'
|
||||||
vite: ^6.4.0 || ^7.0.0 || ^8.0.0
|
vite: ^6.4.0 || ^7.0.0 || ^8.0.0
|
||||||
@@ -761,17 +818,30 @@ packages:
|
|||||||
jsdom:
|
jsdom:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
vscode-jsonrpc@10.0.0:
|
||||||
|
resolution: {integrity: sha512-USSfxg0vDIpTQqlQBGxF3mBARyoS8cU7LHLpbYNh6dOJt32dlskxPWB0Irrh5TllTmyf7oNLAvqDqzklbwwnpA==}
|
||||||
|
engines: {node: '>=14.17.0'}
|
||||||
|
|
||||||
|
vscode-languageserver-protocol@3.18.5:
|
||||||
|
resolution: {integrity: sha512-FW4fBMzZ99N8xeob4py0l050wgCoRgTpEq5Xcsb9lM1bc29UKGR/wSV+4knaqFxssFHajy7OzNiKP/m3U1ZEuA==}
|
||||||
|
|
||||||
|
vscode-languageserver-textdocument@1.0.16:
|
||||||
|
resolution: {integrity: sha512-qeNEuOi9a3qkqRf7Gfez2WL2VwlBTLCNekHBGO9kxPVUp9XuY15yfTJ9jwvOwKI0I2MhUUfZq95NSp+LK1CLQg==}
|
||||||
|
|
||||||
|
vscode-languageserver-types@3.18.5:
|
||||||
|
resolution: {integrity: sha512-kPd6+JQNz3HMJvjKlqUxERSlZHAntl/aGpsk7ImwIh0ewDKDcjgAEyVSYciPiOJD3ftbK9IrfiqUeTZLSbCizw==}
|
||||||
|
|
||||||
vscode-uri@3.2.0:
|
vscode-uri@3.2.0:
|
||||||
resolution: {integrity: sha512-m2gXo3bn0G1kT9InzMf07fTbqMbGtyckj3bH5ktLO+1Ssv+yiATZ4dhwaQv9UZWxJh6E9IFGnQyjgWVDWVBDrg==}
|
resolution: {integrity: sha512-m2gXo3bn0G1kT9InzMf07fTbqMbGtyckj3bH5ktLO+1Ssv+yiATZ4dhwaQv9UZWxJh6E9IFGnQyjgWVDWVBDrg==}
|
||||||
|
|
||||||
vue-tsc@3.3.13:
|
vue-tsc@3.3.14:
|
||||||
resolution: {integrity: sha512-jE4/bXdOMSHVxEGgQCqNllJy+9N3Gx6tfSAsg0yhFK/MAN6eXqISihupnDEKSCt12VVnjN2gI3AqLYcqoh5x/A==}
|
resolution: {integrity: sha512-URAu2H9AuMZMg9GCgnqbaHHHd8pBZRAwNV2e2yYS8VDsoTVXHiOSo663OS6DkEvauQ2yixn5TPFJ9WV9QIspkA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=5.0.0'
|
typescript: '>=5.0.0'
|
||||||
|
|
||||||
vue@3.5.44:
|
vue@3.5.45:
|
||||||
resolution: {integrity: sha512-dvvmaOCG7lAMkJTPqPwWeGMsPS6DIsFsfZDUgBp9V6mHf9b3+/wyVwYR4Es+WV6uJC0FKRxp81Obcq0ZwUcGFQ==}
|
resolution: {integrity: sha512-3cvsib8m9c0vB24+MDKsgcW4+Da4xaBl9Z/5Tbm2pmSIsRPxcil4cdXjXlVsmJ2g64XJo5h+IRd7rsdGT9pZaw==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '*'
|
typescript: '*'
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
@@ -783,8 +853,8 @@ packages:
|
|||||||
engines: {node: '>=20.11'}
|
engines: {node: '>=20.11'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
ws@8.22.0:
|
ws@8.23.0:
|
||||||
resolution: {integrity: sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==}
|
resolution: {integrity: sha512-wCkmX8QMOrKjgO8HW2WyDbTSGeqkocxgDzS9iR79rEAexty6/2qzilx3Ag8Tqf9ykop3irLKle0MtVn5qjVnoQ==}
|
||||||
engines: {node: '>=10.0.0'}
|
engines: {node: '>=10.0.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
bufferutil: ^4.0.1
|
bufferutil: ^4.0.1
|
||||||
@@ -799,17 +869,28 @@ snapshots:
|
|||||||
|
|
||||||
'@babel/helper-string-parser@7.29.11': {}
|
'@babel/helper-string-parser@7.29.11': {}
|
||||||
|
|
||||||
|
'@babel/helper-string-parser@7.29.14': {}
|
||||||
|
|
||||||
'@babel/helper-validator-identifier@7.29.7': {}
|
'@babel/helper-validator-identifier@7.29.7': {}
|
||||||
|
|
||||||
'@babel/parser@7.29.11':
|
'@babel/parser@7.29.11':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/types': 7.29.11
|
'@babel/types': 7.29.11
|
||||||
|
|
||||||
|
'@babel/parser@7.29.14':
|
||||||
|
dependencies:
|
||||||
|
'@babel/types': 7.29.14
|
||||||
|
|
||||||
'@babel/types@7.29.11':
|
'@babel/types@7.29.11':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/helper-string-parser': 7.29.11
|
'@babel/helper-string-parser': 7.29.11
|
||||||
'@babel/helper-validator-identifier': 7.29.7
|
'@babel/helper-validator-identifier': 7.29.7
|
||||||
|
|
||||||
|
'@babel/types@7.29.14':
|
||||||
|
dependencies:
|
||||||
|
'@babel/helper-string-parser': 7.29.14
|
||||||
|
'@babel/helper-validator-identifier': 7.29.7
|
||||||
|
|
||||||
'@biomejs/biome@2.6.3':
|
'@biomejs/biome@2.6.3':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@biomejs/cli-android-arm64': 2.6.3
|
'@biomejs/cli-android-arm64': 2.6.3
|
||||||
@@ -853,6 +934,22 @@ snapshots:
|
|||||||
'@biomejs/cli-win32-x64@2.6.3':
|
'@biomejs/cli-win32-x64@2.6.3':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@emnapi/core@2.0.0-beta.2':
|
||||||
|
dependencies:
|
||||||
|
'@emnapi/wasi-threads': 2.2.0
|
||||||
|
tslib: 2.9.1
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@emnapi/runtime@2.0.0-beta.2':
|
||||||
|
dependencies:
|
||||||
|
tslib: 2.9.1
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@emnapi/wasi-threads@2.2.0':
|
||||||
|
dependencies:
|
||||||
|
tslib: 2.9.1
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@jridgewell/resolve-uri@3.1.2': {}
|
'@jridgewell/resolve-uri@3.1.2': {}
|
||||||
|
|
||||||
'@jridgewell/sourcemap-codec@1.6.0': {}
|
'@jridgewell/sourcemap-codec@1.6.0': {}
|
||||||
@@ -862,59 +959,78 @@ snapshots:
|
|||||||
'@jridgewell/resolve-uri': 3.1.2
|
'@jridgewell/resolve-uri': 3.1.2
|
||||||
'@jridgewell/sourcemap-codec': 1.6.0
|
'@jridgewell/sourcemap-codec': 1.6.0
|
||||||
|
|
||||||
'@oxc-project/types@0.155.0': {}
|
'@napi-rs/wasm-runtime@1.2.6(@emnapi/core@2.0.0-beta.2)(@emnapi/runtime@2.0.0-beta.2)':
|
||||||
|
|
||||||
'@playwright/test@1.64.1':
|
|
||||||
dependencies:
|
dependencies:
|
||||||
playwright: 1.64.1
|
'@emnapi/core': 2.0.0-beta.2
|
||||||
|
'@emnapi/runtime': 2.0.0-beta.2
|
||||||
'@rolldown/binding-android-arm-eabi@1.2.15':
|
'@tybys/wasm-util': 0.10.4
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-android-arm64@1.2.15':
|
'@oxc-project/types@0.156.0': {}
|
||||||
|
|
||||||
|
'@playwright/test@1.65.0':
|
||||||
|
dependencies:
|
||||||
|
playwright: 1.65.0
|
||||||
|
|
||||||
|
'@rolldown/binding-android-arm-eabi@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-darwin-arm64@1.2.15':
|
'@rolldown/binding-android-arm64@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-darwin-x64@1.2.15':
|
'@rolldown/binding-darwin-arm64@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-freebsd-x64@1.2.15':
|
'@rolldown/binding-darwin-x64@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-linux-arm-gnueabihf@1.2.15':
|
'@rolldown/binding-freebsd-x64@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-linux-arm64-gnu@1.2.15':
|
'@rolldown/binding-linux-arm-gnueabihf@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-linux-arm64-musl@1.2.15':
|
'@rolldown/binding-linux-arm64-gnu@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-linux-ppc64-gnu@1.2.15':
|
'@rolldown/binding-linux-arm64-musl@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-linux-s390x-gnu@1.2.15':
|
'@rolldown/binding-linux-ppc64-gnu@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-linux-x64-gnu@1.2.15':
|
'@rolldown/binding-linux-s390x-gnu@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-linux-x64-musl@1.2.15':
|
'@rolldown/binding-linux-x64-gnu@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-openharmony-arm64@1.2.15':
|
'@rolldown/binding-linux-x64-musl@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-win32-arm64-msvc@1.2.15':
|
'@rolldown/binding-openharmony-arm64@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-win32-x64-msvc@1.2.15':
|
'@rolldown/binding-wasm32-wasi@1.2.19':
|
||||||
|
dependencies:
|
||||||
|
'@emnapi/core': 2.0.0-beta.2
|
||||||
|
'@emnapi/runtime': 2.0.0-beta.2
|
||||||
|
'@napi-rs/wasm-runtime': 1.2.6(@emnapi/core@2.0.0-beta.2)(@emnapi/runtime@2.0.0-beta.2)
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@rolldown/binding-win32-arm64-msvc@1.2.19':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@rolldown/binding-win32-x64-msvc@1.2.19':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/pluginutils@1.0.1': {}
|
'@rolldown/pluginutils@1.0.1': {}
|
||||||
|
|
||||||
|
'@tybys/wasm-util@0.10.4':
|
||||||
|
dependencies:
|
||||||
|
tslib: 2.9.1
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@types/chai@5.2.3':
|
'@types/chai@5.2.3':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/deep-eql': 4.0.2
|
'@types/deep-eql': 4.0.2
|
||||||
@@ -922,38 +1038,48 @@ snapshots:
|
|||||||
|
|
||||||
'@types/deep-eql@4.0.2': {}
|
'@types/deep-eql@4.0.2': {}
|
||||||
|
|
||||||
'@types/estree@1.0.9': {}
|
'@types/estree@1.0.10': {}
|
||||||
|
|
||||||
'@types/node@26.6.5':
|
'@types/node@26.6.6':
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: 8.9.0
|
undici-types: 8.9.0
|
||||||
|
|
||||||
'@vitejs/plugin-vue@6.0.10(vite@8.3.5(@types/node@26.6.5))(vue@3.5.44(typescript@6.0.3))':
|
'@vitejs/plugin-vue@6.0.11(vite@8.3.8(@types/node@26.6.6))(vue@3.5.45(typescript@6.0.3))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@rolldown/pluginutils': 1.0.1
|
'@rolldown/pluginutils': 1.0.1
|
||||||
vite: 8.3.5(@types/node@26.6.5)
|
vite: 8.3.8(@types/node@26.6.6)
|
||||||
vue: 3.5.44(typescript@6.0.3)
|
vue: 3.5.45(typescript@6.0.3)
|
||||||
|
|
||||||
'@vitest/mocker@5.0.5(vite@8.3.5(@types/node@26.6.5))':
|
'@vitest/mocker@5.1.0(vite@8.3.8(@types/node@26.6.6))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jridgewell/trace-mapping': 0.3.31
|
'@jridgewell/trace-mapping': 0.3.31
|
||||||
'@vitest/spy': 5.0.5
|
'@vitest/spy': 5.1.0
|
||||||
estree-walker: 3.0.3
|
estree-walker: 3.0.3
|
||||||
magic-string: 1.4.5
|
magic-string: 1.4.5
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
vite: 8.3.5(@types/node@26.6.5)
|
vite: 8.3.8(@types/node@26.6.6)
|
||||||
|
|
||||||
'@vitest/spy@5.0.5': {}
|
'@vitest/spy@5.1.0': {}
|
||||||
|
|
||||||
'@volar/language-core@2.4.28':
|
'@volar/language-core@2.4.30':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@volar/source-map': 2.4.28
|
'@volar/source-map': 2.4.30
|
||||||
|
|
||||||
'@volar/source-map@2.4.28': {}
|
'@volar/language-service@2.4.30(typescript@6.0.3)':
|
||||||
|
|
||||||
'@volar/typescript@2.4.28(typescript@6.0.3)':
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@volar/language-core': 2.4.28
|
'@volar/language-core': 2.4.30
|
||||||
|
vscode-languageserver-protocol: 3.18.5
|
||||||
|
vscode-languageserver-textdocument: 1.0.16
|
||||||
|
vscode-uri: 3.2.0
|
||||||
|
optionalDependencies:
|
||||||
|
typescript: 6.0.3
|
||||||
|
|
||||||
|
'@volar/source-map@2.4.30': {}
|
||||||
|
|
||||||
|
'@volar/typescript@2.4.30(typescript@6.0.3)':
|
||||||
|
dependencies:
|
||||||
|
'@volar/language-core': 2.4.30
|
||||||
|
'@volar/language-service': 2.4.30(typescript@6.0.3)
|
||||||
path-browserify: 1.0.1
|
path-browserify: 1.0.1
|
||||||
vscode-uri: 3.2.0
|
vscode-uri: 3.2.0
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
@@ -967,31 +1093,44 @@ snapshots:
|
|||||||
estree-walker: 2.0.2
|
estree-walker: 2.0.2
|
||||||
source-map-js: 1.2.2
|
source-map-js: 1.2.2
|
||||||
|
|
||||||
|
'@vue/compiler-core@3.5.45':
|
||||||
|
dependencies:
|
||||||
|
'@babel/parser': 7.29.14
|
||||||
|
'@vue/shared': 3.5.45
|
||||||
|
entities: 7.0.1
|
||||||
|
estree-walker: 2.0.2
|
||||||
|
source-map-js: 1.2.2
|
||||||
|
|
||||||
'@vue/compiler-dom@3.5.44':
|
'@vue/compiler-dom@3.5.44':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/compiler-core': 3.5.44
|
'@vue/compiler-core': 3.5.44
|
||||||
'@vue/shared': 3.5.44
|
'@vue/shared': 3.5.44
|
||||||
|
|
||||||
'@vue/compiler-sfc@3.5.44':
|
'@vue/compiler-dom@3.5.45':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/parser': 7.29.11
|
'@vue/compiler-core': 3.5.45
|
||||||
'@vue/compiler-core': 3.5.44
|
'@vue/shared': 3.5.45
|
||||||
'@vue/compiler-dom': 3.5.44
|
|
||||||
'@vue/compiler-ssr': 3.5.44
|
'@vue/compiler-sfc@3.5.45':
|
||||||
'@vue/shared': 3.5.44
|
dependencies:
|
||||||
|
'@babel/parser': 7.29.14
|
||||||
|
'@vue/compiler-core': 3.5.45
|
||||||
|
'@vue/compiler-dom': 3.5.45
|
||||||
|
'@vue/compiler-ssr': 3.5.45
|
||||||
|
'@vue/shared': 3.5.45
|
||||||
estree-walker: 2.0.2
|
estree-walker: 2.0.2
|
||||||
magic-string: 0.30.21
|
magic-string: 0.30.21
|
||||||
postcss: 8.5.32
|
postcss: 8.5.32
|
||||||
source-map-js: 1.2.2
|
source-map-js: 1.2.2
|
||||||
|
|
||||||
'@vue/compiler-ssr@3.5.44':
|
'@vue/compiler-ssr@3.5.45':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/compiler-dom': 3.5.44
|
'@vue/compiler-dom': 3.5.45
|
||||||
'@vue/shared': 3.5.44
|
'@vue/shared': 3.5.45
|
||||||
|
|
||||||
'@vue/language-core@3.3.13':
|
'@vue/language-core@3.3.14':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@volar/language-core': 2.4.28
|
'@volar/language-core': 2.4.30
|
||||||
'@vue/compiler-dom': 3.5.44
|
'@vue/compiler-dom': 3.5.44
|
||||||
'@vue/shared': 3.5.44
|
'@vue/shared': 3.5.44
|
||||||
alien-signals: 3.2.1
|
alien-signals: 3.2.1
|
||||||
@@ -999,30 +1138,32 @@ snapshots:
|
|||||||
path-browserify: 1.0.1
|
path-browserify: 1.0.1
|
||||||
picomatch: 4.0.7
|
picomatch: 4.0.7
|
||||||
|
|
||||||
'@vue/reactivity@3.5.44':
|
'@vue/reactivity@3.5.45':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/shared': 3.5.44
|
'@vue/shared': 3.5.45
|
||||||
|
|
||||||
'@vue/runtime-core@3.5.44':
|
'@vue/runtime-core@3.5.45':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/reactivity': 3.5.44
|
'@vue/reactivity': 3.5.45
|
||||||
'@vue/shared': 3.5.44
|
'@vue/shared': 3.5.45
|
||||||
|
|
||||||
'@vue/runtime-dom@3.5.44':
|
'@vue/runtime-dom@3.5.45':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/reactivity': 3.5.44
|
'@vue/reactivity': 3.5.45
|
||||||
'@vue/runtime-core': 3.5.44
|
'@vue/runtime-core': 3.5.45
|
||||||
'@vue/shared': 3.5.44
|
'@vue/shared': 3.5.45
|
||||||
csstype: 3.2.3
|
csstype: 3.2.3
|
||||||
|
|
||||||
'@vue/server-renderer@3.5.44':
|
'@vue/server-renderer@3.5.45':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/compiler-ssr': 3.5.44
|
'@vue/compiler-ssr': 3.5.45
|
||||||
'@vue/runtime-dom': 3.5.44
|
'@vue/runtime-dom': 3.5.45
|
||||||
'@vue/shared': 3.5.44
|
'@vue/shared': 3.5.45
|
||||||
|
|
||||||
'@vue/shared@3.5.44': {}
|
'@vue/shared@3.5.44': {}
|
||||||
|
|
||||||
|
'@vue/shared@3.5.45': {}
|
||||||
|
|
||||||
alien-signals@3.2.1: {}
|
alien-signals@3.2.1: {}
|
||||||
|
|
||||||
assertion-error@2.0.1: {}
|
assertion-error@2.0.1: {}
|
||||||
@@ -1041,7 +1182,7 @@ snapshots:
|
|||||||
|
|
||||||
estree-walker@3.0.3:
|
estree-walker@3.0.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/estree': 1.0.9
|
'@types/estree': 1.0.10
|
||||||
|
|
||||||
expect-type@1.4.0: {}
|
expect-type@1.4.0: {}
|
||||||
|
|
||||||
@@ -1121,11 +1262,11 @@ snapshots:
|
|||||||
|
|
||||||
picomatch@4.0.7: {}
|
picomatch@4.0.7: {}
|
||||||
|
|
||||||
playwright-core@1.64.1: {}
|
playwright-core@1.65.0: {}
|
||||||
|
|
||||||
playwright@1.64.1:
|
playwright@1.65.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
playwright-core: 1.64.1
|
playwright-core: 1.65.0
|
||||||
|
|
||||||
postcss@8.5.32:
|
postcss@8.5.32:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1133,26 +1274,27 @@ snapshots:
|
|||||||
picocolors: 1.1.1
|
picocolors: 1.1.1
|
||||||
source-map-js: 1.2.2
|
source-map-js: 1.2.2
|
||||||
|
|
||||||
rolldown@1.2.15:
|
rolldown@1.2.19:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@oxc-project/types': 0.155.0
|
'@oxc-project/types': 0.156.0
|
||||||
'@rolldown/pluginutils': 1.0.1
|
'@rolldown/pluginutils': 1.0.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@rolldown/binding-android-arm-eabi': 1.2.15
|
'@rolldown/binding-android-arm-eabi': 1.2.19
|
||||||
'@rolldown/binding-android-arm64': 1.2.15
|
'@rolldown/binding-android-arm64': 1.2.19
|
||||||
'@rolldown/binding-darwin-arm64': 1.2.15
|
'@rolldown/binding-darwin-arm64': 1.2.19
|
||||||
'@rolldown/binding-darwin-x64': 1.2.15
|
'@rolldown/binding-darwin-x64': 1.2.19
|
||||||
'@rolldown/binding-freebsd-x64': 1.2.15
|
'@rolldown/binding-freebsd-x64': 1.2.19
|
||||||
'@rolldown/binding-linux-arm-gnueabihf': 1.2.15
|
'@rolldown/binding-linux-arm-gnueabihf': 1.2.19
|
||||||
'@rolldown/binding-linux-arm64-gnu': 1.2.15
|
'@rolldown/binding-linux-arm64-gnu': 1.2.19
|
||||||
'@rolldown/binding-linux-arm64-musl': 1.2.15
|
'@rolldown/binding-linux-arm64-musl': 1.2.19
|
||||||
'@rolldown/binding-linux-ppc64-gnu': 1.2.15
|
'@rolldown/binding-linux-ppc64-gnu': 1.2.19
|
||||||
'@rolldown/binding-linux-s390x-gnu': 1.2.15
|
'@rolldown/binding-linux-s390x-gnu': 1.2.19
|
||||||
'@rolldown/binding-linux-x64-gnu': 1.2.15
|
'@rolldown/binding-linux-x64-gnu': 1.2.19
|
||||||
'@rolldown/binding-linux-x64-musl': 1.2.15
|
'@rolldown/binding-linux-x64-musl': 1.2.19
|
||||||
'@rolldown/binding-openharmony-arm64': 1.2.15
|
'@rolldown/binding-openharmony-arm64': 1.2.19
|
||||||
'@rolldown/binding-win32-arm64-msvc': 1.2.15
|
'@rolldown/binding-wasm32-wasi': 1.2.19
|
||||||
'@rolldown/binding-win32-x64-msvc': 1.2.15
|
'@rolldown/binding-win32-arm64-msvc': 1.2.19
|
||||||
|
'@rolldown/binding-win32-x64-msvc': 1.2.19
|
||||||
|
|
||||||
source-map-js@1.2.2: {}
|
source-map-js@1.2.2: {}
|
||||||
|
|
||||||
@@ -1167,25 +1309,28 @@ snapshots:
|
|||||||
fdir: 6.5.0(picomatch@4.0.7)
|
fdir: 6.5.0(picomatch@4.0.7)
|
||||||
picomatch: 4.0.7
|
picomatch: 4.0.7
|
||||||
|
|
||||||
|
tslib@2.9.1:
|
||||||
|
optional: true
|
||||||
|
|
||||||
typescript@6.0.3: {}
|
typescript@6.0.3: {}
|
||||||
|
|
||||||
undici-types@8.9.0: {}
|
undici-types@8.9.0: {}
|
||||||
|
|
||||||
vite@8.3.5(@types/node@26.6.5):
|
vite@8.3.8(@types/node@26.6.6):
|
||||||
dependencies:
|
dependencies:
|
||||||
lightningcss: 1.33.0
|
lightningcss: 1.33.0
|
||||||
picomatch: 4.0.7
|
picomatch: 4.0.7
|
||||||
postcss: 8.5.32
|
postcss: 8.5.32
|
||||||
rolldown: 1.2.15
|
rolldown: 1.2.19
|
||||||
tinyglobby: 0.2.17
|
tinyglobby: 0.2.17
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/node': 26.6.5
|
'@types/node': 26.6.6
|
||||||
fsevents: 2.3.3
|
fsevents: 2.3.3
|
||||||
|
|
||||||
vitest@5.0.5(@types/node@26.6.5)(vite@8.3.5(@types/node@26.6.5)):
|
vitest@5.1.0(@types/node@26.6.6)(vite@8.3.8(@types/node@26.6.6)):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/chai': 5.2.3
|
'@types/chai': 5.2.3
|
||||||
'@vitest/mocker': 5.0.5(vite@8.3.5(@types/node@26.6.5))
|
'@vitest/mocker': 5.1.0(vite@8.3.8(@types/node@26.6.6))
|
||||||
chai: 6.3.0
|
chai: 6.3.0
|
||||||
es-module-lexer: 2.3.2
|
es-module-lexer: 2.3.2
|
||||||
expect-type: 1.4.0
|
expect-type: 1.4.0
|
||||||
@@ -1196,31 +1341,42 @@ snapshots:
|
|||||||
tinybench: 6.2.2
|
tinybench: 6.2.2
|
||||||
tinyexec: 1.3.1
|
tinyexec: 1.3.1
|
||||||
tinyglobby: 0.2.17
|
tinyglobby: 0.2.17
|
||||||
vite: 8.3.5(@types/node@26.6.5)
|
vite: 8.3.8(@types/node@26.6.6)
|
||||||
why-is-node-running: 3.2.1
|
why-is-node-running: 3.2.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/node': 26.6.5
|
'@types/node': 26.6.6
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- msw
|
- msw
|
||||||
|
|
||||||
|
vscode-jsonrpc@10.0.0: {}
|
||||||
|
|
||||||
|
vscode-languageserver-protocol@3.18.5:
|
||||||
|
dependencies:
|
||||||
|
vscode-jsonrpc: 10.0.0
|
||||||
|
vscode-languageserver-types: 3.18.5
|
||||||
|
|
||||||
|
vscode-languageserver-textdocument@1.0.16: {}
|
||||||
|
|
||||||
|
vscode-languageserver-types@3.18.5: {}
|
||||||
|
|
||||||
vscode-uri@3.2.0: {}
|
vscode-uri@3.2.0: {}
|
||||||
|
|
||||||
vue-tsc@3.3.13(typescript@6.0.3):
|
vue-tsc@3.3.14(typescript@6.0.3):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@volar/typescript': 2.4.28(typescript@6.0.3)
|
'@volar/typescript': 2.4.30(typescript@6.0.3)
|
||||||
'@vue/language-core': 3.3.13
|
'@vue/language-core': 3.3.14
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
|
|
||||||
vue@3.5.44(typescript@6.0.3):
|
vue@3.5.45(typescript@6.0.3):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/compiler-dom': 3.5.44
|
'@vue/compiler-dom': 3.5.45
|
||||||
'@vue/compiler-sfc': 3.5.44
|
'@vue/compiler-sfc': 3.5.45
|
||||||
'@vue/runtime-dom': 3.5.44
|
'@vue/runtime-dom': 3.5.45
|
||||||
'@vue/server-renderer': 3.5.44
|
'@vue/server-renderer': 3.5.45
|
||||||
'@vue/shared': 3.5.44
|
'@vue/shared': 3.5.45
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
|
|
||||||
why-is-node-running@3.2.1: {}
|
why-is-node-running@3.2.1: {}
|
||||||
|
|
||||||
ws@8.22.0: {}
|
ws@8.23.0: {}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
minimumReleaseAgeExclude:
|
||||||
|
- ws@8.23.0
|
||||||
+33
-8
@@ -2,13 +2,36 @@
|
|||||||
// because service workers can only be registered from a same-origin script URL. Registered with the
|
// because service workers can only be registered from a same-origin script URL. Registered with the
|
||||||
// scope download/ by src/download.ts, its counterpart in the page, it sees no other requests.
|
// scope download/ by src/download.ts, its counterpart in the page, it sees no other requests.
|
||||||
|
|
||||||
|
// Of the messages with the page, see VERSION in src/download.ts.
|
||||||
|
const VERSION = 1;
|
||||||
|
|
||||||
// Downloads by id while the page sends chunks: the queue, the stream controller, its wake up, the
|
// Downloads by id while the page sends chunks: the queue, the stream controller, its wake up, the
|
||||||
// reply port and how many bytes the download manager has read.
|
// reply port and how many bytes the download manager has read.
|
||||||
const downloads = new Map();
|
const downloads = new Map();
|
||||||
// Responses by download id, until the download navigation fetches them. Each is served only once.
|
// Responses by download id, until the download navigation fetches them. Each is served only once.
|
||||||
const responses = new Map();
|
const responses = new Map();
|
||||||
|
// The page pings every KEEPALIVE while a transfer stalls, see src/download.ts. Silent for this long,
|
||||||
|
// it is gone, e.g. its tab was closed: Firefox would stop this worker 30 s after the last event and
|
||||||
|
// save the truncated file as complete. A failed stream leaves the download failed instead. A page
|
||||||
|
// that is still there, only late, e.g. throttled in the background, is told with silent.
|
||||||
|
const SILENCE = 20_000;
|
||||||
|
|
||||||
function open(id, { name, size }, port) {
|
function watch(id, download) {
|
||||||
|
clearTimeout(download.watchdog);
|
||||||
|
download.watchdog = setTimeout(() => {
|
||||||
|
download.controller.error(new Error('the page is gone'));
|
||||||
|
forget(id);
|
||||||
|
download.port.postMessage('silent');
|
||||||
|
}, SILENCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
function forget(id) {
|
||||||
|
clearTimeout(downloads.get(id)?.watchdog);
|
||||||
|
downloads.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function open(id, { version, name, size }, port) {
|
||||||
|
if (version !== VERSION) return port.postMessage('outdated');
|
||||||
// The page checks the sender's offer already. Anything else would throw below or lie to the browser.
|
// The page checks the sender's offer already. Anything else would throw below or lie to the browser.
|
||||||
if (typeof name !== 'string' || !Number.isSafeInteger(size) || size < 0) return port.postMessage('failed');
|
if (typeof name !== 'string' || !Number.isSafeInteger(size) || size < 0) return port.postMessage('failed');
|
||||||
const download = { chunks: [], wake: () => {}, port, read: 0, reported: 0 };
|
const download = { chunks: [], wake: () => {}, port, read: 0, reported: 0 };
|
||||||
@@ -30,18 +53,19 @@ function open(id, { name, size }, port) {
|
|||||||
return controller.enqueue(chunk);
|
return controller.enqueue(chunk);
|
||||||
}
|
}
|
||||||
controller.close();
|
controller.close();
|
||||||
downloads.delete(id);
|
forget(id);
|
||||||
port.postMessage('finished');
|
port.postMessage('finished');
|
||||||
},
|
},
|
||||||
// The user cancelled the download.
|
// The user cancelled the download.
|
||||||
cancel: () => {
|
cancel: () => {
|
||||||
downloads.delete(id);
|
forget(id);
|
||||||
port.postMessage('cancelled');
|
port.postMessage('cancelled');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ highWaterMark: 0 },
|
{ highWaterMark: 0 },
|
||||||
);
|
);
|
||||||
downloads.set(id, download);
|
downloads.set(id, download);
|
||||||
|
watch(id, download);
|
||||||
|
|
||||||
// RFC 8187 encoding, which leaves nothing in the name that could end the header value.
|
// RFC 8187 encoding, which leaves nothing in the name that could end the header value.
|
||||||
const encoded = encodeURIComponent(name.toWellFormed()).replace(
|
const encoded = encodeURIComponent(name.toWellFormed()).replace(
|
||||||
@@ -57,17 +81,18 @@ function open(id, { name, size }, port) {
|
|||||||
port.postMessage('ready');
|
port.postMessage('ready');
|
||||||
}
|
}
|
||||||
|
|
||||||
// The page posts the metadata with a reply port first, then every chunk as its own message and
|
// The page posts its version and the metadata with a reply port first, then every chunk as its own
|
||||||
// finally done (queued as the end marker null) or an error. Pings come in between.
|
// message and finally done (queued as the end marker null) or an error. Pings come in between.
|
||||||
self.addEventListener('message', ({ data, ports: [port] }) => {
|
self.addEventListener('message', ({ data, ports: [port] }) => {
|
||||||
// Only keeps this worker alive while a transfer stalls, see KEEPALIVE in src/download.ts.
|
|
||||||
if (data.ping) return;
|
|
||||||
if (port) return open(data.id, data, port);
|
if (port) return open(data.id, data, port);
|
||||||
const download = downloads.get(data.id);
|
const download = downloads.get(data.id);
|
||||||
if (!download) return;
|
if (!download) return;
|
||||||
|
watch(data.id, download);
|
||||||
|
// Only keeps this worker alive while a transfer stalls, see KEEPALIVE in src/download.ts.
|
||||||
|
if (data.ping) return;
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
download.controller.error(new Error(data.error));
|
download.controller.error(new Error(data.error));
|
||||||
downloads.delete(data.id);
|
forget(data.id);
|
||||||
download.port.postMessage('failed');
|
download.port.postMessage('failed');
|
||||||
} else {
|
} else {
|
||||||
download.chunks.push(data.chunk ? new Uint8Array(data.chunk) : null);
|
download.chunks.push(data.chunk ? new Uint8Array(data.chunk) : null);
|
||||||
|
|||||||
+112
-13
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive, ref, watch } from 'vue';
|
import { computed, reactive, ref, shallowRef, triggerRef, watch } from 'vue';
|
||||||
import {
|
import {
|
||||||
answerOffer,
|
answerOffer,
|
||||||
type Check,
|
type Check,
|
||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
formatTime,
|
formatTime,
|
||||||
type Incoming,
|
type Incoming,
|
||||||
type Phase,
|
type Phase,
|
||||||
|
PROTOCOL,
|
||||||
type ReceiveEvents,
|
type ReceiveEvents,
|
||||||
randomCode,
|
randomCode,
|
||||||
receiveViaTracker,
|
receiveViaTracker,
|
||||||
@@ -46,9 +47,23 @@ function isStun(url: string) {
|
|||||||
return stunChecks.get(url)!;
|
return stunChecks.get(url)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Every # starts a fragment, which WebSocket rejects even when empty.
|
// public/ in the build, which works under any path, see vite.config.ts.
|
||||||
const isTracker = (url: string) =>
|
const BASE = import.meta.env.BASE_URL;
|
||||||
URL.canParse(url) && ['ws:', 'wss:'].includes(new URL(url).protocol) && !url.includes('#');
|
|
||||||
|
// Every # starts a fragment, which WebSocket rejects even when empty. An https page may open ws: only
|
||||||
|
// to this device, browsers refuse it or fail it for anything else. That is localhost and its
|
||||||
|
// subdomains, 127.0.0.0/8 and ::1, URL writes every form of these addresses this way.
|
||||||
|
const secure = location.protocol === 'https:';
|
||||||
|
const isLocal = (hostname: string) =>
|
||||||
|
hostname === 'localhost' ||
|
||||||
|
hostname.endsWith('.localhost') ||
|
||||||
|
/^127\.\d+\.\d+\.\d+$/.test(hostname) ||
|
||||||
|
hostname === '[::1]';
|
||||||
|
const isTracker = (url: string) => {
|
||||||
|
if (!URL.canParse(url) || url.includes('#')) return false;
|
||||||
|
const { protocol, hostname } = new URL(url);
|
||||||
|
return protocol === 'wss:' || (protocol === 'ws:' && (!secure || isLocal(hostname)));
|
||||||
|
};
|
||||||
|
|
||||||
// A textarea with one URL per line for the list at settings[key], invalid lines are listed and skipped.
|
// A textarea with one URL per line for the list at settings[key], invalid lines are listed and skipped.
|
||||||
function serverList(key: 'stunServers' | 'trackers', valid: (url: string) => boolean) {
|
function serverList(key: 'stunServers' | 'trackers', valid: (url: string) => boolean) {
|
||||||
@@ -91,7 +106,12 @@ const receiveCode = ref('');
|
|||||||
|
|
||||||
const check = ref<Check>();
|
const check = ref<Check>();
|
||||||
const confirmed = ref(false);
|
const confirmed = ref(false);
|
||||||
const log = ref<string[]>([]);
|
// Changed in place and triggered, a deep ref would make each line cost every line kept.
|
||||||
|
const log = shallowRef<string[]>([]);
|
||||||
|
// Lines kept, the oldest go first and dropped counts them. A session logs a few dozen, a tracker or
|
||||||
|
// peer that sends garbage could add lines until the tab freezes.
|
||||||
|
const MAX_LOG = 1000;
|
||||||
|
const dropped = ref(0);
|
||||||
// Of the session, shown in the card of its side.
|
// Of the session, shown in the card of its side.
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const status = ref<{ phase: Phase; text: string }>();
|
const status = ref<{ phase: Phase; text: string }>();
|
||||||
@@ -100,7 +120,12 @@ const phase = computed(() => (error.value ? 'error' : status.value?.phase));
|
|||||||
|
|
||||||
// Shared by both sides, each adds its own progress.
|
// Shared by both sides, each adds its own progress.
|
||||||
const events: Omit<Events, 'progress'> = {
|
const events: Omit<Events, 'progress'> = {
|
||||||
log: (message) => log.value.push(`${new Date().toISOString().slice(11, 23)} ${message}`),
|
log: (message) => {
|
||||||
|
const lines = log.value;
|
||||||
|
lines.push(`${new Date().toISOString().slice(11, 23)} ${message}`);
|
||||||
|
if (lines.length > MAX_LOG) dropped.value += lines.splice(0, lines.length - MAX_LOG).length;
|
||||||
|
triggerRef(log);
|
||||||
|
},
|
||||||
error: (message) => {
|
error: (message) => {
|
||||||
events.log(message);
|
events.log(message);
|
||||||
error.value = message;
|
error.value = message;
|
||||||
@@ -217,15 +242,35 @@ async function attempt<T>(signal: AbortSignal, step: Promise<T>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The name of a dropped folder, until a file takes its place.
|
||||||
|
const folder = ref('');
|
||||||
|
|
||||||
|
function take(picked: File) {
|
||||||
|
file.value = picked;
|
||||||
|
folder.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// The input is emptied right away: Chromium fires no change event for the file its input already
|
||||||
|
// holds, though that file may have changed on disk, or another one was dropped since, which the
|
||||||
|
// input never saw. An event without a file has nothing to take. Empty, the input's own tooltip says no
|
||||||
|
// file is chosen, so its title names the one taken.
|
||||||
function onPick(event: Event) {
|
function onPick(event: Event) {
|
||||||
file.value = (event.target as HTMLInputElement).files?.[0];
|
const input = event.target as HTMLInputElement;
|
||||||
|
const picked = input.files?.[0];
|
||||||
|
input.value = '';
|
||||||
|
if (picked) take(picked);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dragging = ref(false);
|
const dragging = ref(false);
|
||||||
|
|
||||||
|
// A folder comes as a file too, one that can't be read: refused here, it would fail only once the
|
||||||
|
// receiver downloads it. The file picked before stays.
|
||||||
function onDrop(event: DragEvent) {
|
function onDrop(event: DragEvent) {
|
||||||
dragging.value = false;
|
dragging.value = false;
|
||||||
file.value = event.dataTransfer?.files[0] ?? file.value;
|
const dropped = event.dataTransfer?.files[0];
|
||||||
|
const entry = [...(event.dataTransfer?.items ?? [])].find((item) => item.kind === 'file')?.webkitGetAsEntry();
|
||||||
|
if (entry?.isDirectory) folder.value = entry.name;
|
||||||
|
else if (dropped) take(dropped);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatSize(bytes: number) {
|
function formatSize(bytes: number) {
|
||||||
@@ -283,12 +328,63 @@ function onReceive() {
|
|||||||
const saltLocked = computed(
|
const saltLocked = computed(
|
||||||
() => viaTracker.value && side.value === 'send' && !['error', 'done', 'stopped'].includes(phase.value!),
|
() => viaTracker.value && side.value === 'send' && !['error', 'done', 'stopped'].includes(phase.value!),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// While a share waits or a transfer runs. A phone that dims and locks may suspend the tab and the
|
||||||
|
// connection dies, a reload or a closed tab ends it for sure.
|
||||||
|
const busy = computed(() => ['start', 'wait', 'retry', 'transfer'].includes(phase.value!));
|
||||||
|
|
||||||
|
// The screen's, held while busy. The browser releases it whenever the page is hidden, so it's
|
||||||
|
// requested again once the page is visible.
|
||||||
|
let wakeLock: Promise<WakeLockSentinel | undefined> | undefined;
|
||||||
|
|
||||||
|
function holdWakeLock() {
|
||||||
|
// Missing outside a secure context, e.g. the dev server opened by its LAN address.
|
||||||
|
if (!busy.value || document.hidden || wakeLock || !navigator.wakeLock) return;
|
||||||
|
const request = navigator.wakeLock.request('screen').then(
|
||||||
|
(sentinel) => {
|
||||||
|
sentinel.addEventListener('release', () => {
|
||||||
|
if (wakeLock === request) wakeLock = undefined;
|
||||||
|
});
|
||||||
|
// Unless let go of meanwhile, releaseWakeLock releases it then.
|
||||||
|
if (wakeLock === request) events.log('keeping the screen on');
|
||||||
|
return sentinel;
|
||||||
|
},
|
||||||
|
(failure) => {
|
||||||
|
if (wakeLock === request) wakeLock = undefined;
|
||||||
|
events.log(`screen may lock: ${failure instanceof Error ? failure.message : failure}`);
|
||||||
|
return undefined;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
wakeLock = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forgotten right away, a session started before the browser released it requests a new one.
|
||||||
|
function releaseWakeLock() {
|
||||||
|
const request = wakeLock;
|
||||||
|
wakeLock = undefined;
|
||||||
|
request?.then((sentinel) => sentinel?.release());
|
||||||
|
}
|
||||||
|
|
||||||
|
// The browser asks before a reload or a closed tab ends it. Only while busy, a page with the handler
|
||||||
|
// may be kept out of the back/forward cache.
|
||||||
|
const confirmLeave = (event: BeforeUnloadEvent) => event.preventDefault();
|
||||||
|
|
||||||
|
watch(busy, (busy) => {
|
||||||
|
if (busy) {
|
||||||
|
holdWakeLock();
|
||||||
|
addEventListener('beforeunload', confirmLeave);
|
||||||
|
} else {
|
||||||
|
releaseWakeLock();
|
||||||
|
removeEventListener('beforeunload', confirmLeave);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.addEventListener('visibilitychange', holdWakeLock);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header>
|
<header>
|
||||||
<div>
|
<div>
|
||||||
<img src="/HellNet_alt.png" alt="" width="40" height="40" />
|
<img :src="`${BASE}HellNet_alt.png`" alt="" width="40" height="40" />
|
||||||
<h1>HellCon</h1>
|
<h1>HellCon</h1>
|
||||||
</div>
|
</div>
|
||||||
<div id="options">
|
<div id="options">
|
||||||
@@ -356,12 +452,13 @@ const saltLocked = computed(
|
|||||||
@dragleave="dragging = false"
|
@dragleave="dragging = false"
|
||||||
@drop.prevent="onDrop"
|
@drop.prevent="onDrop"
|
||||||
>
|
>
|
||||||
<input type="file" @change="onPick" />
|
<input type="file" :title="file?.name" @change="onPick" />
|
||||||
<template v-if="file">
|
<template v-if="file">
|
||||||
<strong>{{ file.name }}</strong>
|
<strong>{{ file.name }}</strong>
|
||||||
{{ formatSize(file.size) }}
|
{{ formatSize(file.size) }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else>Drop a file or click to choose</template>
|
<template v-else>Drop a file or click to choose</template>
|
||||||
|
<span v-if="folder" id="not-a-file" role="alert">{{ folder }} is a folder, only a single file can be sent</span>
|
||||||
</label>
|
</label>
|
||||||
<div v-if="side === 'send' && phase" :data-phase="phase">
|
<div v-if="side === 'send' && phase" :data-phase="phase">
|
||||||
<p v-if="shared !== file" id="send-file">{{ shared!.name }}</p>
|
<p v-if="shared !== file" id="send-file">{{ shared!.name }}</p>
|
||||||
@@ -513,7 +610,8 @@ const saltLocked = computed(
|
|||||||
<label for="trackers">WebTorrent trackers for the code exchange, one URL per line:</label>
|
<label for="trackers">WebTorrent trackers for the code exchange, one URL per line:</label>
|
||||||
<textarea id="trackers" v-model="trackers.text" :aria-invalid="!!trackers.invalid.length"></textarea>
|
<textarea id="trackers" v-model="trackers.text" :aria-invalid="!!trackers.invalid.length"></textarea>
|
||||||
<p v-if="trackers.invalid.length">
|
<p v-if="trackers.invalid.length">
|
||||||
Skipped, not a ws: or wss: URL without #: {{ trackers.invalid.join(', ') }}
|
Skipped, not a ws: or wss: URL without #{{ secure ? ', ws: only to this device on https' : '' }}:
|
||||||
|
{{ trackers.invalid.join(', ') }}
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<button id="reset-servers" type="button" @click="onResetServers">Reset to defaults</button>
|
<button id="reset-servers" type="button" @click="onResetServers">Reset to defaults</button>
|
||||||
@@ -522,14 +620,15 @@ const saltLocked = computed(
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Log</summary>
|
<summary>Log</summary>
|
||||||
<pre id="log">{{ log.join('\n') }}</pre>
|
<pre id="log">{{ dropped ? `${dropped} earlier lines dropped\n` : '' }}{{ log.join('\n') }}</pre>
|
||||||
</details>
|
</details>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<a href="https://gitea.pagequit.net/Schluffe/HellCon" target="_blank" rel="noopener noreferrer">
|
<a href="https://gitea.pagequit.net/Schluffe/HellCon" target="_blank" rel="noopener noreferrer">
|
||||||
<img src="/gitea.svg" alt="" width="20" height="20" />
|
<img :src="`${BASE}gitea.svg`" alt="" width="20" height="20" />
|
||||||
Source code
|
Source code
|
||||||
</a>
|
</a>
|
||||||
|
<span>Protocol {{ PROTOCOL }}</span>
|
||||||
</footer>
|
</footer>
|
||||||
</template>
|
</template>
|
||||||
+291
-24
@@ -1,7 +1,7 @@
|
|||||||
// The core on its own, in Node without browsers: the protocol, the transfer and both kinds of
|
// The core on its own, in Node without browsers: the protocol, the transfer and both kinds of
|
||||||
// signaling, on fake connections, tracker sockets and timers in memory. e2e.spec.ts covers what only
|
// signaling, on fake connections, tracker sockets and timers in memory. e2e.spec.ts covers what only
|
||||||
// browsers can tell: real WebRTC, the service worker and the network.
|
// browsers can tell: real WebRTC, the service worker and the network.
|
||||||
import { createDecipheriv, createHash, hkdfSync, pbkdf2Sync, randomBytes } from 'node:crypto';
|
import { createDecipheriv, createHash, createHmac, hkdfSync, pbkdf2Sync, randomBytes } from 'node:crypto';
|
||||||
import { getEventListeners } from 'node:events';
|
import { getEventListeners } from 'node:events';
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
import {
|
import {
|
||||||
@@ -21,12 +21,16 @@ import {
|
|||||||
live,
|
live,
|
||||||
MAX_BUFFERED,
|
MAX_BUFFERED,
|
||||||
MAX_NAME,
|
MAX_NAME,
|
||||||
|
MAX_TRACKER_MESSAGE,
|
||||||
|
MAX_TRACKER_MESSAGES,
|
||||||
|
MESSAGE_WINDOW,
|
||||||
MIN_INTERVAL,
|
MIN_INTERVAL,
|
||||||
newCode,
|
newCode,
|
||||||
noTracker,
|
noTracker,
|
||||||
own,
|
own,
|
||||||
PBKDF2_ITERATIONS,
|
PBKDF2_ITERATIONS,
|
||||||
PROOF_TIMEOUT,
|
PROOF_TIMEOUT,
|
||||||
|
PROTOCOL,
|
||||||
parse,
|
parse,
|
||||||
prove,
|
prove,
|
||||||
type ReceiveEvents,
|
type ReceiveEvents,
|
||||||
@@ -43,6 +47,7 @@ import {
|
|||||||
settings,
|
settings,
|
||||||
stunChoice,
|
stunChoice,
|
||||||
stunHint,
|
stunHint,
|
||||||
|
TRACKER_NOTES,
|
||||||
TRACKER_TIMEOUT,
|
TRACKER_TIMEOUT,
|
||||||
TRACKER_WAIT,
|
TRACKER_WAIT,
|
||||||
trackerSalt,
|
trackerSalt,
|
||||||
@@ -88,7 +93,7 @@ class FakeChannel extends Target {
|
|||||||
peer?: FakeChannel;
|
peer?: FakeChannel;
|
||||||
// What this side drops instead of sending.
|
// What this side drops instead of sending.
|
||||||
drop = (_data: string | ArrayBuffer) => false;
|
drop = (_data: string | ArrayBuffer) => false;
|
||||||
constructor(readonly label = 'file') {
|
constructor(readonly label = PROTOCOL) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
set onopen(handler: ((event: Any) => unknown) | null) {
|
set onopen(handler: ((event: Any) => unknown) | null) {
|
||||||
@@ -472,7 +477,7 @@ describe('codes and salts', () => {
|
|||||||
it('derives the swarm and the sealing key as the protocol says, the salt in NFC', async () => {
|
it('derives the swarm and the sealing key as the protocol says, the salt in NFC', async () => {
|
||||||
const code = 'abcdefghijk';
|
const code = 'abcdefghijk';
|
||||||
const salt = '2026-01-01T12:00 Grüße';
|
const salt = '2026-01-01T12:00 Grüße';
|
||||||
const master = pbkdf2Sync(code, `hellcon ${salt}`, PBKDF2_ITERATIONS, 32, 'sha256');
|
const master = pbkdf2Sync(code, `hellcon/1 ${salt}`, PBKDF2_ITERATIONS, 32, 'sha256');
|
||||||
const expand = (info: string, length: number) => Buffer.from(hkdfSync('sha256', master, '', info, length));
|
const expand = (info: string, length: number) => Buffer.from(hkdfSync('sha256', master, '', info, length));
|
||||||
const { hash, sealing } = await secrets(code, salt.normalize('NFD'));
|
const { hash, sealing } = await secrets(code, salt.normalize('NFD'));
|
||||||
expect(Buffer.from(hash, 'latin1')).toEqual(expand('swarm', 20));
|
expect(Buffer.from(hash, 'latin1')).toEqual(expand('swarm', 20));
|
||||||
@@ -508,23 +513,45 @@ describe('messages', () => {
|
|||||||
expect(() => decode('not base64!', 'answer')).toThrow('not a valid answer, copy all of it');
|
expect(() => decode('not base64!', 'answer')).toThrow('not a valid answer, copy all of it');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('counts every fingerprint once, at session or media level', () => {
|
it('counts every fingerprint once, at session or media level, also hidden ones', () => {
|
||||||
const sdp =
|
const sdp =
|
||||||
'v=0\r\na=fingerprint:sha-256 AB:CD\r\nm=application\r\na=fingerprint:SHA-256 ab:cd\r\na=fingerprint:sha-1 01\r\n';
|
'v=0\r\na=fingerprint:sha-256 AB:CD\r\nm=application\r\na=fingerprint:SHA-256 ab:cd\na=fingerprint:sha-1\t01\r\n' +
|
||||||
expect(fingerprints(sdp)).toEqual(['sha-1 01', 'sha-256 ab:cd']);
|
// Hidden in lines the browser reads otherwise.
|
||||||
|
'a=candidate:1 1 udp 1 127.0.0.1 9 typ host a=fingerprint:sha-256 01:02\r\n' +
|
||||||
|
'a=x-decoy:a=fingerprint:sha-256 03:04\r\na=x-decoy:\ra=fingerprint:sha-256 05:06\r\n' +
|
||||||
|
// A bare CR doesn't end the line for the browser.
|
||||||
|
'a=fingerprint:sha-256\r07:08\r\n';
|
||||||
|
expect(fingerprints(sdp)).toEqual([
|
||||||
|
'sha-1 01',
|
||||||
|
'sha-256 01:02',
|
||||||
|
'sha-256 03:04',
|
||||||
|
'sha-256 05:06',
|
||||||
|
'sha-256 07:08',
|
||||||
|
'sha-256 ab:cd',
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows the first 8 bytes of both fingerprints for the check', () => {
|
it('shows the first 16 bytes of a hash over all fingerprints for the check', async () => {
|
||||||
const sdp = (fingerprint: string) => ({ sdp: `v=0\r\na=fingerprint:sha-256 ${fingerprint}\r\n` });
|
const code = (list: string[]) =>
|
||||||
|
createHash('sha256')
|
||||||
|
.update(JSON.stringify(list))
|
||||||
|
.digest('hex')
|
||||||
|
.slice(0, 32)
|
||||||
|
.toUpperCase()
|
||||||
|
.match(/../g)!
|
||||||
|
.join(' ');
|
||||||
const pc = {
|
const pc = {
|
||||||
localDescription: sdp('aa:bb:cc:dd:ee:ff:00:11:22:33'),
|
localDescription: { sdp: 'v=0\r\na=fingerprint:sha-256 aa:bb\r\n' },
|
||||||
remoteDescription: sdp('01:02:03:04:05:06:07:08:09'),
|
remoteDescription: { sdp: 'v=0\r\na=fingerprint:sha-256 0A:0B\r\nm=application\r\na=fingerprint:sha-1 0c\r\n' },
|
||||||
} as RTCPeerConnection;
|
} as RTCPeerConnection;
|
||||||
expect(securityCheck(pc)).toEqual({ local: 'AA BB CC DD EE FF 00 11', remote: '01 02 03 04 05 06 07 08' });
|
expect(await securityCheck(pc)).toEqual({
|
||||||
expect(securityCheck({ localDescription: null, remoteDescription: null } as RTCPeerConnection)).toEqual({
|
local: code(['sha-256 aa:bb']),
|
||||||
local: '?',
|
remote: code(['sha-1 0c', 'sha-256 0a:0b']),
|
||||||
remote: '?',
|
|
||||||
});
|
});
|
||||||
|
expect(await securityCheck({ ...pc, remoteDescription: { sdp: 'v=0\r\n' } } as RTCPeerConnection)).toBeUndefined();
|
||||||
|
expect(
|
||||||
|
await securityCheck({ localDescription: null, remoteDescription: null } as RTCPeerConnection),
|
||||||
|
).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('names the side without a public address', () => {
|
it('names the side without a public address', () => {
|
||||||
@@ -699,6 +726,23 @@ describe('tracker socket', () => {
|
|||||||
expect(session.logs).toEqual(['wss://one.test unreachable']);
|
expect(session.logs).toEqual(['wss://one.test unreachable']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('takes a tracker the browser refuses to open for lost, once the caller has it', async () => {
|
||||||
|
vi.stubGlobal(
|
||||||
|
'WebSocket',
|
||||||
|
class {
|
||||||
|
constructor() {
|
||||||
|
throw new DOMException('insecure', 'SecurityError');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const { session, tracker, lost } = socket('ws://one.test');
|
||||||
|
expect(lost).not.toHaveBeenCalled();
|
||||||
|
await settle();
|
||||||
|
expect(lost).toHaveBeenCalledTimes(1);
|
||||||
|
expect(session.logs).toEqual(['ws://one.test refused: insecure']);
|
||||||
|
expect(tracker.alive()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it('gives up on a tracker that never answers', async () => {
|
it('gives up on a tracker that never answers', async () => {
|
||||||
new FakeTracker('wss://one.test', () => undefined);
|
new FakeTracker('wss://one.test', () => undefined);
|
||||||
const { session, tracker, lost } = socket();
|
const { session, tracker, lost } = socket();
|
||||||
@@ -710,7 +754,7 @@ describe('tracker socket', () => {
|
|||||||
expect(tracker.ws.readyState).toBeGreaterThanOrEqual(2);
|
expect(tracker.ws.readyState).toBeGreaterThanOrEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('takes a failure before anything else for a rejection, after that only logs it', async () => {
|
it('takes a failure before anything else for a rejection, after that only notes it', async () => {
|
||||||
new FakeTracker('wss://one.test', () => ({ 'failure reason': 'not here' }));
|
new FakeTracker('wss://one.test', () => ({ 'failure reason': 'not here' }));
|
||||||
const rejected = socket();
|
const rejected = socket();
|
||||||
await until(() => rejected.tracker.ws.readyState === 1);
|
await until(() => rejected.tracker.ws.readyState === 1);
|
||||||
@@ -725,13 +769,78 @@ describe('tracker socket', () => {
|
|||||||
await until(() => accepted.tracker.ws.readyState === 1);
|
await until(() => accepted.tracker.ws.readyState === 1);
|
||||||
accepted.tracker.ws.send('{}');
|
accepted.tracker.ws.send('{}');
|
||||||
await until(() => accepted.got.length);
|
await until(() => accepted.got.length);
|
||||||
(accepted.tracker.ws as unknown as FakeSocket).deliver({ 'failure reason': 'slow down' });
|
const ws = accepted.tracker.ws as unknown as FakeSocket;
|
||||||
(accepted.tracker.ws as unknown as FakeSocket).deliver({ 'not json': undefined });
|
ws.deliver({ 'failure reason': 'x'.repeat(1000) });
|
||||||
expect(accepted.session.logs).toEqual(['wss://two.test: slow down']);
|
ws.deliver({ 'failure reason': 'slow down' });
|
||||||
|
ws.deliver({ 'not json': undefined });
|
||||||
|
ws.deliver({ 'failure reason': 'slow down' });
|
||||||
|
ws.deliver({ 'failure reason': 'shutting down' });
|
||||||
|
// Controls and bidi controls would fake log lines.
|
||||||
|
ws.deliver({ 'failure reason': 'bye\nsecurity check passed\u202E' });
|
||||||
|
expect(accepted.session.logs).toEqual([
|
||||||
|
`wss://two.test: ${'x'.repeat(200)}`,
|
||||||
|
'wss://two.test: slow down',
|
||||||
|
'wss://two.test: shutting down',
|
||||||
|
'wss://two.test: byesecurity check passed',
|
||||||
|
]);
|
||||||
expect(accepted.tracker.alive()).toBe(true);
|
expect(accepted.tracker.alive()).toBe(true);
|
||||||
expect(accepted.lost).not.toHaveBeenCalled();
|
expect(accepted.lost).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('takes a message over MAX_TRACKER_MESSAGE first for a rejection, after that only notes and drops it', async () => {
|
||||||
|
new FakeTracker('wss://one.test', () => undefined);
|
||||||
|
// msg padded to length characters of JSON.
|
||||||
|
const sized = (length: number, msg: object) => {
|
||||||
|
const json = JSON.stringify({ ...msg, pad: '' });
|
||||||
|
return { ...msg, pad: ' '.repeat(length - json.length) };
|
||||||
|
};
|
||||||
|
const rejected = socket();
|
||||||
|
await until(() => rejected.tracker.ws.readyState === 1);
|
||||||
|
(rejected.tracker.ws as unknown as FakeSocket).deliver(
|
||||||
|
sized(MAX_TRACKER_MESSAGE + 1, { 'failure reason': 'not here' }),
|
||||||
|
);
|
||||||
|
expect(rejected.tracker.rejected).toBe('wss://one.test: message over 64 KiB');
|
||||||
|
expect(rejected.session.logs).toEqual(['rejected by wss://one.test: message over 64 KiB']);
|
||||||
|
expect(rejected.lost).toHaveBeenCalledTimes(1);
|
||||||
|
|
||||||
|
const { session, tracker, got, lost } = socket();
|
||||||
|
await until(() => tracker.ws.readyState === 1);
|
||||||
|
const ws = tracker.ws as unknown as FakeSocket;
|
||||||
|
ws.deliver(sized(MAX_TRACKER_MESSAGE, { action: 'announce' }));
|
||||||
|
ws.deliver(sized(MAX_TRACKER_MESSAGE + 1, { action: 'announce' }));
|
||||||
|
ws.deliver(sized(MAX_TRACKER_MESSAGE + 1, { action: 'announce' }));
|
||||||
|
expect(got).toHaveLength(1);
|
||||||
|
expect(session.logs).toEqual(['wss://one.test: message over 64 KiB']);
|
||||||
|
expect(lost).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('drops messages beyond MAX_TRACKER_MESSAGES per MESSAGE_WINDOW', async () => {
|
||||||
|
new FakeTracker('wss://one.test', () => undefined);
|
||||||
|
const { session, tracker, got } = socket();
|
||||||
|
await until(() => tracker.ws.readyState === 1);
|
||||||
|
const ws = tracker.ws as unknown as FakeSocket;
|
||||||
|
for (let i = 0; i < MAX_TRACKER_MESSAGES + 5; i++) ws.deliver({ action: 'announce', i });
|
||||||
|
expect(got.map((msg) => msg.i)).toEqual([...Array(MAX_TRACKER_MESSAGES).keys()]);
|
||||||
|
expect(session.logs).toEqual(['wss://one.test sends too much, dropping some of it']);
|
||||||
|
vi.setSystemTime(Date.now() + MESSAGE_WINDOW);
|
||||||
|
ws.deliver({ action: 'announce', i: 'later' });
|
||||||
|
expect(got.at(-1).i).toBe('later');
|
||||||
|
expect(session.logs).toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('notes at most TRACKER_NOTES lines', async () => {
|
||||||
|
new FakeTracker('wss://one.test', () => undefined);
|
||||||
|
const { session, tracker } = socket();
|
||||||
|
await until(() => tracker.ws.readyState === 1);
|
||||||
|
const ws = tracker.ws as unknown as FakeSocket;
|
||||||
|
ws.deliver({ action: 'announce' });
|
||||||
|
for (let i = 0; i < TRACKER_NOTES + 5; i++) ws.deliver({ 'failure reason': `reason ${i}` });
|
||||||
|
expect(session.logs).toEqual([
|
||||||
|
...[...Array(TRACKER_NOTES).keys()].map((i) => `wss://one.test: reason ${i}`),
|
||||||
|
'wss://one.test: more of it, no longer logged',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('announces again on the interval it names, at least MIN_INTERVAL, at most TRACKER_WAIT', async () => {
|
it('announces again on the interval it names, at least MIN_INTERVAL, at most TRACKER_WAIT', async () => {
|
||||||
for (const [interval, every] of [
|
for (const [interval, every] of [
|
||||||
[0, MIN_INTERVAL],
|
[0, MIN_INTERVAL],
|
||||||
@@ -789,6 +898,24 @@ describe('proof of the code', () => {
|
|||||||
return [a, b] as const;
|
return [a, b] as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The protocol in node:crypto, like the derivation in codes and salts: changing it splits old and new clients.
|
||||||
|
it('proves with the key secrets derives, over the fingerprints as the protocol says', async () => {
|
||||||
|
const master = pbkdf2Sync('abcdefghijk', 'hellcon/1 salt', PBKDF2_ITERATIONS, 32, 'sha256');
|
||||||
|
const proofKey = Buffer.from(hkdfSync('sha256', master, '', 'proof', 64));
|
||||||
|
const hmac = (statement: unknown) =>
|
||||||
|
createHmac('sha256', proofKey).update(JSON.stringify(statement)).digest('base64');
|
||||||
|
const { key } = await secrets('abcdefghijk', 'salt');
|
||||||
|
const channel = new FakeChannel();
|
||||||
|
channel.readyState = 'open';
|
||||||
|
const end = vi.fn();
|
||||||
|
const proven = prove(view('offer', 'AA', 'BB'), asChannel(channel), key, end);
|
||||||
|
await until(() => channel.sent.length);
|
||||||
|
expect(channel.sent).toEqual([JSON.stringify({ proof: hmac(['offer', ['sha-256 aa'], ['sha-256 bb']]) })]);
|
||||||
|
channel.emit('message', { data: JSON.stringify({ proof: hmac(['answer', ['sha-256 bb'], ['sha-256 aa']]) }) });
|
||||||
|
await proven;
|
||||||
|
expect(end).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it('passes on both sides with the same key and the same certificates', async () => {
|
it('passes on both sides with the same key and the same certificates', async () => {
|
||||||
const shared = await key();
|
const shared = await key();
|
||||||
const [a, b] = pair();
|
const [a, b] = pair();
|
||||||
@@ -950,7 +1077,7 @@ describe('sending', () => {
|
|||||||
stopped.channel.receive({ ok: true });
|
stopped.channel.receive({ ok: true });
|
||||||
await until(() => stopped.channel.sent.length);
|
await until(() => stopped.channel.sent.length);
|
||||||
stopped.channel.receive({ start: true });
|
stopped.channel.receive({ start: true });
|
||||||
stopped.channel.receive({ error: `cancelled ${'x'.repeat(300)}` });
|
stopped.channel.receive({ error: `cancelled\n\u202E ${'x'.repeat(300)}` });
|
||||||
expect(stopped.session.errors).toEqual([`receiver stopped: cancelled ${'x'.repeat(190)}`]);
|
expect(stopped.session.errors).toEqual([`receiver stopped: cancelled ${'x'.repeat(190)}`]);
|
||||||
expect(stopped.pc.signalingState).toBe('closed');
|
expect(stopped.pc.signalingState).toBe('closed');
|
||||||
|
|
||||||
@@ -972,6 +1099,17 @@ describe('sending', () => {
|
|||||||
unreadable.channel.receive({ start: true });
|
unreadable.channel.receive({ start: true });
|
||||||
await unreadable.done;
|
await unreadable.done;
|
||||||
expect(unreadable.session.errors).toEqual(['could not read gone.bin anymore']);
|
expect(unreadable.session.errors).toEqual(['could not read gone.bin anymore']);
|
||||||
|
|
||||||
|
// Read short instead of failing.
|
||||||
|
const shrunk = { name: 'shrunk.bin', size: 10, slice: () => ({ arrayBuffer: async () => new ArrayBuffer(5) }) };
|
||||||
|
const short = sending(shrunk as unknown as File);
|
||||||
|
short.check();
|
||||||
|
short.channel.receive({ ok: true });
|
||||||
|
await until(() => short.channel.sent.length);
|
||||||
|
short.channel.receive({ start: true });
|
||||||
|
await short.done;
|
||||||
|
expect(short.session.errors).toEqual(['could not read shrunk.bin anymore']);
|
||||||
|
expect(short.channel.bytes()).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('stops quietly when the connection closes before the transfer or the session ends', async () => {
|
it('stops quietly when the connection closes before the transfer or the session ends', async () => {
|
||||||
@@ -1054,6 +1192,17 @@ describe('receiving', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('strips controls, line separators and bidi controls from the offered name', async () => {
|
||||||
|
const { channel, session, check } = receiving();
|
||||||
|
check();
|
||||||
|
await until(() => channel.sent.length);
|
||||||
|
channel.receive({ name: 'invoice\u202Efdp.exe\n\u2028done\u0000\u009B\u2066', size: 1 });
|
||||||
|
expect(session.files).toMatchObject([{ name: 'invoicefdp.exedone' }]);
|
||||||
|
expect(session.logs.at(-1)).toBe('offered invoicefdp.exedone (1 bytes)');
|
||||||
|
session.files[0]!.download();
|
||||||
|
expect(saved.at(-1)!.file.name).toBe('invoicefdp.exedone');
|
||||||
|
});
|
||||||
|
|
||||||
it("saves the chunks in order, reports the download manager's reads and when it finished", async () => {
|
it("saves the chunks in order, reports the download manager's reads and when it finished", async () => {
|
||||||
const { channel, session, handshake, download } = await downloading(3 * CHUNK_SIZE);
|
const { channel, session, handshake, download } = await downloading(3 * CHUNK_SIZE);
|
||||||
expect(handshake.start).toHaveBeenCalled();
|
expect(handshake.start).toHaveBeenCalled();
|
||||||
@@ -1129,6 +1278,14 @@ describe('receiving', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Data channels opened from here on carry another protocol's label.
|
||||||
|
function otherProtocol() {
|
||||||
|
const create = FakePeer.prototype.createDataChannel;
|
||||||
|
return vi.spyOn(FakePeer.prototype, 'createDataChannel').mockImplementation(function (this: FakePeer, label: string) {
|
||||||
|
return create.call(this, label === PROTOCOL ? 'other/1' : label);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
describe('manual exchange', () => {
|
describe('manual exchange', () => {
|
||||||
// Sender and receiver connected by the manual codes, both shown the check.
|
// Sender and receiver connected by the manual codes, both shown the check.
|
||||||
async function exchange(source: File) {
|
async function exchange(source: File) {
|
||||||
@@ -1170,6 +1327,19 @@ describe('manual exchange', () => {
|
|||||||
expect(openPeers()).toEqual([]);
|
expect(openPeers()).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('shows other codes for a peer that named a second certificate', async () => {
|
||||||
|
const [sender, receiver] = [side(), side()];
|
||||||
|
const { offer, accept } = await createOffer(file(10), sender.events, sender.signal);
|
||||||
|
// The real one first, the fake one connects too. FakePeer only knows the first.
|
||||||
|
const tampered = btoa(`${atob(offer)}m=application\r\na=fingerprint:sha-256 AA:BB\r\n`);
|
||||||
|
await accept(await answerOffer(tampered, receiver.events, receiver.signal));
|
||||||
|
await until(() => sender.checks[0] && receiver.checks[0]);
|
||||||
|
const [own, peer] = [sender.checks[0]!, receiver.checks[0]!];
|
||||||
|
expect(peer.remote).not.toBe(own.local);
|
||||||
|
expect(peer.local).toBe(own.remote);
|
||||||
|
expect(receiver.status()).toBe('wait: Compare the security codes above with the sender');
|
||||||
|
});
|
||||||
|
|
||||||
it('reports a broken offer and answer, the offer stays good for the right answer', async () => {
|
it('reports a broken offer and answer, the offer stays good for the right answer', async () => {
|
||||||
const receiver = side();
|
const receiver = side();
|
||||||
await expect(answerOffer(btoa('v=0 but nothing else'), receiver.events, receiver.signal)).rejects.toThrow(
|
await expect(answerOffer(btoa('v=0 but nothing else'), receiver.events, receiver.signal)).rejects.toThrow(
|
||||||
@@ -1187,6 +1357,20 @@ describe('manual exchange', () => {
|
|||||||
await until(() => sender.checks[0]);
|
await until(() => sender.checks[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('refuses a sender on another protocol', async () => {
|
||||||
|
const [sender, receiver] = [side(), side()];
|
||||||
|
otherProtocol();
|
||||||
|
const { offer, accept } = await createOffer(file(10), sender.events, sender.signal);
|
||||||
|
await accept(await answerOffer(offer, receiver.events, receiver.signal));
|
||||||
|
await until(() => sender.errors.length);
|
||||||
|
expect(receiver.errors).toEqual([`the sender runs another protocol, both pages have to show protocol ${PROTOCOL}`]);
|
||||||
|
expect(receiver.logged('the sender\'s protocol: "other/1"')).toBe(true);
|
||||||
|
expect(receiver.checks).toEqual([]);
|
||||||
|
expect(sender.errors).toEqual(['the receiver left before the transfer']);
|
||||||
|
expect(sender.checks.at(-1)).toBeUndefined();
|
||||||
|
expect(openPeers()).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
it('tells why it could not connect, on each side once its time is up', async () => {
|
it('tells why it could not connect, on each side once its time is up', async () => {
|
||||||
FakePeer.reachable = false;
|
FakePeer.reachable = false;
|
||||||
const [sender, receiver] = [side(), side()];
|
const [sender, receiver] = [side(), side()];
|
||||||
@@ -1254,6 +1438,79 @@ describe('tracker signaling', () => {
|
|||||||
expect(sender.errors).toEqual([]);
|
expect(sender.errors).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('shares on after a receiver on another protocol, with the next receiver', async () => {
|
||||||
|
new FakeTracker(URLS[0]!);
|
||||||
|
settings.trackers = [URLS[0]!];
|
||||||
|
const [sender, other, receiver] = [side(), side(), side()];
|
||||||
|
const { code } = await sendViaTracker(file(10), sender.events, sender.signal);
|
||||||
|
const labels = otherProtocol();
|
||||||
|
await receiveViaTracker(code, other.events, other.signal);
|
||||||
|
await until(() => sender.logged(`receiver via ${URLS[0]} runs another protocol`));
|
||||||
|
await until(() => sender.logged('waiting for the next receiver'));
|
||||||
|
expect(sender.logged('connected via')).toBe(false);
|
||||||
|
other.stop();
|
||||||
|
labels.mockRestore();
|
||||||
|
|
||||||
|
await receiveViaTracker(code, receiver.events, receiver.signal);
|
||||||
|
await until(() => receiver.files[0]);
|
||||||
|
expect(sender.errors).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('walks on past a tracker the browser refuses to open, on both sides', async () => {
|
||||||
|
new FakeTracker(URLS[0]!);
|
||||||
|
settings.trackers = ['ws://refused.test', URLS[0]!];
|
||||||
|
vi.stubGlobal(
|
||||||
|
'WebSocket',
|
||||||
|
class extends FakeSocket {
|
||||||
|
constructor(url: string) {
|
||||||
|
if (url.startsWith('ws:')) throw new DOMException('insecure', 'SecurityError');
|
||||||
|
super(url);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const [sender, receiver] = [side(), side()];
|
||||||
|
const { code } = await sendViaTracker(file(10), sender.events, sender.signal);
|
||||||
|
await receiveViaTracker(code, receiver.events, receiver.signal);
|
||||||
|
await until(() => receiver.files[0]);
|
||||||
|
for (const peer of [sender, receiver]) expect(peer.logged('ws://refused.test refused: insecure')).toBe(true);
|
||||||
|
expect([...sender.errors, ...receiver.errors]).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('answers no offer that waited for its turn on a tracker lost meanwhile', async () => {
|
||||||
|
for (const url of URLS.slice(0, 2)) new FakeTracker(url);
|
||||||
|
settings.trackers = URLS.slice(0, 2);
|
||||||
|
const [sender, silent, waiting] = [side(), side(), side()];
|
||||||
|
const { code } = await sendViaTracker(file(10), sender.events, sender.signal);
|
||||||
|
await receiveViaTracker(code, silent.events, silent.signal);
|
||||||
|
await until(() => FakePeer.all[0]?.channels.length);
|
||||||
|
FakePeer.all[0]!.channels[0]!.drop = (data) => typeof data === 'string' && data.includes('"proof"');
|
||||||
|
await until(() => sender.logged('waiting for the security check'));
|
||||||
|
await receiveViaTracker(code, waiting.events, waiting.signal);
|
||||||
|
await until(() => waiting.logged(`looking on ${URLS[0]}`));
|
||||||
|
await settle();
|
||||||
|
// The sender's socket, the first one made.
|
||||||
|
FakeSocket.all[0]!.drop();
|
||||||
|
await until(() => sender.logged(`waiting on ${URLS[1]}`));
|
||||||
|
// Answered, so it doesn't time out below.
|
||||||
|
await settle();
|
||||||
|
vi.advanceTimersByTime(PROOF_TIMEOUT);
|
||||||
|
await until(() => sender.logged('waiting for the next receiver'));
|
||||||
|
await settle();
|
||||||
|
// The silent one may come back by the next tracker meanwhile, its new channel proves the code.
|
||||||
|
expect(sender.count(`offer via ${URLS[0]}`)).toBe(1);
|
||||||
|
expect(sender.errors).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('opens no tracker for a share that ended while its key was derived', async () => {
|
||||||
|
new FakeTracker(URLS[0]!);
|
||||||
|
settings.trackers = [URLS[0]!];
|
||||||
|
const sender = side();
|
||||||
|
const shared = sendViaTracker(file(10), sender.events, sender.signal);
|
||||||
|
sender.stop();
|
||||||
|
await shared;
|
||||||
|
expect(FakeSocket.all).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
it('stays on the first tracker that accepts the share, the next only once that one is lost', async () => {
|
it('stays on the first tracker that accepts the share, the next only once that one is lost', async () => {
|
||||||
new FakeTracker(URLS[0]!, () => ({ 'failure reason': 'not here' }));
|
new FakeTracker(URLS[0]!, () => ({ 'failure reason': 'not here' }));
|
||||||
const second = new FakeTracker(URLS[1]!);
|
const second = new FakeTracker(URLS[1]!);
|
||||||
@@ -1316,7 +1573,9 @@ describe('tracker signaling', () => {
|
|||||||
trackers.get(URLS[1]!)!.sockets[0]!.deliver({ action: 'announce', interval: 120, complete: 0 });
|
trackers.get(URLS[1]!)!.sockets[0]!.deliver({ action: 'announce', interval: 120, complete: 0 });
|
||||||
await until(() => receiver.logged(`looking on ${URLS[2]}`));
|
await until(() => receiver.logged(`looking on ${URLS[2]}`));
|
||||||
await until(() => receiver.status()?.startsWith('retry: No sender'));
|
await until(() => receiver.status()?.startsWith('retry: No sender'));
|
||||||
expect(receiver.status()).toBe('retry: No sender with this code on any tracker. Check the code, still looking');
|
expect(receiver.status()).toBe(
|
||||||
|
'retry: No sender with this code on any tracker. Check the code and that both pages show protocol hellcon/1, still looking',
|
||||||
|
);
|
||||||
expect(openSockets()).toHaveLength(3);
|
expect(openSockets()).toHaveLength(3);
|
||||||
// It showed up again, busy with another receiver maybe.
|
// It showed up again, busy with another receiver maybe.
|
||||||
trackers.get(URLS[2]!)!.sockets[0]!.deliver({ action: 'announce', interval: 120, complete: 1 });
|
trackers.get(URLS[2]!)!.sockets[0]!.deliver({ action: 'announce', interval: 120, complete: 1 });
|
||||||
@@ -1338,7 +1597,9 @@ describe('tracker signaling', () => {
|
|||||||
for (const sdp of ['v=0\r\na=fingerprint:sha-256 AA\r\n', offer.sdp]) {
|
for (const sdp of ['v=0\r\na=fingerprint:sha-256 AA\r\n', offer.sdp]) {
|
||||||
tracker.sockets[0]!.deliver(relayed({ offer_id, answer: { type: 'answer', sdp } }));
|
tracker.sockets[0]!.deliver(relayed({ offer_id, answer: { type: 'answer', sdp } }));
|
||||||
}
|
}
|
||||||
await until(() => receiver.count('answer without the code') === 2);
|
await until(() => receiver.count('answer without the code'));
|
||||||
|
await settle();
|
||||||
|
expect(receiver.count('answer without the code')).toBe(1);
|
||||||
expect(receiver.logged('answer via')).toBe(false);
|
expect(receiver.logged('answer via')).toBe(false);
|
||||||
expect(FakePeer.all.map((pc) => pc.remoteDescription)).toEqual([null]);
|
expect(FakePeer.all.map((pc) => pc.remoteDescription)).toEqual([null]);
|
||||||
});
|
});
|
||||||
@@ -1354,7 +1615,7 @@ describe('tracker signaling', () => {
|
|||||||
await receiveViaTracker(code, other.events, other.signal, 'Grüße!');
|
await receiveViaTracker(code, other.events, other.signal, 'Grüße!');
|
||||||
await until(() => other.status()?.startsWith('retry: No sender'));
|
await until(() => other.status()?.startsWith('retry: No sender'));
|
||||||
expect(other.status()).toBe(
|
expect(other.status()).toBe(
|
||||||
'retry: No sender with this code on any tracker. Check the code and the salt, still looking',
|
'retry: No sender with this code on any tracker. Check the code and the salt and that both pages show protocol hellcon/1, still looking',
|
||||||
);
|
);
|
||||||
await receiveViaTracker(code, receiver.events, receiver.signal, 'Grüße');
|
await receiveViaTracker(code, receiver.events, receiver.signal, 'Grüße');
|
||||||
await until(() => receiver.files[0]);
|
await until(() => receiver.files[0]);
|
||||||
@@ -1375,9 +1636,13 @@ describe('tracker signaling', () => {
|
|||||||
);
|
);
|
||||||
await until(() => sender.count('unusable offer') === offers);
|
await until(() => sender.count('unusable offer') === offers);
|
||||||
if (offers === 1) ws.deliver({ 'failure reason': 'slow down' });
|
if (offers === 1) ws.deliver({ 'failure reason': 'slow down' });
|
||||||
|
// Fewer than MAX_TRACKER_MESSAGES per MESSAGE_WINDOW, none of them is dropped.
|
||||||
|
if (offers % 10 === 0) vi.setSystemTime(Date.now() + MESSAGE_WINDOW);
|
||||||
}
|
}
|
||||||
for (let offers = 0; offers < 5; offers++) ws.deliver(relayed({ offer_id: offerId(), offer: { sdp: 'garbage' } }));
|
for (let offers = 0; offers < 5; offers++) ws.deliver(relayed({ offer_id: offerId(), offer: { sdp: 'garbage' } }));
|
||||||
await until(() => sender.count('offer without the code') === 5);
|
await until(() => sender.count('offer without the code'));
|
||||||
|
await settle();
|
||||||
|
expect(sender.count('offer without the code')).toBe(1);
|
||||||
expect(sender.logged(`${URLS[0]}: slow down`)).toBe(true);
|
expect(sender.logged(`${URLS[0]}: slow down`)).toBe(true);
|
||||||
expect(sender.logged('rejected by')).toBe(false);
|
expect(sender.logged('rejected by')).toBe(false);
|
||||||
expect(sender.errors).toEqual([]);
|
expect(sender.errors).toEqual([]);
|
||||||
@@ -1432,7 +1697,9 @@ describe('tracker signaling', () => {
|
|||||||
vi.advanceTimersByTime(TRACKER_WAIT - MIN_INTERVAL);
|
vi.advanceTimersByTime(TRACKER_WAIT - MIN_INTERVAL);
|
||||||
expect(sender.errors[0]).toMatch(/^nobody received the file until .+, share it again$/);
|
expect(sender.errors[0]).toMatch(/^nobody received the file until .+, share it again$/);
|
||||||
expect(sender.expired).toBe(true);
|
expect(sender.expired).toBe(true);
|
||||||
expect(receiver.errors[0]).toMatch(/^no sender answered until .+, ask the sender for a new code$/);
|
expect(receiver.errors[0]).toMatch(
|
||||||
|
/^no sender answered until .+, check that both pages show protocol hellcon\/1 or ask the sender for a new code$/,
|
||||||
|
);
|
||||||
await settle();
|
await settle();
|
||||||
expect(openSockets()).toEqual([]);
|
expect(openSockets()).toEqual([]);
|
||||||
expect(openPeers()).toEqual([]);
|
expect(openPeers()).toEqual([]);
|
||||||
|
|||||||
+138
-46
@@ -13,8 +13,8 @@ export const DEFAULT_STUN_SERVERS = [
|
|||||||
'stun:stun.nextcloud.com:443',
|
'stun:stun.nextcloud.com:443',
|
||||||
];
|
];
|
||||||
|
|
||||||
// App.vue uses the settings and their defaults, randomCode, formatTime, the types and the sessions
|
// App.vue uses the settings and their defaults, PROTOCOL, randomCode, formatTime, the types and the
|
||||||
// at the end. src/core.test.ts also tests the other exports on their own, biome.json keeps them to it:
|
// sessions at the end. src/core.test.ts also tests the other exports on their own, biome.json keeps them to it:
|
||||||
// a new one goes on its list there.
|
// a new one goes on its list there.
|
||||||
|
|
||||||
// Without STUN only local addresses are offered: works on the same network or VPN, contacts nobody.
|
// Without STUN only local addresses are offered: works on the same network or VPN, contacts nobody.
|
||||||
@@ -28,7 +28,8 @@ export const settings = {
|
|||||||
export const CHUNK_SIZE = 16 * 1024;
|
export const CHUNK_SIZE = 16 * 1024;
|
||||||
export const MAX_BUFFERED = 1024 * 1024;
|
export const MAX_BUFFERED = 1024 * 1024;
|
||||||
// The receiving side can't pause a data channel, so it reports how much the download manager has
|
// The receiving side can't pause a data channel, so it reports how much the download manager has
|
||||||
// read and the sender keeps at most this much unread, else a slow disk fills the receiver's RAM.
|
// read and the sender keeps at most this much unread, else a slow disk fills the receiver's RAM. The
|
||||||
|
// receiver holds the sender to it and CHUNK_SIZE, raising either takes a new PROTOCOL.
|
||||||
export const WINDOW = 8 * 1024 * 1024;
|
export const WINDOW = 8 * 1024 * 1024;
|
||||||
const ICE_GRACE = 300;
|
const ICE_GRACE = 300;
|
||||||
const ICE_TIMEOUT = 5000;
|
const ICE_TIMEOUT = 5000;
|
||||||
@@ -36,6 +37,15 @@ const ICE_TIMEOUT = 5000;
|
|||||||
const PROBE_TIMEOUT = 2000;
|
const PROBE_TIMEOUT = 2000;
|
||||||
// A tracker that accepted no announcement by then counts as unreachable, the next one gets its turn.
|
// A tracker that accepted no announcement by then counts as unreachable, the next one gets its turn.
|
||||||
export const TRACKER_TIMEOUT = 10_000;
|
export const TRACKER_TIMEOUT = 10_000;
|
||||||
|
// A tracker relays one sealed SDP of a few KiB at a time, a larger message isn't parsed. The browser
|
||||||
|
// has received it by then, nothing limits that: this only spares parsing and decrypting it.
|
||||||
|
export const MAX_TRACKER_MESSAGE = 64 * 1024;
|
||||||
|
// A tracker sends a few messages a minute, replies to announcements and the other side's SDP. Beyond
|
||||||
|
// MAX_TRACKER_MESSAGES per MESSAGE_WINDOW the rest is dropped, a tracker can't keep the page busy.
|
||||||
|
export const MAX_TRACKER_MESSAGES = 20;
|
||||||
|
export const MESSAGE_WINDOW = 10_000;
|
||||||
|
// What a tracker makes a socket log, each line once and at most this many: it can't fill the log.
|
||||||
|
export const TRACKER_NOTES = 10;
|
||||||
// A tracker peer that got an answer but never opens the data channel gives up its turn after this,
|
// A tracker peer that got an answer but never opens the data channel gives up its turn after this,
|
||||||
// e.g. one whose SDP has no usable candidates: Chromium never even fails its connection. The manual
|
// e.g. one whose SDP has no usable candidates: Chromium never even fails its connection. The manual
|
||||||
// sender gives up on the answer after it as well.
|
// sender gives up on the answer after it as well.
|
||||||
@@ -46,13 +56,25 @@ export const CONNECT_TIMEOUT = 30_000;
|
|||||||
// The manual receiver waits this long for the sender to connect, it has to get the answer first.
|
// The manual receiver waits this long for the sender to connect, it has to get the answer first.
|
||||||
export const TRACKER_WAIT = 6 * 60_000;
|
export const TRACKER_WAIT = 6 * 60_000;
|
||||||
export const MIN_INTERVAL = 30_000;
|
export const MIN_INTERVAL = 30_000;
|
||||||
// OWASP's recommendation for PBKDF2-SHA-256. Changing it splits old and new clients into separate swarms.
|
// OWASP's recommendation for PBKDF2-SHA-256. Changing it takes a new PROTOCOL.
|
||||||
export const PBKDF2_ITERATIONS = 600_000;
|
export const PBKDF2_ITERATIONS = 600_000;
|
||||||
|
// Goes into the key derivation, see secrets: sides on different versions end up in different swarms
|
||||||
|
// and never meet, the receiver only finds no sender. The manual exchange has no derivation, the data
|
||||||
|
// channel's label carries it there and the side it reaches checks it. The page shows it, so the two
|
||||||
|
// can compare. Every change that breaks sharing between versions takes a new one: the code and its
|
||||||
|
// salt, the derivation, the signaling, the data channel's messages and its flow control. A fork that
|
||||||
|
// changes any of them takes a name of its own, two forks would otherwise share a version that means
|
||||||
|
// different things.
|
||||||
|
export const PROTOCOL = 'hellcon/1';
|
||||||
// A tracker peer that connects but proves no code gives up its turn after this. Signing takes
|
// A tracker peer that connects but proves no code gives up its turn after this. Signing takes
|
||||||
// milliseconds, a peer that knows the code is never near it.
|
// milliseconds, a peer that knows the code is never near it.
|
||||||
export const PROOF_TIMEOUT = 10_000;
|
export const PROOF_TIMEOUT = 10_000;
|
||||||
// Far beyond what a file system stores, but keeps an absurd name out of the page and the worker.
|
// Far beyond what a file system stores, but keeps an absurd name out of the page and the worker.
|
||||||
export const MAX_NAME = 1024;
|
export const MAX_NAME = 1024;
|
||||||
|
// Controls and line separators in an offered name could fake log lines, bidi controls disguise its
|
||||||
|
// extension: invoice\u202Efdp.exe shows as invoiceexe.pdf. They go before the name is shown, logged
|
||||||
|
// or saved.
|
||||||
|
const HIDDEN = /[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}]/gu;
|
||||||
|
|
||||||
export type Check = {
|
export type Check = {
|
||||||
local: string;
|
local: string;
|
||||||
@@ -291,7 +313,7 @@ export const formatTime = (time: number) =>
|
|||||||
// so the same one comes back every ~6 hours. The receiver takes the window with that character nearest
|
// so the same one comes back every ~6 hours. The receiver takes the window with that character nearest
|
||||||
// its own clock's: both sides agree on the window even with clocks hours apart, and a code lasts
|
// its own clock's: both sides agree on the window even with clocks hours apart, and a code lasts
|
||||||
// TRACKER_WAIT from the click whenever in its window that was.
|
// TRACKER_WAIT from the click whenever in its window that was.
|
||||||
// Its own constant, not TRACKER_WAIT: changing it splits old and new clients into separate swarms.
|
// Its own constant, not TRACKER_WAIT: changing it takes a new PROTOCOL.
|
||||||
export const SALT_WINDOW = 6 * 60_000;
|
export const SALT_WINDOW = 6 * 60_000;
|
||||||
export const CODE_LENGTH = 11;
|
export const CODE_LENGTH = 11;
|
||||||
const clockWindow = (time: number) => Math.floor(time / SALT_WINDOW);
|
const clockWindow = (time: number) => Math.floor(time / SALT_WINDOW);
|
||||||
@@ -330,7 +352,9 @@ export function codeSalt(code: string, own?: string) {
|
|||||||
// clock's salt limits a table to the shares of one window, for 62¹⁰ codes it takes over a million GPU
|
// clock's salt limits a table to the shares of one window, for 62¹⁰ codes it takes over a million GPU
|
||||||
// years. An own salt nobody can predict leaves guessing while the share lasts. NFC, an ü typed on one
|
// years. An own salt nobody can predict leaves guessing while the share lasts. NFC, an ü typed on one
|
||||||
// system can be other bytes than on the next. HKDF splits the result, the public info_hash tells
|
// system can be other bytes than on the next. HKDF splits the result, the public info_hash tells
|
||||||
// nothing about the keys: one seals the signaling, see seal, one proves the connection.
|
// nothing about the keys: one seals the signaling, see seal, one proves the connection. The PROTOCOL
|
||||||
|
// goes in front of the salt, each version gets swarms and keys of its own. The proof's HMAC key takes
|
||||||
|
// the hash's block size without a length given, 64 bytes.
|
||||||
export async function secrets(code: string, salt: string) {
|
export async function secrets(code: string, salt: string) {
|
||||||
const text = new TextEncoder();
|
const text = new TextEncoder();
|
||||||
const password = await crypto.subtle.importKey('raw', text.encode(code), 'PBKDF2', false, ['deriveBits']);
|
const password = await crypto.subtle.importKey('raw', text.encode(code), 'PBKDF2', false, ['deriveBits']);
|
||||||
@@ -338,7 +362,7 @@ export async function secrets(code: string, salt: string) {
|
|||||||
{
|
{
|
||||||
name: 'PBKDF2',
|
name: 'PBKDF2',
|
||||||
hash: 'SHA-256',
|
hash: 'SHA-256',
|
||||||
salt: text.encode(`hellcon ${salt.normalize('NFC')}`),
|
salt: text.encode(`${PROTOCOL} ${salt.normalize('NFC')}`),
|
||||||
iterations: PBKDF2_ITERATIONS,
|
iterations: PBKDF2_ITERATIONS,
|
||||||
},
|
},
|
||||||
password,
|
password,
|
||||||
@@ -442,24 +466,39 @@ const BLOCKED = 'a network in between, e.g. a VPN or firewall, may block direct
|
|||||||
|
|
||||||
const host = (url: string) => URL.parse(url)?.host || url;
|
const host = (url: string) => URL.parse(url)?.host || url;
|
||||||
|
|
||||||
// Anti-MITM check: the first 8 bytes of both DTLS certificate fingerprints, fewer an interposer can
|
|
||||||
// brute force with matching certificates. My local code must equal the peer's remote code and vice
|
|
||||||
// versa, otherwise someone interposed on the signaling.
|
|
||||||
export function securityCheck(pc: RTCPeerConnection) {
|
|
||||||
const short = (sdp = '') =>
|
|
||||||
sdp
|
|
||||||
.match(/a=fingerprint:\S+ ([0-9A-F:]+)/i)?.[1]
|
|
||||||
?.toUpperCase()
|
|
||||||
.split(':')
|
|
||||||
.slice(0, 8)
|
|
||||||
.join(' ') ?? '?';
|
|
||||||
return { local: short(pc.localDescription?.sdp), remote: short(pc.remoteDescription?.sdp) };
|
|
||||||
}
|
|
||||||
|
|
||||||
// Every fingerprint the SDP names, in full: one added beside the real one changes the result too.
|
// Every fingerprint the SDP names, in full: one added beside the real one changes the result too.
|
||||||
// Browsers may move them between session and media level, so each counts once.
|
// Browsers may move them between session and media level, so each counts once. Any a=fingerprint
|
||||||
|
// counts, also one hidden in another line: one the browser ignores only makes the result differ,
|
||||||
|
// one missed that the browser uses would let an interposer through. So nothing depends on how a
|
||||||
|
// browser splits lines.
|
||||||
export const fingerprints = (sdp: string) =>
|
export const fingerprints = (sdp: string) =>
|
||||||
[...new Set([...sdp.matchAll(/^a=fingerprint:(.+)$/gim)].map(([, line]) => line!.trim().toLowerCase()))].sort();
|
[
|
||||||
|
...new Set(
|
||||||
|
[...sdp.matchAll(/a=fingerprint:([^\n]*)/gi)].map(([, fingerprint]) =>
|
||||||
|
fingerprint!.trim().replace(/\s+/g, ' ').toLowerCase(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
].sort();
|
||||||
|
|
||||||
|
// Anti-MITM check of the manual exchange: the first 16 bytes of a SHA-256 over all DTLS
|
||||||
|
// certificate fingerprints of each side. An interposer can try one cheaply, it only has to vary a
|
||||||
|
// line the browser ignores, so it takes that many to be out of its reach. My local code must equal
|
||||||
|
// the peer's remote code and vice versa, otherwise someone interposed on the signaling. All of them
|
||||||
|
// count, like in prove: one certificate may be named by several hash functions, and a browser may
|
||||||
|
// accept a certificate by any of them. Without one on either side there is nothing to check:
|
||||||
|
// undefined.
|
||||||
|
export async function securityCheck(pc: RTCPeerConnection) {
|
||||||
|
const short = async (sdp = '') => {
|
||||||
|
const list = fingerprints(sdp);
|
||||||
|
if (!list.length) return;
|
||||||
|
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(JSON.stringify(list)));
|
||||||
|
return Array.from(new Uint8Array(digest, 0, 16), (byte) => byte.toString(16).padStart(2, '0'))
|
||||||
|
.join(' ')
|
||||||
|
.toUpperCase();
|
||||||
|
};
|
||||||
|
const [local, remote] = await Promise.all([short(pc.localDescription?.sdp), short(pc.remoteDescription?.sdp)]);
|
||||||
|
if (local && remote) return { local, remote };
|
||||||
|
}
|
||||||
|
|
||||||
// The security check of tracker signaling, resolves once the peer proved the code. Each side signs its
|
// The security check of tracker signaling, resolves once the peer proved the code. Each side signs its
|
||||||
// role, its SDP type, and the fingerprints of both certificates as it sees them. The peer checks that
|
// role, its SDP type, and the fingerprints of both certificates as it sees them. The peer checks that
|
||||||
@@ -522,7 +561,6 @@ function connected(
|
|||||||
events.log(`connected via ${via}`);
|
events.log(`connected via ${via}`);
|
||||||
events.log('waiting for the security check');
|
events.log('waiting for the security check');
|
||||||
if (key) events.status('start', 'Connected, checking the code');
|
if (key) events.status('start', 'Connected, checking the code');
|
||||||
else events.status('wait', `Compare the security codes above with the ${peer}`);
|
|
||||||
let done = false;
|
let done = false;
|
||||||
const end = (reason: string) => {
|
const end = (reason: string) => {
|
||||||
if (done) return;
|
if (done) return;
|
||||||
@@ -541,8 +579,15 @@ function connected(
|
|||||||
return {
|
return {
|
||||||
checked: key
|
checked: key
|
||||||
? prove(pc, channel, key, end).then(() => events.log('security check passed'))
|
? prove(pc, channel, key, end).then(() => events.log('security check passed'))
|
||||||
: new Promise((resolve) =>
|
: securityCheck(pc).then(
|
||||||
events.check({ ...securityCheck(pc), confirm: resolve, reject: () => end('security check failed') }),
|
(codes) =>
|
||||||
|
new Promise<void>((resolve) => {
|
||||||
|
// The peer may have left while the codes were computed.
|
||||||
|
if (done) return;
|
||||||
|
if (!codes) return end('no certificate to check');
|
||||||
|
events.check({ ...codes, confirm: resolve, reject: () => end('security check failed') });
|
||||||
|
events.status('wait', `Compare the security codes above with the ${peer}`);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
start: () => (done = true),
|
start: () => (done = true),
|
||||||
end,
|
end,
|
||||||
@@ -590,7 +635,7 @@ export async function sendFile(
|
|||||||
events.progress(file.size, file.size);
|
events.progress(file.size, file.size);
|
||||||
stop();
|
stop();
|
||||||
} else if (typeof message?.error === 'string') {
|
} else if (typeof message?.error === 'string') {
|
||||||
stop(`receiver stopped: ${message.error.slice(0, 200)}`);
|
stop(`receiver stopped: ${message.error.replace(HIDDEN, '').slice(0, 200)}`);
|
||||||
}
|
}
|
||||||
wake();
|
wake();
|
||||||
};
|
};
|
||||||
@@ -638,7 +683,9 @@ export async function sendFile(
|
|||||||
.slice(offset, offset + CHUNK_SIZE)
|
.slice(offset, offset + CHUNK_SIZE)
|
||||||
.arrayBuffer()
|
.arrayBuffer()
|
||||||
.catch(() => undefined);
|
.catch(() => undefined);
|
||||||
if (!chunk) return stop(`could not read ${file.name} anymore`);
|
// A browser may read a file that shrank meanwhile short instead of failing.
|
||||||
|
if (chunk?.byteLength !== Math.min(CHUNK_SIZE, file.size - offset))
|
||||||
|
return stop(`could not read ${file.name} anymore`);
|
||||||
if (!open()) return;
|
if (!open()) return;
|
||||||
channel.send(chunk);
|
channel.send(chunk);
|
||||||
}
|
}
|
||||||
@@ -749,10 +796,10 @@ export function receiveFile(
|
|||||||
if (typeof name !== 'string' || name.length > MAX_NAME || !Number.isSafeInteger(size) || size < 0) {
|
if (typeof name !== 'string' || name.length > MAX_NAME || !Number.isSafeInteger(size) || size < 0) {
|
||||||
return handshake.end('the sender offered no valid file');
|
return handshake.end('the sender offered no valid file');
|
||||||
}
|
}
|
||||||
meta = { name, size };
|
meta = { name: name.replace(HIDDEN, ''), size };
|
||||||
events.log(`offered ${name} (${size} bytes)`);
|
events.log(`offered ${meta.name} (${size} bytes)`);
|
||||||
events.status('wait', 'Click Download to save the file');
|
events.status('wait', 'Click Download to save the file');
|
||||||
events.incoming({ name, size, download });
|
events.incoming({ ...meta, download });
|
||||||
} else if (downloading && !complete) {
|
} else if (downloading && !complete) {
|
||||||
received += data.byteLength;
|
received += data.byteLength;
|
||||||
if (received > meta!.size) return fail('the sender sent more than it offered');
|
if (received > meta!.size) return fail('the sender sent more than it offered');
|
||||||
@@ -808,7 +855,7 @@ export async function createOffer(file: File, events: Events, signal: AbortSigna
|
|||||||
events = live(events, signal);
|
events = live(events, signal);
|
||||||
events.status('start', 'Creating the offer');
|
events.status('start', 'Creating the offer');
|
||||||
const pc = await createPeerConnection(signal);
|
const pc = await createPeerConnection(signal);
|
||||||
const channel = pc.createDataChannel('file');
|
const channel = pc.createDataChannel(PROTOCOL);
|
||||||
channel.onopen = () =>
|
channel.onopen = () =>
|
||||||
sendFile(pc, channel, file, events, connected(pc, channel, 'manual exchange', 'receiver', events), signal);
|
sendFile(pc, channel, file, events, connected(pc, channel, 'manual exchange', 'receiver', events), signal);
|
||||||
const wait = failUnconnected(pc, () => channel.readyState !== 'connecting', events, signal, 'receiver');
|
const wait = failUnconnected(pc, () => channel.readyState !== 'connecting', events, signal, 'receiver');
|
||||||
@@ -844,6 +891,11 @@ export async function answerOffer(offer: string, events: ReceiveEvents, signal:
|
|||||||
// The sender's file channel, anything more is none of ours.
|
// The sender's file channel, anything more is none of ours.
|
||||||
if (opened) return;
|
if (opened) return;
|
||||||
opened = true;
|
opened = true;
|
||||||
|
if (channel.label !== PROTOCOL) {
|
||||||
|
events.log(`the sender's protocol: ${JSON.stringify(channel.label.replace(HIDDEN, '').slice(0, 100))}`);
|
||||||
|
pc.close();
|
||||||
|
return events.error(`the sender runs another protocol, both pages have to show protocol ${PROTOCOL}`);
|
||||||
|
}
|
||||||
receiveFile(pc, channel, events, connected(pc, channel, 'manual exchange', 'sender', events), signal);
|
receiveFile(pc, channel, events, connected(pc, channel, 'manual exchange', 'sender', events), signal);
|
||||||
};
|
};
|
||||||
const wait = failUnconnected(pc, () => opened, events, signal, 'sender');
|
const wait = failUnconnected(pc, () => opened, events, signal, 'sender');
|
||||||
@@ -861,9 +913,11 @@ export async function answerOffer(offer: string, events: ReceiveEvents, signal:
|
|||||||
|
|
||||||
// A socket to the tracker at url, closed with the session. Messages arrive parsed. A failure reason
|
// A socket to the tracker at url, closed with the session. Messages arrive parsed. A failure reason
|
||||||
// before anything else rejects the announcement, the tracker is no use then and its socket closes, a
|
// before anything else rejects the announcement, the tracker is no use then and its socket closes, a
|
||||||
// later one only concerns that message and is logged. message may be async, the next message doesn't
|
// later one only concerns that message and is noted. A message over MAX_TRACKER_MESSAGE rejects it the
|
||||||
// wait for it. lost runs once it closed without close() being called: unreachable, lost, rejected or
|
// same way, a later one is noted and dropped. note logs what the tracker made the page do, see
|
||||||
// without an answer within TRACKER_TIMEOUT. again announces once more, on the first interval it names.
|
// TRACKER_NOTES. message may be async, the next message doesn't wait for it. lost runs once it closed
|
||||||
|
// without close() being called: unreachable, lost, rejected or without an answer within
|
||||||
|
// TRACKER_TIMEOUT. again announces once more, on the first interval it names.
|
||||||
export function trackerSocket(
|
export function trackerSocket(
|
||||||
url: string,
|
url: string,
|
||||||
signal: AbortSignal,
|
signal: AbortSignal,
|
||||||
@@ -872,10 +926,27 @@ export function trackerSocket(
|
|||||||
lost: () => void,
|
lost: () => void,
|
||||||
again: () => void,
|
again: () => void,
|
||||||
) {
|
) {
|
||||||
const ws = new WebSocket(url);
|
let ws: WebSocket;
|
||||||
|
try {
|
||||||
|
ws = new WebSocket(url);
|
||||||
|
} catch (error) {
|
||||||
|
// Chromium refuses e.g. ws: on an https page right away, Firefox only closes the socket. Lost all
|
||||||
|
// the same, once the caller has it.
|
||||||
|
ws = Object.assign(new EventTarget(), { close: () => {} }) as unknown as WebSocket;
|
||||||
|
queueMicrotask(() => end(`${url} refused: ${error instanceof Error ? error.message : error}`));
|
||||||
|
}
|
||||||
let opened = false;
|
let opened = false;
|
||||||
let accepted = false;
|
let accepted = false;
|
||||||
let closed = false;
|
let closed = false;
|
||||||
|
// Messages in the current MESSAGE_WINDOW, since windowStart.
|
||||||
|
let windowStart = Date.now();
|
||||||
|
let count = 0;
|
||||||
|
const noted = new Set<string>();
|
||||||
|
const note = (line: string) => {
|
||||||
|
if (noted.has(line) || noted.size > TRACKER_NOTES) return;
|
||||||
|
noted.add(line);
|
||||||
|
events.log(noted.size > TRACKER_NOTES ? `${url}: more of it, no longer logged` : line);
|
||||||
|
};
|
||||||
let reannounce: ReturnType<typeof setInterval> | undefined;
|
let reannounce: ReturnType<typeof setInterval> | undefined;
|
||||||
const end = (reason: string) => {
|
const end = (reason: string) => {
|
||||||
if (closed) return;
|
if (closed) return;
|
||||||
@@ -891,6 +962,7 @@ export function trackerSocket(
|
|||||||
// What the tracker answered, if it rejected the announcement.
|
// What the tracker answered, if it rejected the announcement.
|
||||||
rejected: undefined as string | undefined,
|
rejected: undefined as string | undefined,
|
||||||
alive: () => !closed,
|
alive: () => !closed,
|
||||||
|
note,
|
||||||
close: () => {
|
close: () => {
|
||||||
if (closed) return;
|
if (closed) return;
|
||||||
closed = true;
|
closed = true;
|
||||||
@@ -901,6 +973,15 @@ export function trackerSocket(
|
|||||||
});
|
});
|
||||||
ws.addEventListener('open', () => (opened = true));
|
ws.addEventListener('open', () => (opened = true));
|
||||||
ws.addEventListener('message', ({ data }) => {
|
ws.addEventListener('message', ({ data }) => {
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - windowStart >= MESSAGE_WINDOW) {
|
||||||
|
windowStart = now;
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
if (++count > MAX_TRACKER_MESSAGES) return note(`${url} sends too much, dropping some of it`);
|
||||||
|
if (typeof data === 'string' && data.length > MAX_TRACKER_MESSAGE) {
|
||||||
|
return reject(`${url}: message over ${MAX_TRACKER_MESSAGE / 1024} KiB`);
|
||||||
|
}
|
||||||
const msg = parse(data);
|
const msg = parse(data);
|
||||||
const failure = msg?.['failure reason'];
|
const failure = msg?.['failure reason'];
|
||||||
if (typeof failure !== 'string') {
|
if (typeof failure !== 'string') {
|
||||||
@@ -913,10 +994,14 @@ export function trackerSocket(
|
|||||||
}
|
}
|
||||||
return void message(msg);
|
return void message(msg);
|
||||||
}
|
}
|
||||||
if (accepted) return events.log(`${url}: ${failure}`);
|
reject(`${url}: ${failure.replace(HIDDEN, '').slice(0, 200)}`);
|
||||||
tracker.rejected = `${url}: ${failure.slice(0, 200)}`;
|
|
||||||
end(`rejected by ${tracker.rejected}`);
|
|
||||||
});
|
});
|
||||||
|
// A problem with the tracker's message: the end before acceptance, after it only that message's.
|
||||||
|
const reject = (reason: string) => {
|
||||||
|
if (accepted) return note(reason);
|
||||||
|
tracker.rejected = reason;
|
||||||
|
end(`rejected by ${reason}`);
|
||||||
|
};
|
||||||
ws.addEventListener('close', () => end(opened ? `lost ${url}` : `${url} unreachable`));
|
ws.addEventListener('close', () => end(opened ? `lost ${url}` : `${url} unreachable`));
|
||||||
return tracker;
|
return tracker;
|
||||||
}
|
}
|
||||||
@@ -1031,6 +1116,8 @@ export async function sendViaTracker(file: File, events: SendEvents, signal: Abo
|
|||||||
const timeout = setTimeout(unconnected, CONNECT_TIMEOUT);
|
const timeout = setTimeout(unconnected, CONNECT_TIMEOUT);
|
||||||
pc.ondatachannel = ({ channel }) => {
|
pc.ondatachannel = ({ channel }) => {
|
||||||
if (settled) return;
|
if (settled) return;
|
||||||
|
// Only a fork that kept the name derives these keys.
|
||||||
|
if (channel.label !== PROTOCOL) return giveUp(`receiver via ${url} runs another protocol`);
|
||||||
settled = true;
|
settled = true;
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
const handshake = connected(pc, channel, url, 'receiver', events, next, key);
|
const handshake = connected(pc, channel, url, 'receiver', events, next, key);
|
||||||
@@ -1080,9 +1167,13 @@ export async function sendViaTracker(file: File, events: SendEvents, signal: Abo
|
|||||||
const sdp = await unseal(sealing, 'offer', msg.offer.sdp);
|
const sdp = await unseal(sealing, 'offer', msg.offer.sdp);
|
||||||
// Meanwhile the share may have been used up, expired or ended, its tracker closed then.
|
// Meanwhile the share may have been used up, expired or ended, its tracker closed then.
|
||||||
if (signal.aborted || !tracker.alive()) return;
|
if (signal.aborted || !tracker.alive()) return;
|
||||||
if (sdp === undefined) return events.log(`offer without the code via ${url}`);
|
if (sdp === undefined) return tracker.note(`offer without the code via ${url}`);
|
||||||
const offer = { offer: { sdp }, peer_id: msg.peer_id, offer_id: msg.offer_id };
|
const offer = { offer: { sdp }, peer_id: msg.peer_id, offer_id: msg.offer_id };
|
||||||
if (busy) waiting = () => answer(tracker.ws, url, offer);
|
// A lost tracker would take no answer, a receiver that came by it looks on the next one.
|
||||||
|
if (busy)
|
||||||
|
waiting = async () => {
|
||||||
|
if (tracker.alive()) await answer(tracker.ws, url, offer);
|
||||||
|
};
|
||||||
else void answer(tracker.ws, url, offer);
|
else void answer(tracker.ws, url, offer);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
@@ -1100,7 +1191,8 @@ export async function sendViaTracker(file: File, events: SendEvents, signal: Abo
|
|||||||
trackers.push(tracker);
|
trackers.push(tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
join(0);
|
// Ended while the key was derived.
|
||||||
|
if (!signal.aborted) join(0);
|
||||||
return { code, until };
|
return { code, until };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,7 +1241,7 @@ export async function receiveViaTracker(code: string, events: ReceiveEvents, sig
|
|||||||
const nobody = () =>
|
const nobody = () =>
|
||||||
hint
|
hint
|
||||||
? `no sender connected until ${formatTime(until)}: ${hint}`
|
? `no sender connected until ${formatTime(until)}: ${hint}`
|
||||||
: `no sender answered until ${formatTime(until)}, ${ownSalt === undefined ? '' : 'check that both of you use the same salt or '}ask the sender for a new code`;
|
: `no sender answered until ${formatTime(until)}, check that both pages show protocol ${PROTOCOL}${ownSalt === undefined ? '' : ' and you use the same salt'} or ask the sender for a new code`;
|
||||||
// Without a sender connected the search is over, every offer goes.
|
// Without a sender connected the search is over, every offer goes.
|
||||||
const end = (reason: string) => {
|
const end = (reason: string) => {
|
||||||
expiry.close();
|
expiry.close();
|
||||||
@@ -1194,7 +1286,7 @@ export async function receiveViaTracker(code: string, events: ReceiveEvents, sig
|
|||||||
entry.pc = pc;
|
entry.pc = pc;
|
||||||
// Meanwhile the download may have started or the search ended.
|
// Meanwhile the download may have started or the search ended.
|
||||||
if (signal.aborted || started || expired) return pc.close();
|
if (signal.aborted || started || expired) return pc.close();
|
||||||
const channel = pc.createDataChannel('file');
|
const channel = pc.createDataChannel(PROTOCOL);
|
||||||
const offerId = randomBinary(20);
|
const offerId = randomBinary(20);
|
||||||
let timeout: ReturnType<typeof setTimeout> | undefined;
|
let timeout: ReturnType<typeof setTimeout> | undefined;
|
||||||
// Unless another offer is connected, next replaces this one then.
|
// Unless another offer is connected, next replaces this one then.
|
||||||
@@ -1263,7 +1355,7 @@ export async function receiveViaTracker(code: string, events: ReceiveEvents, sig
|
|||||||
if (none)
|
if (none)
|
||||||
events.status(
|
events.status(
|
||||||
'retry',
|
'retry',
|
||||||
`No sender with this code on any tracker. Check the code${ownSalt === undefined ? '' : ' and the salt'}, still looking`,
|
`No sender with this code on any tracker. Check the code${ownSalt === undefined ? '' : ' and the salt'} and that both pages show protocol ${PROTOCOL}, still looking`,
|
||||||
);
|
);
|
||||||
else if (failure) events.status('retry', `${failure}. Looking again`);
|
else if (failure) events.status('retry', `${failure}. Looking again`);
|
||||||
else events.status('wait', `Found the share on ${host(url)}, waiting for the sender to answer`);
|
else events.status('wait', `Found the share on ${host(url)}, waiting for the sender to answer`);
|
||||||
@@ -1276,7 +1368,7 @@ export async function receiveViaTracker(code: string, events: ReceiveEvents, sig
|
|||||||
// Only one answer per offer, a replacement opens its own socket. Meanwhile it may have
|
// Only one answer per offer, a replacement opens its own socket. Meanwhile it may have
|
||||||
// come, or the search ended, its socket closed then.
|
// come, or the search ended, its socket closed then.
|
||||||
if (pc.signalingState === 'closed' || !tracker.alive()) return;
|
if (pc.signalingState === 'closed' || !tracker.alive()) return;
|
||||||
if (answer === undefined) return events.log(`answer without the code via ${url}`);
|
if (answer === undefined) return tracker.note(`answer without the code via ${url}`);
|
||||||
events.log(`answer via ${url}`);
|
events.log(`answer via ${url}`);
|
||||||
attempts++;
|
attempts++;
|
||||||
noSender = false;
|
noSender = false;
|
||||||
|
|||||||
+11
-1
@@ -5,11 +5,17 @@
|
|||||||
|
|
||||||
// Firefox stops a service worker after 30 s without events, also in the middle of a download, and
|
// Firefox stops a service worker after 30 s without events, also in the middle of a download, and
|
||||||
// then saves the truncated file as complete. A stalled transfer sends no chunks, so the receiver pings.
|
// then saves the truncated file as complete. A stalled transfer sends no chunks, so the receiver pings.
|
||||||
|
// Without either for longer, public/sw.js takes the page for gone and fails the download, see SILENCE.
|
||||||
const KEEPALIVE = 10_000;
|
const KEEPALIVE = 10_000;
|
||||||
// The browser may read all of a small file, e.g. an empty one, before it hands the navigation to its
|
// The browser may read all of a small file, e.g. an empty one, before it hands the navigation to its
|
||||||
// download manager. Its frame removed before that, the download never shows up, though the worker
|
// download manager. Its frame removed before that, the download never shows up, though the worker
|
||||||
// reported it finished. No event tells when the browser took it, 1 s was always enough in the tests.
|
// reported it finished. No event tells when the browser took it, 1 s was always enough in the tests.
|
||||||
const DOWNLOAD_GRACE = 1000;
|
const DOWNLOAD_GRACE = 1000;
|
||||||
|
// Of the messages between this page and public/sw.js, which has it too. A page can talk to a worker
|
||||||
|
// of another version: a new page while another tab's download holds the old worker, or an old page
|
||||||
|
// once an update took over. The worker refuses a version it doesn't speak with outdated, each change
|
||||||
|
// to the messages takes a new one, in both files.
|
||||||
|
const VERSION = 1;
|
||||||
|
|
||||||
const downloads = registerDownloads();
|
const downloads = registerDownloads();
|
||||||
// Reported once the user receives, not as an uncaught error on every visit, e.g. in a private window.
|
// Reported once the user receives, not as an uncaught error on every visit, e.g. in a private window.
|
||||||
@@ -110,11 +116,15 @@ export function startDownload(file: { name: string; size: number }, events: Down
|
|||||||
if (data === 'finished') events.finished();
|
if (data === 'finished') events.finished();
|
||||||
if (data === 'cancelled') events.cancelled();
|
if (data === 'cancelled') events.cancelled();
|
||||||
if (data === 'failed') events.failed('the service worker refused it');
|
if (data === 'failed') events.failed('the service worker refused it');
|
||||||
|
if (data === 'silent') events.failed('the service worker heard nothing from this page for too long');
|
||||||
|
if (data === 'outdated') {
|
||||||
|
events.failed('this page and its service worker are different versions, reload once no tab receives');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ended = true;
|
ended = true;
|
||||||
release(data === 'finished');
|
release(data === 'finished');
|
||||||
};
|
};
|
||||||
worker.postMessage({ id, ...file }, [port2]);
|
worker.postMessage({ id, version: VERSION, ...file }, [port2]);
|
||||||
return worker;
|
return worker;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
|||||||
+13
-1
@@ -411,6 +411,12 @@ label strong,
|
|||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A dropped folder, refused */
|
||||||
|
#not-a-file {
|
||||||
|
color: var(--color-secondary-text);
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
/* How the session is doing, below the file on its side. Until the transfer starts a pill passes
|
/* How the session is doing, below the file on its side. Until the transfer starts a pill passes
|
||||||
through the bar, blue, or pink while it tries again after a failure. Then the transfer's progress,
|
through the bar, blue, or pink while it tries again after a failure. Then the transfer's progress,
|
||||||
green once done, muted once stopped, pink for an error. The line below says what. */
|
green once done, muted once stopped, pink for an error. The line below says what. */
|
||||||
@@ -616,14 +622,20 @@ output {
|
|||||||
/* Source link, quiet below everything */
|
/* Source link, quiet below everything */
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--space-2) var(--space-4);
|
||||||
padding-bottom: var(--space-6);
|
padding-bottom: var(--space-6);
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
color: var(--color-text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a {
|
footer a {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--space-2);
|
gap: var(--space-2);
|
||||||
font-size: var(--text-sm);
|
|
||||||
color: var(--color-text-muted);
|
color: var(--color-text-muted);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: color var(--transition);
|
transition: color var(--transition);
|
||||||
|
|||||||
+22
-1
@@ -2,8 +2,29 @@
|
|||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
|
const DEV_STYLE_SRC = "style-src 'self'";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()],
|
plugins: [
|
||||||
|
vue(),
|
||||||
|
// index.html's Content-Security-Policy allows no inline styles, the dev server injects the CSS
|
||||||
|
// through JavaScript. A nonce lets only those style elements through, so the dev server enforces
|
||||||
|
// the same policy as the production build, which links the CSS as files.
|
||||||
|
{
|
||||||
|
name: 'dev-csp',
|
||||||
|
apply: 'serve',
|
||||||
|
config: () => ({ html: { cspNonce: 'dev' } }),
|
||||||
|
transformIndexHtml(html) {
|
||||||
|
if (!html.includes(DEV_STYLE_SRC)) throw new Error(`dev-csp: index.html has no "${DEV_STYLE_SRC}"`);
|
||||||
|
return html.replace(DEV_STYLE_SRC, `${DEV_STYLE_SRC} 'nonce-dev'`);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// The dev server would inline small images like gitea.svg as data: URLs, which index.html's
|
||||||
|
// Content-Security-Policy blocks. The production build links them as files either way.
|
||||||
|
build: { assetsInlineLimit: 0 },
|
||||||
|
// Relative links, so the build works under any path, not only at the root of a host.
|
||||||
|
base: './',
|
||||||
// Playwright runs e2e.spec.ts and backend/, which Vitest would pick up too.
|
// Playwright runs e2e.spec.ts and backend/, which Vitest would pick up too.
|
||||||
test: { include: ['src/**/*.test.ts'] },
|
test: { include: ['src/**/*.test.ts'] },
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user