From 7454f6710cb3f3a2ffe7a4a636d4e65ec4754467 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Aug 2024 13:04:33 +0200 Subject: [PATCH] add_repo --- manage.html | 59 ++++++++++++++++++++++++++++++++++------------------- scan.php | 17 ++++++++++++--- 2 files changed, 52 insertions(+), 24 deletions(-) diff --git a/manage.html b/manage.html index 5087df0..993a077 100644 --- a/manage.html +++ b/manage.html @@ -21,30 +21,33 @@ -
-System -
Loading...
+
+ System services +
Loading...
+
@@ -95,6 +98,14 @@ function get_repositories() { }); } +function add_repository() { + var url = 'scan.php?op=add_repository&repo='+jQuery('#repository').val(); + jQuery.get(url, function(data) { + if (data=="OK") { + } + get_repositories(); + }); +} function check_system() { var url = 'scan.php?op=check_system&services=1'; jQuery.get(url, function(data) { @@ -162,6 +173,12 @@ jQuery(document).ready(function(){ jQuery('#settings').toggle(); }); + jQuery('#add_repo').submit(function() { + jQuery('#repositories').html('Loading...'); + add_repository(); + return false; + }); + jQuery('select#smarthost').click(function() { if (jQuery(this).val()=='yes') jQuery('#div_smarthost').show(); else jQuery('#div_smarthost').hide(); diff --git a/scan.php b/scan.php index 9edb164..ab40597 100644 --- a/scan.php +++ b/scan.php @@ -92,19 +92,30 @@ switch ($_GET["op"]) { $op = "repositories"; redis_set($op,$json); echo "OK"; // TODO? - + break; case "check_repositories": $arr = check_redis("web_out","repositories"); if (!empty($arr)) { foreach ($arr as $key=>$data) { if ($key=="repositories") { - echo base64_decode($data["REPOSITORIES"]); + $repos = json_decode(base64_decode($data["REPOSITORIES"])); + foreach ($repos->repositories as $repo) { + echo $repo."
"; + } redis_remove("$key"); } } } else echo ""; break; + case "add_repository": + $arr = array("NEW_REPO" => $_GET["repo"]); + $json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); + + $op = "add_repository"; + redis_set($op,$json); + echo "OK"; // TODO? + break; case "containers": $arr = array("STATUS" => 0); $json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); @@ -112,7 +123,7 @@ switch ($_GET["op"]) { $op = "containers"; redis_set($op,$json); echo "OK"; // TODO? - + break; case "check_containers": $arr = check_redis("web_out","containers"); if (!empty($arr)) {