From d0085d3c9a975a84aab6413e79c893d6b265e172 Mon Sep 17 00:00:00 2001 From: Magnus Walbeck <mw@mwalbeck.org> Date: Wed, 8 Sep 2021 15:22:18 +0200 Subject: [PATCH] Remove unix:// syntax to improve maintainability and document that abstract socket aren't supported. Fixes #9 (#12) --- README.md | 4 +++- appinfo/info.xml | 6 +++++- lib/Command/Record.php | 9 ++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 74b2afd..26b0ad3 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,9 @@ After you have registered the Talk command you should configure Talked. If you h The http / https should be included in the url, for example: https://talked.example.com -You can also connect to the Talked server over a unix socket. To specify the path to a unix socket prefix the path with unix: or unix://. +You can also connect to the Talked server over a unix socket. To specify the path to a unix socket prefix the path with `unix:` for example: `unix:/tmp/talked.sock`. + +Please note that abstract sockets aren't supported. ## Usage diff --git a/appinfo/info.xml b/appinfo/info.xml index c68d9ce..0af69a0 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -47,10 +47,14 @@ occ talk:command:add recording Talked "php /var/www/html/occ talked:record {ROOM ### Configuring Talked -After you have registered the Talk command you should configure Talked. If you head to Admin settings > Talk, then you will find the settings for Talked near the bottom. Here you can specify the URL for your Talked server and whether to use HTTP Basic auth, and the credentials for HTTP Basic auth. +After you have registered the Talk command you should configure Talked. If you head to Admin settings > Talk, then you will find the settings for Talked near the bottom. Here you can specify the URI for your Talked server and whether to use HTTP Basic auth, and the credentials for HTTP Basic auth. The http / https should be included in the url, for example: https://talked.example.com +You can also connect to the Talked server over a unix socket. To specify the path to a unix socket prefix the path with `unix:` for example: `unix:/tmp/talked.sock`. + +Please note that abstract sockets aren't supported. + ## Usage To use Talked, simply use the `/recording` command in a chat room. If you don't specify any options or run `/recording help` you will get a help message telling you about the different options. The following options are available: diff --git a/lib/Command/Record.php b/lib/Command/Record.php index 798e6ee..405424a 100644 --- a/lib/Command/Record.php +++ b/lib/Command/Record.php @@ -216,17 +216,12 @@ You have the following options available: protected function configureServerUri($curlHandle, string $serverUrl, string $endpoint) { # Check if the URI is pointing to a unix socket if (substr($serverUrl, 0, 5) === "unix:") { - # Check if the URI is using long form (unix://) or short form (unix:) - if (substr($serverUrl, 6, 1) === "/") { - curl_setopt($curlHandle, CURLOPT_UNIX_SOCKET_PATH, substr($serverUrl, 7)); - } else { - curl_setopt($curlHandle, CURLOPT_UNIX_SOCKET_PATH, substr($serverUrl, 5)); - } + curl_setopt($curlHandle, CURLOPT_UNIX_SOCKET_PATH, substr($serverUrl, 5)); # Configure the URL the requests should go to. In later versions # curl requires a dummy hostname, so here we just specify localhost. curl_setopt($curlHandle, CURLOPT_URL, "http://localhost" . '/' . $endpoint); } else { - # If the URI isn't pointing to a unix socket, assume we are connecting over standard TCP + # If the URI isn't pointing to a unix socket, assume we are connecting over TCP curl_setopt($curlHandle, CURLOPT_URL, $serverUrl . '/' . $endpoint); } return $curlHandle;