The crux.sexy website
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

70 lignes
1.9 KiB

  1. from flask import Flask, render_template, redirect, request
  2. from time import time
  3. from urllib.parse import urlparse, unquote
  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 = unquote(request.url.split("?to=")[1])
  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. if urlparse(url).netloc and urlparse(url).netloc[-9:] != "crux.sexy":
  27. print("oops")
  28. url = "/"
  29. if not url:
  30. url = "/"
  31. res = redirect(url, 307)
  32. res.set_cookie("agegate", "true", time() + 60*60*24*365, domain="crux.sexy")
  33. return res
  34. @app.route('/changelog')
  35. def changelog():
  36. game_names = ["stroll", "feast", "gorge", "satiate", "macrovision"]
  37. games = []
  38. for game in game_names:
  39. data = json.load(open("{0}/changelog.json".format(game)))
  40. keys = sorted(data.keys())[::-1]
  41. versions = []
  42. for key in keys:
  43. versions.append({"version": key, "changes": markdown(data[key])})
  44. games.append({"name": game, "versions": versions})
  45. return render_template("changelog.html", games=games)
  46. @app.route('/commits')
  47. def commits():
  48. game_names = ["stroll", "feast", "gorge", "satiate", "macrovision"]
  49. games = []
  50. for game in game_names:
  51. data = json.load(open("commits/{0}.json".format(game)))
  52. games.append({"name": game, "commits": data})
  53. return render_template("commits.html", games=games)
  54. if __name__ == "__main__":
  55. app.run(debug=True, host='0.0.0.0', port=5002)