generated from ztimson/template
Accenpt kiwix server URL and patched local zim icon to be dataURL
This commit is contained in:
+6
-4
@@ -13,13 +13,15 @@ export class ZimManager {
|
||||
server;
|
||||
#ownsServer;
|
||||
|
||||
/** @param {{catalog?: string, server?: KiwixServer, port?: number, host?: string, binDir?: string}} [opts]
|
||||
* server: reuse an existing KiwixServer; if omitted, one is created (not yet started) and exposed via `.server` for reuse elsewhere. */
|
||||
constructor(dir, {catalog = CATALOG_URL, server, port, host, binDir} = {}) {
|
||||
/** @param {{catalog?: string, server?: KiwixServer, port?: number, host?: string, binDir?: string, url?: string}} [opts]
|
||||
* server: reuse an existing KiwixServer instance directly.
|
||||
* url: attach to an already-running kiwix-serve by address instead (e.g. started elsewhere in your codebase
|
||||
* with no shared reference) - mutually exclusive with `server`, ignored if `server` is given. */
|
||||
constructor(dir, {catalog = CATALOG_URL, server, port, host, binDir, url} = {}) {
|
||||
this.#catalogUrl = catalog;
|
||||
this.#dir = dir;
|
||||
this.#ownsServer = !server;
|
||||
this.server = server ?? new KiwixServer(dir, {port, host, binDir});
|
||||
this.server = server ?? new KiwixServer(dir, {port, host, binDir, url});
|
||||
}
|
||||
|
||||
/** The KiwixServer backing this manager - reuse it directly for content/search access, or pass into another ZimManager. */
|
||||
|
||||
Reference in New Issue
Block a user