mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Port homepage intro to fastapi
Port the main home page content to fastapi.
This commit is contained in:
parent
0a3aa40f20
commit
12911a101e
5 changed files with 146 additions and 0 deletions
|
@ -46,3 +46,9 @@ def getboolean(section, option):
|
|||
|
||||
def getint(section, option, fallback=None):
|
||||
return _get_parser().getint(section, option, fallback=fallback)
|
||||
|
||||
|
||||
def get_section(section_name):
|
||||
for section in _get_parser().sections():
|
||||
if section == section_name:
|
||||
return _get_parser()[section]
|
||||
|
|
|
@ -58,6 +58,8 @@ async def language(request: Request,
|
|||
async def index(request: Request):
|
||||
""" Homepage route. """
|
||||
context = make_context(request, "Home")
|
||||
context['ssh_fingerprints'] = util.get_ssh_fingerprints()
|
||||
|
||||
return render_template(request, "index.html", context)
|
||||
|
||||
|
||||
|
|
|
@ -172,3 +172,13 @@ def add_samesite_fields(response: Response, value: str):
|
|||
cookie += f"; SameSite={value}"
|
||||
response.raw_headers[idx] = (header[0], cookie.encode())
|
||||
return response
|
||||
|
||||
|
||||
def get_ssh_fingerprints():
|
||||
fingerprints = {}
|
||||
fingerprint_section = aurweb.config.get_section("fingerprints")
|
||||
|
||||
if fingerprint_section:
|
||||
fingerprints = {key: fingerprint_section[key] for key in fingerprint_section.keys()}
|
||||
|
||||
return fingerprints
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue