37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
From 070fc3ff00d21939ddc127273467f42ef0bb4767 Mon Sep 17 00:00:00 2001
|
|
From: Balakrishnan Balasubramanian <git.user@balki.me>
|
|
Date: Wed, 12 Feb 2025 11:18:31 -0500
|
|
Subject: [PATCH] support unix socket
|
|
|
|
|
|
diff --git a/server/Server.js b/server/Server.js
|
|
index c3e73ae..115d170 100644
|
|
--- a/server/Server.js
|
|
+++ b/server/Server.js
|
|
@@ -395,10 +395,18 @@ class Server {
|
|
})
|
|
router.get('/healthcheck', (req, res) => res.sendStatus(200))
|
|
|
|
- this.server.listen(this.Port, this.Host, () => {
|
|
- if (this.Host) Logger.info(`Listening on http://${this.Host}:${this.Port}`)
|
|
- else Logger.info(`Listening on port :${this.Port}`)
|
|
- })
|
|
+ if(fs.pathExistsSync("/run/audiobookshelf")) {
|
|
+ const sockPath = "/run/audiobookshelf/web.sock"
|
|
+ this.server.listen(sockPath, () => {
|
|
+ fs.chmodSync(sockPath, 0o666);
|
|
+ Logger.info(`Listening on unix socket :${sockPath}`)
|
|
+ })
|
|
+ } else {
|
|
+ this.server.listen(this.Port, this.Host, () => {
|
|
+ if (this.Host) Logger.info(`Listening on http://${this.Host}:${this.Port}`)
|
|
+ else Logger.info(`Listening on port :${this.Port}`)
|
|
+ })
|
|
+ }
|
|
|
|
// Start listening for socket connections
|
|
SocketAuthority.initialize(this)
|
|
--
|
|
2.48.1
|
|
|