Skip to content

Commit c7e7bbf

Browse files
Overhaul the web UI: in-app dialogs, file viewer, typed icons, PWA, legal pages
A broad polish pass across the whole web app: - Branding: stylised OpenCoperLock wordmark (no padlock glyph beside it). - Replace every native browser prompt/confirm/alert with an in-app dialog + toast system (confirm / prompt / choose / toast), used in Drive, Admin, Shares and Account. Adds a share-link result modal with copy-to-clipboard. - File-type icons: coloured, type-aware glyphs (PDF red, Word blue, Excel green, etc.) shared across Drive and the share page. - In-app file viewer: open PDFs, images, text, audio and video inside OCL (server and Zero-Knowledge files); Office/other fall back to download. - Responsive: mobile top bar + slide-over drawer; fluid paddings. - Redesigned login (legal footer), Quick-Upload (drag & drop, FR) and the public share page (dark theme, file icons, credit footer). - Legal/about pages (terms, privacy, license) crediting Forge Network and the AGPLv3 licence, linked from login and shares. - Error pages: styled 404, error boundary and global-error. - PWA: web manifest, minimal app-shell service worker, maskable icon. - Open Graph / Twitter metadata + generated OG image for link previews.
1 parent 2a8137e commit c7e7bbf

28 files changed

Lines changed: 1788 additions & 404 deletions

‎apps/web/public/icon-maskable.svg‎

Lines changed: 14 additions & 0 deletions
Loading

‎apps/web/public/icon.svg‎

Lines changed: 8 additions & 0 deletions
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "OpenCoperLock",
3+
"short_name": "OpenCoperLock",
4+
"description": "Cloud privé auto-hébergeable : espaces chiffrés, coffres Zero-Knowledge, partage et outils de sécurité.",
5+
"lang": "fr",
6+
"start_url": "/",
7+
"scope": "/",
8+
"display": "standalone",
9+
"background_color": "#0a0a0f",
10+
"theme_color": "#0a0a0f",
11+
"icons": [
12+
{ "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" },
13+
{ "src": "/icon-maskable.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "maskable" }
14+
]
15+
}

‎apps/web/public/sw.js‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* OpenCoperLock service worker — deliberately minimal.
3+
*
4+
* It exists to make the app installable and to serve an offline fallback for page
5+
* navigations. It NEVER caches API responses or file contents: those are private and
6+
* potentially large, and stale copies would be both confusing and a data-leak risk. Only
7+
* same-origin GET navigations get a cached app-shell fallback when the network is down.
8+
*/
9+
const CACHE = 'ocl-shell-v1';
10+
const SHELL = '/';
11+
12+
self.addEventListener('install', (event) => {
13+
event.waitUntil(caches.open(CACHE).then((c) => c.add(SHELL)).catch(() => {}));
14+
self.skipWaiting();
15+
});
16+
17+
self.addEventListener('activate', (event) => {
18+
event.waitUntil(
19+
caches.keys().then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))),
20+
);
21+
self.clients.claim();
22+
});
23+
24+
self.addEventListener('fetch', (event) => {
25+
const req = event.request;
26+
if (req.method !== 'GET') return;
27+
28+
const url = new URL(req.url);
29+
if (url.origin !== self.location.origin) return; // never touch the cross-origin API
30+
31+
// App-shell strategy for page navigations only.
32+
if (req.mode === 'navigate') {
33+
event.respondWith(
34+
fetch(req)
35+
.then((res) => {
36+
caches.open(CACHE).then((c) => c.put(SHELL, res.clone())).catch(() => {});
37+
return res;
38+
})
39+
.catch(() => caches.match(SHELL).then((r) => r || Response.error())),
40+
);
41+
}
42+
});

‎apps/web/src/app/(app)/account/page.tsx‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useCallback, useEffect, useState } from 'react';
88
import { useRouter } from 'next/navigation';
99
import { api, API_URL, ApiError } from '@/lib/api';
1010
import { useAuth } from '@/lib/auth';
11+
import { prompt } from '@/components/ui/overlays';
1112

