Compare commits
2 commits
21f54f478b
...
73ca66bbf5
| Author | SHA1 | Date | |
|---|---|---|---|
| 73ca66bbf5 | |||
| 8a614eef1a |
7 changed files with 52 additions and 18 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
1253
|
1254
|
||||||
|
|
@ -329,17 +329,22 @@ async def upload_partner_logo(file: UploadFile = File(...), user=Depends(require
|
||||||
new_name = f"logo_{uuid.uuid4().hex[:8]}.webp"
|
new_name = f"logo_{uuid.uuid4().hex[:8]}.webp"
|
||||||
new_path = os.path.join(save_dir, new_name)
|
new_path = os.path.join(save_dir, new_name)
|
||||||
|
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
# HEIC/HEIF (iPhone) zuerst nach JPEG wandeln — Pillow kann HEIC nicht ohne Opener
|
||||||
|
data, ext = await loop.run_in_executor(None, lambda: convert_media(raw, filename))
|
||||||
|
if ext in (".heic", ".heif"):
|
||||||
|
raise HTTPException(400, "HEIC-Bild konnte nicht konvertiert werden. Bitte als JPG/PNG exportieren.")
|
||||||
|
|
||||||
def _save():
|
def _save():
|
||||||
import io
|
import io
|
||||||
from PIL import Image, ImageOps
|
from PIL import Image, ImageOps
|
||||||
img = Image.open(io.BytesIO(raw))
|
img = Image.open(io.BytesIO(data))
|
||||||
img = ImageOps.exif_transpose(img)
|
img = ImageOps.exif_transpose(img)
|
||||||
# Transparenz erhalten (Logos sind oft PNG mit Alpha)
|
# Transparenz erhalten (Logos sind oft PNG mit Alpha)
|
||||||
img = img.convert("RGBA" if "A" in (img.mode or "") or img.mode == "P" else "RGB")
|
img = img.convert("RGBA" if "A" in (img.mode or "") or img.mode == "P" else "RGB")
|
||||||
img.thumbnail((512, 512))
|
img.thumbnail((512, 512))
|
||||||
img.save(new_path, format="WEBP", quality=85)
|
img.save(new_path, format="WEBP", quality=85)
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
|
||||||
try:
|
try:
|
||||||
await loop.run_in_executor(None, _save)
|
await loop.run_in_executor(None, _save)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -394,6 +399,11 @@ async def upload_partner_photo(file: UploadFile = File(...), user=Depends(requir
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
# HEIC→JPEG bzw. MOV/AVI→MP4 (ffmpeg, komprimiert) — blockierend, daher Threadpool
|
# HEIC→JPEG bzw. MOV/AVI→MP4 (ffmpeg, komprimiert) — blockierend, daher Threadpool
|
||||||
data, ext = await loop.run_in_executor(None, lambda: convert_media(raw, filename))
|
data, ext = await loop.run_in_executor(None, lambda: convert_media(raw, filename))
|
||||||
|
if ext in (".heic", ".heif"):
|
||||||
|
raise HTTPException(400, "HEIC-Bild konnte nicht konvertiert werden. Bitte als JPG/PNG exportieren.")
|
||||||
|
if ext in (".mov", ".avi", ".m4v"):
|
||||||
|
# ffmpeg-Konvertierung fehlgeschlagen — unkonvertiert wäre es im Browser nicht abspielbar
|
||||||
|
raise HTTPException(400, "Video konnte nicht konvertiert werden. Bitte als MP4 hochladen.")
|
||||||
|
|
||||||
save_dir = _pp_dir(user["id"])
|
save_dir = _pp_dir(user["id"])
|
||||||
file_id = uuid.uuid4().hex[:12]
|
file_id = uuid.uuid4().hex[:12]
|
||||||
|
|
|
||||||
|
|
@ -86,14 +86,14 @@
|
||||||
<title>Ban Yaro</title>
|
<title>Ban Yaro</title>
|
||||||
|
|
||||||
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
|
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
|
||||||
<script src="/js/boot-early.js?v=1253"></script>
|
<script src="/js/boot-early.js?v=1254"></script>
|
||||||
|
|
||||||
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
|
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
|
||||||
<link rel="stylesheet" href="/css/design-system.css?v=1253">
|
<link rel="stylesheet" href="/css/design-system.css?v=1254">
|
||||||
<link rel="stylesheet" href="/css/layout.css?v=1253">
|
<link rel="stylesheet" href="/css/layout.css?v=1254">
|
||||||
<link rel="stylesheet" href="/css/components.css?v=1253">
|
<link rel="stylesheet" href="/css/components.css?v=1254">
|
||||||
<link rel="stylesheet" href="/css/utilities.css?v=1253">
|
<link rel="stylesheet" href="/css/utilities.css?v=1254">
|
||||||
<link rel="stylesheet" href="/css/lists.css?v=1253">
|
<link rel="stylesheet" href="/css/lists.css?v=1254">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
@ -612,11 +612,11 @@
|
||||||
<div id="modal-container"></div>
|
<div id="modal-container"></div>
|
||||||
|
|
||||||
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
||||||
<script src="/js/api.js?v=1253"></script>
|
<script src="/js/api.js?v=1254"></script>
|
||||||
<script src="/js/ui.js?v=1253"></script>
|
<script src="/js/ui.js?v=1254"></script>
|
||||||
<script src="/js/app.js?v=1253"></script>
|
<script src="/js/app.js?v=1254"></script>
|
||||||
<script src="/js/worlds.js?v=1253"></script>
|
<script src="/js/worlds.js?v=1254"></script>
|
||||||
<script src="/js/offline-indicator.js?v=1253"></script>
|
<script src="/js/offline-indicator.js?v=1254"></script>
|
||||||
|
|
||||||
<!-- Feature-Seiten werden lazy geladen -->
|
<!-- Feature-Seiten werden lazy geladen -->
|
||||||
|
|
||||||
|
|
@ -626,7 +626,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
|
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
|
||||||
<script src="/js/boot.js?v=1253"></script>
|
<script src="/js/boot.js?v=1254"></script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '1253'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '1254'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||||
window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator)
|
window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator)
|
||||||
window.APP_VERSION = APP_VERSION;
|
window.APP_VERSION = APP_VERSION;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="color-scheme" content="light dark">
|
<meta name="color-scheme" content="light dark">
|
||||||
<script src="/js/landing-init.js?v=1253"></script>
|
<script src="/js/landing-init.js?v=1254"></script>
|
||||||
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
|
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
|
||||||
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, direkt im Browser.">
|
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, direkt im Browser.">
|
||||||
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">
|
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
// ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab
|
// ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab
|
||||||
const VER = '1253';
|
const VER = '1254';
|
||||||
const CACHE_VERSION = `by-v${VER}`;
|
const CACHE_VERSION = `by-v${VER}`;
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,30 @@ def test_logo_and_photo_upload(client, user):
|
||||||
assert r.json()["photos"] == []
|
assert r.json()["photos"] == []
|
||||||
|
|
||||||
|
|
||||||
|
def test_heic_uploads_convert(client, user):
|
||||||
|
"""HEIC (iPhone-Format) wird bei Logo UND Foto nach WebP konvertiert."""
|
||||||
|
import pillow_heif
|
||||||
|
from PIL import Image
|
||||||
|
_make_partner(user["email"])
|
||||||
|
|
||||||
|
pillow_heif.register_heif_opener()
|
||||||
|
buf = io.BytesIO()
|
||||||
|
Image.new("RGB", (64, 64), "green").save(buf, format="HEIF")
|
||||||
|
heic_bytes = buf.getvalue()
|
||||||
|
|
||||||
|
# Logo als HEIC
|
||||||
|
r = client.post("/api/partner/my-profile/logo", headers=user["headers"],
|
||||||
|
files={"file": ("IMG_0001.HEIC", io.BytesIO(heic_bytes), "image/heic")})
|
||||||
|
assert r.status_code == 200, r.text
|
||||||
|
assert r.json()["logo_url"].endswith(".webp")
|
||||||
|
|
||||||
|
# Foto als HEIC
|
||||||
|
r = client.post("/api/partner/my-profile/photos", headers=user["headers"],
|
||||||
|
files={"file": ("IMG_0002.heic", io.BytesIO(heic_bytes), "image/heic")})
|
||||||
|
assert r.status_code == 200, r.text
|
||||||
|
assert r.json()["photos"][0].endswith(".webp")
|
||||||
|
|
||||||
|
|
||||||
def test_partner_has_pro_access(client, user):
|
def test_partner_has_pro_access(client, user):
|
||||||
"""is_partner=1 -> has_pro_access True (Pro gratis fuer Partner)."""
|
"""is_partner=1 -> has_pro_access True (Pro gratis fuer Partner)."""
|
||||||
from auth import has_pro_access
|
from auth import has_pro_access
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue