Whitespace

dev
gravel 1 year ago
parent b044f99a47
commit 9e63e33d06
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -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) {

@ -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.
*/

@ -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);
?>

@ -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);

@ -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;

@ -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;
}

@ -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+"];

@ -8,7 +8,7 @@
</div>
<div id="details-modal-close-hint">
(Esc to close.)
</div>
</div>
<div id="details-modal-flow">
<div id="details-modal-panes" data-pane="0">
<div id="details-modal-start" class="details-modal-pane" data-pane="0">
@ -23,7 +23,7 @@
width="64"
height="64"
data-hydrate-with="icon:src;icon_safety:data-icon-safety"
/></div><h1><a
/></div><h1><a
id="details-modal-community-name"
data-hydrate-with="name;preview_link:href"
title="Open preview in new tab"
@ -54,7 +54,7 @@
</p>
<p id="details-modal-host">
Server:
<a
<a
title="Open server in new tab"
data-hydrate-with="hostname;hostname:href"
target="_blank"
@ -75,7 +75,7 @@
>
<div id="details-modal-qr-code-label">
Scan QR code in Session to join
<span
<span
id="details-modal-qr-code-label-name"
>'<span data-hydrate-with="name"></span>'</span>
</div>

@ -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="'<?=$name?>' has had <?=$users?> active users in the last <?=$users_cutoff?>."
><?=$users?></td>
<td class="td_preview" itemprop="url">
<a
href="<?=$preview_link?>"
title="Click here to preview '<?=$name?>'"
target="_blank"
<a
href="<?=$preview_link?>"
title="Click here to preview '<?=$name?>'"
target="_blank"
rel="noopener noreferrer nofollow"
>
<span class="protocol-indicator"></span>

@ -58,7 +58,7 @@
<header>
<div id="header-start"></div>
<div id="header-end">
<label
<label
for="toggle-theme-switch"
class="anchorstyle"
title="Switch color theme"

Loading…
Cancel
Save