forked from iris/neotel-website
Compare commits
12 Commits
c28509204a
...
1f64b85aa6
Author | SHA1 | Date | |
---|---|---|---|
1f64b85aa6 | |||
57326ec6c5 | |||
bfdcfd827e | |||
2ba153abac | |||
1914b0d589 | |||
d009b6e266 | |||
7549db9360 | |||
460f4dcbb9 | |||
ee30063de6 | |||
082f7a99e4 | |||
dddbaf8b34 | |||
de0c0c0bcb |
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,5 @@
|
|||
.env*
|
||||
.bundle/
|
||||
vendor/bundle/
|
||||
.jekyll-cache/
|
||||
_site/
|
||||
|
|
24
Gemfile.lock
24
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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<nav class="main-nav">
|
||||
<ul class="inline-list">
|
||||
<li><a href="{{ site.baseurl }}/"><strong>{{ site.name }}</strong></a></li>
|
||||
<li><a href="{{ site.baseurl }}/">☎️ <strong>{{ site.name }}</strong></a></li>
|
||||
<li><a href="{{ site.baseurl }}/phonebook/">phonebook</a></li>
|
||||
<li><a href="{{ site.baseurl }}/the-original/">the original</a></li>
|
||||
<li><a href="https://tel.tilde.org.nz/register/">request account</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
{%- if page.php_session -%}<?php
|
||||
session_name("neotildetel");
|
||||
session_start();
|
||||
?>{%- endif -%}<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
|
32
_sass/form.scss
Normal file
32
_sass/form.scss
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -18,3 +18,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.banner
|
||||
{
|
||||
width: 100%;
|
||||
padding: 0.5rem 1rem;
|
||||
border: 1px solid #000;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
layout: base
|
||||
---
|
||||
|
||||
<main class="index-container">
|
||||
<main class="container index-container">
|
||||
<h1>☎️ {{ site.name }} ☎️</h1>
|
||||
|
||||
<ul class="inline-list">
|
||||
<li><a href="/phonebook/">phonebook</a></li>
|
||||
<li><a href="/the-original/">the original</a></li>
|
||||
<li><a href="https://tel.tilde.org.nz/register/">request account</a></li>
|
||||
</ul>
|
||||
</main>
|
||||
|
|
|
@ -27,13 +27,10 @@ title: phonebook
|
|||
<h2>The community</h2>
|
||||
|
||||
<p>
|
||||
To get a <code>tel.tilde.org.nz</code> number, please message <code>darcy</code>
|
||||
in <code>#tildetel</code> on <a href="https://tilde.chat">the tilde.chat IRC</a>.
|
||||
</p>
|
||||
<p>
|
||||
If you had a <code>tilde.tel</code> number, in most cases, you can use that number
|
||||
on <code>tel.tilde.org.nz</code>! Just let <code>darcy</code> know when asking for
|
||||
an account.
|
||||
Want a <code>tel.tilde.org.nz</code> number?
|
||||
<a href="https://tel.tilde.org.nz/register/">
|
||||
Click here for the registration form!
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<table>
|
||||
|
|
12
register/index.md
Normal file
12
register/index.md
Normal file
|
@ -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.
|
111
register/register.php
Normal file
111
register/register.php
Normal file
|
@ -0,0 +1,111 @@
|
|||
---
|
||||
layout: page
|
||||
title: register for tel.tilde.org.nz
|
||||
php_session: true
|
||||
---
|
||||
|
||||
<?php
|
||||
function exit_with_banner(?string $message) {
|
||||
unset($_SESSION['captcha']);
|
||||
|
||||
echo '<div class="banner">';
|
||||
if (!is_null($message)) {
|
||||
echo "An error occurred: {$message}";
|
||||
} else {
|
||||
echo "An unknown error occurred.";
|
||||
}
|
||||
echo '</div>';
|
||||
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 <code>#tildetel</code>");
|
||||
$_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 '<div class="banner">Your registration request was submitted successfully!</div>';
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
|
||||
<p>If you had an account on the old <code>tilde.tel</code>, please include your previous number in the message field.</p>
|
||||
|
||||
<form method="POST" class="form">
|
||||
<label for="reg_user">Username:</label>
|
||||
<input id="reg_user" name="user" type="text" placeholder="Username">
|
||||
|
||||
<label for="reg_tilde">Tilde / Pubnix:</label>
|
||||
<input id="reg_tilde" name="tilde" type="text" placeholder="Tilde / Pubnix">
|
||||
|
||||
<label for="reg_msg">Message (optional):</label>
|
||||
<textarea id="reg_msg" name="reg_msg"></textarea>
|
||||
|
||||
<div class="form-captcha">
|
||||
<label for="reg_captcha">What is the answer to the below equation?</label>
|
||||
<img class="form-captcha-img" src="{{ site.smolcaptcha_url }}/render/<?php echo $_SESSION['captcha'] ?>">
|
||||
<input id="reg_captcha" name="captcha" type="text" placeholder="Your answer">
|
||||
</div>
|
||||
|
||||
<button class="button" type="submit">
|
||||
Submit registration request
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
27
shell.nix
Normal file
27
shell.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ pkgs ? import <nixpkgs> {}, 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";
|
||||
}
|
|
@ -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';
|
||||
|
|
Loading…
Reference in New Issue
Block a user