Implement basic listings

dev
gravel 1 year ago
parent 89c3c283d8
commit 178e091aa1
Signed by: gravel
GPG Key ID: C0538F3C906B308F

3
.gitignore vendored

@ -7,6 +7,9 @@ output/qr-codes
# Served icons
output/icons
# Served listings
listings/lp-output
# Server-side cache
cache

@ -12,7 +12,10 @@
$ROOM_ICONS_RELATIVE="icons";
$LISTING_PROVIDER_ROOT="$PROJECT_ROOT/listings";
$LISTINGS_INI="$LISTING_PROVIDER_ROOT/listings.ini";
$LISTING_PROVIDER_OUTPUT="$LISTING_PROVIDER_ROOT/lp-output";
$LISTING_PROVIDER_LISTING_SUMMARY="$LISTING_PROVIDER_OUTPUT/listings";
$LISTING_PROVIDER_LISTINGS="$LISTING_PROVIDER_OUTPUT/listing";
$REPOSITORY_CANONICAL_URL="https://codeberg.org/gravel/sessioncommunities.online";

@ -22,6 +22,10 @@ fetch:
html:
/bin/php php/generate-html.php $(FLAGS)
# Generate listing provider endpoints from data.
listing:
/bin/php php/generate-listings.php $(FLAGS)
# Serve a local copy which responds to file changes.
dev: FLAGS = --verbose
dev: open

@ -1,5 +0,0 @@
<?php
require_once "../getenv.php";
?>

@ -113,6 +113,19 @@
return $details;
}
/**
* Return information for JSON serialization in listing.
*/
function to_listing_data(): array {
$details = get_object_vars($this);
$details['join_url'] = $this->get_join_url();
$details['tags'] = array_map(function(\CommunityTag $tag) {
return $tag->text;
}, $this->tags);
unset($details['message_sequence']);
return $details;
}
/**
* Create a CommunityRoom instance from loaded data.
* @param CommunityServer $server

Loading…
Cancel
Save