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

@ -3,6 +3,7 @@ import { Icon } from "./Icon.jsx";
import { ImageViewer } from "./ImageViewer.jsx";
import { AutoBackupModal, ConfirmModal, CreateToolboxModal, LinkToolboxModal, NotificationToast } from "./ToolboxModals.jsx";
import { navigate } from "../router/hashRouter.js";
import { ShareToolboxModal } from "../features/toolboxes/sharing/ShareToolboxModal.jsx";
import { uid } from "../features/toolboxes/storage/toolboxStorage.js";
function scrollToTopAfterNavigation() {
@ -30,6 +31,9 @@ export function AppOverlays({
setCreateModal,
linkModalGameId,
setLinkModalGameId,
shareToolboxId,
setShareToolboxId,
shareContent,
setDrawerGameId,
storageError,
storageErrorTitle,
@ -74,6 +78,13 @@ export function AppOverlays({
actions.linkToolboxToGame(gameId, toolboxId);
setDrawerGameId(gameId);
}} />}
{shareToolboxId && shareContent && toolboxes.some((toolbox) => toolbox.id === shareToolboxId) && <ShareToolboxModal
key={shareToolboxId}
toolbox={toolboxes.find((toolbox) => toolbox.id === shareToolboxId)}
content={shareContent}
actions={actions}
onClose={() => setShareToolboxId("")}
/>}
{autoBackupModalOpen && <AutoBackupModal backup={autoBackup} content={autoBackupContent} onExport={actions.exportAllToolboxes} onClose={() => setAutoBackupModalOpen(false)} />}
{storageError && <ConfirmModal title={storageErrorTitle} message={storageError} confirmLabel="Compris" cancelLabel="Fermer" danger onClose={() => setStorageError("")} />}
{image && <ImageViewer image={image} onClose={() => setImage(null)} createMarkerId={() => uid("marker")} />}

View file

@ -8,7 +8,7 @@ import { Tooltip } from "./Tooltip.jsx";
export function Shell({ route, content, games, drawerGameId = "", drawerVisible = false, compactGameLayout = false, reducedSidebar = false, cardsEnabled = false, actions, onOpenAutoBackup, children }) {
const gameId = route.split("/")[1] === "games" ? route.split("/")[2] || "" : "";
const game = games.find((item) => item.id === gameId);
const topbarLabel = route === "/design-system" && import.meta.env.DEV ? "Design system" : route.startsWith("/toolbox") ? content.topbar.toolbox : route.startsWith("/games") ? content.topbar.games : route === "/library" ? content.topbar.library : route.startsWith("/cards") ? content.topbar.cards : content.topbar.dashboard;
const topbarLabel = route === "/design-system" && import.meta.env.DEV ? "Design system" : route.startsWith("/toolbox") || route.startsWith("/receive/") ? content.topbar.toolbox : route.startsWith("/games") ? content.topbar.games : route === "/library" ? content.topbar.library : route.startsWith("/cards") ? content.topbar.cards : content.topbar.dashboard;
const toolboxOpen = Boolean(game && drawerGameId === game.id && drawerVisible);
const toolboxLabel = toolboxOpen ? "Masquer la toolbox" : "Afficher la toolbox";
const compactSidebar = Boolean(reducedSidebar || (!compactGameLayout && toolboxOpen));