1 | import * as express from "express";
|
2 | import { OPDSFeed } from "r2-opds-js/dist/es5/src/opds/opds2/opds2";
|
3 | import { Publication } from "r2-shared-js/dist/es5/src/models/publication";
|
4 | import { CertificateData } from "../utils/self-signed";
|
5 | import { IHTTPHeaderNameValue } from "./server-secure";
|
6 | export interface ServerData extends CertificateData {
|
7 | urlScheme: string;
|
8 | urlHost: string;
|
9 | urlPort: number;
|
10 | }
|
11 | export interface IServerOptions {
|
12 | disableReaders?: boolean;
|
13 | disableDecryption?: boolean;
|
14 | disableRemotePubUrl?: boolean;
|
15 | disableOPDS?: boolean;
|
16 | maxPrefetchLinks?: number;
|
17 | }
|
18 | export declare const MAX_PREFETCH_LINKS = 10;
|
19 | export declare class Server {
|
20 | readonly disableReaders: boolean;
|
21 | readonly disableDecryption: boolean;
|
22 | readonly disableRemotePubUrl: boolean;
|
23 | readonly disableOPDS: boolean;
|
24 | readonly maxPrefetchLinks: number;
|
25 | readonly lcpBeginToken = "*-";
|
26 | readonly lcpEndToken = "-*";
|
27 | private readonly publications;
|
28 | private publicationsOPDSfeed;
|
29 | private publicationsOPDSfeedNeedsUpdate;
|
30 | private readonly pathPublicationMap;
|
31 | private creatingPublicationsOPDS;
|
32 | private readonly opdsJsonFilePath;
|
33 | private readonly expressApp;
|
34 | private httpServer;
|
35 | private httpsServer;
|
36 | private serverData;
|
37 | constructor(options?: IServerOptions);
|
38 | preventRobots(): void;
|
39 | expressUse(pathf: string, func: express.Handler): void;
|
40 | expressGet(paths: string[], func: express.Handler): void;
|
41 | isStarted(): boolean;
|
42 | isSecured(): boolean;
|
43 | getSecureHTTPHeader(url: string): IHTTPHeaderNameValue | undefined;
|
44 | start(port: number, secure: boolean): Promise<ServerData>;
|
45 | stop(): void;
|
46 | serverInfo(): ServerData | undefined;
|
47 | serverUrl(): string | undefined;
|
48 | setResponseCacheHeaders(res: express.Response, enableCaching: boolean): void;
|
49 | setResponseCORS(res: express.Response): void;
|
50 | addPublications(pubs: string[]): string[];
|
51 | removePublications(pubs: string[]): string[];
|
52 | getPublications(): string[];
|
53 | loadOrGetCachedPublication(filePath: string): Promise<Publication>;
|
54 | isPublicationCached(filePath: string): boolean;
|
55 | cachedPublication(filePath: string): Publication | undefined;
|
56 | cachePublication(filePath: string, pub: Publication): void;
|
57 | uncachePublication(filePath: string): void;
|
58 | uncachePublications(): void;
|
59 | publicationsOPDS(): OPDSFeed | undefined;
|
60 | }
|