A corporation manager and dashboard for EVE Online
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.
 
 
 
 
 

39 lignes
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. from flask import g, json
  3. from flask_mako import render_template
  4. from ._provided import app, blueprint
  5. def home():
  6. """Render and return the main map page."""
  7. return render_template("map/map.mako")
  8. def navitem():
  9. """Render and return the navigation item for this module."""
  10. return render_template("map/navitem.mako").decode("utf8")
  11. @blueprint.rroute("/map")
  12. def map():
  13. """Render and return the main map page."""
  14. return home()
  15. @blueprint.rroute("/map/data.json")
  16. def mapdata():
  17. """Render and return the map data as a JSON object."""
  18. payload = {
  19. "galaxy": {
  20. system.id: {
  21. "name": system.name,
  22. "coords": system.coords,
  23. "security": system.security
  24. }
  25. for system in g.eve.universe.systems() if not system.is_whspace
  26. }
  27. }
  28. resp = app.response_class(response=json.dumps(payload), status=200,
  29. mimetype="application/json")
  30. resp.cache_control.private = True
  31. resp.cache_control.max_age = 24 * 60 * 60
  32. return resp