Add a index page
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 22 Aug 2015 19:35:17 +0000 (22:35 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 22 Aug 2015 19:35:17 +0000 (22:35 +0300)
MANIFEST
app.psgi
web/index.html [new file with mode: 0644]

index f7f2c14a82045039e9b2ef87e3741864a20857df..25e07341522c57de846a2c026071bd96f2d01812 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -13,3 +13,4 @@ t/perlcritic.t
 t/xlogfile
 web/dash.css
 web/dash.html
+web/index.html
index a71a3cffa76d6380df318844df6e3250be887a97..984b37f0369e6f960b0b8daed1de2d9add8fe111 100644 (file)
--- a/app.psgi
+++ b/app.psgi
@@ -3,11 +3,20 @@ use 5.014000;
 use warnings;
 
 use App::Web::NAOdash;
+use File::Slurp;
 use Plack::Builder;
 
+my $index = read_file 'web/index.html';
+
 builder {
        mount '/dash/' => App::Web::NAOdash->new->to_app;
        mount '/json/' => App::Web::NAOdash->new(json => 1)->to_app;
        mount '/ok' => sub { [200, [], []] };
-       mount '/' => sub { App::Web::NAOdash::reply(404, 'Try /dash/USERNAME or /json/USERNAME')};
+       mount '/' => sub {
+               [200, [
+                       'Cache-Control' => 'max-age=86400',
+                       'Content-Type' => "text/html; charset=utf-8",
+                       'Content-Length' => length $index,
+               ], [$index]]
+       };
 }
diff --git a/web/index.html b/web/index.html
new file mode 100644 (file)
index 0000000..29e3019
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>NetHack.alt.org dashboards</title>
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<style>
+html {
+       color: #DDD;
+       background-color: #000;
+       padding: 1%;
+       line-height: 1.5;
+}
+
+a:link {
+       color: #66F;
+       text-decoration: none;
+}
+
+a:visited {
+       color: #84B;
+}
+
+code {
+       color: #90EE90;
+}
+
+dt {
+       font-weight: bold;
+}
+</style>
+
+<p><strong>NAOdash</strong> is a service that analyzes <a href="https://nethackwiki.com/wiki/NetHack">NetHack</a> players' game data on the <a href="https://alt.org/nethack/">nethack.alt.org</a> public server and displays statistics.
+
+<p>It can be used in several ways. In all cases below, USERNAME is your NAO username.
+
+<dl>
+<dt>Website
+<dd>Go to /dash/USERNAME. <a href="/dash/mgv">Example</a>.
+
+<dt>CLI program
+<dd>Install the <code>App::NAOdash</code> module using your favourite CPAN client, for example by running <code>cpanm --sudo App::NAOdash</code> or <code>sudo cpan App::NAOdash</code>.
+<p>You can then run <code>naodash USERNAME</code>.
+
+<dt>JSON API
+<dd>Go to /json/USERNAME. <a href="/json/mgv">Example</a>.
+
+<dt>Perl module
+<dd>Install the <code>NetHack::NAOdash</code> module using your favourite CPAN client. <a href="https://metacpan.org/pod/NetHack::NAOdash">Link to documentation</a>.
+</dl>
This page took 0.012179 seconds and 4 git commands to generate.