Merge branch 'main' into dev

dev
gravel 2 years ago
commit 0dccb889f7
Signed by: gravel
GPG Key ID: C0538F3C906B308F

3
.gitignore vendored

@ -8,7 +8,8 @@ output/qr-codes
output/icons
# Served listings
listings/lp-output
listings/lp-output/*
!listings/lp-output/index.html
# Server-side cache
cache

@ -46,6 +46,6 @@ We occassionally accept requests from server operators to de-list whole Communit
## Contact us
To report issues or make suggestions, [file an issue on this repository](https://codeberg.org/gravel/sessioncommunities.online/issues/new) or visit the Web Development Community on [caliban.org](http://sog.caliban.org/r/webdev).
To report issues or make suggestions, [file an issue on this repository](https://codeberg.org/gravel/sessioncommunities.online/issues/new) or [visit the Web Development Community](https://sessioncommunities.online/#webdev+118d) on caliban.org.
In case your issue cannot be resolved publicly, contact [gravel](https://codeberg.org/gravel/gravel) on Session as `gravel` (Registered Session ID).

@ -28,4 +28,4 @@ $server_languages[] = array(
To label a Community, you would search for the `xxxx` suffix (in this case `a03c`) in the [flags file](./language-flags.php) and add the appropriate entry.
If you cannot any labels for this code, copy an existing block from another server & replace the entries with your own. If you have trouble entering language flags on your keyboard, you may find it helpful to copy them from <https://www.alt-codes.net/flags>.
If you cannot find any entries for this code, copy an existing block from another server & replace the entries with your own. If you have trouble entering language flags on your keyboard, you may find it helpful to copy them from <https://www.alt-codes.net/flags>.

@ -104,3 +104,8 @@ rating=nsfw
rooms[]=womanbodybeauty+13f6
rooms[]=piao+2cd5
rooms[]=AINSFW+fc30
[all]
name=All Communities
rating=unsafe
rooms[]=*

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Listing provider by sessioncommunities.online</title>
</head>
<body>
<h1>Community Listing Provider API</h1>
<p>
Hi there!
</p>
<p>
This domain isn't meant to be accessed via a browser,
but to provide lists of Communities to <a href="https://getsession.org/" target="_blank">Session Messenger</a>,
and looks something <a href="./listings" target="_blank">like this</a>.
</p>
<p>
If that doesn't phase you, click these links to read more about what this service does:
</p>
<p>
<a href="https://codeberg.org/gravel/session-listing-providers" target="_blank">
Session Listing Provider README
</a>
</p>
<p>
<a href="https://codeberg.org/gravel/session-listing-providers/src/branch/main/PROTOCOL.md" target="_blank">
Session Listing Provider Protocol Specification
</a>
</p>
</body>
</html>

@ -47,8 +47,9 @@
$servers_raw = file_get_contents($ROOMS_FILE);
$server_data = json_decode($servers_raw, true);
$servers = CommunityServer::from_details_array($server_data);
$rooms_all = CommunityServer::enumerate_rooms($servers);
$rooms_by_id = [];
foreach (CommunityServer::enumerate_rooms($servers) as $room) {
foreach ($rooms_all as $room) {
$rooms_by_id[$room->get_room_identifier()] = $room;
}
$sogs_by_pubkey = [];
@ -58,8 +59,13 @@
$listings = [];
foreach ($listings_raw as $id => $listing_props) {
$rooms = [];
// TODO: Blocklist option
if (isset($listing_props['rooms'])) {
foreach ($listing_props['rooms'] as $room_id) {
if ($room_id == '*') {
$rooms = $rooms_all;
break;
}
if (isset($rooms_by_id[$room_id])) {
$rooms[] = $rooms_by_id[$room_id];
} else {

Loading…
Cancel
Save