Add default config file and improve config/data directory detection

This commit is contained in:
Anmol Sethi
2020-05-10 01:35:42 -04:00
parent c5179c2a06
commit 00d164b67f
9 changed files with 77 additions and 38 deletions

View File

@ -14,7 +14,7 @@ import * as url from "url"
import { HttpCode, HttpError } from "../common/http"
import { normalize, Options, plural, split } from "../common/util"
import { SocketProxyProvider } from "./socket"
import { getMediaMime, xdgLocalDir } from "./util"
import { getMediaMime, paths } from "./util"
export type Cookies = { [key: string]: string[] | undefined }
export type PostData = { [key: string]: string | string[] | undefined }
@ -473,7 +473,7 @@ export class HttpServer {
public constructor(private readonly options: HttpServerOptions) {
this.proxyDomains = new Set((options.proxyDomains || []).map((d) => d.replace(/^\*\./, "")))
this.heart = new Heart(path.join(xdgLocalDir, "heartbeat"), async () => {
this.heart = new Heart(path.join(paths.data, "heartbeat"), async () => {
const connections = await this.getConnections()
logger.trace(`${connections} active connection${plural(connections)}`)
return connections !== 0