diff --git a/.gitignore b/.gitignore
index a285669..f448bd0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
+.env*
+.bundle/
+vendor/bundle/
.jekyll-cache/
_site/
diff --git a/Gemfile.lock b/Gemfile.lock
index aac5691..ea75b1a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,20 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
- addressable (2.7.0)
+ addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.9)
- em-websocket (0.5.2)
+ em-websocket (0.5.3)
eventmachine (>= 0.12.9)
- http_parser.rb (~> 0.6.0)
+ http_parser.rb (~> 0)
eventmachine (1.2.7)
- ffi (1.15.1)
+ ffi (1.15.4)
forwardable-extended (2.6.0)
- http_parser.rb (0.6.0)
- i18n (1.8.10)
+ http_parser.rb (0.8.0)
+ i18n (1.8.11)
concurrent-ruby (~> 1.0)
- jekyll (4.2.0)
+ jekyll (4.2.1)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
@@ -38,7 +38,7 @@ GEM
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
- listen (3.5.1)
+ listen (3.7.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
@@ -49,19 +49,19 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
- rouge (3.26.0)
+ rouge (3.26.1)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
- unicode-display_width (1.7.0)
+ unicode-display_width (1.8.0)
PLATFORMS
- ruby
+ x86_64-darwin-17
DEPENDENCIES
jekyll
BUNDLED WITH
- 2.1.4
+ 2.2.24
diff --git a/_config.yml b/_config.yml
index 2dce671..a279b27 100644
--- a/_config.yml
+++ b/_config.yml
@@ -3,6 +3,11 @@ description: neo-tildetel - a PBX for the tildeverse
url: https://tel.tilde.org.nz
baseurl: ''
+smolcaptcha_url: "https://httpbin.org/status/418"
+smolcaptcha_client: ""
+register_hook: "https://httpbin.org/status/418"
+register_hook_secret: ""
+
kramdown:
smart_quotes: apos,apos,quot,quot
typographic_symbols:
diff --git a/_data/phonebook.yml b/_data/phonebook.yml
index 292f1ff..4ffcceb 100644
--- a/_data/phonebook.yml
+++ b/_data/phonebook.yml
@@ -63,6 +63,9 @@ community:
- tilde: tilde.team
ext: 2013116
name: xfnw
+ - tilde: tilde.team
+ ext: 2013121
+ name: kayw
- tilde: tilde.team
ext: 2013123
name: rawktucc
@@ -72,12 +75,18 @@ community:
- tilde: tilde.team
ext: 2013125
name: forero
+ - tilde: tilde.team
+ ext: 2013126
+ name: r1k
- tilde: cosmic.voyage
ext: 2023101
name: tomasino
- tilde: tilde.institute
ext: 2033110
name: O4dco
+ - tilde: tilde.institute
+ ext: 2033130
+ name: rnelson
- tilde: thunix.net
ext: 2043110
name: Loki
@@ -96,12 +105,18 @@ community:
- tilde: tilde.town
ext: 2063110
name: login
+ - tilde: tilde.town
+ ext: 2063120
+ name: kat
- tilde: tilde.club
ext: 2123103
name: deepend
- tilde: tilde.club
ext: 2123106
name: alex11
+ - tilde: tilde.club
+ ext: 2123120
+ name: dokoissho
- tilde: tilde.org.nz
ext: 2163101
name: darcy
diff --git a/_includes/nav.html b/_includes/nav.html
index 2cef319..5f58903 100644
--- a/_includes/nav.html
+++ b/_includes/nav.html
@@ -1,7 +1,8 @@
diff --git a/_layouts/base.html b/_layouts/base.html
index 25a61a9..5944d67 100644
--- a/_layouts/base.html
+++ b/_layouts/base.html
@@ -1,4 +1,7 @@
-
+{%- if page.php_session -%}{%- endif -%}
diff --git a/_sass/form.scss b/_sass/form.scss
new file mode 100644
index 0000000..b1824e6
--- /dev/null
+++ b/_sass/form.scss
@@ -0,0 +1,32 @@
+.form
+{
+ width: 100%;
+ margin: 0 0 1rem 0;
+}
+
+.form input:not([type = "checkbox"]),
+.form select,
+.form button,
+.form textarea
+{
+ display: block;
+ width: 100%;
+ padding: 0.25rem;
+ margin-bottom: 0.5rem;
+ border: 1px solid #000;
+ border-radius: 3px;
+}
+
+.form-captcha
+{
+ margin: 1rem 0;
+ padding: 1rem;
+ border: 1px solid #000;
+ border-radius: 3px;
+
+ .form-captcha-img
+ {
+ display: block;
+ margin: 1rem 0;
+ }
+}
diff --git a/_sass/index.scss b/_sass/index.scss
index 0dd8aa3..d7abe2c 100644
--- a/_sass/index.scss
+++ b/_sass/index.scss
@@ -1,10 +1,5 @@
.index-container
{
- height: 100%;
- min-height: 100vh;
- width: 100%;
- max-width: 100vw;
-
display: flex;
flex-flow: column wrap;
align-items: center;
diff --git a/_sass/utils.scss b/_sass/utils.scss
index 0edb8b7..c193adf 100644
--- a/_sass/utils.scss
+++ b/_sass/utils.scss
@@ -18,3 +18,11 @@
}
}
}
+
+.banner
+{
+ width: 100%;
+ padding: 0.5rem 1rem;
+ border: 1px solid #000;
+ border-radius: 3px;
+}
diff --git a/index.html b/index.html
index 1dd7fd6..a509960 100644
--- a/index.html
+++ b/index.html
@@ -2,11 +2,12 @@
layout: base
---
-
+
☎️ {{ site.name }} ☎️
diff --git a/phonebook/index.html b/phonebook/index.html
index f8fb450..0e201a7 100644
--- a/phonebook/index.html
+++ b/phonebook/index.html
@@ -27,13 +27,10 @@ title: phonebook
The community
- To get a tel.tilde.org.nz
number, please message darcy
- in #tildetel
on the tilde.chat IRC .
-
-
- If you had a tilde.tel
number, in most cases, you can use that number
- on tel.tilde.org.nz
! Just let darcy
know when asking for
- an account.
+ Want a tel.tilde.org.nz
number?
+
+ Click here for the registration form!
+
diff --git a/register/index.md b/register/index.md
new file mode 100644
index 0000000..3e78f59
--- /dev/null
+++ b/register/index.md
@@ -0,0 +1,12 @@
+---
+layout: page
+title: register for tel.tilde.org.nz
+---
+
+Registrations for `tel.tilde.org.nz`
+are currently unavailable.
+
+Please check back later,
+or ask in `#tildetel`
+on [tilde.chat](https://tilde.chat)
+for more details.
diff --git a/register/register.php b/register/register.php
new file mode 100644
index 0000000..6927a82
--- /dev/null
+++ b/register/register.php
@@ -0,0 +1,111 @@
+---
+layout: page
+title: register for tel.tilde.org.nz
+php_session: true
+---
+
+';
+ if (!is_null($message)) {
+ echo "An error occurred: {$message}";
+ } else {
+ echo "An unknown error occurred.";
+ }
+ echo '';
+ exit;
+}
+
+function verify_captcha(string $result): bool {
+ $ch = curl_init("{{ site.smolcaptcha_url }}/api/verify");
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, [
+ "client" => "{{ site.smolcaptcha_client }}",
+ "captcha" => $_SESSION['captcha'],
+ "result" => $result,
+ ]);
+
+ $resp = curl_exec($ch);
+ curl_close($ch);
+
+ return ($resp !== null && trim($resp) === "ok");
+}
+
+if (!array_key_exists("captcha", $_SESSION) || is_null($_SESSION['captcha'])) {
+ $ch = curl_init("{{ site.smolcaptcha_url }}/api/generate");
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, [
+ "client" => "{{ site.smolcaptcha_client }}",
+ ]);
+
+ $resp = curl_exec($ch);
+ curl_close($ch);
+
+ if ($resp === false) exit_with_banner("CAPTCHA request failed, please alert darcy in #tildetel
");
+ $_SESSION['captcha'] = $resp;
+}
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $form_user = array_key_exists('user', $_POST) ? trim($_POST['user']) : null;
+ $form_tilde = array_key_exists('tilde', $_POST) ? trim($_POST['tilde']) : null;
+ $form_msg = array_key_exists('msg', $_POST) ? trim($_POST['msg']) : "(no message)";
+
+ if ($form_user === null || $form_user === "" || $form_tilde === null || $form_tilde === "") {
+ exit_with_banner("A required field was not provided.");
+ }
+
+ $captcha = array_key_exists('captcha', $_POST) ? trim($_POST['captcha']) : "";
+ if (!verify_captcha($captcha)) {
+ exit_with_banner("CAPTCHA verification failed");
+ }
+
+ $ch = curl_init("{{ site.register_hook }}");
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, [
+ "secret" => "{{ site.register_hook_secret }}",
+ "user" => $form_user,
+ "tilde" => $form_tilde,
+ "msg" => $form_msg,
+ ]);
+
+ $resp = curl_exec($ch);
+ curl_close($ch);
+
+ unset($_SESSION['captcha']);
+
+ if (!$resp) {
+ exit_with_banner("Couldn't submit registration request, please try again");
+ } else {
+ echo 'Your registration request was submitted successfully!
';
+ }
+} else {
+?>
+
+If you had an account on the old tilde.tel
, please include your previous number in the message field.
+
+
+
+
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..7f014a9
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,27 @@
+{ pkgs ? import {}, lib ? pkgs.lib }:
+
+with lib;
+
+let
+ neededLibraries = with pkgs; [
+ curl
+ libxml2
+ libxslt
+ ];
+
+in
+pkgs.mkShell {
+ buildInputs = with pkgs; [
+ ruby
+ bundler
+
+ pkg-config
+ shared-mime-info
+ cacert
+ ] ++ neededLibraries;
+
+ "LD_LIBRARY_PATH" = makeLibraryPath neededLibraries;
+ "SSL_CERT_DIR" = "${pkgs.cacert}/etc/ssl/certs";
+ "SSL_CERT_FILE" = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
+ "FREEDESKTOP_MIME_TYPES_PATH" = "${pkgs.shared-mime-info}/share/mime/packages/freedesktop.org.xml";
+}
diff --git a/styles.scss b/styles.scss
index b1bef14..1c53e18 100644
--- a/styles.scss
+++ b/styles.scss
@@ -16,6 +16,9 @@ body
max-width: 100vw;
width: auto;
+ display: flex;
+ flex-direction: column;
+
margin: 0;
padding: 0;
@@ -35,10 +38,9 @@ a
.container
{
- height: 100%;
- min-height: 100vh;
width: 100%;
max-width: 100vw;
+ flex: 1;
padding: 1rem;
}
@@ -46,5 +48,6 @@ a
@import 'nav';
@import 'footer';
@import 'table';
+@import 'form';
@import 'utils';
@import 'index';