Refactor [su_ajax|admin_cmd|api_webhook] methods into single /api/ interface
This commit is contained in:
parent
75e53f2f52
commit
d0aea4e4e7
42
www/commands/alephnote_statsping.php
Normal file
42
www/commands/alephnote_statsping.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
global $API_OPTIONS;
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../internals/database.php');
|
||||||
|
|
||||||
|
if (!isset($API_OPTIONS['name'])) die("Wrong parameters.");
|
||||||
|
if (!isset($API_OPTIONS['clientid'])) die("Wrong parameters.");
|
||||||
|
if (!isset($API_OPTIONS['version'])) die("Wrong parameters.");
|
||||||
|
if (!isset($API_OPTIONS['providerstr'])) die("Wrong parameters.");
|
||||||
|
if (!isset($API_OPTIONS['providerid'])) die("Wrong parameters.");
|
||||||
|
if (!isset($API_OPTIONS['notecount'])) die("Wrong parameters.");
|
||||||
|
|
||||||
|
$nam = $API_OPTIONS['name'];
|
||||||
|
$cid = $API_OPTIONS['clientid'];
|
||||||
|
$ver = $API_OPTIONS['version'];
|
||||||
|
$prv = $API_OPTIONS['providerstr'];
|
||||||
|
$pid = $API_OPTIONS['providerid'];
|
||||||
|
$tnc = $API_OPTIONS['notecount'];
|
||||||
|
|
||||||
|
if ($nam !== 'AlephNote') print('{"success":false, "message":"Unknown AppName"}');
|
||||||
|
|
||||||
|
|
||||||
|
Database::connect();
|
||||||
|
|
||||||
|
Database::sql_exec_prep('INSERT INTO an_statslog (ClientID, Version, ProviderStr, ProviderID, NoteCount) VALUES (:cid1, :ver1, :prv1, :pid1, :tnc1) ON DUPLICATE KEY UPDATE Version=:ver2,ProviderStr=:prv2,ProviderID=:pid2,NoteCount=:tnc2',
|
||||||
|
[
|
||||||
|
[':cid1', $cid, PDO::PARAM_STR],
|
||||||
|
[':ver1', $ver, PDO::PARAM_STR],
|
||||||
|
[':prv1', $prv, PDO::PARAM_STR],
|
||||||
|
[':pid1', $pid, PDO::PARAM_STR],
|
||||||
|
[':tnc1', $tnc, PDO::PARAM_INT],
|
||||||
|
|
||||||
|
[':ver2', $ver, PDO::PARAM_STR],
|
||||||
|
[':prv2', $prv, PDO::PARAM_STR],
|
||||||
|
[':pid2', $pid, PDO::PARAM_STR],
|
||||||
|
[':tnc2', $tnc, PDO::PARAM_INT],
|
||||||
|
]);
|
||||||
|
|
||||||
|
print('{"success":true}');
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph2.php');
|
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
||||||
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
||||||
|
|
||||||
set_time_limit(900); // 15min
|
set_time_limit(900); // 15min
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph2.php');
|
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
||||||
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
||||||
|
|
||||||
set_time_limit(900); // 15min
|
set_time_limit(900); // 15min
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
|
||||||
|
|
||||||
global $CONFIG;
|
global $CONFIG;
|
||||||
|
|
||||||
|
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
||||||
|
|
||||||
if (isset($_GET['clear']))
|
if (isset($_GET['clear']))
|
||||||
{
|
{
|
||||||
if (key_exists($CONFIG['extendedgitgraph']['session_var'], $_SESSION)) $_SESSION[$CONFIG['extendedgitgraph']['session_var']] = '';
|
if (key_exists($CONFIG['extendedgitgraph']['session_var'], $_SESSION)) $_SESSION[$CONFIG['extendedgitgraph']['session_var']] = '';
|
21
www/commands/progs_updatecheck.php
Normal file
21
www/commands/progs_updatecheck.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
global $API_OPTIONS;
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../internals/programs.php');
|
||||||
|
require_once (__DIR__ . '/../internals/updateslog.php');
|
||||||
|
|
||||||
|
if (!isset($API_OPTIONS['name'])) die("Wrong parameters.");
|
||||||
|
|
||||||
|
$name = $API_OPTIONS['name'];
|
||||||
|
|
||||||
|
$updatedata = Programs::listUpdateData();
|
||||||
|
|
||||||
|
if (!array_key_exists($name, $updatedata)) httpError(404, 'Invalid Request - [Name] not found');
|
||||||
|
|
||||||
|
$data = $updatedata[$name];
|
||||||
|
|
||||||
|
UpdatesLog::insert($name, $data['version']);
|
||||||
|
|
||||||
|
print($name."<hr>".$data['version']."<hr>".$data['url']);
|
@ -1,19 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
global $OPTIONS;
|
global $API_OPTIONS;
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
require_once (__DIR__ . '/../internals/database.php');
|
require_once (__DIR__ . '/../internals/database.php');
|
||||||
|
|
||||||
$folder = $OPTIONS['folder'];
|
if (!isset($API_OPTIONS['folder'])) die("Wrong parameters.");
|
||||||
$filename = $OPTIONS['filename'];
|
if (!isset($API_OPTIONS['filename'])) die("Wrong parameters.");
|
||||||
$secret = $OPTIONS['secret'];
|
if (!isset($API_OPTIONS['secret'])) die("Wrong parameters.");
|
||||||
$uri = $OPTIONS['uri'];
|
if (!isset($API_OPTIONS['uri'])) die("Wrong parameters.");
|
||||||
|
|
||||||
|
$folder = $API_OPTIONS['folder'];
|
||||||
|
$filename = $API_OPTIONS['filename'];
|
||||||
|
$secret = $API_OPTIONS['secret'];
|
||||||
|
$uri = $API_OPTIONS['uri'];
|
||||||
|
|
||||||
$reltarget = "Backup/$folder/$filename";
|
$reltarget = "Backup/$folder/$filename";
|
||||||
|
|
||||||
if ($secret !== $CONFIG['upload_secret']) die('Unauthorized.');
|
|
||||||
|
|
||||||
$putdata = fopen("php://input", "r");
|
$putdata = fopen("php://input", "r");
|
||||||
$fp = tmpfile();
|
$fp = tmpfile();
|
||||||
$tmppath = stream_get_meta_data($fp)['uri'];
|
$tmppath = stream_get_meta_data($fp)['uri'];
|
29
www/commands/server_gitwebhook.php
Normal file
29
www/commands/server_gitwebhook.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
global $API_OPTIONS;
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../internals/database.php');
|
||||||
|
|
||||||
|
if (!isset($API_OPTIONS['target'])) die("Wrong parameters.");
|
||||||
|
if (!isset($API_OPTIONS['secret'])) die("Wrong parameters.");
|
||||||
|
if (!isset($API_OPTIONS['uri'])) die("Wrong parameters.");
|
||||||
|
|
||||||
|
$hook = $API_OPTIONS['target'];
|
||||||
|
$secret = $API_OPTIONS['secret'];
|
||||||
|
$uri = $API_OPTIONS['uri'];
|
||||||
|
|
||||||
|
$cmd = "";
|
||||||
|
|
||||||
|
if ($hook == 'website_mikescher') $cmd = 'git pull';
|
||||||
|
else if ($hook == 'griddominance') $cmd = 'update-gdapi';
|
||||||
|
else die("Unknown webhook: $hook");
|
||||||
|
|
||||||
|
$std = shell_exec($cmd);
|
||||||
|
|
||||||
|
$content = "REQUEST: " . $uri . "\r\n\r\n" .
|
||||||
|
"IP: " . get_client_ip() . "\r\n\r\n" .
|
||||||
|
"TARGET: " . $hook . "\r\n\r\n" .
|
||||||
|
"OUTPUT: " . $std . "\r\n\r\n";
|
||||||
|
|
||||||
|
sendMail("Webhook '$hook' triggered", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com');
|
9
www/commands/server_setselfaddress.php
Normal file
9
www/commands/server_setselfaddress.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$ip = get_client_ip();
|
||||||
|
|
||||||
|
file_put_contents(__DIR__ . '/../dynamic/self_ip_address.auto.cfg', $ip);
|
||||||
|
|
||||||
|
system('add-trusted-ip "' . $ip . '"');
|
||||||
|
|
||||||
|
echo 'Ok.';
|
32
www/commands/site_createBookThumbnails.php
Normal file
32
www/commands/site_createBookThumbnails.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
global $OPTIONS;
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../internals/books.php');
|
||||||
|
require_once (__DIR__ . '/../internals/programs.php');
|
||||||
|
|
||||||
|
echo '<!DOCTYPE html>';
|
||||||
|
echo '<html lang="en">';
|
||||||
|
echo '<head>';
|
||||||
|
echo '<meta charset="utf-8">';
|
||||||
|
echo '<title>Mikescher.com - AdminExec</title>';
|
||||||
|
echo '<link rel="icon" type="image/png" href="/data/images/favicon.png"/>';
|
||||||
|
echo '<link rel="canonical" href="https://www.mikescher.com/logout"/>';
|
||||||
|
echo '<meta http-equiv="refresh" content="3; url=/admin; ?>" />';
|
||||||
|
echo '</head>';
|
||||||
|
echo '<body>';
|
||||||
|
|
||||||
|
foreach (Books::listAll() as $book)
|
||||||
|
{
|
||||||
|
echo 'Create preview for ' . $book['title'] . '<br/>' . "\n";
|
||||||
|
Books::createPreview($book);
|
||||||
|
}
|
||||||
|
echo 'Finished.' . '<br/>' . "\n";
|
||||||
|
|
||||||
|
echo '<script>setTimeout(function () { window.location.href = "/admin"; }, 3000);</script>';
|
||||||
|
echo '</body>';
|
||||||
|
echo '</html>';
|
||||||
|
|
||||||
|
|
||||||
|
die('Wrong command.');
|
29
www/commands/site_createProgramThumbnails.php
Normal file
29
www/commands/site_createProgramThumbnails.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
global $OPTIONS;
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../internals/books.php');
|
||||||
|
require_once (__DIR__ . '/../internals/programs.php');
|
||||||
|
|
||||||
|
echo '<!DOCTYPE html>';
|
||||||
|
echo '<html lang="en">';
|
||||||
|
echo '<head>';
|
||||||
|
echo '<meta charset="utf-8">';
|
||||||
|
echo '<title>Mikescher.com - AdminExec</title>';
|
||||||
|
echo '<link rel="icon" type="image/png" href="/data/images/favicon.png"/>';
|
||||||
|
echo '<link rel="canonical" href="https://www.mikescher.com/logout"/>';
|
||||||
|
echo '<meta http-equiv="refresh" content="3;url=/admin;"/>';
|
||||||
|
echo '</head>';
|
||||||
|
echo '<body>';
|
||||||
|
|
||||||
|
foreach (Programs::listAll() as $prog)
|
||||||
|
{
|
||||||
|
echo 'Create preview for ' . $prog['name'] . '<br/>' . "\n";
|
||||||
|
Programs::createPreview($prog);
|
||||||
|
}
|
||||||
|
echo 'Finished.' . '<br/>' . "\n";
|
||||||
|
|
||||||
|
echo '<script>setTimeout(function () { window.location.href = "/admin"; }, 3000);</script>';
|
||||||
|
echo '</body>';
|
||||||
|
echo '</html>';
|
@ -677,7 +677,7 @@ html, body {
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.about_egh_container {
|
.about_egg_container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -812,7 +812,7 @@ html, body {
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.egh_ajaxOutput {
|
.egg_ajaxOutput {
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
4
www/data/css/styles.min.css
vendored
4
www/data/css/styles.min.css
vendored
@ -134,7 +134,7 @@ html,body{margin:0;padding:0;height:100%}
|
|||||||
@media(max-width:850px){.index_pnl_base{width:330px}}
|
@media(max-width:850px){.index_pnl_base{width:330px}}
|
||||||
.aboutcontent{display:block;width:100%}
|
.aboutcontent{display:block;width:100%}
|
||||||
.aboutcontent .boxedcontent{margin-bottom:20px}
|
.aboutcontent .boxedcontent{margin-bottom:20px}
|
||||||
.about_egh_container{display:flex;flex-direction:column;align-items:center}
|
.about_egg_container{display:flex;flex-direction:column;align-items:center}
|
||||||
.git_list{display:inline-block;width:715px;height:115px;overflow:visible}
|
.git_list{display:inline-block;width:715px;height:115px;overflow:visible}
|
||||||
@media(max-width:991px){
|
@media(max-width:991px){
|
||||||
.git_list{width:100%;height:auto}
|
.git_list{width:100%;height:auto}
|
||||||
@ -159,7 +159,7 @@ html,body{margin:0;padding:0;height:100%}
|
|||||||
.egg_col_x5_4{fill:#003958}
|
.egg_col_x5_4{fill:#003958}
|
||||||
.admincontent{display:block;width:100%}
|
.admincontent{display:block;width:100%}
|
||||||
.admincontent .boxedcontent{margin-bottom:20px}
|
.admincontent .boxedcontent{margin-bottom:20px}
|
||||||
.egh_ajaxOutput{display:flex;box-sizing:border-box;width:100%;align-self:center;margin-left:auto;margin-right:auto;resize:none;height:300px}
|
.egg_ajaxOutput{display:flex;box-sizing:border-box;width:100%;align-self:center;margin-left:auto;margin-right:auto;resize:none;height:300px}
|
||||||
.keyvaluelist{display:flex;flex-direction:column}
|
.keyvaluelist{display:flex;flex-direction:column}
|
||||||
.keyvaluelist div{display:flex;flex-direction:row}
|
.keyvaluelist div{display:flex;flex-direction:row}
|
||||||
.keyvaluelist div span{align-self:center}
|
.keyvaluelist div span{align-self:center}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.about_egh_container {
|
.about_egg_container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.egh_ajaxOutput {
|
.egg_ajaxOutput {
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
function queryStatus(appendix, secret)
|
function queryStatus(appendix, secret)
|
||||||
{
|
{
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
url: '/admin/egh/status?secret='+secret,
|
url: '/api/extendedgitgraph::status?secret='+secret,
|
||||||
success: function(result)
|
success: function(result)
|
||||||
{
|
{
|
||||||
let ajaxOutput = $('#egh_ajaxOutput');
|
let ajaxOutput = $('#egh_ajaxOutput');
|
||||||
@ -14,11 +14,11 @@ function queryStatus(appendix, secret)
|
|||||||
|
|
||||||
function startAjaxRefresh(secret)
|
function startAjaxRefresh(secret)
|
||||||
{
|
{
|
||||||
$('#egh_ajaxOutput').val("Started.");
|
$('#egg_ajaxOutput').val("Started.");
|
||||||
val = setInterval(function(){ queryStatus('', secret); }, 500);
|
val = setInterval(function(){ queryStatus('', secret); }, 500);
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
url: '/admin/egh/refresh?secret='+secret,
|
url: '/api/extendedgitgraph::refresh?secret='+secret,
|
||||||
success: function(result)
|
success: function(result)
|
||||||
{
|
{
|
||||||
clearInterval(val);
|
clearInterval(val);
|
||||||
@ -35,11 +35,11 @@ function startAjaxRefresh(secret)
|
|||||||
|
|
||||||
function startAjaxRedraw(secret)
|
function startAjaxRedraw(secret)
|
||||||
{
|
{
|
||||||
$('#egh_ajaxOutput').val("Started.");
|
$('#egg_ajaxOutput').val("Started.");
|
||||||
val = setInterval(function(){ queryStatus('', secret); }, 500);
|
val = setInterval(function(){ queryStatus('', secret); }, 500);
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
url: '/admin/egh/redraw?secret='+secret,
|
url: '/api/extendedgitgraph::redraw?secret='+secret,
|
||||||
success: function(result)
|
success: function(result)
|
||||||
{
|
{
|
||||||
clearInterval(val);
|
clearInterval(val);
|
||||||
|
@ -30,26 +30,21 @@ $URL_RULES =
|
|||||||
[ 'url' => ['books', 'view', '?{id}'], 'target' => 'pages/books_view.php', 'options' => [ 'id' => '%GET%' ], ],
|
[ 'url' => ['books', 'view', '?{id}'], 'target' => 'pages/books_view.php', 'options' => [ 'id' => '%GET%' ], ],
|
||||||
[ 'url' => ['books', 'view', '?{id}', '*'], 'target' => 'pages/books_view.php', 'options' => [ 'id' => '%URL%' ], ],
|
[ 'url' => ['books', 'view', '?{id}', '*'], 'target' => 'pages/books_view.php', 'options' => [ 'id' => '%URL%' ], ],
|
||||||
|
|
||||||
[ 'url' => ['update.php'], 'target' => 'pages/api_updatecheck.php', 'options' => [ '_opt' => 'http', 'Name' => '%GET%' ], ],
|
[ 'url' => ['update.php'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'progs::updatecheck' ], ],
|
||||||
[ 'url' => ['update.php', '?{Name}'], 'target' => 'pages/api_updatecheck.php', 'options' => [ '_opt' => 'http', 'Name' => '%URL%' ], ],
|
[ 'url' => ['update.php', '?{Name}'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'progs::updatecheck' ], ],
|
||||||
[ 'url' => ['update'], 'target' => 'pages/api_updatecheck.php', 'options' => [ '_opt' => 'http', 'Name' => '%GET%' ], ],
|
[ 'url' => ['update'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'progs::updatecheck' ], ],
|
||||||
[ 'url' => ['update', '?{Name}'], 'target' => 'pages/api_updatecheck.php', 'options' => [ '_opt' => 'http', 'Name' => '%URL%' ], ],
|
[ 'url' => ['update', '?{Name}'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'progs::updatecheck' ], ],
|
||||||
[ 'url' => ['update2'], 'target' => 'pages/api_updatecheck.php', 'options' => [ '_opt' => 'http', 'Name' => '%GET%' ], ],
|
[ 'url' => ['update2'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'progs::updatecheck' ], ],
|
||||||
[ 'url' => ['api', 'update'], 'target' => 'pages/api_updatecheck.php', 'options' => [ '_opt' => 'http', 'Name' => '%GET%' ], ],
|
[ 'url' => ['api', 'update'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'progs::updatecheck' ], ],
|
||||||
[ 'url' => ['api', 'update', '?{Name}'], 'target' => 'pages/api_updatecheck.php', 'options' => [ '_opt' => 'http', 'Name' => '%URL%' ], ],
|
[ 'url' => ['api', 'update', '?{Name}'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'progs::updatecheck' ], ],
|
||||||
[ 'url' => ['api', 'test'], 'target' => 'pages/api_test.php', 'options' => [ '_opt' => 'http', ], ],
|
[ 'url' => ['api', 'test'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'base::test' ], ],
|
||||||
[ 'url' => ['api', 'setselfadress'], 'target' => 'pages/api_setselfadress.php', 'options' => [ '_opt' => 'http', ], ],
|
[ 'url' => ['api', 'setselfadress'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'server::setselfaddress' ], ],
|
||||||
[ 'url' => ['api', 'statsping'], 'target' => 'pages/api_stats.php', 'options' => [ '_opt' => 'http', 'Name' => '%GET%', 'ClientID' => '%GET%', 'Version' => '%GET%', 'ProviderStr' => '%GET%', 'ProviderID' => '%GET%', 'NoteCount' => '%GET%', ], ],
|
[ 'url' => ['api', 'statsping'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'alephnote::statsping' ], ],
|
||||||
[ 'url' => ['api', 'webhook', '?{target}'], 'target' => 'pages/api_webhook.php', 'options' => [ '_opt' => 'http', 'target' => '%URL%', 'secret' => '%GET%', ],],
|
[ 'url' => ['api', 'webhook', '?{target}'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'server::gitwebhook' ], ],
|
||||||
[ 'url' => ['api', 'backupupload'], 'target' => 'pages/api_backupupload.php', 'options' => [ '_opt' => 'http', 'folder' => '%GET%', 'filename' => '%GET%', 'secret' => '%GET%', ],],
|
[ 'url' => ['api', 'backupupload'], 'target' => 'pages/api.php', 'options' => [ '_opt' => 'http', 'cmd' => 'server::backupupload' ], ],
|
||||||
|
[ 'url' => ['api', '?{cmd}'], 'target' => 'pages/api.php', 'options' => [ 'cmd' => '%URL%' ], ],
|
||||||
|
|
||||||
[ 'url' => ['admin'], 'target' => 'pages/admin.php', 'options' => [ '_opt' => 'password'], ],
|
[ 'url' => ['admin'], 'target' => 'pages/admin.php', 'options' => [ '_opt' => 'password'], ],
|
||||||
[ 'url' => ['admin', 'updateslog', '${name}'], 'target' => 'pages/admin_ul-list.php', 'options' => [ '_opt' => 'password', 'name' => '%URL%'],],
|
|
||||||
[ 'url' => ['admin', 'cmd', '?{cmd}'], 'target' => 'pages/admin_cmd.php', 'options' => [ '_opt' => 'password', 'cmd' => '%URL%'], ],
|
|
||||||
[ 'url' => ['admin', 'egh', '?{cmd}'], 'target' => 'pages/su_ajax.php', 'options' => [ 'suffix' => 'egh', 'cmd' => '%URL%', 'secret' => '%GET%' ], ],
|
|
||||||
|
|
||||||
[ 'url' => ['su_ajax', '?{cmd}'], 'target' => 'pages/su_ajax.php', 'options' => [ 'suffix' => '', 'cmd' => '%URL%', 'secret' => '%GET%' ], ],
|
|
||||||
[ 'url' => ['su_ajax'], 'target' => 'pages/su_ajax.php', 'options' => [ 'suffix' => '', 'cmd' => '%GET%', 'secret' => '%GET%' ], ],
|
|
||||||
|
|
||||||
[ 'url' => ['blog'], 'target' => 'pages/blog_list.php', 'options' => [], ],
|
[ 'url' => ['blog'], 'target' => 'pages/blog_list.php', 'options' => [], ],
|
||||||
[ 'url' => ['log'], 'target' => 'pages/blog_list.php', 'options' => [], ],
|
[ 'url' => ['log'], 'target' => 'pages/blog_list.php', 'options' => [], ],
|
||||||
@ -80,7 +75,7 @@ $URL_RULES =
|
|||||||
[ 'url' => ['highscores', 'list_top50'], 'target' => 'pages/highscores_top50.php', 'options' => [ '_opt' => 'http', 'gameid' => '%GET%' ], ],
|
[ 'url' => ['highscores', 'list_top50'], 'target' => 'pages/highscores_top50.php', 'options' => [ '_opt' => 'http', 'gameid' => '%GET%' ], ],
|
||||||
[ 'url' => ['highscores', 'getNewID.php'], 'target' => 'pages/highscores_newid.php', 'options' => [ '_opt' => 'http', 'gameid' => '%GET%' ], ],
|
[ 'url' => ['highscores', 'getNewID.php'], 'target' => 'pages/highscores_newid.php', 'options' => [ '_opt' => 'http', 'gameid' => '%GET%' ], ],
|
||||||
[ 'url' => ['highscores', 'newid'], 'target' => 'pages/highscores_newid.php', 'options' => [ '_opt' => 'http', 'gameid' => '%GET%' ], ],
|
[ 'url' => ['highscores', 'newid'], 'target' => 'pages/highscores_newid.php', 'options' => [ '_opt' => 'http', 'gameid' => '%GET%' ], ],
|
||||||
|
|
||||||
[ 'url' => ['404'], 'target' => 'pages/error_404.php', 'options' => [], ],
|
[ 'url' => ['404'], 'target' => 'pages/error_404.php', 'options' => [], ],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -156,6 +151,10 @@ try {
|
|||||||
|
|
||||||
$opt[strtolower($optname)] = $value;
|
$opt[strtolower($optname)] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$opt['_urlparams'] = [];
|
||||||
|
foreach ($urlparams as $name => $value) $opt['_urlparams'][strtolower($name)] = urldecode($value);
|
||||||
|
|
||||||
if (!$match) continue;
|
if (!$match) continue;
|
||||||
|
|
||||||
if (in_array('disabled', $ctrlOpt)) continue;
|
if (in_array('disabled', $ctrlOpt)) continue;
|
||||||
@ -181,7 +180,9 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$OPTIONS = $opt;
|
$OPTIONS = $opt;
|
||||||
include $target;
|
|
||||||
|
/** @noinspection PhpIncludeInspection */
|
||||||
|
include $target;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph2.php');
|
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
||||||
|
|
||||||
class MikescherGitGraph
|
class MikescherGitGraph
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ global $OPTIONS;
|
|||||||
<div class="boxedcontent">
|
<div class="boxedcontent">
|
||||||
<div class="bc_header">My git timeline</div>
|
<div class="bc_header">My git timeline</div>
|
||||||
|
|
||||||
<div class="bc_data about_egh_container">
|
<div class="bc_data about_egg_container">
|
||||||
|
|
||||||
<?php print(MikescherGitGraph::get()); ?>
|
<?php print(MikescherGitGraph::get()); ?>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ $consistency_blog = Blog::checkConsistency();
|
|||||||
$consistency_prog = Programs::checkConsistency();
|
$consistency_prog = Programs::checkConsistency();
|
||||||
$consistency_euler = Euler::checkConsistency();
|
$consistency_euler = Euler::checkConsistency();
|
||||||
$consistency_books = Books::checkConsistency();
|
$consistency_books = Books::checkConsistency();
|
||||||
$consistency_egh = MikescherGitGraph::checkConsistency();
|
$consistency_egg = MikescherGitGraph::checkConsistency();
|
||||||
$consistency_progimg = Programs::checkThumbnails();
|
$consistency_progimg = Programs::checkThumbnails();
|
||||||
$consistency_bookimg = Books::checkThumbnails();
|
$consistency_bookimg = Books::checkThumbnails();
|
||||||
$consistency_aoc = AdventOfCode::checkConsistency();
|
$consistency_aoc = AdventOfCode::checkConsistency();
|
||||||
@ -75,7 +75,7 @@ function dumpConsistency($c) {
|
|||||||
<div class="bc_data">
|
<div class="bc_data">
|
||||||
<div class="keyvaluelist kvl_200">
|
<div class="keyvaluelist kvl_200">
|
||||||
<div><span>Program thumbnails:</span> <?php dumpConsistency($consistency_progimg); ?></div>
|
<div><span>Program thumbnails:</span> <?php dumpConsistency($consistency_progimg); ?></div>
|
||||||
<div><span>ExtendedGitGraph:</span> <?php dumpConsistency($consistency_egh); ?></div>
|
<div><span>ExtendedGitGraph:</span> <?php dumpConsistency($consistency_egg); ?></div>
|
||||||
<div><span>Book thumbnails:</span> <?php dumpConsistency($consistency_bookimg); ?></div>
|
<div><span>Book thumbnails:</span> <?php dumpConsistency($consistency_bookimg); ?></div>
|
||||||
<div><span>Blog data:</span> <?php dumpConsistency($consistency_blog); ?></div>
|
<div><span>Blog data:</span> <?php dumpConsistency($consistency_blog); ?></div>
|
||||||
<div><span>Euler data:</span> <?php dumpConsistency($consistency_euler); ?></div>
|
<div><span>Euler data:</span> <?php dumpConsistency($consistency_euler); ?></div>
|
||||||
@ -84,8 +84,8 @@ function dumpConsistency($c) {
|
|||||||
<div><span>Books data:</span> <?php dumpConsistency($consistency_books); ?></div>
|
<div><span>Books data:</span> <?php dumpConsistency($consistency_books); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<a class="button" href="/admin/cmd/createProgramThumbnails">Update Program Thumbnails</a>
|
<a class="button" href="/api/site::createProgramThumbnails">Update Program Thumbnails</a>
|
||||||
<a class="button" href="/admin/cmd/createBookThumbnails">Update Book Thumbnails</a>
|
<a class="button" href="/api/site::createBookThumbnails">Update Book Thumbnails</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -115,7 +115,7 @@ function dumpConsistency($c) {
|
|||||||
|
|
||||||
<div class="bc_data">
|
<div class="bc_data">
|
||||||
|
|
||||||
<textarea class="egh_ajaxOutput" id="egh_ajaxOutput" readonly="readonly"></textarea>
|
<textarea class="egg_ajaxOutput" id="egg_ajaxOutput" readonly="readonly"></textarea>
|
||||||
<a class="button" href="javascript:startAjaxRefresh('<?php echo $CONFIG['ajax_secret'] ?>')">Update</a>
|
<a class="button" href="javascript:startAjaxRefresh('<?php echo $CONFIG['ajax_secret'] ?>')">Update</a>
|
||||||
<a class="button" href="javascript:startAjaxRedraw('<?php echo $CONFIG['ajax_secret'] ?>')">Redraw</a>
|
<a class="button" href="javascript:startAjaxRedraw('<?php echo $CONFIG['ajax_secret'] ?>')">Redraw</a>
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ function dumpConsistency($c) {
|
|||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div id="an_ajax_target"></div>
|
<div id="an_ajax_target"></div>
|
||||||
<a class="button" href="javascript:startAjaxReplace('#an_ajax_target', '/su_ajax/alephNoteTable?secret=<?php echo $CONFIG['ajax_secret'] ?>')">Show</a>
|
<a class="button" href="javascript:startAjaxReplace('#an_ajax_target', '/api/alephnote::show?secret=<?php echo $CONFIG['ajax_secret'] ?>')">Show</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -162,7 +162,7 @@ function dumpConsistency($c) {
|
|||||||
|
|
||||||
<div class="bc_data keyvaluelist kvl_300">
|
<div class="bc_data keyvaluelist kvl_300">
|
||||||
<?php foreach (UpdatesLog::listProgramsInformation() as $info): ?>
|
<?php foreach (UpdatesLog::listProgramsInformation() as $info): ?>
|
||||||
<div><span><?php echo '[' . $info['name'] . '] Count:' ?></span> <span><a href="javascript:startAjaxReplace('#ul_ajax_target', '/su_ajax/updateslog?secret=<?php echo $CONFIG['ajax_secret'] ?>&ulname=<?php echo $info['name'] ?>')"><?php echo $info['count_total']; ?></a></span></div>
|
<div><span><?php echo '[' . $info['name'] . '] Count:' ?></span> <span><a href="javascript:startAjaxReplace('#ul_ajax_target', '/admin/updates::show?secret=<?php echo $CONFIG['ajax_secret'] ?>&ulname=<?php echo $info['name'] ?>')"><?php echo $info['count_total']; ?></a></span></div>
|
||||||
<div><span><?php echo '[' . $info['name'] . '] Last query:' ?></span> <span><?php echo $info['last_query']; ?></span></div>
|
<div><span><?php echo '[' . $info['name'] . '] Last query:' ?></span> <span><?php echo $info['last_query']; ?></span></div>
|
||||||
<div><span><?php echo '[' . $info['name'] . '] Count (1 week):' ?></span> <span><?php echo $info['count_week']; ?></span></div>
|
<div><span><?php echo '[' . $info['name'] . '] Count (1 week):' ?></span> <span><?php echo $info['count_week']; ?></span></div>
|
||||||
<hr />
|
<hr />
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
global $OPTIONS;
|
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
|
||||||
require_once (__DIR__ . '/../internals/books.php');
|
|
||||||
require_once (__DIR__ . '/../internals/programs.php');
|
|
||||||
|
|
||||||
$cmd = $OPTIONS['cmd'];
|
|
||||||
|
|
||||||
if ($cmd === 'createProgramThumbnails')
|
|
||||||
{
|
|
||||||
echo '<!DOCTYPE html>';
|
|
||||||
echo '<html lang="en">';
|
|
||||||
echo '<head>';
|
|
||||||
echo '<meta charset="utf-8">';
|
|
||||||
echo '<title>Mikescher.com - AdminExec</title>';
|
|
||||||
echo '<link rel="icon" type="image/png" href="/data/images/favicon.png"/>';
|
|
||||||
echo '<link rel="canonical" href="https://www.mikescher.com/logout"/>';
|
|
||||||
echo '<meta http-equiv="refresh" content="3;url=/admin;"/>';
|
|
||||||
echo '</head>';
|
|
||||||
echo '<body>';
|
|
||||||
|
|
||||||
foreach (Programs::listAll() as $prog)
|
|
||||||
{
|
|
||||||
echo 'Create preview for ' . $prog['name'] . '<br/>' . "\n";
|
|
||||||
Programs::createPreview($prog);
|
|
||||||
}
|
|
||||||
echo 'Finished.' . '<br/>' . "\n";
|
|
||||||
|
|
||||||
echo '<script>setTimeout(function () { window.location.href = "/admin"; }, 3000);</script>';
|
|
||||||
echo '</body>';
|
|
||||||
echo '</html>';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cmd === 'createBookThumbnails')
|
|
||||||
{
|
|
||||||
echo '<!DOCTYPE html>';
|
|
||||||
echo '<html lang="en">';
|
|
||||||
echo '<head>';
|
|
||||||
echo '<meta charset="utf-8">';
|
|
||||||
echo '<title>Mikescher.com - AdminExec</title>';
|
|
||||||
echo '<link rel="icon" type="image/png" href="/data/images/favicon.png"/>';
|
|
||||||
echo '<link rel="canonical" href="https://www.mikescher.com/logout"/>';
|
|
||||||
echo '<meta http-equiv="refresh" content="3; url=/admin; ?>" />';
|
|
||||||
echo '</head>';
|
|
||||||
echo '<body>';
|
|
||||||
|
|
||||||
foreach (Books::listAll() as $book)
|
|
||||||
{
|
|
||||||
echo 'Create preview for ' . $book['title'] . '<br/>' . "\n";
|
|
||||||
Books::createPreview($book);
|
|
||||||
}
|
|
||||||
echo 'Finished.' . '<br/>' . "\n";
|
|
||||||
|
|
||||||
echo '<script>setTimeout(function () { window.location.href = "/admin"; }, 3000);</script>';
|
|
||||||
echo '</body>';
|
|
||||||
echo '</html>';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
die('Wrong command.');
|
|
89
www/pages/api.php
Normal file
89
www/pages/api.php
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
global $OPTIONS;
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
|
||||||
|
$API_COMMANDS =
|
||||||
|
[
|
||||||
|
'base::test' => [ 'src' => __DIR__.'/../commands/base_test.php', 'auth' => 'none' ],
|
||||||
|
|
||||||
|
'progs::updatecheck' => [ 'src' => __DIR__.'/../commands/progs_updatecheck.php', 'auth' => 'none' ],
|
||||||
|
|
||||||
|
'site::createProgramThumbnails' => [ 'src' => __DIR__.'/../commands/site_createProgramThumbnails.php', 'auth' => 'admin' ],
|
||||||
|
'site::createBookThumbnails' => [ 'src' => __DIR__.'/../commands/site_createBookThumbnails.php', 'auth' => 'admin' ],
|
||||||
|
|
||||||
|
'server::setselfaddress' => [ 'src' => __DIR__.'/../commands/server_setselfaddress.php', 'auth' => 'none' ],
|
||||||
|
'server::gitwebhook' => [ 'src' => __DIR__.'/../commands/server_gitwebhook.php', 'auth' => 'webhook_secret' ],
|
||||||
|
'server::backupupload' => [ 'src' => __DIR__.'/../commands/server_backupupload.php', 'auth' => 'upload_secret' ],
|
||||||
|
|
||||||
|
'extendedgitgraph::status' => [ 'src' => __DIR__.'/../commands/extendedgitgraph_status.php', 'auth' => 'ajax_secret' ],
|
||||||
|
'extendedgitgraph::redraw' => [ 'src' => __DIR__.'/../commands/extendedgitgraph_redraw.php', 'auth' => 'ajax_secret' ],
|
||||||
|
'extendedgitgraph::refresh' => [ 'src' => __DIR__.'/../commands/extendedgitgraph_refresh.php', 'auth' => 'ajax_secret' ],
|
||||||
|
|
||||||
|
'alephnote::statsping' => [ 'src' => __DIR__.'/../commands/alephnote_statsping.php', 'auth' => 'none' ],
|
||||||
|
'alephnote::show' => [ 'src' => __DIR__.'/../commands/alephnote_show.php', 'auth' => 'ajax_secret' ],
|
||||||
|
|
||||||
|
'updates::show' => [ 'src' => __DIR__.'/../commands/updates_show.php', 'auth' => 'ajax_secret' ],
|
||||||
|
];
|
||||||
|
|
||||||
|
$cmd = strtolower($OPTIONS['cmd']);
|
||||||
|
|
||||||
|
if (!array_key_exists($cmd, $API_COMMANDS))
|
||||||
|
{
|
||||||
|
print(" \n");
|
||||||
|
print(" \n");
|
||||||
|
print(" ... \n");
|
||||||
|
print(" ;::::; \n");
|
||||||
|
print(" ;::::; :; \n");
|
||||||
|
print(" ;:::::' :; \n");
|
||||||
|
print(" ;:::::; ;. \n");
|
||||||
|
print(" ,:::::' ; OOO\\ \n");
|
||||||
|
print(" ::::::; ; OOOOO\\ \n");
|
||||||
|
print(" ;:::::; ; OOOOOOOO \n");
|
||||||
|
print(" ,;::::::; ;' / OOOOOOO \n");
|
||||||
|
print(" ;:::::::::`. ,,,;. / / DOOOOOO \n");
|
||||||
|
print(" .';:::::::::::::::::;, / / DOOOO \n");
|
||||||
|
print(" ,::::::;::::::;;;;::::;, / / DOOO \n");
|
||||||
|
print(" ;`::::::`'::::::;;;::::: ,#/ / DOOO \n");
|
||||||
|
print(" :`:::::::`;::::::;;::: ;::# / DOOO \n");
|
||||||
|
print(" ::`:::::::`;:::::::: ;::::# / DOO \n");
|
||||||
|
print(" `:`:::::::`;:::::: ;::::::#/ DOO \n");
|
||||||
|
print(" :::`:::::::`;; ;:::::::::## OO \n");
|
||||||
|
print(" ::::`:::::::`;::::::::;:::# OO \n");
|
||||||
|
print(" `:::::`::::::::::::;'`:;::# O \n");
|
||||||
|
print(" `:::::`::::::::;' / / `:# \n");
|
||||||
|
print(" ::::::`:::::;' / / `# \n");
|
||||||
|
print(" \n");
|
||||||
|
print(" \n");
|
||||||
|
die('Wrong command.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = $API_COMMANDS[$cmd];
|
||||||
|
|
||||||
|
|
||||||
|
$secret = isset($_GET['secret']) ? $_GET['secret'] : '';
|
||||||
|
|
||||||
|
if ($config['auth'] === 'webhook_secret' && $secret !== $CONFIG['webhook_secret']) die('Unauthorized.');
|
||||||
|
if ($config['auth'] === 'ajax_secret' && $secret !== $CONFIG['ajax_secret']) die('Unauthorized.');
|
||||||
|
if ($config['auth'] === 'upload_secret' && $secret !== $CONFIG['upload_secret']) die('Unauthorized.');
|
||||||
|
if ($config['auth'] === 'admin' && !isLoggedInByCookie()) die('Unauthorized.');
|
||||||
|
|
||||||
|
|
||||||
|
global $API_OPTIONS;
|
||||||
|
|
||||||
|
$API_OPTIONS = [];
|
||||||
|
foreach ($_GET as $k => $v) $API_OPTIONS[strtolower($k)] = $v;
|
||||||
|
foreach ($OPTIONS['_urlparams'] as $k => $v) $API_OPTIONS[strtolower($k)] = $v;
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
/** @noinspection PhpIncludeInspection */
|
||||||
|
include $config['src'];
|
||||||
|
}
|
||||||
|
catch (exception $e)
|
||||||
|
{
|
||||||
|
print("API Command failed with exception");
|
||||||
|
print($e);
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$ip = get_client_ip();
|
|
||||||
|
|
||||||
file_put_contents(__DIR__ . '/../dynamic/self_ip_address.auto.cfg', $ip);
|
|
||||||
|
|
||||||
system('add-trusted-ip "' . $ip . '"');
|
|
||||||
|
|
||||||
echo 'Ok.';
|
|
@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
global $OPTIONS;
|
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
|
||||||
require_once (__DIR__ . '/../internals/database.php');
|
|
||||||
|
|
||||||
$nam = $OPTIONS['name'];
|
|
||||||
$cid = $OPTIONS['clientid'];
|
|
||||||
$ver = $OPTIONS['version'];
|
|
||||||
$prv = $OPTIONS['providerstr'];
|
|
||||||
$pid = $OPTIONS['providerid'];
|
|
||||||
$tnc = $OPTIONS['notecount'];
|
|
||||||
|
|
||||||
if ($nam === 'AlephNote')
|
|
||||||
{
|
|
||||||
Database::connect();
|
|
||||||
|
|
||||||
Database::sql_exec_prep('INSERT INTO an_statslog (ClientID, Version, ProviderStr, ProviderID, NoteCount) VALUES (:cid1, :ver1, :prv1, :pid1, :tnc1) ON DUPLICATE KEY UPDATE Version=:ver2,ProviderStr=:prv2,ProviderID=:pid2,NoteCount=:tnc2',
|
|
||||||
[
|
|
||||||
[':cid1', $cid, PDO::PARAM_STR],
|
|
||||||
[':ver1', $ver, PDO::PARAM_STR],
|
|
||||||
[':prv1', $prv, PDO::PARAM_STR],
|
|
||||||
[':pid1', $pid, PDO::PARAM_STR],
|
|
||||||
[':tnc1', $tnc, PDO::PARAM_INT],
|
|
||||||
|
|
||||||
[':ver2', $ver, PDO::PARAM_STR],
|
|
||||||
[':prv2', $prv, PDO::PARAM_STR],
|
|
||||||
[':pid2', $pid, PDO::PARAM_STR],
|
|
||||||
[':tnc2', $tnc, PDO::PARAM_INT],
|
|
||||||
]);
|
|
||||||
|
|
||||||
print('{"success":true}');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print('{"success":false, "message":"Unknown AppName"}');
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
global $OPTIONS;
|
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
|
||||||
require_once (__DIR__ . '/../internals/programs.php');
|
|
||||||
require_once (__DIR__ . '/../internals/updateslog.php');
|
|
||||||
|
|
||||||
$name = $OPTIONS['name'];
|
|
||||||
|
|
||||||
$updatedata = Programs::listUpdateData();
|
|
||||||
|
|
||||||
if (! array_key_exists($name, $updatedata)) httpError(404, 'Invalid Request - [Name] not found');
|
|
||||||
|
|
||||||
$data = $updatedata[$name];
|
|
||||||
|
|
||||||
UpdatesLog::insert($name, $data['version']);
|
|
||||||
|
|
||||||
print($name."<hr>".$data['version']."<hr>".$data['url']);
|
|
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
global $OPTIONS;
|
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
|
||||||
require_once (__DIR__ . '/../internals/database.php');
|
|
||||||
|
|
||||||
$hook = $OPTIONS['target'];
|
|
||||||
$secret = $OPTIONS['secret'];
|
|
||||||
$uri = $OPTIONS['uri'];
|
|
||||||
|
|
||||||
if ($secret !== $CONFIG['webhook_secret']) die('Unauthorized.');
|
|
||||||
|
|
||||||
$cmd = "";
|
|
||||||
|
|
||||||
if ($hook == 'website_mikescher') $cmd = 'git pull';
|
|
||||||
else if ($hook == 'griddominance') $cmd = 'update-gdapi';
|
|
||||||
else throw new Exception("Unknown webhook: $hook");
|
|
||||||
|
|
||||||
|
|
||||||
$std = shell_exec($cmd);
|
|
||||||
|
|
||||||
$content = "REQUEST: " . $uri . "\r\n\r\n" .
|
|
||||||
"IP: " . get_client_ip() . "\r\n\r\n" .
|
|
||||||
"TARGET: " . $hook . "\r\n\r\n" .
|
|
||||||
"OUTPUT: " . $std . "\r\n\r\n";
|
|
||||||
|
|
||||||
sendMail("Webhook '$hook' triggered", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com');
|
|
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
|
||||||
|
|
||||||
$cmd = $OPTIONS['cmd'];
|
|
||||||
$secret = $OPTIONS['secret'];
|
|
||||||
|
|
||||||
if (isset($OPTIONS['suffix']) && $OPTIONS['suffix'] !== '') $cmd = $OPTIONS['suffix'] . '::' . $cmd;
|
|
||||||
$cmd = strtolower($cmd);
|
|
||||||
|
|
||||||
if ($secret !== $CONFIG['ajax_secret']) die('Unauthorized.');
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ($cmd === 'egh::status') { include (__DIR__ . '/../ajax/egh_status.php'); exit; }
|
|
||||||
if ($cmd === 'egh::refresh') { include (__DIR__ . '/../ajax/egh_refresh.php'); exit; }
|
|
||||||
if ($cmd === 'egh::redraw') { include (__DIR__ . '/../ajax/egh_redraw.php'); exit; }
|
|
||||||
|
|
||||||
if ($cmd === 'alephnotetable') { include (__DIR__ . '/../ajax/an_activeusers.php'); exit; }
|
|
||||||
if ($cmd === 'updateslog') { include (__DIR__ . '/../ajax/ul_entries.php'); exit; }
|
|
||||||
}
|
|
||||||
catch (exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
die('Wrong command.');
|
|
Loading…
Reference in New Issue
Block a user