update patch

This commit is contained in:
2025-03-27 10:35:44 -04:00
parent b90bfd4e43
commit 7cfd98c9e2
3 changed files with 15 additions and 23 deletions

View File

@ -1,14 +1,8 @@
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
index c3e73aec..fde5343e 100644
--- a/server/Server.js
+++ b/server/Server.js
@@ -395,10 +395,18 @@ class Server {
@@ -395,10 +395,19 @@ class Server {
})
router.get('/healthcheck', (req, res) => res.sendStatus(200))
@ -16,21 +10,19 @@ index c3e73ae..115d170 100644
- 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}`)
+ })
+ const unixSocketPrefix = "unix/"
+ if(this.Host.startsWith(unixSocketPrefix)) {
+ const sockPath = this.Host.slice(unixSocketPrefix.length)
+ 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}`)
+ })
+ 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