electron: external data dir, packaged path fix, footer responsive, test stabilization
- DB + uploads stored outside app bundle (survives updates) - Router uses DOCUMENT_ROOT instead of __DIR__ (fixes AppImage paths) - Footer count shifts right below 1250px, min-width 1150px - Gallery opens gracefully on fetch errors - Stabilized gallery, export, and find/replace tests with poll loops Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ee192a15e7
commit
d3d9355191
9 files changed
+78
-39
No files matched your search
+1
-1
@@ -158,7 +158,7 @@ function createWindow() {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1280,
|
||||
height: 820,
|
||||
minWidth: 800,
|
||||
minWidth: 1150,
|
||||
minHeight: 500,
|
||||
title: 'hyprcrd',
|
||||
backgroundColor: '#0f172a',
|
||||
|
||||
+29
-2
@@ -1,9 +1,36 @@
|
||||
<?php
|
||||
// Router for PHP's built-in server (replaces .htaccess rewrite rules).
|
||||
// Static files are served directly; everything else goes to index.php.
|
||||
|
||||
// docRoot is set via `php -S ... -t <docRoot>` in main.js
|
||||
$docRoot = $_SERVER['DOCUMENT_ROOT'];
|
||||
|
||||
// Electron passes HYPRCRD_DATA_DIR so the app stores all user data
|
||||
// outside the app bundle (survives updates).
|
||||
$dataDir = getenv('HYPRCRD_DATA_DIR');
|
||||
if ($dataDir) {
|
||||
define('DB_PATH', $dataDir . '/hyprcrd.db');
|
||||
define('UPLOAD_DIR', $dataDir . '/uploads');
|
||||
if (!is_dir($dataDir . '/uploads')) {
|
||||
mkdir($dataDir . '/uploads', 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
$file = __DIR__ . '/../public' . $path;
|
||||
$file = $docRoot . $path;
|
||||
if ($path !== '/' && is_file($file)) {
|
||||
return false;
|
||||
}
|
||||
require __DIR__ . '/../public/index.php';
|
||||
|
||||
// Serve uploaded files from the external data dir
|
||||
if ($dataDir && str_starts_with($path, '/uploads/')) {
|
||||
$extFile = $dataDir . $path;
|
||||
if (is_file($extFile)) {
|
||||
$mime = mime_content_type($extFile) ?: 'application/octet-stream';
|
||||
header('Content-Type: ' . $mime);
|
||||
readfile($extFile);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
require $docRoot . '/index.php';
|
||||
Reference in new issue
Block a user