A corporation manager and dashboard for EVE Online
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
1.0 KiB

  1. # -*- coding: utf-8 -*-
  2. from flask import abort, g
  3. from flask_mako import render_template
  4. from ._provided import blueprint, config
  5. def get_current():
  6. """Return the name of the currently selected campaign, or None."""
  7. if not config["enabled"]:
  8. return None
  9. setting = g.auth.get_character_modprop("campaigns", "current")
  10. if not setting or setting not in config["enabled"]:
  11. return config["enabled"][0]
  12. return setting
  13. def home():
  14. return render_template("campaigns/campaign.mako", current=get_current())
  15. def navitem():
  16. current = get_current()
  17. if current:
  18. result = render_template("campaigns/navitem.mako", current=current)
  19. return result.decode("utf8")
  20. @blueprint.rroute("/campaign")
  21. def campaign():
  22. return home()
  23. @blueprint.rroute("/settings/campaign/<campaign>", methods=["POST"])
  24. def set_campaign(campaign):
  25. if campaign not in config["enabled"]:
  26. abort(404)
  27. g.auth.set_character_modprop("campaigns", "current", campaign)
  28. return "", 204