From c94c28dfe46d2b4f4db0d5c6410b75e70f252157 Mon Sep 17 00:00:00 2001 From: gravel Date: Sun, 22 Jan 2023 19:45:34 +0100 Subject: [PATCH 1/4] Add disclaimer and links to footer --- output/js/constants.js | 4 +-- output/main.js | 10 +++--- output/styles2.css | 18 +++++++++-- sites/index.php | 69 ++++++++++++++++++++++++++++++++++-------- 4 files changed, 78 insertions(+), 23 deletions(-) diff --git a/output/js/constants.js b/output/js/constants.js index 82b89c4..f313728 100644 --- a/output/js/constants.js +++ b/output/js/constants.js @@ -4,10 +4,10 @@ export const dom = { tbl_communities: () => document.getElementById("tbl_communities"), - td_last_checked: () => document.getElementById("td_last_checked"), + last_checked: () => document.getElementById("last_checked_value"), qr_modal: (communityID) => document.getElementById(`modal_${communityID}`), join_urls: () => document.getElementsByClassName("td_join_url"), - td_summary: () => document.getElementById("td_summary"), + servers_hidden: () => document.getElementById("servers_hidden"), snackbar: () => document.getElementById("copy-snackbar") } diff --git a/output/main.js b/output/main.js index 38a7a46..5580094 100644 --- a/output/main.js +++ b/output/main.js @@ -92,9 +92,8 @@ function hideBadCommunities() { .reduce((a, b) => a + b); } - // Not ideal. Separate element should be allocated for content. - const summary = dom.td_summary(); - summary.innerText += ` (${numberOfHiddenCommunities} hidden)`; + const summary = dom.servers_hidden(); + summary.innerText = `(${numberOfHiddenCommunities} hidden)`; } /** @@ -131,9 +130,8 @@ function setLastChecked(last_checked) { const time_passed_in_seconds = seconds_now - last_checked; const time_passed_in_minutes = Math.floor(time_passed_in_seconds / 60); // time in minutes, rounded down - const timestamp_element = dom.td_last_checked(); - timestamp_element.innerText = - `Last checked ${time_passed_in_minutes} minutes ago.`; + const timestamp_element = dom.last_checked(); + timestamp_element.innerText = `${time_passed_in_minutes} minutes`; } /** diff --git a/output/styles2.css b/output/styles2.css index e66d4a1..4a9843b 100644 --- a/output/styles2.css +++ b/output/styles2.css @@ -19,11 +19,23 @@ .copy_button { } -#tbl_footer { width:100%; } +footer { + display: flex; + flex-direction: column; + align-items: center; + width: 100%; + text-align: center; +} -#td_summary { text-align: center; } -#td_last_checked { text-align: center; } +footer p { + width: 75%; + margin: .5em; + text-align: center; +} +footer nav a { + margin: 0 .5ch; +} /* */ :root { diff --git a/sites/index.php b/sites/index.php index f0d7092..3d58e78 100644 --- a/sites/index.php +++ b/sites/index.php @@ -22,18 +22,63 @@ - - - - - - - - - + +
+ +
+

+ unique Session Communities + on servers have been found. + (None hidden as JS is off) +

+

+ Last checked ago. +

+

+ This site is not affiliated with + Oxen Tech Privacy Foundation. +
+ Communities shown are fetched automatically from + various sources. +
+ We make an attempt to hide communities containing + objectionable or illegal content, but + you should still proceed with caution. +

