Skip to content

Commit

Permalink
start on missing get req parameter on api/modpack
Browse files Browse the repository at this point in the history
  • Loading branch information
maggi373 committed Nov 18, 2024
1 parent 48cacd2 commit 1aa652b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ def verify_key(key: str = None):
return jsonify({"error": "Invalid key provided."})


@api.route("/api/modpack/") # fix for technic website not following their own api
@api.route("/api/modpack")
@cached(cache_type(cache_size), key=lambda: str(request.args.get("cid")))
@cached(cache_type(cache_size), key=lambda: str(request.args.get("cid")) + str(request.args.get('include')))
def modpack():
modpacks = Modpack.get_by_cid_api(request.args.get("cid"))
return jsonify({"modpacks": {modpack.slug: modpack.name for modpack in modpacks}, "mirror_url": public_repo_url})
if request.args.get('include') == "full":
return jsonify({"mirror_url": public_repo_url})
else:
modpacks = Modpack.get_by_cid_api(request.args.get("cid"))
return jsonify({"modpacks": {modpack.slug: modpack.name for modpack in modpacks}, "mirror_url": public_repo_url})

@api.route("/api/modpack/<slug>")
@cached(cache_type(cache_size), key=lambda slug: str(request.args.get("cid")) + slug)
Expand Down

0 comments on commit 1aa652b

Please sign in to comment.