mirror of
https://github.com/DarrylNixon/ghostforge
synced 2024-04-22 06:27:20 -07:00
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
import importlib.metadata
|
|
|
|
from fastapi.templating import Jinja2Templates
|
|
|
|
templates = Jinja2Templates(directory="ghostforge/templates")
|
|
|
|
# Inject version string and Github URL into every template for navbar display.
|
|
try:
|
|
gf_version = importlib.metadata.version(__package__)
|
|
except ValueError:
|
|
gf_version = "Local"
|
|
templates.env.globals["gf_version"] = f"v{gf_version}"
|
|
templates.env.globals["gf_repository_url"] = "https://github.com/DarrylNixon/ghostforge"
|
|
|
|
# Same, but build the navbar from an ordered dictionary for centralization.
|
|
# Since 3.7 (we require >= 3.9), dicts are guaranteed ordered as inserted.
|
|
templates.env.globals["gf_navbar"] = {
|
|
"Ghosts": {
|
|
"Dashboard": "/users/0",
|
|
"New": "/users/0",
|
|
"Active": "/users/0",
|
|
"Archived": "/users/0",
|
|
},
|
|
"Research": {
|
|
"Guidebook": "/users/0",
|
|
"Cheat Sheet": "/users/0",
|
|
},
|
|
"Settings": {
|
|
"Your Profile": "/users/0",
|
|
"Configuration": "/users/0",
|
|
"Integrations": "/users/0",
|
|
"Manage Users": "/users/0",
|
|
},
|
|
"Meta": {
|
|
"About GhostForge": "/users/0",
|
|
"System Logs": "/users/0",
|
|
"Logout": "/users/0",
|
|
},
|
|
}
|
|
|
|
templates.env.globals["avatar_menu"] = {
|
|
"Dashboard": "/users/0",
|
|
"Your Profile": "/users/0",
|
|
"Logout": "/users/0",
|
|
}
|