+ + +
Copied URL to clipboard. Paste into Session app to join From 55d5b43ca6714fb5e03188edb79564f122275a7d Mon Sep 17 00:00:00 2001 From: gravel Date: Sun, 22 Jan 2023 19:48:49 +0100 Subject: [PATCH 2/4] Move common to component --- sites/+components/page-head.php | 2 ++ sites/index.php | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 sites/+components/page-head.php diff --git a/sites/+components/page-head.php b/sites/+components/page-head.php new file mode 100644 index 0000000..d5bde1f --- /dev/null +++ b/sites/+components/page-head.php @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/sites/index.php b/sites/index.php index 3d58e78..701ac1a 100644 --- a/sites/index.php +++ b/sites/index.php @@ -2,7 +2,7 @@ // prerequisite include for sites and components require_once "+getenv.php"; require_once "$PROJECT_ROOT/php/utils/server-utils.php"; - + $rooms_raw = file_get_contents($ROOMS_FILE); $rooms = json_decode($rooms_raw); $rooms_assoc = json_decode($rooms_raw, true); @@ -11,8 +11,8 @@ - - + + Self-updating list of active Session communities From 16d70f3c6b3a54e0e2b3a410a7e2b77624b200eb Mon Sep 17 00:00:00 2001 From: gravel Date: Sun, 22 Jan 2023 19:50:39 +0100 Subject: [PATCH 3/4] Make sites/ root for relative PHP site includes --- php/generate-html.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/php/generate-html.php b/php/generate-html.php index d6bfb73..7df70db 100644 --- a/php/generate-html.php +++ b/php/generate-html.php @@ -26,7 +26,9 @@ // This works? Yes, yes it does. // We do this to isolate the environment and include-once triggers, // otherwise we could include the documents in an ob_* wrapper. - $document = `php $phppath`; // should be identical to shell_exec("php $phppath") + + // Same as shell_exec, except we don't have to escape quotes. + $document = `cd "$TEMPLATES_ROOT"; php $phppath`; file_put_contents($docpath, $document); } From 83a80590f78f815ed5f07b26da21db1136061f4a Mon Sep 17 00:00:00 2001 From: gravel Date: Sun, 22 Jan 2023 19:51:07 +0100 Subject: [PATCH 4/4] Add instructions page --- output/css/instructions.css | 20 ++++++++++ output/styles2.css | 12 +++++- sites/+instructions/English.txt | 13 +++++++ sites/+instructions/Esperanto.txt | 5 +++ sites/index.php | 16 ++++++-- sites/instructions.php | 63 +++++++++++++++++++++++++++++++ 6 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 output/css/instructions.css create mode 100644 sites/+instructions/English.txt create mode 100644 sites/+instructions/Esperanto.txt create mode 100644 sites/instructions.php diff --git a/output/css/instructions.css b/output/css/instructions.css new file mode 100644 index 0000000..e31f6b2 --- /dev/null +++ b/output/css/instructions.css @@ -0,0 +1,20 @@ +header { + text-align: center; +} + +#instructions { + padding: 1em; +} + +.instructions { + display: none; + /* Inconsistent with rest of content */ + font-family: sans-serif; + font-weight: bold; + font-size: 1.25em; + line-height: 1.5; + padding: 2em; + background-color: silver; + border: 2px solid black; + border-radius: 1em; +} diff --git a/output/styles2.css b/output/styles2.css index 4a9843b..26a1c3d 100644 --- a/output/styles2.css +++ b/output/styles2.css @@ -1,4 +1,14 @@ -#headline { text-align: center; } +header { + display: flex; + direction: row; + /* Push items as far apart as possible */ + justify-content: space-between; +} + +#headline { + text-align: center; + flex-grow: 1; +} #tbl_communities { width:100%; } diff --git a/sites/+instructions/English.txt b/sites/+instructions/English.txt new file mode 100644 index 0000000..384f2bb --- /dev/null +++ b/sites/+instructions/English.txt @@ -0,0 +1,13 @@ +On mobile: + + +- Click the Copy button to copy the Join URL. +- Open Session, tap the plus button and choose "Join Community". +- Tap the "Enter Community URL" field, paste your URL and tap "Join". + + +On mobile, with this site open on your PC: + +- Click the QR Code button for your chosen community on your PC. +- Open Session, tap the plus button and choose "Join Community". +- Choose "Scan QR Code" at the top and point your phone camera at the QR code. \ No newline at end of file diff --git a/sites/+instructions/Esperanto.txt b/sites/+instructions/Esperanto.txt new file mode 100644 index 0000000..f4d8f48 --- /dev/null +++ b/sites/+instructions/Esperanto.txt @@ -0,0 +1,5 @@ +Ĉe poŝtelefono: + +- Klaki sur la butono "Copy" por kopii la kuniĝa ligilo. +- Malfermi Session-on, frapeti sur la plus-a butono kaj elekti "Kuniĝi komunumon". +- Frapeti sur "Entajpi komunuma liĝilo", elpoŝigi via ligilo kaj frapeti sur "Kuniĝi". \ No newline at end of file diff --git a/sites/index.php b/sites/index.php index 701ac1a..2555bb8 100644 --- a/sites/index.php +++ b/sites/index.php @@ -18,13 +18,23 @@ Self-updating list of active Session communities -

Session Communities

+
+
+ +
+

Session Communities

- +
- +