Skip to content

Commit bb686ab

Browse files
docs(site): add Desktop integrations section (right-click + WebDAV mount)
- New /docs section with download buttons and copy-paste one-liners for the "Send to OpenCoperLock" right-click uploader (Windows + Linux) and the Windows WebDAV mount script, served from the official repo. - Make both Send-To installers repo-aware: they pull their components (send.ps1/send.sh, icon) from the checkout when present, else from the official repo, so the `irm|iex` / `curl|bash` one-liners work standalone. - Add a btns block type to the docs page for download links.
1 parent ac95210 commit bb686ab

4 files changed

Lines changed: 107 additions & 13 deletions

File tree

apps/web/src/app/docs/page.tsx

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import {
2323
UserCog,
2424
Smartphone,
2525
ArrowUpRight,
26+
Download,
27+
MousePointer2,
2628
type LucideIcon,
2729
} from 'lucide-react';
2830
import { API_URL } from '@/lib/api';
@@ -38,7 +40,8 @@ type Block =
3840
| { ol: string[] }
3941
| { code: string }
4042
| { note: string }
41-
| { warn: string };
43+
| { warn: string }
44+
| { btns: { label: string; href: string }[] };
4245

4346
interface Section {
4447
id: string;
@@ -378,6 +381,53 @@ curl -H "Authorization: Bearer ocl_…" -F "file=@backup.tgz" \\
378381
},
379382
],
380383
},
384+
{
385+
id: 'desktop',
386+
icon: MousePointer2,
387+
title: L('Intégrations bureau (clic droit, disque réseau)', 'Desktop integrations (right-click, network drive)'),
388+
blocks: [
389+
{ h: L('Envoyer vers OpenCoperLock (clic droit)', 'Send to OpenCoperLock (right-click)') },
390+
{
391+
p: L(
392+
'Ajoute une entrée « Envoyer vers → OpenCoperLock » au clic droit de votre explorateur de fichiers (Windows et Linux). Les fichiers sélectionnés sont envoyés en un clic dans un espace « ComputerShared » de votre Drive, via WebDAV. L’installeur mémorise votre serveur et votre jeton d’API.',
393+
'Adds a “Send to → OpenCoperLock” entry to your file manager’s right-click menu (Windows and Linux). Selected files upload in one click to a “ComputerShared” space in your Drive, over WebDAV. The installer remembers your server and API token.',
394+
),
395+
},
396+
{ note: L('Créez d’abord un jeton d’API non restreint : Compte → Jetons d’API.', 'First create an unrestricted API token: Account → API tokens.') },
397+
{ h: L('Windows', 'Windows') },
398+
{
399+
p: L(
400+
'Ouvrez PowerShell et lancez (aucun droit administrateur requis) :',
401+
'Open PowerShell and run (no administrator rights needed):',
402+
),
403+
},
404+
{ code: 'irm https://raw.githubusercontent.com/softpython2884/OpenCoperLock/main/scripts/send-to/windows/install-windows.ps1 | iex' },
405+
{ h: L('Linux', 'Linux') },
406+
{ p: L('GNOME Files, Cinnamon (Nemo) et KDE Dolphin. Dans un terminal :', 'GNOME Files, Cinnamon (Nemo) and KDE Dolphin. In a terminal:') },
407+
{ code: 'curl -fsSL https://raw.githubusercontent.com/softpython2884/OpenCoperLock/main/scripts/send-to/linux/install-linux.sh | bash' },
408+
{
409+
btns: [
410+
{ label: L('Télécharger l’installeur Windows (.cmd)', 'Download Windows installer (.cmd)'), href: 'https://github.com/softpython2884/OpenCoperLock/raw/main/scripts/send-to/windows/install-windows.cmd' },
411+
{ label: L('Voir les scripts sur GitHub', 'View the scripts on GitHub'), href: 'https://github.com/softpython2884/OpenCoperLock/tree/main/scripts/send-to' },
412+
],
413+
},
414+
{ h: L('Monter le Drive en disque réseau (Windows)', 'Mount the Drive as a network drive (Windows)') },
415+
{
416+
p: L(
417+
'Le client WebDAV de Windows est capricieux (voir la section WebDAV). Ce script configure le service WebClient, corrige les réglages qui bloquent, puis monte votre Drive sur une lettre (X: par défaut). Lancez dans PowerShell :',
418+
'Windows’ WebDAV client is finicky (see the WebDAV section). This script configures the WebClient service, fixes the settings that block it, then maps your Drive to a letter (X: by default). Run in PowerShell:',
419+
),
420+
},
421+
{ code: '$f="$env:TEMP\\ocl-mount.ps1"; irm https://raw.githubusercontent.com/softpython2884/OpenCoperLock/main/scripts/mount-opencoperlock-windows.ps1 -OutFile $f; powershell -ExecutionPolicy Bypass -File $f' },
422+
{
423+
btns: [
424+
{ label: L('Télécharger le script (.cmd)', 'Download the script (.cmd)'), href: 'https://github.com/softpython2884/OpenCoperLock/raw/main/scripts/mount-opencoperlock-windows.cmd' },
425+
{ label: L('Télécharger le script (.ps1)', 'Download the script (.ps1)'), href: 'https://github.com/softpython2884/OpenCoperLock/raw/main/scripts/mount-opencoperlock-windows.ps1' },
426+
],
427+
},
428+
{ note: L('Un prompt UAC apparaît uniquement pour la partie qui règle le service WebClient. Le mappage du lecteur reste en session utilisateur.', 'A UAC prompt appears only for the part that configures the WebClient service. The drive mapping stays in your user session.') },
429+
],
430+
},
381431
{
382432
id: 'security',
383433
icon: ShieldCheck,
@@ -533,6 +583,20 @@ curl -H "Authorization: Bearer ocl_…" -F "file=@backup.tgz" \\
533583
<p key={i} className="rounded-lg border border-amber-500/25 bg-amber-500/[0.06] px-3 py-2 text-sm text-amber-100/90">
534584
⚠️ {b.warn}
535585
</p>
586+
) : 'btns' in b ? (
587+
<div key={i} className="flex flex-wrap gap-2 pt-1">
588+
{b.btns.map((btn) => (
589+
<a
590+
key={btn.href}
591+
href={btn.href}
592+
target="_blank"
593+
rel="noreferrer"
594+
className="inline-flex items-center gap-1.5 rounded-lg border border-white/10 bg-white/[0.03] px-3 py-1.5 text-sm text-zinc-200 transition hover:border-violet-400/40 hover:bg-violet-500/10 hover:text-white"
595+
>
596+
<Download size={15} /> {btn.label}
597+
</a>
598+
))}
599+
</div>
536600
) : 'ol' in b ? (
537601
<ol key={i} className="list-decimal space-y-1 pl-5 text-sm leading-relaxed text-zinc-400">
538602
{b.ol.map((li) => (

scripts/send-to/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ new server code — just your existing `ocl_…` API token.
1313

1414
1. Get an **unrestricted API token**: web app → *Account → API tokens* (folder-scoped tokens are
1515
refused by WebDAV).
16-
2. Double-click **`windows/install-windows.cmd`**. Paste your WebDAV URL
17-
(e.g. `https://copper.forgenet.fr/api/dav`) and the token when asked. *No admin needed.*
16+
2. Install, either way (no admin needed):
17+
- **One-liner** — in PowerShell:
18+
```powershell
19+
irm https://raw.githubusercontent.com/softpython2884/OpenCoperLock/main/scripts/send-to/windows/install-windows.ps1 | iex
20+
```
21+
- **Or** double-click **`windows/install-windows.cmd`** from a checkout.
22+
23+
Paste your WebDAV URL (e.g. `https://copper.forgenet.fr/api/dav`) and the token when asked.
1824
3. Done — right-click any file(s) → **Send to → OpenCoperLock**.
1925
2026
The installer copies `send.ps1` + the icon into `%LOCALAPPDATA%\OpenCoperLock`, stores your token
@@ -28,7 +34,11 @@ Re-run the installer any time to change the URL/token. To uninstall, delete the
2834
## Linux
2935
3036
1. Get an unrestricted API token (as above).
31-
2. Run **`linux/install-linux.sh`** and paste your WebDAV URL + token.
37+
2. Install with the one-liner:
38+
```bash
39+
curl -fsSL https://raw.githubusercontent.com/softpython2884/OpenCoperLock/main/scripts/send-to/linux/install-linux.sh | bash
40+
```
41+
(or run **`linux/install-linux.sh`** from a checkout), then paste your WebDAV URL + token.
3242
3. Right-click a file:
3343
- **GNOME Files / Cinnamon:** *Scripts → Send to OpenCoperLock*
3444
- **KDE Dolphin:** *Send to OpenCoperLock* (top of the menu)

scripts/send-to/linux/install-linux.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@
55
# KDE Dolphin. Selected files upload to the "ComputerShared" space of your Drive over WebDAV.
66
set -euo pipefail
77

8-
here="$(cd "$(dirname "$0")" && pwd)"
9-
assets="$(cd "$here/../assets" && pwd)"
8+
# Components come from the local checkout when run from one, or from the official repo when this
9+
# script is piped from the web (curl ... | bash), so a one-line install works either way.
10+
REPO_RAW="https://raw.githubusercontent.com/softpython2884/OpenCoperLock/main/scripts/send-to"
11+
here="$(cd "$(dirname -- "$0")" 2>/dev/null && pwd || true)"
12+
sendto_root="$(cd "$here/.." 2>/dev/null && pwd || true)"
1013
data="${XDG_DATA_HOME:-$HOME/.local/share}/opencoperlock"
1114
cfgdir="${XDG_CONFIG_HOME:-$HOME/.config}/opencoperlock"
1215
mkdir -p "$data" "$cfgdir"
1316

17+
fetch() { # $1 = path under send-to, $2 = destination, $3 = chmod mode
18+
if [ -n "$sendto_root" ] && [ -f "$sendto_root/$1" ]; then
19+
install -m "$3" "$sendto_root/$1" "$2"
20+
else
21+
curl -fsSL "$REPO_RAW/$1" -o "$2" && chmod "$3" "$2"
22+
fi
23+
}
24+
1425
default_base="https://copper.forgenet.fr/api/dav"
1526
read -rp "WebDAV base URL [$default_base]: " BASE
1627
BASE="${BASE:-$default_base}"
@@ -24,9 +35,9 @@ umask 077
2435
printf 'BASE=%q\nTOKEN=%q\n' "$BASE" "$TOKEN" > "$cfgdir/config"
2536
chmod 600 "$cfgdir/config"
2637

27-
# Install the uploader + icon.
28-
install -m 0755 "$here/send.sh" "$data/send.sh"
29-
install -m 0644 "$assets/opencoperlock.png" "$data/opencoperlock.png"
38+
# Install the uploader + icon (from the checkout or the official repo).
39+
fetch 'linux/send.sh' "$data/send.sh" 0755
40+
fetch 'assets/opencoperlock.png' "$data/opencoperlock.png" 0644
3041

3142
installed=()
3243

scripts/send-to/windows/install-windows.ps1

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,20 @@ param(
2020
)
2121
$ErrorActionPreference = 'Stop'
2222

23-
$srcDir = Split-Path -Parent $MyInvocation.MyCommand.Path # ...\send-to\windows
24-
$assets = Join-Path (Split-Path -Parent $srcDir) 'assets' # ...\send-to\assets
23+
# Files come from the local checkout when run from one, or from the official repo when this script
24+
# is piped straight from the web (irm ... | iex), so a one-line install works either way.
25+
$RepoRaw = 'https://raw.githubusercontent.com/softpython2884/OpenCoperLock/main/scripts/send-to'
26+
$self = $PSCommandPath # null under irm|iex
27+
$sendToRoot = if ($self) { Split-Path -Parent (Split-Path -Parent $self) } else { $null }
2528
$dstDir = Join-Path $env:LOCALAPPDATA 'OpenCoperLock'
2629
New-Item -ItemType Directory -Force -Path $dstDir | Out-Null
2730

31+
function Get-Component($rel, $dst) {
32+
$local = if ($sendToRoot) { Join-Path $sendToRoot ($rel -replace '/', '\') } else { $null }
33+
if ($local -and (Test-Path $local)) { Copy-Item $local $dst -Force }
34+
else { Invoke-WebRequest -UseBasicParsing "$RepoRaw/$rel" -OutFile $dst }
35+
}
36+
2837
# --- gather settings -----------------------------------------------------------------------------
2938
$defaultBase = 'https://copper.forgenet.fr/api/dav'
3039
if (-not $Base) {
@@ -42,8 +51,8 @@ if (-not $Token) {
4251
if ([string]::IsNullOrWhiteSpace($Token)) { throw "No token provided." }
4352

4453
# --- install files -------------------------------------------------------------------------------
45-
Copy-Item (Join-Path $srcDir 'send.ps1') (Join-Path $dstDir 'send.ps1') -Force
46-
Copy-Item (Join-Path $assets 'opencoperlock.ico') (Join-Path $dstDir 'opencoperlock.ico') -Force
54+
Get-Component 'windows/send.ps1' (Join-Path $dstDir 'send.ps1')
55+
Get-Component 'assets/opencoperlock.ico' (Join-Path $dstDir 'opencoperlock.ico')
4756

4857
# DPAPI-encrypt the token (current-user scope) and write the config.
4958
$enc = ConvertTo-SecureString $Token -AsPlainText -Force | ConvertFrom-SecureString

0 commit comments

Comments
 (0)