Move static assets to shared location
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { NextFunction, Request, Response } from 'express-serve-static-core'
|
||||
import { resolve } from 'path'
|
||||
import { getConfigOption } from './config/access'
|
||||
|
||||
/** Static assets both apps serve from core: pico, the Inter font, the favicon and theme.css. */
|
||||
export const CORE_PUBLIC_DIR = resolve(__dirname, '../public')
|
||||
|
||||
/**
|
||||
* Apply the response headers configured under `ipp.responseHeaders` to the
|
||||
* given Response. Used by route handlers to attach the default Cache-Control
|
||||
@@ -20,6 +24,18 @@ export function addNoStoreHeaders (res: Response): void {
|
||||
res.set('Expires', '0')
|
||||
}
|
||||
|
||||
/**
|
||||
* A signal that aborts when the visitor's connection closes before the
|
||||
* response has finished, so the request to Immich stops with it.
|
||||
*/
|
||||
export function abortOnClose (res: Response): AbortSignal {
|
||||
const controller = new AbortController()
|
||||
const onClose = () => { if (!res.writableFinished) controller.abort() }
|
||||
res.once('close', onClose)
|
||||
if (res.closed) onClose()
|
||||
return controller.signal
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap an async route handler so a rejected promise is passed to Express's
|
||||
* error chain (and on to `errorHandler`).
|
||||
|
||||
@@ -73,12 +73,17 @@ export interface ImmichVersion {
|
||||
}
|
||||
|
||||
export interface SharedLink {
|
||||
// Immich's id for the link itself, not the album
|
||||
id?: string;
|
||||
key: string;
|
||||
keyType: KeyType;
|
||||
slug?: string | null;
|
||||
type: string;
|
||||
description?: string;
|
||||
assets: Asset[];
|
||||
allowDownload?: boolean;
|
||||
// The owner's "Allow public user to upload" toggle
|
||||
allowUpload?: boolean;
|
||||
showMetadata?: boolean;
|
||||
password?: string;
|
||||
album?: {
|
||||
|
||||
Reference in New Issue
Block a user