commit 81f6aaea43f46a73e42a48cb869b05fa2716d600
parent 4a2ce26056e81defec11075e01a6e1838ad8c27f
Author: Al Beano <albino@autistici.org>
Date: Thu, 21 Sep 2017 22:43:36 +0100
Add script to generate servers page
Diffstat:
7 files changed, 130 insertions(+), 114 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,2 +1,3 @@
.well-known
*.swp
+htdocs/servers.html
diff --git a/README b/README
@@ -1,5 +1,8 @@
Website of cyberia.uptime.party
+A bundle of hacks
+run write_servers.pl if you want to generate the servers page
+
All content Copyright (C) 2017 Al Beano <albino@autistici.org> and subject to the
terms in the `COPYING` file, with the following exceptions:
* cyb.webm and telelines.jpg are property of their respective owners
diff --git a/cpanfile b/cpanfile
@@ -0,0 +1,2 @@
+requires "YAML::Tiny" => "0";
+requires "File::Slurp" => "0";
diff --git a/htdocs/servers.html b/htdocs/servers.html
@@ -1,114 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<title>Cyberia</title>
-<style>
-* {
- margin: 0;
-}
-body, a {
- background-color: black;
- font-family: monospace;
- color: white;
-}
-td {
- border: 1px solid white;
- padding: 5px;
-}
-img, table {
- max-width: 75%;
-}
-</style>
-</head>
-<body>
- <center>
- <h2>Server list</h2>
- All servers are connectable via SSL port 6697. Hubs are not listed as they are not open to the public.
- <br />
- Connect to irc.cyberia.is for a random server (recommended).
- <br /><br />
- <img src=telelines.jpg>
- <br /><br />
- <table>
- <tr>
- <td><strong>Server name</strong></td>
- <td><strong>Server address(es)</strong></td>
- <td><strong>Administrator nickname</strong></td>
- <td><strong>Location</strong></td>
- </tr>
- <tr>
- <td>cyberia.uptime.party (this server)</td>
- <td>cyberia.uptime.party, mmgjqbf4c3nc3eyu.onion</td>
- <td>albino</td>
- <td>CZ</td>
- </tr>
- <tr>
- <td>cyberiairo7us642.onion <em>(Love Lain or be lame)</em></td>
- <td>cyberiairo7us642.onion <em>(Tor HS only)</em></td>
- <td>em</td>
- <td>SE</td>
- </tr>
- <!--
- <tr>
- <td>b.irc.cyberia.is <em>(No matter where you go, everybody's connected)</em></td>
- <td>b.irc.cyberia.is, ruhljvi2c22aibty.onion</td>
- <td>plue</td>
- <td>NL</td>
- </tr>
- -->
- <tr>
- <td>irc.the.worst.is</td>
- <td>irc.the.worst.is</td>
- <td>plue</td>
- <td>NL</td>
- </tr>
- <tr>
- <td>serotonin.lain.sh</td>
- <td>serotonin.lain.sh, mpm4eq6evshl2qd2.onion</td>
- <td>plue</td>
- <td>NL</td>
- </tr>
- <tr>
- <!--
- <tr>
- <td>sinope.zm.is</td>
- <td>sinope.zm.is, irc.zm.is</td>
- <td>syx</td>
- <td>GB</td>
- </tr>
- <td>rhine.ml <em>(DN42)</em></td>
- <td>rhine.ml, cyberia.dn42 <em>(dn42)</em></td>
- <td>str</td>
- <td>UK</td>
- </tr>
- <tr>
- <td>hidden.int</td>
- <td>2gvnv5uuih6ok4de.onion <em>(Tor HS only)</em></td>
- <td>str</td>
- <td>??</td>
- </tr>
- -->
- <tr>
- <td>aitne</td>
- <td>aitne.zm.is</td>
- <td>sy</td>
- <td>RO</td>
- </tr>
- <tr>
- <td>eniac.flipflappe.rs</td>
- <td>eniac.flipflappe.rs</td>
- <td>zero</td>
- <td>DE</td>
- </tr>
- <tr>
- <td>callisto (experimental server)</td>
- <td>ts.k.vu</td>
- <td>albino</td>
- <td>GB<small>-SCT</small></td>
- </tr>
- </table>
- <br />
- <a href=/>[ go back ]</a>
- </center>
-</body>
-</html>
diff --git a/servers.yml b/servers.yml
@@ -0,0 +1,31 @@
+servers:
+ -
+ name: cyberia.uptime.party
+ note: this server
+ admin_nick: albino
+ location: CZ
+ extra_addrs:
+ -
+ addr: mmgjqbf4c3nc3eyu.onion
+ note: Tor HS
+ -
+ name: cyberiairo7us642.onion
+ note: Tor HS only
+ admin_nick: em
+ location: SE
+ -
+ name: irc.the.worst.is
+ admin_nick: plue
+ location: NL
+ -
+ name: serotonin.lain.sh
+ admin_nick: plue
+ location: NL
+ extra_addrs:
+ -
+ addr: mpm4eq6evshl2qd2.onion
+ note: Tor HS
+ -
+ name: eniac.flipflappe.rs
+ admin_nick: zero
+ location: DE
diff --git a/servers_template.html b/servers_template.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Cyberia</title>
+<style>
+* {
+ margin: 0;
+}
+body, a {
+ background-color: black;
+ font-family: monospace;
+ color: white;
+}
+td {
+ border: 1px solid white;
+ padding: 5px;
+}
+img, table {
+ max-width: 75%;
+}
+</style>
+</head>
+<body>
+ <center>
+ <h2>Server list</h2>
+ All servers are connectable via SSL port 6697. Hubs are not listed as they are not open to the public.
+ <br />
+ Connect to irc.cyberia.is for a random server (recommended).
+ <br /><br />
+ <img src=telelines.jpg>
+ <br /><br />
+ <table>
+ <tr>
+ <td><strong>Server name</strong></td>
+ <td><strong>Additional address(es)</strong></td>
+ <td><strong>Administrator nickname</strong></td>
+ <td><strong>Location</strong></td>
+ <!-- {{{ SERVERS }}} -->
+ </tr>
+ </table>
+ <br />
+ <a href=/>[ go back ]</a>
+ </center>
+</body>
+</html>
diff --git a/write_servers.pl b/write_servers.pl
@@ -0,0 +1,48 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use YAML::Tiny;
+use File::Slurp qw/read_file write_file/;
+
+my $ser = YAML::Tiny->read("servers.yml")->[0];
+my $html;
+
+for my $s (@{ $ser->{"servers"} }) {
+ $html .= "<tr><td>$s->{name}";
+
+ if (exists $s->{"note"}) {
+ $html .= note($s->{"note"});
+ }
+
+ $html .= "</td><td>";
+
+ if (exists $s->{"extra_addrs"}) {
+ my $first = 1;
+ for my $a (@{ $s->{"extra_addrs"} }) {
+ if (!$first) {
+ $html .= ", ";
+ } else {
+ $first = 0;
+ }
+
+ $html .= $a->{"addr"};
+
+ if (exists $a->{"note"}) {
+ $html .= note($a->{"note"});
+ }
+ }
+ } else {
+ $html .= "n/a";
+ }
+
+ $html .= "</td><td>$s->{admin_nick}</td><td>$s->{location}</td></tr>";
+}
+
+my $doc = read_file("servers_template.html");
+$doc =~ s/<!-- \{\{\{ SERVERS \}\}\} -->/$html/;
+write_file("htdocs/servers.html", $doc);
+
+sub note {
+ my $n = shift;
+ return " <em>($n)</em>";
+}