1213
interface TwoFaStatus {
1314
enabled: boolean;
@@ -74,7 +75,7 @@ export default function AccountPage() {
7475
}
7576

7677
async function disable() {
77-
const password = window.prompt('Confirm your password to disable two-factor');
78+
const password = await prompt({ title: 'Désactiver la 2FA', label: 'Confirmez votre mot de passe', password: true });
7879
if (!password) return;
7980
await wrap(async () => {
8081
await api.post('/2fa/disable', { password });
@@ -84,7 +85,7 @@ export default function AccountPage() {
8485
}
8586

8687
async function regenerate() {
87-
const password = window.prompt('Confirm your password to regenerate recovery codes');
88+
const password = await prompt({ title: 'Régénérer les codes de secours', label: 'Confirmez votre mot de passe', password: true });
8889
if (!password) return;
8990
await wrap(async () => {
9091
const res = await api.post<{ recoveryCodes: string[] }>('/2fa/recovery/regenerate', { password });
@@ -107,9 +108,12 @@ export default function AccountPage() {
107108
}
108109

109110
async function deleteAccount() {
110-
const password = window.prompt(
111-
'This permanently deletes your account and all your files. Enter your password to confirm.',
112-
);
111+
const password = await prompt({
112+
title: 'Supprimer le compte',
113+
message: 'Cette action supprime définitivement votre compte et tous vos fichiers. Irréversible.',
114+
label: 'Confirmez votre mot de passe',
115+
password: true,
116+
});
113117
if (!password) return;
114118
await wrap(async () => {
115119
await api.post('/account/delete', { password });

‎apps/web/src/app/(app)/admin/page.tsx‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { PublicQuickCode, PublicUser } from '@opencoperlock/shared/client';
55
import { formatBytes } from '@opencoperlock/shared/client';
66
import { api, ApiError } from '@/lib/api';
77
import { useAuth } from '@/lib/auth';
8+
import { confirm, prompt } from '@/components/ui/overlays';
89

910
interface Stats {
1011
globalUsedBytes: number;
@@ -167,10 +168,14 @@ export default function AdminPage() {
167168
<div className="flex gap-2">
168169
<button
169170
className="btn-ghost px-2 py-1"
170-
onClick={() => {
171-
const gb = window.prompt('Quota in GiB (empty = unlimited)');
171+
onClick={async () => {
172+
const gb = await prompt({
173+
title: 'Quota de stockage',
174+
label: 'Quota en Gio (vide = illimité)',
175+
defaultValue: u.quotaBytes !== null ? String(Math.round(u.quotaBytes / 1024 ** 3)) : '',
176+
});
172177
if (gb === null) return;
173-
const quotaBytes = gb === '' ? null : Math.round(Number(gb) * 1024 ** 3);
178+
const quotaBytes = gb.trim() === '' ? null : Math.round(Number(gb) * 1024 ** 3);
174179
void wrap(() => api.patch(`/admin/users/${u.id}`, { quotaBytes }));
175180
}}
176181
>
@@ -186,8 +191,8 @@ export default function AdminPage() {
186191
<button
187192
className="btn-danger px-2 py-1"
188193
disabled={u.id === user?.id}
189-
onClick={() => {
190-
if (window.confirm(`Delete ${u.email}?`))
194+
onClick={async () => {
195+
if (await confirm({ title: `Supprimer ${u.email} ?`, danger: true, confirmLabel: 'Supprimer' }))
191196
void wrap(() => api.del(`/admin/users/${u.id}`));
192197
}}
193198
>
@@ -204,7 +209,8 @@ export default function AdminPage() {
204209
<h2 className="font-semibold">Quick-Upload codes</h2>
205210
<p className="text-sm text-neutral-500">
206211
Leave the code blank for a random one, or set a memorable code you can type from any
207-
device (letters, digits and dashes).
212+
device (letters, digits and dashes). Files dropped with a code land in your
213+
<span className="font-medium text-zinc-300"> Fast-Upload</span> folder.
208214
</p>
209215
<div className="flex flex-wrap items-center gap-2">
210216
<input

0 commit comments

Comments
 (0)