File size: 752 Bytes
4394363
 
 
153dbfd
4394363
 
 
36a49c2
153dbfd
4394363
 
 
 
 
 
 
 
153dbfd
4394363
 
153dbfd
36a49c2
c45ccc7
2c13efa
4394363
92c0f55
4394363
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import requests
from flask import Flask, request, jsonify, send_file

app = Flask(__name__)

# πŸ”‘ Ambil secret key dari Hugging Face Secrets
HCAPTCHA_SECRET = os.environ.get("HCAPTCHA_SECRET")

@app.route("/")
def index():
    # Serve index.html langsung dari root
    return send_file("index.html")

@app.route("/verify", methods=["POST"])
def verify():
    token = request.form.get("token")
    if not token:
        return jsonify({"success": False, "error": "❌ No token received"}), 400

    url = "https://hcaptcha.com/siteverify"
    data = {"secret": HCAPTCHA_SECRET, "response": token}
    result = requests.post(url, data=data).json()

    return jsonify(result)

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=7860)