From 4d2b9288d5403294fe6541358341986910e43c36 Mon Sep 17 00:00:00 2001
From: Christian Weiske
Date: Thu, 14 May 2020 07:09:02 +0200
Subject: [PATCH] "Push to my OUYA" support
---
.gitignore | 1 +
README.rst | 1 +
bin/build-html.php | 9 ++
config.php.dist | 1 +
data/templates/game.tpl.php | 39 +++++++
src/push-to-my-ouya-helpers.php | 39 +++++++
www/.htaccess | 6 +
www/api/v1/queued_downloads.php | 54 +++++++++
www/api/v1/queued_downloads_delete.php | 53 +++++++++
www/ouya-game.css | 38 +++++++
www/push-to-my-ouya.php | 145 +++++++++++++++++++++++++
www/push-to-my-ouya.png | Bin 0 -> 11908 bytes
12 files changed, 386 insertions(+)
create mode 100644 src/push-to-my-ouya-helpers.php
create mode 100644 www/api/v1/queued_downloads.php
create mode 100644 www/api/v1/queued_downloads_delete.php
create mode 100644 www/push-to-my-ouya.php
create mode 100644 www/push-to-my-ouya.png
diff --git a/.gitignore b/.gitignore
index cd66da5..4827cbd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
/config.php
+/data/push-to-my-ouya.sqlite3
/README.html
www/api/v1/apps/
www/api/v1/details-data/
diff --git a/README.rst b/README.rst
index 91d490f..d06a382 100644
--- a/README.rst
+++ b/README.rst
@@ -36,6 +36,7 @@ Apache setup
Virtual host configuration::
Script PUT /empty-json.php
+ Script DELETE /api/v1/queued_downloads_delete.php
``mod_actions`` need to be enabled for apache 2.4.
diff --git a/bin/build-html.php b/bin/build-html.php
index b4561e6..f7f9154 100755
--- a/bin/build-html.php
+++ b/bin/build-html.php
@@ -7,6 +7,13 @@
*/
require_once __DIR__ . '/functions.php';
+//default configuration values
+$GLOBALS['pushToMyOuyaUrl'] = '../push-to-my-ouya.php';
+$cfgFile = __DIR__ . '/../config.php';
+if (file_exists($cfgFile)) {
+ include $cfgFile;
+}
+
$wwwDir = __DIR__ . '/../www/';
$discoverDir = __DIR__ . '/../www/api/v1/discover-data/';
$wwwDiscoverDir = $wwwDir . 'discover/';
@@ -111,6 +118,8 @@ function renderGameFile($gameDataFile)
)
);
$apkDownloadUrl = $downloadJson->app->downloadLink;
+ $pushUrl = $GLOBALS['pushToMyOuyaUrl']
+ . '?game=' . urlencode($json->apk->package);
$navLinks = [];
foreach ($json->genres as $genreTitle) {
diff --git a/config.php.dist b/config.php.dist
index 8c23bd2..5087c22 100644
--- a/config.php.dist
+++ b/config.php.dist
@@ -11,3 +11,4 @@ $GLOBALS['packagelists']["cweiske's picks"] = [
'com.cosmos.babyloniantwins',
'com.inverseblue.skyriders',
];
+$GLOBALS['pushToMyOuyaUrl'] = '../push-to-my-ouya.php';
diff --git a/data/templates/game.tpl.php b/data/templates/game.tpl.php
index 36a1d09..531fb28 100644
--- a/data/templates/game.tpl.php
+++ b/data/templates/game.tpl.php
@@ -75,6 +75,15 @@
= gmdate('Y-m-d', $json->version->publishedAt) ?>
+
+
+
+
+
+