diff --git a/output/main.js b/output/main.js index aee8b9c..39e9a78 100644 --- a/output/main.js +++ b/output/main.js @@ -51,7 +51,7 @@ const preloadedImages = []; /** * Create an interactive version of the Community join link. - * @param {string} join_link + * @param {string} join_link * @returns {HTMLElement} */ const transformJoinURL = (join_link) => { @@ -132,7 +132,7 @@ const tagBody = ({text, type, description}) => element.span({ /** * Shows the details modal hydrated with the given community's details. - * @param {string} communityID + * @param {string} communityID * @param {number} pane Pane number to display in modal */ function displayQRModal(communityID, pane = 0) { diff --git a/php/servers/known-servers.php b/php/servers/known-servers.php index 4dd71ea..8467c38 100644 --- a/php/servers/known-servers.php +++ b/php/servers/known-servers.php @@ -55,7 +55,7 @@ "sogs.k9net.org" => "fdcb047eb78520e925fda512a45ae74c6e2de9e0df206b3c0471bf1509919559", ); - /** + /** * @var string[] $ICON_ALLOWLIST * These hostnames are considered to have safe room icons. */ @@ -65,7 +65,7 @@ "sog.zcyph.cc" ]; - /** + /** * @var string[] $ICON_BLOCKLIST * These hostnames or rooms are considered to have unsafe room icons. */ diff --git a/php/utils/room-icons.php b/php/utils/room-icons.php index d4a0c57..feade44 100644 --- a/php/utils/room-icons.php +++ b/php/utils/room-icons.php @@ -100,7 +100,7 @@ } return 0; } - + file_exists($ROOM_ICONS_CACHE) or mkdir($ROOM_ICONS_CACHE, 0755, true); file_exists($ROOM_ICONS) or mkdir($ROOM_ICONS, 0755, true); ?> \ No newline at end of file diff --git a/php/utils/room-invites.php b/php/utils/room-invites.php index e813a40..9b921e1 100644 --- a/php/utils/room-invites.php +++ b/php/utils/room-invites.php @@ -17,7 +17,7 @@ return "$QR_CODES_RELATIVE/$room_id.png"; } - + /** * Fetch QR invite of the given room and return its relative path. * @param \CommunityRoom $room @@ -26,7 +26,7 @@ function room_qr_code($room): string { $room_id = $room->get_room_identifier(); $png_cached = room_qr_code_path($room_id); - $image_expired = file_exists($png_cached) && + $image_expired = file_exists($png_cached) && filemtime($png_cached) < strtotime("-12 hour"); if (file_exists($png_cached) && !$image_expired) { return room_qr_code_path_relative($room_id); diff --git a/php/utils/servers-rooms.php b/php/utils/servers-rooms.php index cf96858..166a722 100644 --- a/php/utils/servers-rooms.php +++ b/php/utils/servers-rooms.php @@ -275,7 +275,7 @@ public function has_nsfw_keywords(): bool { // Description not included due to false positives. - $blob = + $blob = strtolower($this->name) . " " . strtolower(join(" ", $this->tags)); @@ -284,7 +284,7 @@ return true; } } - + return false; } @@ -332,9 +332,9 @@ } if ($this->has_nsfw_keywords()) { - $derived_tags[] = + $derived_tags[] = new CommunityTag( - "nsfw", + "nsfw", TagType::WARNING_TAG, "This Community may contain adult material. $WARNING" ); @@ -822,7 +822,7 @@ $candidates = array_filter($this->rooms, function(\CommunityRoom $room) use ($token) { return $room->token == $token; }); - + /** Filter doesn't reindex */ foreach ($candidates as $candidate) { return $candidate; diff --git a/php/utils/sources.php b/php/utils/sources.php index 24a8e3c..6626479 100644 --- a/php/utils/sources.php +++ b/php/utils/sources.php @@ -8,7 +8,7 @@ } /** - * Create new instance of this source from contents. + * Create new instance of this source from contents. * Returns false if processing the source fails. * @return \SDIRCommunitySource|false */ @@ -30,8 +30,8 @@ private array $tags; private static function sdir_validate_entry( - array $room_entry, - bool &$missing_url, + array $room_entry, + bool &$missing_url, bool &$missing_tags ): bool { if (!isset($room_entry['url']) || !is_string($room_entry['url'])) { @@ -89,7 +89,7 @@ $tags = $room_entry['tags']; $room_id = url_get_room_id($url); - + $this->tags[$room_id] = explode(',', $tags); } @@ -171,7 +171,7 @@ } if (str_starts_with($line, "hashtag")) { - $room_tags = ASGLCommunitySource::read_asgl_tags($line); + $room_tags = ASGLCommunitySource::read_asgl_tags($line); } } @@ -181,9 +181,9 @@ // Return first group matches. return $matches[1]; } - + public function get_tags(): array { - + return $this->tags; } } @@ -235,9 +235,9 @@ log_info('Done fetching sources.'); $this->contents_aggregated = - $this->contents_asgl . - $this->contents_fark . - $this->contents_loki . + $this->contents_asgl . + $this->contents_fark . + $this->contents_loki . // Slashes are escaped when served, unescape them str_replace("\\/", "/", $this->contents_sdir); } @@ -274,17 +274,17 @@ private function process_sources(): bool { $source_sdir = SDIRCommunitySource::from_contents($this->contents_sdir); - + $source_asgl = ASGLCommunitySource::from_contents($this->contents_asgl); $source_sdir && $this->add_tags($source_sdir->get_tags()); $source_asgl && $this->add_tags($source_asgl->get_tags()); - + if (!$source_sdir) { return false; } - + if (!$source_asgl) { return false; } diff --git a/php/utils/tags.php b/php/utils/tags.php index cd2e518..b83d5f6 100644 --- a/php/utils/tags.php +++ b/php/utils/tags.php @@ -16,7 +16,7 @@ ) { $this->text = $text; $this->type = $tag_type; - $this->description = + $this->description = empty($description) ? "Tag: $text" : $description; } @@ -114,7 +114,7 @@ public static function from_details_array(array $details_array): array { return CommunityTag::from_user_tags($details_array); } - + /** * @param \CommunityTag[] $tags * @return \CommunityTag[] @@ -155,7 +155,7 @@ ]; private const SHOWCASED_TAGS = ["official", "new", "we're here"]; - + private const REDUNDANT_TAGS = ["session"]; public const NSFW_KEYWORDS = ["nsfw", "porn", "erotic", "18+"]; diff --git a/sites/+components/qr_modals.php b/sites/+components/qr_modals.php index acc6639..d0d3343 100644 --- a/sites/+components/qr_modals.php +++ b/sites/+components/qr_modals.php @@ -8,7 +8,7 @@
(Esc to close.) -
+
@@ -23,7 +23,7 @@ width="64" height="64" data-hydrate-with="icon:src;icon_safety:data-icon-safety" - />

Server: -

diff --git a/sites/+components/tbl_communities.php b/sites/+components/tbl_communities.php index 231f5bb..c7e62c3 100644 --- a/sites/+components/tbl_communities.php +++ b/sites/+components/tbl_communities.php @@ -66,7 +66,7 @@ $join_link = html_sanitize($room->get_join_url()); $pubkey = html_sanitize($pubkey); $hostname = html_sanitize($hostname); - + $staff_json = json_encode(array_map('html_sanitize', $room->get_staff())); $tags_json = json_encode($room->get_room_tags()); ?> @@ -118,10 +118,10 @@ title="'' has had active users in the last ." > - diff --git a/sites/index.php b/sites/index.php index e66b6fb..0dce2ab 100644 --- a/sites/index.php +++ b/sites/index.php @@ -58,7 +58,7 @@
-