Package a self-contained macOS app and harden serving
- Add macos/build.mjs: stages a universal .app outside the checkout, bundles and checksums Node, installs production deps per architecture, compiles the launcher shim, signs ad-hoc or with a Developer ID, and writes a zip and dmg with an optional notarization path. - Serve precompressed brotli/gzip assets and split admin panels and the public pages out of the main bundle. - Support HTTP range requests, and fix upload and quota accounting, gallery download counts and unreadable-file handling. - Add server HTTP integration tests, a Gitea CI workflow, a catalog backup script and a crash screen for the UI.
This commit is contained in:
+66
-51
@@ -1,21 +1,15 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import AboutModal from './components/AboutModal';
|
||||
import AdminPanel from './components/AdminPanel';
|
||||
import CloudPanel from './components/CloudPanel';
|
||||
import CommandPalette from './components/CommandPalette';
|
||||
import ContextMenu, { type MenuEntry } from './components/ContextMenu';
|
||||
import Develop from './components/Develop';
|
||||
import EventSidebar from './components/EventSidebar';
|
||||
import ExportModal from './components/ExportModal';
|
||||
import CompareView from './components/CompareView';
|
||||
import FilterBar from './components/FilterBar';
|
||||
import ImportModal from './components/ImportModal';
|
||||
import ImmichPanel from './components/ImmichPanel';
|
||||
import LibraryGrid from './components/LibraryGrid';
|
||||
import MergeModal from './components/MergeModal';
|
||||
import PasteSettingsModal from './components/PasteSettingsModal';
|
||||
import PrintModal from './components/PrintModal';
|
||||
import ShareModal from './components/ShareModal';
|
||||
import RawReprocessModal, {
|
||||
type RawReprocessFailure,
|
||||
type RawReprocessJob,
|
||||
@@ -26,6 +20,15 @@ import Shortcuts from './components/Shortcuts';
|
||||
import Stars, { ColorSwatches, FlagButtons } from './components/Stars';
|
||||
import TopBar from './components/TopBar';
|
||||
import { usePersistentState } from './lib/usePersistentState';
|
||||
|
||||
// Only mounted when the user opens them, so they are separate chunks: the grid
|
||||
// and the editor are what the first paint needs.
|
||||
const AdminPanel = lazy(() => import('./components/AdminPanel'));
|
||||
const CompareView = lazy(() => import('./components/CompareView'));
|
||||
const ImmichPanel = lazy(() => import('./components/ImmichPanel'));
|
||||
const MergeModal = lazy(() => import('./components/MergeModal'));
|
||||
const PrintModal = lazy(() => import('./components/PrintModal'));
|
||||
const ShareModal = lazy(() => import('./components/ShareModal'));
|
||||
import {
|
||||
currentUser,
|
||||
deleteEventRemote,
|
||||
@@ -2563,32 +2566,38 @@ export default function App() {
|
||||
)}
|
||||
|
||||
{compareOpen && selected.length >= 2 && selected.length <= 4 && (
|
||||
<CompareView
|
||||
photos={selected
|
||||
.map((id) => photos.find((photo) => photo.id === id))
|
||||
.filter((photo): photo is PhotoRecord => Boolean(photo))
|
||||
.slice(0, 4)}
|
||||
onClose={() => setCompareOpen(false)}
|
||||
onOpen={(id) => {
|
||||
setCompareOpen(false);
|
||||
openPhoto(id);
|
||||
}}
|
||||
/>
|
||||
<Suspense fallback={null}>
|
||||
<CompareView
|
||||
photos={selected
|
||||
.map((id) => photos.find((photo) => photo.id === id))
|
||||
.filter((photo): photo is PhotoRecord => Boolean(photo))
|
||||
.slice(0, 4)}
|
||||
onClose={() => setCompareOpen(false)}
|
||||
onOpen={(id) => {
|
||||
setCompareOpen(false);
|
||||
openPhoto(id);
|
||||
}}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{printOpen && (
|
||||
<PrintModal
|
||||
photos={photos.filter((photo) => selected.includes(photo.id))}
|
||||
onClose={() => setPrintOpen(false)}
|
||||
/>
|
||||
<Suspense fallback={null}>
|
||||
<PrintModal
|
||||
photos={photos.filter((photo) => selected.includes(photo.id))}
|
||||
onClose={() => setPrintOpen(false)}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{mergeOpen && (
|
||||
<MergeModal
|
||||
photos={photos.filter((photo) => selected.includes(photo.id))}
|
||||
onClose={() => setMergeOpen(false)}
|
||||
onDone={(result) => void addMergedPhoto(result)}
|
||||
/>
|
||||
<Suspense fallback={null}>
|
||||
<MergeModal
|
||||
photos={photos.filter((photo) => selected.includes(photo.id))}
|
||||
onClose={() => setMergeOpen(false)}
|
||||
onDone={(result) => void addMergedPhoto(result)}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{exportOpen && (
|
||||
@@ -2638,13 +2647,15 @@ export default function App() {
|
||||
const shared = events.find((e) => e.id === shareEventId);
|
||||
if (!shared) return null;
|
||||
return (
|
||||
<ShareModal
|
||||
event={shared}
|
||||
photos={livePhotos.filter((p) => p.eventId === shared.id)}
|
||||
onClose={() => setShareEventId(null)}
|
||||
onToast={setToast}
|
||||
onProofPublished={handleProofPublished}
|
||||
/>
|
||||
<Suspense fallback={null}>
|
||||
<ShareModal
|
||||
event={shared}
|
||||
photos={livePhotos.filter((p) => p.eventId === shared.id)}
|
||||
onClose={() => setShareEventId(null)}
|
||||
onToast={setToast}
|
||||
onProofPublished={handleProofPublished}
|
||||
/>
|
||||
</Suspense>
|
||||
);
|
||||
})()}
|
||||
|
||||
@@ -2681,26 +2692,30 @@ export default function App() {
|
||||
)}
|
||||
|
||||
{adminOpen && cloudUser && !localMode && (
|
||||
<AdminPanel
|
||||
user={cloudUser}
|
||||
onClose={() => setAdminOpen(false)}
|
||||
onChanged={() => {
|
||||
void getHealth().then((health) => setCloudHealth(health));
|
||||
void getImmichStatus().then(setImmichStatus).catch(() => undefined);
|
||||
}}
|
||||
onRestored={() => void refreshCatalogFromServer()}
|
||||
/>
|
||||
<Suspense fallback={null}>
|
||||
<AdminPanel
|
||||
user={cloudUser}
|
||||
onClose={() => setAdminOpen(false)}
|
||||
onChanged={() => {
|
||||
void getHealth().then((health) => setCloudHealth(health));
|
||||
void getImmichStatus().then(setImmichStatus).catch(() => undefined);
|
||||
}}
|
||||
onRestored={() => void refreshCatalogFromServer()}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{immichOpen && cloudUser && (
|
||||
<ImmichPanel
|
||||
onClose={() => setImmichOpen(false)}
|
||||
onChanged={() => {
|
||||
void getImmichStatus().then(setImmichStatus).catch(() => undefined);
|
||||
void refreshCatalogFromServer();
|
||||
}}
|
||||
onToast={setToast}
|
||||
/>
|
||||
<Suspense fallback={null}>
|
||||
<ImmichPanel
|
||||
onClose={() => setImmichOpen(false)}
|
||||
onChanged={() => {
|
||||
void getImmichStatus().then(setImmichStatus).catch(() => undefined);
|
||||
void refreshCatalogFromServer();
|
||||
}}
|
||||
onToast={setToast}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{menu &&
|
||||
|
||||
Reference in New Issue
Block a user