From 6c1b6cc99d20641663866403f5f33b05650cf616 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 26 Jan 2024 10:11:42 +0200 Subject: [PATCH] remove pins, add about links config, add link names support --- example/config.json | 7 +++++++ src/controller/room.php | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/example/config.json b/example/config.json index bc8f55d..f9593c6 100644 --- a/example/config.json +++ b/example/config.json @@ -20,6 +20,13 @@ }, "kevachat": { + "link": + { + "about": + [ + "https://github.com/kevachat/geminiapp" + ] + }, "room": { "key": diff --git a/src/controller/room.php b/src/controller/room.php index e5c4b67..c49878d 100644 --- a/src/controller/room.php +++ b/src/controller/room.php @@ -59,11 +59,7 @@ class Room [ 'namespace' => $namespace['namespaceId'], 'name' => $namespace['displayName'], - 'total' => $total, - 'pin' => in_array( - $namespace['namespaceId'], - $this->_config->kevachat->room->pin - ) + 'total' => $total ]; } @@ -109,12 +105,17 @@ class Room return str_replace( [ '{logo}', + '{about}', '{rooms}' ], [ file_get_contents( __DIR__ . '/../../logo.ascii' ), + implode( + PHP_EOL, + $this->_config->kevachat->link->about + ), implode( PHP_EOL, $rooms @@ -409,9 +410,10 @@ class Room ); } - private function _url(?string $path = null) + private function _url(?string $path = null, ?string $name = null) { - return ( + return + ( $this->_config->gemini->server->port == 1965 ? sprintf( 'gemini://%s%s', @@ -424,6 +426,10 @@ class Room $this->_config->gemini->server->port, $path ) + ) + . + ( + $name ? ' ' . $name : null ); } } \ No newline at end of file