diff --git a/get_online_session_communities.php b/get_online_session_communities.php index 957c02bb..72796288 100644 --- a/get_online_session_communities.php +++ b/get_online_session_communities.php @@ -66,7 +66,7 @@ //TODO: What about room view links? $table_html = get_table_html($room_assignments); - $final_html = create_html_page_from_table($table_html, "Session Communities"); + $final_html = create_html_page_from_table($table_html, "Self-updating list of active Session Communities"); // write output to disk global $output; @@ -227,6 +227,7 @@ return true; } else { +// echo($url . " is " . $retcode . PHP_EOL); return false; } } @@ -549,13 +550,34 @@ $table_lines = array(); foreach($ordered_table_elements as $id => $content) { + // https://1.2.3.4:56789/token?public_key=0123456789abcdef + $join_link = $content["join_link"]; + + // get preview links + $exploded = explode("/", $join_link); // https: + "" + 1.2.3.4:56789 + token?public_key=0123456789abcdef + $server = $exploded[0] . "//" . $exploded[2]; + $token = explode("?", $exploded[3])[0]; + $preview_link = $server . "/r/" . $token . "/"; + $preview_link_alt = $server . "/view/room/" . $token; + + // test if preview_links are 404 + if(!url_is_reachable($preview_link)) { + if(!url_is_reachable($preview_link_alt)) { + $preview_link = null; // $preview_link and $preview_link_alt not reachable + } + else { + $preview_link = $preview_link_alt; // $preview_link_alt reachable + } + } + $line = "