add index content page master codeberg/master v0.9.0
authorChristian Weiske <cweiske@cweiske.de>
Wed, 3 Sep 2025 20:18:05 +0000 (22:18 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 3 Sep 2025 20:18:05 +0000 (22:18 +0200)
.gitignore
bin/build-html.php
content/index.htm [new file with mode: 0644]
data/templates/page.tpl.php [new file with mode: 0644]
www/css/discover.css
www/img/box-gamestick.2048.jpg [new file with mode: 0644]

index 02b63ab5c35fc63b7eded859ff94738eb011febc..972c68a615fba4b03cb0ebd5c534cd69793eb22f 100644 (file)
@@ -9,3 +9,4 @@
 /www/frodo
 /www/gamestick-api-docs.htm
 /www/game/
+/www/index.htm
index ab11b573618dbbcc5d25d81a332fab0421e24db4..1c7f92c8da029901de3657e38c9c1f28b5c1019d 100755 (executable)
@@ -60,19 +60,12 @@ if (!is_dir($wwwDiscoverDir)) {
     mkdir($wwwDiscoverDir, 0755);
 }
 
-/*
-$gameFiles = [
-    '../game-data/classic/de.eiswuxe.blookid.json',
-    '../game-data/classic/com.Refresh_Creations_Ltd.Super_Grid_Run.json',//video
-    '../game-data/classic/com.ubisoft.princeofpersia.shadowandflame.ggp.json',//achievements
-    '../game-data/classic/com.crescentmoongames.mimpi.json',//products
-];
-*/
+$contentDir = __DIR__ . '/../content/';
 
 $mainNav = [
     'discover/'             => 'Games',
     'discover/media.htm'    => 'Media',
-    //'/'                     => 'About',
+    '/'                     => 'About',
 ];
 $subNav = [
     'discover/'               => 'Featured',
@@ -276,6 +269,33 @@ foreach ($gameFiles as $gameDataFile) {
 }
 
 
+//Content pages
+file_put_contents(
+    $wwwDir . 'index.htm',
+    renderContentPage(
+        'PlayJam GameStick community server', 'index.htm',
+        $mainNav, [], '/'
+    )
+);
+
+
+function renderContentPage(
+    string $title, string $path,
+    array $mainNav, array $subNav,
+    string $mainNavActivePath, string $subNavActivePath = null
+): string {
+    $content      = file_get_contents($GLOBALS['contentDir'] . $path);
+    $canonicalUrl = $GLOBALS['baseUrl'] . $path;
+    $pageTemplate = __DIR__ . '/../data/templates/page.tpl.php';
+
+    ob_start();
+    include $pageTemplate;
+    $html = ob_get_contents();
+    ob_end_clean();
+
+    return $html;
+}
+
 function renderGameFile($gameDataFile, $path): string
 {
     $json = json_decode(file_get_contents($gameDataFile));
diff --git a/content/index.htm b/content/index.htm
new file mode 100644 (file)
index 0000000..8315885
--- /dev/null
@@ -0,0 +1,33 @@
+<h1>PlayJam GameStick community server</h1>
+<p>
+ The <em>PlayJam GameStick</em> was an Android based gaming micro-console,
+ released in 2013.
+ <a href="https://cweiske.de/tagebuch/gamestick-timeline.htm" title="PlayJam GameStick timeline">In 2017</a>
+ the official server shut down,
+ bricking the GameSticks that need the server to function.
+</p>
+<p>
+ After several years of dedicated work,
+ the
+ <a href="https://cweiske.de/gamestick-api-docs.htm" title="PlayJam GameStick server API documentation">server API</a>
+ has been reverse engineered and documented,
+ <a href="https://codeberg.org/gamestick-fans/game-data">meta data</a>
+ of all 188 games have been collected,
+ game files and firmware version have been
+ <a href="https://archive.org/details/gamesticklibrary" title="The GameStick library @ Internet Archive">archived</a>
+ and a replacement server software has been
+ <a href="https://codeberg.org/gamestick-fans/pjgsapi/" title="pjgsapi">implemented</a>.
+</p>
+<p>
+ This community server lets you register a new user account for brand new
+ or factory reset GameSticks, browse the <a href="discover/" title="games">game library</a>,
+ download and nearly all of the games!
+</p>
+<p>
+ Because not all games have been archived yet, GameSticks need to be manually
+ whitelisted - see the
+ <a href="https://cweiske.de/tagebuch/gamestick-server-public.htm#whitelisting" title="GameStick server: Semi-public alpha">blog post</a>
+ for more information about that.
+</p>
+
+<img src="img/box-gamestick.2048.jpg" alt="GameStick box cover" width="2048" height="2048"/>
diff --git a/data/templates/page.tpl.php b/data/templates/page.tpl.php
new file mode 100644 (file)
index 0000000..ad07a73
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+  <head>
+    <meta charset="utf-8"/>
+    <title><?= htmlspecialchars($title); ?></title>
+    <meta name="generator" content="pjgsapi"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <link rel="stylesheet" type="text/css" href="css/discover.css"/>
+    <link rel="icon" href="img/faviconnew.png"/>
+    <link rel="canonical" href="<?= htmlspecialchars($canonicalUrl) ?>"/>
+  </head>
+  <body>
+    <header>
+      <a href="/">
+        <img src="img/logo_2.png" width="176" height="24"
+          alt="PlayJam GameStick Logo"/>
+      </a>
+    </header>
+
+    <?php if (count($subNav)): ?>
+      <nav id="subnav">
+        <ul>
+          <?php foreach ($subNav as $navUrl => $navTitle): ?>
+            <?php if ($navUrl == $path || $navUrl === $subNavActivePath): ?>
+              <li class="active"><a href="<?= htmlspecialchars($navUrl) ?>"><?= htmlspecialchars($navTitle) ?></a></li>
+            <?php else: ?>
+              <li><a href="<?= htmlspecialchars($navUrl) ?>"><?= htmlspecialchars($navTitle) ?></a></li>
+            <?php endif; ?>
+          <?php endforeach; ?>
+        </ul>
+      </nav>
+      <script type="text/javascript">
+        document.addEventListener('DOMContentLoaded', function (event) {
+          var element = document.querySelector('#subnav li.active');
+          element.scrollIntoView({behavior: 'instant', inline: 'center', block: 'center'});
+        });
+      </script>
+    <?php endif; ?>
+    <div id="content">
+
+      <input id="showmainnav" type="checkbox" style="display: none"/>
+      <nav id="mainnav">
+        <ul>
+          <?php foreach ($mainNav as $navUrl => $navTitle): ?>
+            <?php if ($navUrl == $path || $navUrl == $mainNavActivePath): ?>
+              <li class="mobile-current"><label for="showmainnav"><span class="text"><?= htmlspecialchars($navTitle) ?></span><span class="icon">≡</span></label></li>
+            <?php endif; ?>
+          <?php endforeach; ?>
+
+          <?php foreach ($mainNav as $navUrl => $navTitle): ?>
+            <?php if ($navUrl == $path || $navUrl == $mainNavActivePath): ?>
+              <li class="active"><a href="<?= htmlspecialchars($navUrl) ?>"><?= htmlspecialchars($navTitle) ?></a></li>
+            <?php else: ?>
+              <li><a href="<?= htmlspecialchars($navUrl) ?>"><?= htmlspecialchars($navTitle) ?></a></li>
+            <?php endif; ?>
+          <?php endforeach; ?>
+        </ul>
+      </nav>
+
+      <article>
+          <?= $content ?>
+      </article>
+    </div>
+  </body>
+</html>
index ec68d56a09f4c7ee723a09fbfc3c72b6254909b5..202c155d41df3c94690058063bbd7a777e4f335a 100644 (file)
@@ -367,3 +367,24 @@ header {
         display: none;
     }
 }
+
+#content article {
+    margin-left: 20px;
+    margin-right: 20px;
+    max-width: 50rem;
+}
+#content article h1 {
+    margin-top: 0px;
+}
+#content article a,
+#content article a:visited {
+    font-weight: normal;
+    color: white;
+}
+#content article > img {
+    display: block;
+    margin-left: auto;
+    margin-right: auto;
+    max-width: 80%;
+    height: auto;
+}
diff --git a/www/img/box-gamestick.2048.jpg b/www/img/box-gamestick.2048.jpg
new file mode 100644 (file)
index 0000000..acb23b3
Binary files /dev/null and b/www/img/box-gamestick.2048.jpg differ