Invidious is an alternative front-end to YouTube
Change bind_unix to socket_binding, add socket_permissions and config example
Caian Benedictob4e930f3bcfa
diff --git a/config/config.example.yml b/config/config.example.ymlindex a3a2eeb7..439063e1 100644--- a/config/config.example.yml+++ b/config/config.example.yml@@ -130,6 +130,27 @@ https_only: false###hsts: true+##+## Path of a UNIX socket to listen on for incoming connections.+##+## Note: Enabling socket will make invidious stop listening on the address+## specified by 'host_binding' and 'port'.+##+## Accepted values: Any path to a new file (that doesn't exist yet)+## Default: <none>+##+socket_binding: /tmp/invidious.sock++##+## Permissions for the UNIX socket specified by 'socket_binding'.+##+## Note: The permissions are given in octal, following UNIX convention.+##+## Accepted values: 000-777+## Default: 777+##+socket_permissions: 777+# -----------------------------# Network (outbound)@@ -177,7 +198,7 @@ https_only: false## Configuration for using a HTTP proxy#### If unset, then no HTTP proxy will be used.-##+##http_proxy:user:password:@@ -839,7 +860,7 @@ default_user_preferences:## Default: true###vr_mode: true-+#### Save the playback position## Allow to continue watching at the previous position whendiff --git a/src/invidious.cr b/src/invidious.crindex 0be73555..92ae8045 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -248,11 +248,15 @@ Kemal.config.app_name = "Invidious"{% end %}Kemal.run do |config|- if CONFIG.bind_unix- if File.exists?(CONFIG.bind_unix.not_nil!)- File.delete(CONFIG.bind_unix.not_nil!)+ if CONFIG.socket_binding+ if File.exists?(CONFIG.socket_binding.not_nil!)+ File.delete(CONFIG.socket_binding.not_nil!)end- config.server.not_nil!.bind_unix CONFIG.bind_unix.not_nil!+ # Create a socket and set its desired permissions+ server = UNIXServer.new(CONFIG.socket_binding.not_nil!)+ perms = CONFIG.socket_permissions.to_i(base: 8)+ File.chmod(CONFIG.socket_binding.not_nil!, perms)+ config.server.not_nil!.bind serverelseKemal.config.host_binding = Kemal.config.host_binding != "0.0.0.0" ? Kemal.config.host_binding : CONFIG.host_bindingKemal.config.port = Kemal.config.port != 3000 ? Kemal.config.port : CONFIG.portdiff --git a/src/invidious/config.cr b/src/invidious/config.crindex ff768197..7c9e9ca6 100644--- a/src/invidious/config.cr+++ b/src/invidious/config.cr@@ -138,8 +138,10 @@ class Configproperty port : Int32 = 3000# Host to bind (overridden by command line argument)property host_binding : String = "0.0.0.0"- # Make Invidious listening on UNIX sockets - Example: /tmp/invidious.sock- property bind_unix : String? = nil+ # Make Invidious listen on a UNIX socket instead of a TCP port - Example: /tmp/invidious.sock+ property socket_binding : String? = nil+ # Permissions of the listening socket in octal+ property socket_permissions : String = "777"# Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`)property pool_size : Int32 = 100# HTTP Proxy configuration