mirror of
https://github.com/skoelle/icloud-contacts-sync.git
synced 2026-09-17 23:40:24 +00:00
web custom links urlquote
This commit is contained in:
@@ -11,6 +11,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import secrets
|
import secrets
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
from urllib.parse import quote_plus
|
||||||
|
|
||||||
from fastapi import Depends, FastAPI, Query, Request
|
from fastapi import Depends, FastAPI, Query, Request
|
||||||
from fastapi.responses import HTMLResponse, RedirectResponse
|
from fastapi.responses import HTMLResponse, RedirectResponse
|
||||||
@@ -30,6 +31,7 @@ app = FastAPI(title="iCloud Contacts Sync – Interne API", version="1.0.0")
|
|||||||
app.add_middleware(SessionMiddleware, secret_key=secrets.token_hex(32), session_cookie="ics_session")
|
app.add_middleware(SessionMiddleware, secret_key=secrets.token_hex(32), session_cookie="ics_session")
|
||||||
app.mount("/static", StaticFiles(directory="api/static"), name="static")
|
app.mount("/static", StaticFiles(directory="api/static"), name="static")
|
||||||
templates = Jinja2Templates(directory="api/templates")
|
templates = Jinja2Templates(directory="api/templates")
|
||||||
|
templates.env.filters["urlquote"] = lambda s: quote_plus(s or "")
|
||||||
|
|
||||||
|
|
||||||
def _row_to_contact_out(row: dict) -> dict:
|
def _row_to_contact_out(row: dict) -> dict:
|
||||||
|
|||||||
@@ -410,7 +410,7 @@
|
|||||||
<div class="section-title">Schnelllinks</div>
|
<div class="section-title">Schnelllinks</div>
|
||||||
<div class="section-list">
|
<div class="section-list">
|
||||||
{% for link in custom_links %}
|
{% for link in custom_links %}
|
||||||
<a href="{{ link.url | replace('[fullname]', contact.full_name or '') }}" target="_blank" class="quicklink-item">
|
<a href="{{ link.url | replace('[fullname]', contact.full_name | urlquote) }}" target="_blank" class="quicklink-item">
|
||||||
{{ link.label }}
|
{{ link.label }}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user