From 2d8f29caba236c9e39e67e53f0d7fbf4722e7616 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Mon, 8 Oct 2018 23:02:34 +0200 Subject: [PATCH] Release help --- client-api/api.php | 38 +++++++++++++++++++++++++++++++++----- files.php | 9 +++++++-- scripts/git-release.sh | 24 ++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 scripts/git-release.sh diff --git a/client-api/api.php b/client-api/api.php index a474276a..05440a69 100644 --- a/client-api/api.php +++ b/client-api/api.php @@ -6,7 +6,7 @@ * Time: 16:42 */ - $BASE_PATH = "files/"; + $UI_BASE_PATH = "ui-files/"; if(!isset($_SERVER['REQUEST_METHOD'])) { error_log("This is a web only script!"); @@ -55,7 +55,7 @@ } function handle_develop_web_request() { - global $BASE_PATH; + global $UI_BASE_PATH; if($_GET["type"] === "files") { header("Content-Type: text/plain"); @@ -63,7 +63,7 @@ /* header("mode: develop"); */ echo ("type\thash\tpath\tname\n"); - foreach (list_dir($BASE_PATH) as $file) { + foreach (list_dir($UI_BASE_PATH) as $file) { $type_idx = strrpos($file, "."); $type = substr($file, $type_idx + 1); if($type == "php") $type = "html"; @@ -75,13 +75,13 @@ $name_idx = strrpos($name, "."); $name = substr($name, 0, $name_idx); - echo $type . "\t" . sha1_file($BASE_PATH . $file) . "\t" . $path . "\t" . $name . "." . $type . "\n"; + echo $type . "\t" . sha1_file($UI_BASE_PATH . $file) . "\t" . $path . "\t" . $name . "." . $type . "\n"; } die; } else if($_GET["type"] === "file") { header("Content-Type: text/plain"); - $path = realpath($BASE_PATH . $_GET["path"]); + $path = realpath($UI_BASE_PATH . $_GET["path"]); $name = $_GET["name"]; if($path === False || strpos($path, realpath(".")) === False || strpos($name, "/") !== False) die(json_encode([ "success" => false, @@ -102,6 +102,34 @@ fdump( $path . DIRECTORY_SEPARATOR . $name); die(); + } else if ($_GET["type"] == "update-info") { + //TODO read real data from update/info.txt + die(json_encode([ + "versions" => [ + [ + "channel" => "beta", + "major" => 1, + "minor" => 0, + "patch" => 0, + "build" => 0 + ], + [ + "channel" => "release", + "major" => 1, + "minor" => 0, + "patch" => 0, + "build" => 0 + ] + ], + "updater" => [ + "channel" => "release", + "major" => 1, + "minor" => 0, + "patch" => 0, + "build" => 0 + ], + "success" => true + ])); } else die(json_encode([ "success" => false, "error" => "invalid action!" diff --git a/files.php b/files.php index c396dc16..7d7bd60e 100644 --- a/files.php +++ b/files.php @@ -250,7 +250,7 @@ $environment = "web/dev-environment"; } else if ($_SERVER["argv"][2] == "client") { $flagset = 0b10; - $environment = "client-api/environment/files"; + $environment = "client-api/environment/ui-files"; } else { error_log("Invalid type!"); goto help; @@ -262,7 +262,7 @@ $environment = "web/rel-environment"; } else if ($_SERVER["argv"][2] == "client") { $flagset = 0b10; - $environment = "client-api/environment/files"; + $environment = "client-api/environment/ui-files"; } else { error_log("Invalid type!"); goto help; @@ -313,6 +313,11 @@ error_log("Failed to enter directory client-api/environment!"); exit(1); } + if(!is_dir("versions/beta")) + exec($command = "mkdir -p versions/beta", $output, $state); if($state) goto handle_error; + if(!is_dir("versions/stable")) + exec($command = "mkdir -p versions/beta", $output, $state); if($state) goto handle_error; + exec($command = "ln -s ../api.php ./", $output, $state); if($state) goto handle_error; } diff --git a/scripts/git-release.sh b/scripts/git-release.sh new file mode 100644 index 00000000..fcd8e11c --- /dev/null +++ b/scripts/git-release.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +version=$1 +text=$2 +branch=$(git rev-parse --abbrev-ref HEAD) +repo_full_name=$(git config --get remote.origin.url | sed 's/.*:\/\/github.com\///;s/.git$//') +token=$(git config --global github.token) + +generate_post_data() +{ + cat <