mirror of
https://github.com/skoelle/icloud-contacts-sync.git
synced 2026-09-17 15:30:24 +00:00
web custom links
This commit is contained in:
@@ -4,13 +4,18 @@
|
|||||||
"name": "markus",
|
"name": "markus",
|
||||||
"apple_email": "markus@icloud.com",
|
"apple_email": "markus@icloud.com",
|
||||||
"apple_app_password": "xxxx-xxxx-xxxx-xxxx",
|
"apple_app_password": "xxxx-xxxx-xxxx-xxxx",
|
||||||
"authelia_user": "mmustermann"
|
"authelia_user": "mmustermann",
|
||||||
|
"custom_links": [
|
||||||
|
{"label": "Google Suche", "url": "https://www.google.com/search?q=[fullname]"},
|
||||||
|
{"label": "LinkedIn", "url": "https://www.linkedin.com/search/results/all/?keywords=[fullname]"}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "partner",
|
"name": "partner",
|
||||||
"apple_email": "partner@icloud.com",
|
"apple_email": "partner@icloud.com",
|
||||||
"apple_app_password": "yyyy-yyyy-yyyy-yyyy",
|
"apple_app_password": "yyyy-yyyy-yyyy-yyyy",
|
||||||
"authelia_user": "partner.user"
|
"authelia_user": "partner.user",
|
||||||
|
"custom_links": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"admins": [
|
"admins": [
|
||||||
|
|||||||
@@ -354,6 +354,15 @@ def web_contact(
|
|||||||
|
|
||||||
contact = _row_to_contact_out(row)
|
contact = _row_to_contact_out(row)
|
||||||
|
|
||||||
|
custom_links = []
|
||||||
|
contact_account = contact.get("account")
|
||||||
|
if contact_account:
|
||||||
|
accounts = Config.load_accounts()
|
||||||
|
for acc in accounts:
|
||||||
|
if acc.name == contact_account:
|
||||||
|
custom_links = acc.custom_links
|
||||||
|
break
|
||||||
|
|
||||||
return templates.TemplateResponse(
|
return templates.TemplateResponse(
|
||||||
"contact.html",
|
"contact.html",
|
||||||
{
|
{
|
||||||
@@ -363,5 +372,6 @@ def web_contact(
|
|||||||
"show_all": show_all,
|
"show_all": show_all,
|
||||||
"contact": contact,
|
"contact": contact,
|
||||||
"search": search or "",
|
"search": search or "",
|
||||||
|
"custom_links": custom_links,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -48,11 +48,48 @@
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.contact-layout {
|
||||||
|
display: flex;
|
||||||
|
gap: 1.5rem;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
.contact-card {
|
.contact-card {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 1rem 1.25rem;
|
padding: 1rem 1.25rem;
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-links-box {
|
||||||
|
width: 280px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.links-spacer {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quicklink-item {
|
||||||
|
display: block;
|
||||||
|
padding: 0.75rem;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 6px;
|
||||||
|
color: #0066cc;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
transition: background 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quicklink-item:hover {
|
||||||
|
background: #e7f3ff;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-header {
|
.contact-header {
|
||||||
@@ -224,6 +261,17 @@
|
|||||||
.contact-photo:hover {
|
.contact-photo:hover {
|
||||||
transform: scale(1.03);
|
transform: scale(1.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1100px) {
|
||||||
|
.custom-links-box,
|
||||||
|
.links-spacer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-layout {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -231,6 +279,9 @@
|
|||||||
<h1><a href="/" style="text-decoration:none;color:inherit;display:inline-flex;align-items:center;gap:0.4rem"><img src="/static/favicon.svg" alt="" style="height:1.5em;width:1.5em;vertical-align:middle">Kontakte</a></h1>
|
<h1><a href="/" style="text-decoration:none;color:inherit;display:inline-flex;align-items:center;gap:0.4rem"><img src="/static/favicon.svg" alt="" style="height:1.5em;width:1.5em;vertical-align:middle">Kontakte</a></h1>
|
||||||
<a href="/search{% if search %}?search={{ search }}{% endif %}" class="back-link">← Zurück zur Liste</a>
|
<a href="/search{% if search %}?search={{ search }}{% endif %}" class="back-link">← Zurück zur Liste</a>
|
||||||
|
|
||||||
|
<div class="contact-layout">
|
||||||
|
<div class="links-spacer"></div>
|
||||||
|
|
||||||
<div class="contact-card">
|
<div class="contact-card">
|
||||||
<div class="contact-header">
|
<div class="contact-header">
|
||||||
<div>
|
<div>
|
||||||
@@ -353,6 +404,20 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if custom_links %}
|
||||||
|
<div class="custom-links-box">
|
||||||
|
<div class="section-title">Schnelllinks</div>
|
||||||
|
<div class="section-list">
|
||||||
|
{% for link in custom_links %}
|
||||||
|
<a href="{{ link.url | replace('[fullname]', contact.full_name or '') }}" target="_blank" class="quicklink-item">
|
||||||
|
{{ link.label }}
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if contact.photo_url %}
|
{% if contact.photo_url %}
|
||||||
|
|||||||
+5
-2
@@ -11,11 +11,13 @@ ICLOUD_BASE_URL = "https://contacts.icloud.com/"
|
|||||||
|
|
||||||
|
|
||||||
class Account:
|
class Account:
|
||||||
def __init__(self, name: str, apple_email: str, apple_app_password: str, authelia_user: str | None):
|
def __init__(self, name: str, apple_email: str, apple_app_password: str, authelia_user: str | None,
|
||||||
|
custom_links: list[dict] | None = None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.apple_email = apple_email
|
self.apple_email = apple_email
|
||||||
self.apple_app_password = apple_app_password
|
self.apple_app_password = apple_app_password
|
||||||
self.authelia_user = authelia_user
|
self.authelia_user = authelia_user
|
||||||
|
self.custom_links = custom_links or []
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
@@ -95,7 +97,8 @@ class Config:
|
|||||||
if name in seen_names:
|
if name in seen_names:
|
||||||
raise RuntimeError(f"Account-Name '{name}' ist nicht eindeutig")
|
raise RuntimeError(f"Account-Name '{name}' ist nicht eindeutig")
|
||||||
seen_names.add(name)
|
seen_names.add(name)
|
||||||
accounts.append(Account(name, email, pwd, authelia_user))
|
custom_links = entry.get("custom_links", [])
|
||||||
|
accounts.append(Account(name, email, pwd, authelia_user, custom_links))
|
||||||
return accounts
|
return accounts
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user