Send a toolbox through an encrypted link
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 20m39s
Validate and deploy Sokko G / deploy (push) Successful in 12s

Sharing a toolbox meant exporting a JSON file and passing it around by
hand. A toolbox can now be sent from the site while staying local first:
the browser compresses and encrypts the v2 export with AES-GCM, and the
key lives only in the link fragment, so the server keeps for at most
24 hours a copy it cannot read.

- Add the /api/shares service: upload, metadata, download and revoke,
  with files in SHARES_DIR, a purge every 10 minutes, and single-use
  links (the default) deleted only once fully downloaded.
- Cap the server load: 50 MiB per share, total storage, free disk
  space, daily volume, concurrent and stalled uploads, reads per link,
  plus a wide per-connection cap kept in memory without storing IPs.
- Limit each browser to 2 shares and 100 MiB per day and 2 active
  links, and show the existing link of a toolbox already shared.
- Add the send dialog (card and game drawer) and the /receive page,
  which previews or directly imports through the existing import path.
- Move shared HTTP helpers to services/http.js for both APIs.
- Document the format, delivery, server layout and privacy wording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-11 16:26:05 +01:00
parent 957bfdc86f
commit bec9ea5b2f
43 changed files with 2349 additions and 59 deletions

View file

@ -6,3 +6,4 @@
@use "overlays/notifications";
@use "overlays/tool-add";
@use "overlays/toolbox-management";
@use "overlays/toolbox-share";

View file

@ -44,6 +44,11 @@
-webkit-mask-image: url("/static/icons/import.svg");
}
.ui-icon-send {
mask-image: url("/static/icons/send.svg");
-webkit-mask-image: url("/static/icons/send.svg");
}
.ui-icon-link {
mask-image: url("/static/icons/link.svg");
-webkit-mask-image: url("/static/icons/link.svg");

View file

@ -0,0 +1,151 @@
// Rôle : stylise l'envoi d'une toolbox par lien et la page de réception.
.toolbox-share-modal.nds-modal {
width: min(620px, calc(100vw - 32px));
max-height: min(760px, calc(100vh - 32px));
overflow-y: auto;
}
.toolbox-share-modal-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--space-4);
}
.toolbox-share-modal-header h2 {
margin-bottom: 0;
overflow-wrap: anywhere;
}
.toolbox-share-modal-header .eyebrow {
margin-bottom: 4px;
}
.toolbox-share-description,
.toolbox-share-privacy,
.toolbox-share-link-meta,
.toolbox-share-status {
color: var(--color-text-secondary);
line-height: 1.6;
}
.toolbox-share-privacy {
margin-top: var(--space-4);
font-size: var(--font-size-sm);
}
.toolbox-share-form,
.toolbox-share-link,
.toolbox-share-error,
.toolbox-share-active {
margin-top: var(--space-4);
}
.toolbox-share-option {
display: flex;
align-items: flex-start;
gap: var(--space-3);
padding: var(--space-4);
border: 1px solid rgba(165, 180, 252, 0.14);
border-radius: var(--radius-md);
background: rgba(5, 7, 17, 0.32);
cursor: pointer;
}
.toolbox-share-option input {
flex: none;
margin-top: 2px;
}
.toolbox-share-option span,
.toolbox-share-active li > span {
display: grid;
gap: 2px;
min-width: 0;
}
.toolbox-share-option small,
.toolbox-share-active small {
color: var(--color-text-secondary);
}
.toolbox-share-link .nds-input {
width: 100%;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.toolbox-share-link-actions {
margin-top: var(--space-3);
}
.toolbox-share-active h3 {
margin-bottom: var(--space-2);
font-size: var(--font-size-sm);
}
.toolbox-share-active ul {
display: grid;
gap: var(--space-2);
margin: 0;
padding: 0;
list-style: none;
}
.toolbox-share-active li {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-3);
}
.toolbox-share-active strong {
overflow-wrap: anywhere;
}
.toolbox-receive {
width: min(720px, 100%);
margin: 0 auto;
}
.toolbox-receive-card {
padding: var(--space-6);
}
.toolbox-receive-summary {
display: flex;
align-items: center;
gap: var(--space-4);
margin-top: var(--space-4);
}
.toolbox-receive-summary img {
flex: none;
width: 72px;
height: 72px;
border-radius: var(--radius-md);
object-fit: cover;
background: var(--gradient-nebula);
}
.toolbox-receive-summary h2 {
margin-bottom: 4px;
overflow-wrap: anywhere;
}
.toolbox-receive-tools {
display: flex;
flex-wrap: wrap;
gap: var(--space-2);
margin: var(--space-4) 0 var(--space-3);
padding: 0;
list-style: none;
}
.toolbox-receive-text {
color: var(--color-text-secondary);
line-height: 1.6;
}
.toolbox-receive-actions {
margin-top: var(--space-5);
}