Add reMarkable backup system with web UI
- Docker container with rmapi cloud backup, PDF conversion pipeline - Web UI: file browser, multi-select, delete/move, thumbnail preview - Sync: backup from reMarkable cloud, rmdoc→PDF conversion via rmc+Inkscape - Excluded-files mechanism to prevent deleted items from returning after sync Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
26
remarkable/web/auth.php
Executable file
26
remarkable/web/auth.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
$user = getenv('RM_USER') ?: 'admin';
|
||||
$pass = getenv('RM_PASS') ?: '';
|
||||
|
||||
if ($pass === '') return; // kein Passwort gesetzt → kein Schutz
|
||||
|
||||
// PHP Built-in Server liefert keine PHP_AUTH_* Variablen — Header manuell parsen
|
||||
$authUser = $_SERVER['PHP_AUTH_USER'] ?? '';
|
||||
$authPass = $_SERVER['PHP_AUTH_PW'] ?? '';
|
||||
|
||||
if ($authUser === '' && isset($_SERVER['HTTP_AUTHORIZATION'])) {
|
||||
$decoded = base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6));
|
||||
[$authUser, $authPass] = explode(':', $decoded, 2) + ['', ''];
|
||||
}
|
||||
|
||||
$ok = $authUser === $user
|
||||
&& hash_equals(hash('sha256', $pass), hash('sha256', $authPass));
|
||||
|
||||
if (!$ok) {
|
||||
header('WWW-Authenticate: Basic realm="reMarkable"');
|
||||
header('HTTP/1.1 401 Unauthorized');
|
||||
echo 'Zugriff verweigert.';
|
||||
exit;
|
||||
}
|
||||
Reference in New Issue
Block a user