From 486f5c837e66226969e7ba60b277b56d853ba0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 26 Aug 2023 21:49:38 +0200 Subject: [PATCH] remove server::* commands (they no longer work inside of the docker container) --- www/commands/server_backupupload.php | 36 -------------------------- www/commands/server_gitwebhook.php | 35 ------------------------- www/commands/server_setselfaddress.php | 14 ---------- www/pages/api.php | 4 --- 4 files changed, 89 deletions(-) delete mode 100644 www/commands/server_backupupload.php delete mode 100644 www/commands/server_gitwebhook.php delete mode 100644 www/commands/server_setselfaddress.php diff --git a/www/commands/server_backupupload.php b/www/commands/server_backupupload.php deleted file mode 100644 index 1b7c2e9..0000000 --- a/www/commands/server_backupupload.php +++ /dev/null @@ -1,36 +0,0 @@ -forceResult(400, "Wrong parameters."); return; } -if (!isset($API_OPTIONS['filename'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; } - -$folder = $API_OPTIONS['folder']; -$filename = $API_OPTIONS['filename']; -$uri = $ROUTE->full_url; - -$reltarget = "Backup/$folder/$filename"; - -$putdata = fopen("php://input", "r"); -$fp = tmpfile(); -$tmppath = stream_get_meta_data($fp)['uri']; -while ($data = fread($putdata, 1024)) fwrite($fp, $data); -fclose($putdata); - -$std = shell_exec("ncc_upload " . '"' . $tmppath . '" "' . $reltarget . '" 2>&1'); - -fclose($fp); - -$content = "REQUEST: " . $uri . "\n\n" . - "IP: " . get_client_ip() . "\n\n" . - "TARGET: " . $reltarget . "\n\n" . - "OUTPUT: " . $std . "\n\n"; - -sendMail("Fileupload to '$folder' triggered", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com'); - -echo "OK.\n\n"; -echo $content; diff --git a/www/commands/server_gitwebhook.php b/www/commands/server_gitwebhook.php deleted file mode 100644 index 621eb85..0000000 --- a/www/commands/server_gitwebhook.php +++ /dev/null @@ -1,35 +0,0 @@ -forceResult(400, "Wrong parameters."); return; } - -$hook = $API_OPTIONS['target']; -$uri = $ROUTE->full_url; - -$cmd = ""; - -if ($hook == 'website_mikescher') - $cmd = 'git fetch ; git reset origin/master --hard'; -else if ($hook == 'griddominance') - $cmd = 'update-gdapi'; -else -{ - $FRAME_OPTIONS->forceResult(400, "Unknown webhook: $hook"); - return; -} - -$std = shell_exec($cmd); - -$content = "REQUEST: " . $uri . "\n\n" . - "IP: " . get_client_ip() . "\n\n" . - "TARGET: " . $hook . "\n\n" . - "OUTPUT: " . $std . "\n\n"; - -sendMail("Webhook '$hook' triggered", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com'); - -echo "{ 'status': 'ok', 'message': 'Webhook '$hook' triggered' }"; \ No newline at end of file diff --git a/www/commands/server_setselfaddress.php b/www/commands/server_setselfaddress.php deleted file mode 100644 index 4f3dc28..0000000 --- a/www/commands/server_setselfaddress.php +++ /dev/null @@ -1,14 +0,0 @@ - [ 'src' => __DIR__.'/../commands/site_selftest.php', 'auth' => 'admin' ], 'site::gitinfo' => [ 'src' => __DIR__.'/../commands/site_gitinfo.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' ],