add actual index page instead of just sending you to a 404 page when hitting the base url

This commit is contained in:
Seaswimmer 2024-08-05 15:27:27 -04:00
parent 06d923e042
commit f48d752899
Signed by: cswimr
GPG key ID: 3813315477F26F82
2 changed files with 14 additions and 4 deletions

View file

@ -45,10 +45,6 @@ if not config.artifact_names:
app = Flask(__name__, template_folder='templates')
@app.route('/')
def index():
return render_template('404.html')
async def fetch_tasks():
url = f'{config.base_url}/api/v1/repos/{config.user}/{config.repo}/actions/tasks'
headers = {
@ -91,6 +87,10 @@ for artifact_name in config.artifact_names:
endpoint = f'handle_{artifact_name}'
app.add_url_rule(route, view_func=create_handle_artifact(artifact_name), endpoint=endpoint)
@app.route('/')
def index():
return render_template('index.html', artifact_urls=[f'/{artifact_name}/GalacticFactory' for artifact_name in config.artifact_names])
def handle_sigterm(*args):
print("Received SIGTERM, exiting gracefully...")
sys.exit(0)

10
src/templates/index.html Normal file
View file

@ -0,0 +1,10 @@
{% block body %}
<h1>GalacticFactory Downloader</h1>
<p>Welcome to the download site for the GalacticFactory modpack!</p>
<p>The links below link to the available artifacts:</p>
<ul>
{% for artifact_url in artifact_urls %}
<li><a href="{{ artifact_url }}">{{ artifact_url }}</a></li>
{% endfor %}
</ul>
{% endblock %}