diff --git a/.phpenv b/.phpenv index 968940f..0ee1220 100644 --- a/.phpenv +++ b/.phpenv @@ -11,23 +11,10 @@ $ROOM_ICONS="$DOCUMENT_ROOT/icons"; $ROOM_ICONS_RELATIVE="icons"; - $REPOSITORY_CANONICAL_URL="https://codeberg.org/gravel/sessioncommunities.online"; - - include_once "$PROJECT_ROOT/php/utils/logging.php"; - - // Read the -v|--verbose option increasing logging verbosity to debug. - $options = getopt("v", ["verbose", "fast", "no-color"]); - if (isset($options["v"]) or isset($options["verbose"])) { - $LOGGING_VERBOSITY = LoggingVerbosity::Debug; - } + $LISTING_PROVIDER_ROOT="$PROJECT_ROOT/listings"; + $LISTING_PROVIDER_OUTPUT="$LISTING_PROVIDER_ROOT/lp-output"; - if (isset($options["fast"])) { - $FAST_FETCH_MODE = true; - } - - if (isset($options["no-color"])) { - LoggingVerbosity::$showColor = false; - } + $REPOSITORY_CANONICAL_URL="https://codeberg.org/gravel/sessioncommunities.online"; // set timeout for file_get_contents() ini_set('default_socket_timeout', 6); // in seconds, default is 60 diff --git a/Makefile b/Makefile index 7926096..627653e 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ list: ## Using make dependencies is duplicating behaviour but reads better. # /bin/php php/update-listing.php # Refresh listing and generate HTML. -all: fetch html +sco: fetch html # Fetch room listing. fetch: @@ -60,19 +60,19 @@ clean: # Build everything from scratch and test functionality. test: FLAGS = --verbose -test: clean all open server +test: clean sco open server # Build everything from scratch and test functionality on LAN. test-lan: FLAGS = --verbose -test-lan: clean all open lan-server +test-lan: clean sco open lan-server # Run basic tests without launching site in browser. test-noninteractive: FLAGS = --verbose -test-noninteractive: clean all +test-noninteractive: clean sco # Run Continuous Integration tests. test-ci: FLAGS = --verbose --fast --no-color -test-ci: clean all +test-ci: clean sco # -- Aliases -- serve: server diff --git a/listings/listings.ini b/listings/listings.ini new file mode 100644 index 0000000..844eaa5 --- /dev/null +++ b/listings/listings.ini @@ -0,0 +1,106 @@ + +[regional] +name=Regional Communities +rating=safe +rooms[]=brasil+118d +rooms[]=deutsch+118d +rooms[]=espanol+118d +rooms[]=francais+118d +rooms[]=iom+118d +rooms[]=italiano+118d +rooms[]=nl+118d +rooms[]=persian+118d +rooms[]=portugues+118d +rooms[]=uk+118d +rooms[]=russian+118d +rooms[]=bangladesh+13f6 +rooms[]=czsk+13f6 +rooms[]=india+13f6 +rooms[]=indonesia+13f6 +rooms[]=korea+13f6 +rooms[]=poland+13f6 +rooms[]=scandinavia+2812 +rooms[]=fi+2812 +rooms[]=br+2b92 +rooms[]=germanpoliticssocietyphilosophy+8183 +sogs[]=fe93941471c07f294255391dba92ae3cf356efc4fdd287d8ba1ffef096dbaf56 + +[tech] +name=Tech Communities +rating=safe +rooms[]=android+118d +rooms[]=ai+118d +rooms[]=gaming+118d +rooms[]=im+118d +rooms[]=linux+118d +rooms[]=webdev+118d +rooms[]=programming+13f6 +rooms[]=tech+2054 +rooms[]=ev-en+2812 +rooms[]=pv-en+2812 +rooms[]=gee+2b92 +rooms[]=mathnodes-dvpn-oxen-dero+8585 +rooms[]=plex+c01b + +[china] +na;=Chinese-language Communities +rating=unknown +sogs[]=45674f4135e2dd929279a72e1e73957eed741c7bec00c87b1797ad52c235ea36 +sogs[]=7f55510a392324988041e7a97191f618a32dc05f2f6343de917fcfe1cb424e51 + +[powerusers] +name=Communities for Powerusers +rating=safe +rooms[]=snops+118d +rooms[]=sogops+118d +rooms[]=indexloki+2cbd +rooms[]=SNappsDevs+2cbd +rooms[]=sessiondev+e56f + +[misc] +name=Miscellanous +rating=unknown +rooms[]=health+118d +rooms[]=music+118d +rooms[]=modernsurvival+118d +rooms[]=philosophy+118d +rooms[]=pol+2054 +rooms[]=biz+2b92 +rooms[]=guns+2b92 +rooms[]=hall+7242 +rooms[]=camping+c01b +rooms[]=offtopic+e56f +rooms[]=AISFW+fc30 + +[oxen] +name=Official Communities +rating=safe +sogs[]=a03c + +[cryptocurrency] +name=Cryptocurrency +rooms[]=bitcoinaustralia+4bec +rooms[]=moneroaustralia+4bec +rooms[]=crypto+a03c + +[privsec] +name=Privacy & Security +rating=safe +rooms[]=im+118d +rooms[]=privacy+118d +rooms[]=security+118d +rooms[]=degoogle+48e9 +rooms[]=privacyaustralia+4bec + +[casual] +name=Casual Communities +rating=safe +rooms[]=general-chat+8c12 +rooms[]=midnight-madness+9be4 + +[nsfw] +name=18+ Communities +rating=nsfw +rooms[]=womanbodybeauty+13f6 +rooms[]=piao+2cd5 +rooms[]=AINSFW+fc30 \ No newline at end of file diff --git a/php/fetch-servers.php b/php/fetch-servers.php index 0bdcfb8..e0e01b3 100644 --- a/php/fetch-servers.php +++ b/php/fetch-servers.php @@ -2,6 +2,7 @@ // requires php-curl require_once 'getenv.php'; + require_once 'utils/getopt.php'; require_once 'utils/utils.php'; require_once 'servers/known-servers.php'; require_once 'utils/servers-rooms.php'; diff --git a/php/generate-html.php b/php/generate-html.php index 9034ccc..6cd874c 100644 --- a/php/generate-html.php +++ b/php/generate-html.php @@ -2,6 +2,7 @@ // Perform static site generation. require_once "getenv.php"; + require_once "utils/getopt.php"; // https://stackoverflow.com/a/17161106 function rglob($pattern, $flags = 0) { diff --git a/php/listing-providers/generate-listings.php b/php/listing-providers/generate-listings.php new file mode 100644 index 0000000..6fef4ab --- /dev/null +++ b/php/listing-providers/generate-listings.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/php/utils/getopt.php b/php/utils/getopt.php new file mode 100644 index 0000000..654e7c1 --- /dev/null +++ b/php/utils/getopt.php @@ -0,0 +1,17 @@ + \ No newline at end of file