Skip to content

Commit 5ca1058

Browse files
committed
Update to Rust API Routes
1 parent 5cf5b0b commit 5ca1058

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ envs.py
33
.venv
44
venv/
55
users.sqlite3
6-
launch.json
6+
launch.json
7+
.env

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM docker.io/python:3.8-buster
22
LABEL maintainer="Andrew Simonson <[email protected]>"
33

44
WORKDIR /app
5-
ADD ./src /app
5+
#ADD ./src /app
66
COPY ./requirements.txt requirements.txt
77
RUN apt-get -yq update && \
88
pip install --no-cache-dir -r requirements.txt

src/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def uploadgame():
4141
author = current_user.id
4242
file = {'file': ("game.zip", f.stream, "application/zip")}
4343
fields = {'title': title, 'description': description, 'author':author}
44-
r = requests.post(app.config["DEVCADE_API_URI"] + "games/", files=file, data=fields)
44+
r = requests.post(app.config["DEVCADE_API_URI"] + "games/", files=file, data=fields, headers={"frontend_api_key":app.config["FRONTEND_API_KEY"]})
4545
if r.status_code == 200:
4646
return flask.redirect('/catalog')
4747
return "<p>" + r.text + "</p>"
@@ -72,7 +72,7 @@ def deleteGame(id):
7272
game = requests.get(app.config['DEVCADE_API_URI'] + "games/" + id).json()
7373
author = game['author']
7474
if(current_user.admin or current_user.id == author):
75-
r = requests.delete(app.config["DEVCADE_API_URI"] + "games/" + id)
75+
r = requests.delete(app.config["DEVCADE_API_URI"] + "games/" + id, headers={"frontend_api_key":app.config["FRONTEND_API_KEY"]})
7676
if r.status_code != 200:
7777
return r.text
7878
else:

src/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
OIDC_CLIENT_SECRET = env.get('OIDC_CLIENT_SECRET', 'NOT-A-SECRET')
3232

3333
DEVCADE_API_URI = env.get('DEVCADE_API_URI')
34+
FRONTEND_API_KEY = env.get('FRONTEND_API_KEY')
3435

3536
DEVCADE_IS_DEV = env.get('DEVCADE_IS_DEV')

src/templates/header.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% macro gamecard(game) %}
2-
<a href="/game/{{ game.id }}">
3-
<div class="game-card" style="background-image: url({{ game.bannerLink }})">
4-
<img class="game-icon" src="{{ game.iconLink }}" />
2+
<a href="/game/{{ game.game_id }}">
3+
<div class="game-card" style="background-image: url({{ config['DEVCADE_API_URI'] }}games/{{ game.game_id }}/banner)">
4+
<img class="game-icon" src="{{ config['DEVCADE_API_URI'] }}games/{{ game.game_id }}/icon" />
55
<div class="game-name">
66
<div>
77
<h2>{{ game.name }}</h2>

0 commit comments

Comments
 (0)