t* my version of playonbsd.com data
URI git clone git://git.codevoid.de/playonbsd-sdk.git
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 8f09aeed439bb67e86cd302972faea2423c4b5da
URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de>
Date: Sun, 10 May 2020 19:20:49 +0200
initial commit
Diffstat:
A .dancer | 0
A MANIFEST | 24 ++++++++++++++++++++++++
A MANIFEST.SKIP | 17 +++++++++++++++++
A Makefile.PL | 26 ++++++++++++++++++++++++++
A README | 7 +++++++
A bin/app.psgi | 45 +++++++++++++++++++++++++++++++
A config.yml | 62 +++++++++++++++++++++++++++++++
A cpanfile | 14 ++++++++++++++
A environments/development.yml | 23 +++++++++++++++++++++++
A environments/production.yml | 16 ++++++++++++++++
A lib/PlayOnBSD.pm | 52 +++++++++++++++++++++++++++++++
A playonbsd.sqlite | 0
A public/404.html | 18 ++++++++++++++++++
A public/500.html | 18 ++++++++++++++++++
A public/css/error.css | 0
A public/css/style.css | 2 ++
A public/dispatch.cgi | 16 ++++++++++++++++
A public/dispatch.fcgi | 18 ++++++++++++++++++
A public/favicon.ico | 0
A public/images/perldancer-bg.jpg | 0
A public/images/perldancer.jpg | 0
A public/javascripts/jquery.js | 2 ++
A schema.sql | 38 +++++++++++++++++++++++++++++++
A start.sh | 2 ++
A t/001_base.t | 5 +++++
A t/002_index_route.t | 16 ++++++++++++++++
A views/404.tt | 8 ++++++++
A views/index.tt | 62 +++++++++++++++++++++++++++++++
A views/layouts/main.tt | 15 +++++++++++++++
29 files changed, 506 insertions(+), 0 deletions(-)
---
DIR diff --git a/.dancer b/.dancer
DIR diff --git a/MANIFEST b/MANIFEST
t@@ -0,0 +1,24 @@
+MANIFEST
+MANIFEST.SKIP
+Makefile.PL
+config.yml
+cpanfile
+.dancer
+bin/app.psgi
+environments/production.yml
+environments/development.yml
+lib/PlayOnBSD.pm
+public/dispatch.fcgi
+public/404.html
+public/500.html
+public/favicon.ico
+public/dispatch.cgi
+public/css/style.css
+public/css/error.css
+public/images/perldancer.jpg
+public/images/perldancer-bg.jpg
+public/javascripts/jquery.js
+t/001_base.t
+t/002_index_route.t
+views/index.tt
+views/layouts/main.tt
DIR diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
t@@ -0,0 +1,17 @@
+^\.git\/
+maint
+^tags$
+.last_cover_stats
+Makefile$
+^blib
+^pm_to_blib
+^.*.bak
+^.*.old
+^t.*sessions
+^cover_db
+^.*\.log
+^.*\.swp$
+MYMETA.*
+^.gitignore
+^.svn\/
+^PlayOnBSD-
DIR diff --git a/Makefile.PL b/Makefile.PL
t@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+# Normalize version strings like 6.30_02 to 6.3002,
+# so that we can do numerical comparisons on it.
+my $eumm_version = $ExtUtils::MakeMaker::VERSION;
+$eumm_version =~ s/_//;
+
+WriteMakefile(
+ NAME => 'PlayOnBSD',
+ AUTHOR => q{sdk <sh+playonbsd[at]codevoid.de>},
+ VERSION_FROM => 'lib/PlayOnBSD.pm',
+ ABSTRACT => 'The OpenBSD Gaming Community',
+ ($eumm_version >= 6.3001
+ ? ('LICENSE'=> 'perl')
+ : ()),
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ 'YAML' => 0,
+ 'Dancer2' => 0.300000,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'PlayOnBSD-*' },
+);
DIR diff --git a/README b/README
t@@ -0,0 +1,7 @@
+# PlayOnBSD Page
+
+## Requirements
+
+- p5-Dancer2
+- p5-DBD-SQLite
+- p5-File-Slurper
DIR diff --git a/bin/app.psgi b/bin/app.psgi
t@@ -0,0 +1,45 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+
+# use this block if you don't need middleware, and only have a single target Dancer app to run here
+use PlayOnBSD;
+
+PlayOnBSD->to_app;
+
+=begin comment
+# use this block if you want to include middleware such as Plack::Middleware::Deflater
+
+use PlayOnBSD;
+use Plack::Builder;
+
+builder {
+ enable 'Deflater';
+ PlayOnBSD->to_app;
+}
+
+=end comment
+
+=cut
+
+=begin comment
+# use this block if you want to mount several applications on different path
+
+use PlayOnBSD;
+use PlayOnBSD_admin;
+
+use Plack::Builder;
+
+builder {
+ mount '/' => PlayOnBSD->to_app;
+ mount '/admin' => PlayOnBSD_admin->to_app;
+}
+
+=end comment
+
+=cut
+
DIR diff --git a/config.yml b/config.yml
t@@ -0,0 +1,62 @@
+# This is the main configuration file of your Dancer2 app
+# env-related settings should go to environments/$env.yml
+# all the settings in this file will be loaded at Dancer's startup.
+
+# === Basic configuration ===
+
+# Your application's name
+appname: "PlayOnBSD"
+
+# The default layout to use for your application (located in
+# views/layouts/main.tt)
+layout: "main"
+
+# when the charset is set to UTF-8 Dancer2 will handle for you
+# all the magic of encoding and decoding. You should not care
+# about unicode within your app when this setting is set (recommended).
+charset: "UTF-8"
+
+# === Engines ===
+#
+# NOTE: All the engine configurations need to be under a single "engines:"
+# key. If you uncomment engine configurations below, make sure to delete
+# all "engines:" lines except the first. Otherwise, only the last
+# "engines:" block will take effect.
+
+# template engine
+# simple: default and very basic template engine
+# template_toolkit: TT
+
+# template: "simple"
+
+template: "template_toolkit"
+engines:
+ template:
+ template_toolkit:
+ # Note: start_tag and end_tag are regexes
+ start_tag: '<%'
+ end_tag: '%>'
+
+# session engine
+#
+# Simple: in-memory session store - Dancer2::Session::Simple
+# YAML: session stored in YAML files - Dancer2::Session::YAML
+#
+# Check out metacpan for other session storage options:
+# https://metacpan.org/search?q=Dancer2%3A%3ASession&search_type=modules
+#
+# Default value for 'cookie_name' is 'dancer.session'. If you run multiple
+# Dancer apps on the same host then you will need to make sure 'cookie_name'
+# is different for each app.
+#
+engines:
+ session:
+ Simple:
+ cookie_name: playonbsd.session
+#
+#engines:
+# session:
+# YAML:
+# cookie_name: eshop.session
+# is_secure: 1
+# is_http_only: 1
DIR diff --git a/cpanfile b/cpanfile
t@@ -0,0 +1,14 @@
+requires "Dancer2" => "0.300000";
+requires "DBD::SQLite" => "0";
+requires "File::Slurper" => "0";
+
+
+recommends "YAML" => "0";
+recommends "URL::Encode::XS" => "0";
+recommends "CGI::Deurl::XS" => "0";
+recommends "HTTP::Parser::XS" => "0";
+
+on "test" => sub {
+ requires "Test::More" => "0";
+ requires "HTTP::Request::Common" => "0";
+};
DIR diff --git a/environments/development.yml b/environments/development.yml
t@@ -0,0 +1,23 @@
+# configuration file for development environment
+
+# the logger engine to use
+# console: log messages to STDOUT (your console where you started the
+# application server)
+# file: log message to a file in log/
+logger: "console"
+
+# the log level for this environment
+# core is the lowest, it shows Dancer2's core log messages as well as yours
+# (debug, info, warning and error)
+log: "core"
+
+# should Dancer2 consider warnings as critical errors?
+warnings: 1
+
+# should Dancer2 show a stacktrace when an 5xx error is caught?
+# if set to yes, public/500.html will be ignored and either
+# views/500.tt, 'error_template' template, or a default error template will be used.
+show_errors: 1
+
+# print the banner
+startup_info: 1
DIR diff --git a/environments/production.yml b/environments/production.yml
t@@ -0,0 +1,16 @@
+# configuration file for production environment
+
+# only log warning and error messsages
+log: "warning"
+
+# log message to a file in logs/
+logger: "file"
+
+# don't consider warnings critical
+warnings: 0
+
+# hide errors
+show_errors: 0
+
+# disable server tokens in production environments
+no_server_tokens: 1
DIR diff --git a/lib/PlayOnBSD.pm b/lib/PlayOnBSD.pm
t@@ -0,0 +1,52 @@
+package PlayOnBSD;
+use Dancer2;
+
+use DBI;
+use File::Spec;
+use File::Slurper qw/ read_text /;
+use Template;
+
+# debug
+use Data::Dumper;
+# /debug
+
+set 'database' => File::Spec->catfile('playonbsd.sqlite');
+set 'show_errors' => 1;
+set 'startup_info' => 1;
+set 'warnings' => 1;
+
+our $VERSION = '0.1';
+
+sub connect_db {
+ my $dbh = DBI->connect("dbi:SQLite:dbname=".setting('database'))
+ or die $DBI::errstr;
+ print "Connection to database established\n";
+ return $dbh;
+}
+
+sub init_db {
+ my $db = connect_db();
+ my $schema = read_text('./schema.sql');
+ $db->do($schema)
+ or die $db->errstr;
+ print "Database initialized\n";
+}
+
+get '/' => sub {
+ my $db = connect_db();
+
+ my $sql = 'SELECT game_id, title, image, engine, comment, createdat, changedat FROM games ORDER BY game_id DESC';
+
+ my $sth = $db->prepare($sql)
+ or die $db->errstr;
+
+ $sth->execute
+ or die $sth->errstr;
+
+ template 'index.tt', {
+ games => $sth->fetchall_hashref('game_id')
+ };
+};
+
+init_db;
+true;
DIR diff --git a/playonbsd.sqlite b/playonbsd.sqlite
Binary files differ.
DIR diff --git a/public/404.html b/public/404.html
t@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
+ <title>Error 404</title>
+ <link rel="stylesheet" href="/css/error.css">
+</head>
+<body>
+<h1>Error 404</h1>
+<div id="content">
+<h2>Page Not Found</h2><p>Sorry, this is the void.</p>
+</div>
+<div id="footer">
+Powered by <a href="http://perldancer.org/">Dancer2</a>.
+</div>
+</body>
+</html>
DIR diff --git a/public/500.html b/public/500.html
t@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
+ <title>Error 500</title>
+ <link rel="stylesheet" href="/css/error.css">
+</head>
+<body>
+<h1>Error 500</h1>
+<div id="content">
+<h2>Internal Server Error</h2><p>Wooops, something went wrong</p>
+</div>
+<div id="footer">
+Powered by <a href="http://perldancer.org/">Dancer2</a>.
+</div>
+</body>
+</html>
DIR diff --git a/public/css/error.css b/public/css/error.css
DIR diff --git a/public/css/style.css b/public/css/style.css
t@@ -0,0 +1 @@
codevoid.de:70 /git/playonbsd-sdk/commit/8f09aeed439bb67e86cd302972faea2423c4b5da.gph:400: line too long