diff --git a/config/versions.json b/config/versions.json new file mode 100644 index 00000000..0e60bcab --- /dev/null +++ b/config/versions.json @@ -0,0 +1,17 @@ +{ + "choices": [ + ["master", "nightly"], + ["1.4.3", "1.4.3"], + ["1.4.2", "1.4.2"], + ["1.4.1", "1.4.1"], + ["1.4.0", "1.4.0"], + ["1.3.9", "1.3.9"], + ["1.3.8", "1.3.8"], + ["1.3.7", "1.3.7"], + ["1.3.6", "1.3.6"], + ["1.3.5", "1.3.5"], + ["1.3.4", "1.3.4"], + ["1.3.3", "1.3.3"] + ], + "initial": "1.4.3" +} diff --git a/config_loader.py b/config_loader.py new file mode 100644 index 00000000..c5b06cc2 --- /dev/null +++ b/config_loader.py @@ -0,0 +1,10 @@ +# config_loader.py +import json +import os + +def load_version_config(): + config_path = os.path.join(os.path.dirname(__file__), './config/versions.json') + with open(config_path, 'r', encoding='utf-8') as f: + data = json.load(f) + data['choices'] = [tuple(choice) for choice in data['choices']] + return data diff --git a/docker-compose.yml b/docker-compose.yml index c55db3ff..72271fd0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,8 @@ services: GENURL: "accessible_url_of_server" PROTOCOL: "https" REPONAME: "rdgen" + volumes: + - ./config:/opt/rdgen/config ports: - "8000:8000" dns: diff --git a/rdgenerator/forms.py b/rdgenerator/forms.py index 19e6239b..241f555d 100644 --- a/rdgenerator/forms.py +++ b/rdgenerator/forms.py @@ -1,10 +1,17 @@ from django import forms from PIL import Image +from config_loader import load_version_config + +version = load_version_config() class GenerateForm(forms.Form): #Platform platform = forms.ChoiceField(choices=[('windows','Windows 64Bit'),('windows-x86','Windows 32Bit'),('linux','Linux'),('android','Android'),('macos','macOS')], initial='windows') - version = forms.ChoiceField(choices=[('master','nightly'),('1.4.3','1.4.3'),('1.4.2','1.4.2'),('1.4.1','1.4.1'),('1.4.0','1.4.0'),('1.3.9','1.3.9'),('1.3.8','1.3.8'),('1.3.7','1.3.7'),('1.3.6','1.3.6'),('1.3.5','1.3.5'),('1.3.4','1.3.4'),('1.3.3','1.3.3')], initial='1.4.3') + #version = forms.ChoiceField(choices=[('master','nightly'),('1.4.3','1.4.3'),('1.4.2','1.4.2'),('1.4.1','1.4.1'),('1.4.0','1.4.0'),('1.3.9','1.3.9'),('1.3.8','1.3.8'),('1.3.7','1.3.7'),('1.3.6','1.3.6'),('1.3.5','1.3.5'),('1.3.4','1.3.4'),('1.3.3','1.3.3')], initial='1.4.3') + version = forms.ChoiceField( + choices=version['choices'], + initial=version['initial'] + ) help_text="'master' is the development version (nightly build) with the latest features but may be less stable" delayFix = forms.BooleanField(initial=True, required=False) diff --git a/setup.md b/setup.md index 781ee184..cbf911c0 100644 --- a/setup.md +++ b/setup.md @@ -26,7 +26,11 @@ * GHBEARER="your fine-grained access token" * PROTOCOL="https" *optional - defaults to "https", change to "http" if you need to * REPONAME="rdgen" *optional - defaults to "rdgen", change this if you renamed the repo when you forked it -5. Now just run ```docker compose up -d``` +5. Copy the config/versions.json file from this project to the config directory, located in the same directory as docker-compose.yml(edit the versions list if you want). The directory structure is as follows: + * docker-compose.yml + * config/ + * |----versions.json +6. Now just run ```docker compose up -d``` ## Host manually: