from flask import Flask, render_template, redirect, request from time import time from urllib.parse import urlparse app = Flask( __name__, static_url_path='', static_folder='static/', template_folder='templates/' ) @app.route('/') def index(): return render_template("index.html") @app.route('/agegate') def agegate(): url = request.args.get("to", default="/") return render_template("age-gate.html", url=url) @app.route('/accept') def accept(): url = request.args.get("url", default=None) print(urlparse(url).netloc) if urlparse(url).netloc and urlparse(url).netloc[-9:] != "crux.sexy": print("oops") url = "/" if not url: url = "/" res = redirect(url, 307) res.set_cookie("agegate", "true", time() + 60*60*24*365, domain="crux.sexy") return res if __name__ == "__main__": app.run(debug=True, host='0.0.0.0', port=5002)