From b5fdec50a83ba10078a0246abdf4dd7f4dde5432 Mon Sep 17 00:00:00 2001 From: Bill Song Date: Sun, 17 Nov 2024 04:13:58 +0000 Subject: [PATCH] enable cors --- app/package.json | 1 + app/src/index.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/package.json b/app/package.json index f10f231..c7a617e 100644 --- a/app/package.json +++ b/app/package.json @@ -17,6 +17,7 @@ "main": "dist/index.js", "dependencies": { "archiver": "^7.0.1", + "cors": "^2.8.5", "dayjs": "^1.11.13", "dotenv": "^16.4.5", "ejs": "^3.1.10", diff --git a/app/src/index.ts b/app/src/index.ts index a5db9db..c42b6af 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -2,6 +2,7 @@ import express from 'express' import immich from './immich' import render from './render' import dayjs from 'dayjs' +import cors from 'cors' import { AssetType, ImageSize } from './types' import { decrypt } from './encrypt' import { log, toString, addResponseHeaders } from './functions' @@ -9,6 +10,8 @@ import { log, toString, addResponseHeaders } from './functions' require('dotenv').config() const app = express() +// Enable CORS +app.use(cors()) // Add the EJS view engine, to render the gallery page app.set('view engine', 'ejs') // For parsing the password unlock form