|
|
|
|
@@ -23,25 +23,19 @@ import imageproxy from '@server/routes/imageproxy';
|
|
|
|
|
import { getAppVersion } from '@server/utils/appVersion';
|
|
|
|
|
import restartFlag from '@server/utils/restartFlag';
|
|
|
|
|
import { getClientIp } from '@supercharge/request-ip';
|
|
|
|
|
import type CacheableLookupType from 'cacheable-lookup';
|
|
|
|
|
import { TypeormStore } from 'connect-typeorm/out';
|
|
|
|
|
import cookieParser from 'cookie-parser';
|
|
|
|
|
import csurf from 'csurf';
|
|
|
|
|
import { lookup } from 'dns';
|
|
|
|
|
import type { NextFunction, Request, Response } from 'express';
|
|
|
|
|
import express from 'express';
|
|
|
|
|
import * as OpenApiValidator from 'express-openapi-validator';
|
|
|
|
|
import type { Store } from 'express-session';
|
|
|
|
|
import session from 'express-session';
|
|
|
|
|
import next from 'next';
|
|
|
|
|
import http from 'node:http';
|
|
|
|
|
import https from 'node:https';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
import swaggerUi from 'swagger-ui-express';
|
|
|
|
|
import YAML from 'yamljs';
|
|
|
|
|
|
|
|
|
|
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
|
|
|
|
|
|
|
|
|
|
const API_SPEC_PATH = path.join(__dirname, '../overseerr-api.yml');
|
|
|
|
|
|
|
|
|
|
logger.info(`Starting Overseerr version ${getAppVersion()}`);
|
|
|
|
|
@@ -52,25 +46,6 @@ const handle = app.getRequestHandler();
|
|
|
|
|
app
|
|
|
|
|
.prepare()
|
|
|
|
|
.then(async () => {
|
|
|
|
|
const CacheableLookup = (await _importDynamic('cacheable-lookup'))
|
|
|
|
|
.default as typeof CacheableLookupType;
|
|
|
|
|
const cacheable = new CacheableLookup();
|
|
|
|
|
|
|
|
|
|
const originalLookup = cacheable.lookup;
|
|
|
|
|
|
|
|
|
|
// if hostname is localhost use dns.lookup instead of cacheable-lookup
|
|
|
|
|
cacheable.lookup = (...args: any) => {
|
|
|
|
|
const [hostname] = args;
|
|
|
|
|
if (hostname === 'localhost') {
|
|
|
|
|
lookup(...(args as Parameters<typeof lookup>));
|
|
|
|
|
} else {
|
|
|
|
|
originalLookup(...(args as Parameters<typeof originalLookup>));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
cacheable.install(http.globalAgent);
|
|
|
|
|
cacheable.install(https.globalAgent);
|
|
|
|
|
|
|
|
|
|
const dbConnection = await dataSource.initialize();
|
|
|
|
|
|
|
|
|
|
// Run migrations in production
|
|
|
|
|
|