Implement license validation endpoint and update templates; add test script

This commit is contained in:
Maximilian G.
2026-03-22 14:49:38 +00:00
committed by GitHub
parent 5e0c77b147
commit 91feb7d010
6 changed files with 20 additions and 14 deletions
+11 -7
View File
@@ -1,9 +1,7 @@
from pathlib import Path
import sys
from flask import Flask, render_template
from flask import Flask, render_template, request, jsonify
import verify
import requests
import json
def _resolve_template_dir() -> Path:
candidates = [
@@ -38,9 +36,9 @@ def _read_app_version() -> str:
APP_VERSION = _read_app_version()
@app.route("/_validate__information", methods=['POST'])
def default():
data = requests.get_json()
@app.route("/validate__information", methods=['POST'])
def validate__information():
data = request.get_json(silent=True)
if not data:
return jsonify({"error": "No JSON data provided"}), 400
license_key = data.get("license")
@@ -48,7 +46,13 @@ def default():
if not license_key or not hwid_uuid:
return jsonify({"error": "Missing 'license' or 'hwid' in JSON data"}), 400
if verify.check(license_key, hwid_uuid):
return 200
return jsonify({"status": "ok"}), 200
else:
return jsonify({"status": "invalid"}), 402
@app.route("/")
def default():
return render_template("main.html")
def main():
+1 -3
View File
@@ -1,4 +1,2 @@
<a>This is a Test If this works it would be great!</a>
<p>Version: {{ version }}</p>
<p>UUID: {{ uuid }}</p>
<p>License Key: {{ license }}</p>
<p>Version: {{ version }}</p>
+1 -1
View File
@@ -2,7 +2,7 @@ import json
import os
import secrets
LICENSES_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "licenses.json"))
LICENSES_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "licenses.json"))
def load_file() -> dict: