Added WIP updater Files. (Script doesn't work atm.)

This commit is contained in:
ZKWolf 2023-09-05 18:50:18 +02:00
parent 1c1d829484
commit 5cc2f58701
3 changed files with 103 additions and 0 deletions

52
Doc/updater.md Normal file
View File

@ -0,0 +1,52 @@
# Updater WIP DOC!
The Updater is a self writen Script that updates the Game modifications to the latest build.
In the future there will also be a in-game part that will show you when you need a update.
# 1. Script explained
## 1.1 Script Part X
# 2. Endpoints
These Endpoints are used by the updater to download its files, check for newer versions,...
ROOT: /updater/
## 2.1 /updater/version/*
Type: GET
Response Type: JSON
Example: {"version": 1}
Description: Used to check for newer Versions.
### 2.1.1 Sub-Endpoints
/script
/pak
/sig
## 2.2 /updater/files/*
Type: GET
Response: FILE
Description: Used for downloading Files.
### 2.2.1 Sub-Endpoints
/script
/pak
/sig
# 3. In-Game Part
What it does
How its done

View File

@ -0,0 +1,35 @@
@echo off
setlocal enabledelayedexpansion
TITLE The Exit Rebirth Updater
set version_url=http://localhost:8080/updater/version/pak
set download_url=http://localhost:8080/updater/files/pak
set path_value=C:\tmp\
if not exist "updater_versions" (
mkdir "updater_versions"
)
if not exist "updater_versions\pak_version.txt" (
echo 0 > "updater_versions\pak_version.txt"
)
for /f %%i in ('type "updater_versions\pak_version.txt"') do set current_version=%%i
for /f %%i in ('powershell -command "(Invoke-WebRequest '%version_url%' -UseBasicParsing).Content | ConvertFrom-Json"') do (
set json_version=%%i
)
if %json_version% gtr %current_version% (
echo Updating...
powershell -command "Invoke-WebRequest '%download_url%' -OutFile '%path_value%\pak'"
echo %json_version% > "updater_versions\pak_version.txt"
echo Update complete.
) else (
echo No update required.
)
pause

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta
name = "color-scheme"
content = "light dark"
/>
<html>
<head>
<title>Deathgarden Bloodharvest testing API Updater Endpoint</title>
</head>
<body>
<h1>This Endpoint is used to update any files that we provide.</h1>
<p>For more information read the doc.</p>
</body>
</html>