The crux.sexy website
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

60 wiersze
1.5 KiB

  1. from flask import Flask, render_template, redirect, request
  2. from time import time
  3. from urllib.parse import urlparse
  4. from markdown2 import markdown
  5. import json
  6. import os.path
  7. app = Flask(
  8. __name__,
  9. static_url_path='',
  10. static_folder='static/',
  11. template_folder='templates/'
  12. )
  13. @app.route('/')
  14. def index():
  15. return render_template("index.html", nightly=False)
  16. @app.route('/nightly')
  17. def nightly():
  18. return render_template("index.html", nightly=True)
  19. @app.route('/agegate')
  20. def agegate():
  21. url = request.args.get("to", default="/")
  22. return render_template("age-gate.html", url=url)
  23. @app.route('/accept')
  24. def accept():
  25. url = request.args.get("url", default=None)
  26. print(urlparse(url).netloc)
  27. if urlparse(url).netloc and urlparse(url).netloc[-9:] != "crux.sexy":
  28. print("oops")
  29. url = "/"
  30. if not url:
  31. url = "/"
  32. res = redirect(url, 307)
  33. res.set_cookie("agegate", "true", time() + 60*60*24*365, domain="crux.sexy")
  34. return res
  35. @app.route('/changelog')
  36. def changelog():
  37. game_names = ["stroll", "feast", "gorge", "satiate"]
  38. games = []
  39. for game in game_names:
  40. data = json.load(open("{0}/changelog.json".format(game)))
  41. keys = sorted(data.keys())[::-1]
  42. versions = []
  43. for key in keys:
  44. versions.append({"version": key, "changes": markdown(data[key])})
  45. games.append({"name": game, "versions": versions})
  46. return render_template("changelog.html", games=games)
  47. if __name__ == "__main__":
  48. app.run(debug=True, host='0.0.0.0', port=5002)