Asset brand + pagina download + 1-click download endpoint

- assets/: script generate_logo.py + generate_ls_images.py per produrre
  loghi (mark/horizontal light+dark/stacked light+dark) e immagini
  prodotto Lemon Squeezy (thumbnail 1024x1024, cover 1920x1080,
  OG 1200x630). Riproducibili: rilanciare gli script per rigenerare.
- landing/download.html: pagina con form email+chiave o autofill da
  query string ?key=&email= (link 1-click dall'email). Bottoni
  Mac/Windows + istruzioni installazione per OS.
- landing/index.html: link Download in nav, hero ("Hai gia
  acquistato?"), pricing card ("Hai gia una licenza?"), footer.
- landing/js/main.js: rimosso warning placeholder LS (URL ora reale).
- server/src/downloads.js: endpoint GET /api/download/:platform
  che verifica (key, email) contro DB e redirect a URL firmato del
  binario. Errori chiari (400/401/403/503) leggibili dall'utente.
- server/src/email.js: template Resend con 2 bottoni 1-click
  (link con key+email gia compilati).
- server/src/server.js: route aggiunta.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
luzadevandClaude Opus 4.7 committed 2026-06-09 01:29:48 +02:00
1 parent 8272985459
commit bcd4f22b1e
17 files changed
+812 -28

No files matched your search

+146
View File
@@ -0,0 +1,146 @@
"""Genera i loghi brand MusicTools partendo dall'icona master.
Produce:
- logo_mark.png 1024x1024 solo squircle + nota, bg trasparente
- logo_horizontal_dark.png 2400x720 mark + "MusicTools" testo bianco (per bg scuri)
- logo_horizontal_light.png 2400x720 mark + "MusicTools" testo nero (per bg chiari)
- logo_stacked.png 1280x1600 mark sopra + testo sotto, bianco (per bg scuri)
Lo squircle riuso quello generato da generate_icon.py (assets/icon.png),
cosi' resta coerente con l'icona dell'app.
"""
from __future__ import annotations
from pathlib import Path
from PIL import Image, ImageDraw, ImageFilter, ImageFont
HERE = Path(__file__).resolve().parent
ICON_PATH = HERE / "icon.png"
ARIAL_BLACK = "/System/Library/Fonts/Supplemental/Arial Black.ttf"
ARIAL_BOLD = "/System/Library/Fonts/Supplemental/Arial Bold.ttf"
WHITE = (255, 255, 255)
BLACK = (10, 10, 10)
def font(size: int, *, black: bool = True) -> ImageFont.FreeTypeFont:
path = ARIAL_BLACK if black else ARIAL_BOLD
try:
return ImageFont.truetype(path, size)
except OSError:
return ImageFont.load_default()
def load_mark(target_size: int) -> Image.Image:
"""Carica l'icona master e la riscala alla dimensione richiesta.
L'icona originale ha sfondo trasparente fuori dallo squircle
(vedi generate_icon.py), quindi va bene per overlay su qualunque bg.
"""
if not ICON_PATH.exists():
raise FileNotFoundError(
f"icon.png non trovata: rilancia prima 'python3 assets/generate_icon.py'"
)
icon = Image.open(ICON_PATH).convert("RGBA")
if icon.size != (target_size, target_size):
icon = icon.resize((target_size, target_size), Image.LANCZOS)
return icon
def measure_text(text: str, f: ImageFont.FreeTypeFont) -> tuple[int, int]:
"""Ritorna (larghezza, altezza) effettiva del testo."""
bbox = f.getbbox(text)
return bbox[2] - bbox[0], bbox[3] - bbox[1]
def draw_text_top_left(canvas: Image.Image, text: str, top_left: tuple[int, int],
f: ImageFont.FreeTypeFont, color: tuple) -> None:
"""Disegna testo con angolo top-left = top_left (compensa font bbox)."""
draw = ImageDraw.Draw(canvas, "RGBA")
bbox = f.getbbox(text)
x = top_left[0] - bbox[0]
y = top_left[1] - bbox[1]
draw.text((x, y), text, font=f, fill=(*color, 255))
def make_mark(path: Path) -> None:
mark = load_mark(1024)
mark.save(path, "PNG", optimize=True)
print(f"[ok] mark -> {path}")
def make_horizontal(path: Path, text_color: tuple) -> None:
"""Layout: mark a sinistra + testo. Canvas si autodimensiona al testo."""
H = 720
mark_size = int(H * 0.92)
pad_left = 60
gap = 70
pad_right = 80
text = "MusicTools"
f = font(260, black=True)
tw, th = measure_text(text, f)
W = pad_left + mark_size + gap + tw + pad_right
canvas = Image.new("RGBA", (W, H), (0, 0, 0, 0))
# Mark a sinistra, centrato verticalmente
mark = load_mark(mark_size)
mark_y = (H - mark_size) // 2
canvas.alpha_composite(mark, (pad_left, mark_y))
# Testo allineato top-left calcolato in modo che la sua baseline
# sia visivamente centrata sull'altezza dello squircle.
text_x = pad_left + mark_size + gap
text_y = (H - th) // 2
draw_text_top_left(canvas, text, (text_x, text_y), f, text_color)
canvas.save(path, "PNG", optimize=True)
name = "dark" if text_color == WHITE else "light"
print(f"[ok] horizontal ({name}) -> {path} [{W}x{H}]")
def make_stacked(path: Path, text_color: tuple) -> None:
"""Mark sopra + 'MusicTools' sotto. Canvas autodimensionato al testo."""
mark_size = 1024
f = font(180, black=True)
text = "MusicTools"
tw, th = measure_text(text, f)
pad = 80
gap = 50
W = max(mark_size, tw) + 2 * pad
H = pad + mark_size + gap + th + pad
canvas = Image.new("RGBA", (W, H), (0, 0, 0, 0))
mark = load_mark(mark_size)
mark_x = (W - mark_size) // 2
canvas.alpha_composite(mark, (mark_x, pad))
text_x = (W - tw) // 2
text_y = pad + mark_size + gap
draw_text_top_left(canvas, text, (text_x, text_y), f, text_color)
canvas.save(path, "PNG", optimize=True)
name = "dark" if text_color == WHITE else "light"
print(f"[ok] stacked ({name}) -> {path} [{W}x{H}]")
def main() -> None:
make_mark(HERE / "logo_mark.png")
make_horizontal(HERE / "logo_horizontal_dark.png", WHITE) # per sfondi scuri
make_horizontal(HERE / "logo_horizontal_light.png", BLACK) # per sfondi chiari
make_stacked(HERE / "logo_stacked_dark.png", WHITE) # per sfondi scuri
make_stacked(HERE / "logo_stacked_light.png", BLACK) # per sfondi chiari
# rimuovo eventuale vecchio file senza suffisso
old = HERE / "logo_stacked.png"
if old.exists():
old.unlink()
if __name__ == "__main__":
main()
+296
View File
@@ -0,0 +1,296 @@
"""Genera le immagini prodotto per Lemon Squeezy.
Produce:
- ls_thumbnail.png 1024x1024 (thumbnail prodotto + checkout)
- ls_cover.png 1920x1080 (cover/hero per la pagina prodotto)
- ls_og.png 1200x630 (Open Graph per social share)
La nota musicale e' disegnata geometricamente (no glyph Unicode)
per essere indipendente dai font installati sul sistema.
"""
from __future__ import annotations
import math
from pathlib import Path
from PIL import Image, ImageDraw, ImageFilter, ImageFont
OUT_DIR = Path(__file__).resolve().parent
GREEN_LIGHT = (29, 185, 84)
GREEN_DARK = (19, 122, 55)
BG_TOP = (10, 50, 26)
BG_BOTTOM = (6, 6, 6)
WHITE = (255, 255, 255)
MUTED = (190, 190, 190)
ARIAL_BOLD = "/System/Library/Fonts/Supplemental/Arial Bold.ttf"
ARIAL_BLACK = "/System/Library/Fonts/Supplemental/Arial Black.ttf"
ARIAL_REG = "/System/Library/Fonts/Supplemental/Arial.ttf"
def font(size: int, *, black: bool = False, bold: bool = True) -> ImageFont.FreeTypeFont:
path = ARIAL_BLACK if black else (ARIAL_BOLD if bold else ARIAL_REG)
try:
return ImageFont.truetype(path, size)
except OSError:
return ImageFont.load_default()
def vgradient(size: tuple[int, int], top: tuple, bottom: tuple) -> Image.Image:
"""Gradient verticale tra due colori (RGB)."""
w, h = size
img = Image.new("RGB", size, top)
px = img.load()
for y in range(h):
t = y / max(h - 1, 1)
r = int(top[0] + (bottom[0] - top[0]) * t)
g = int(top[1] + (bottom[1] - top[1]) * t)
b = int(top[2] + (bottom[2] - top[2]) * t)
for x in range(w):
px[x, y] = (r, g, b)
return img
def radial_glow(size: tuple[int, int], center: tuple[int, int],
radius: int, color: tuple, opacity: int = 90) -> Image.Image:
"""Glow radiale soft (RGBA)."""
glow = Image.new("RGBA", size, (0, 0, 0, 0))
draw = ImageDraw.Draw(glow)
cx, cy = center
draw.ellipse(
[cx - radius, cy - radius, cx + radius, cy + radius],
fill=(*color, opacity),
)
return glow.filter(ImageFilter.GaussianBlur(radius // 3))
def draw_text_centered(canvas: Image.Image, text: str, center: tuple[int, int],
size_px: int, color=WHITE, *, black: bool = True,
bold: bool = True) -> None:
draw = ImageDraw.Draw(canvas, "RGBA")
f = font(size_px, black=black, bold=bold)
bbox = draw.textbbox((0, 0), text, font=f)
tw, th = bbox[2] - bbox[0], bbox[3] - bbox[1]
x = center[0] - tw // 2 - bbox[0]
y = center[1] - th // 2 - bbox[1]
draw.text((x, y), text, font=f, fill=(*color, 255))
def draw_text_left(canvas: Image.Image, text: str, anchor: tuple[int, int],
size_px: int, color=WHITE, *, black: bool = True,
bold: bool = True) -> None:
"""Disegna testo allineato a sinistra (anchor = baseline-left)."""
draw = ImageDraw.Draw(canvas, "RGBA")
f = font(size_px, black=black, bold=bold)
bbox = draw.textbbox(anchor, text, font=f)
draw.text(anchor, text, font=f, fill=(*color, 255))
def draw_pill(canvas: Image.Image, center: tuple[int, int], text: str,
pad_x: int, pad_y: int, font_size: int,
fill=(255, 255, 255, 30), text_color=WHITE,
*, bold: bool = True) -> None:
draw = ImageDraw.Draw(canvas, "RGBA")
f = font(font_size, bold=bold, black=False)
bbox = draw.textbbox((0, 0), text, font=f)
tw, th = bbox[2] - bbox[0], bbox[3] - bbox[1]
pill_w = tw + 2 * pad_x
pill_h = th + 2 * pad_y
x0 = center[0] - pill_w // 2
y0 = center[1] - pill_h // 2
draw.rounded_rectangle(
[x0, y0, x0 + pill_w, y0 + pill_h],
radius=pill_h // 2,
fill=fill,
)
tx = center[0] - tw // 2 - bbox[0]
ty = center[1] - th // 2 - bbox[1]
draw.text((tx, ty), text, font=f, fill=(*text_color, 255))
def draw_music_note(canvas: Image.Image, center: tuple[int, int],
size_px: int, color=WHITE) -> None:
"""Disegna una nota musicale stilizzata (due crome connesse).
Geometria approssimativa:
- 2 teste ellittiche (sinistra e destra)
- 2 aste verticali sottili
- barra orizzontale curva in alto che le connette
Tutto scalato in funzione di size_px (larghezza disegno).
"""
cx, cy = center
W = size_px
head_w = int(W * 0.30) # larghezza testa
head_h = int(head_w * 0.74) # altezza testa (ovale schiacciata)
stem_w = max(int(W * 0.035), 6)
stem_h = int(W * 0.78)
spacing = int(W * 0.40) # distanza tra le 2 aste
layer = Image.new("RGBA", canvas.size, (0, 0, 0, 0))
d = ImageDraw.Draw(layer)
# Posizioni delle 2 aste
left_stem_x = cx - spacing // 2
right_stem_x = cx + spacing // 2
top_y = cy - stem_h // 2
bot_y = cy + stem_h // 2
# Aste (rettangoli verticali)
d.rounded_rectangle(
[left_stem_x - stem_w // 2, top_y, left_stem_x + stem_w // 2, bot_y],
radius=stem_w // 2, fill=color + (255,),
)
d.rounded_rectangle(
[right_stem_x - stem_w // 2, top_y, right_stem_x + stem_w // 2, bot_y],
radius=stem_w // 2, fill=color + (255,),
)
# Barra orizzontale spessa in alto che unisce le aste (ramo)
bar_thick = max(int(W * 0.09), 14)
d.rounded_rectangle(
[left_stem_x - stem_w // 2 - 4, top_y,
right_stem_x + stem_w // 2 + 4, top_y + bar_thick],
radius=bar_thick // 3, fill=color + (255,),
)
# Seconda barra subito sotto (la nota doppia ha sempre 2 ramificazioni)
second_bar_y = top_y + int(bar_thick * 1.6)
d.rounded_rectangle(
[left_stem_x - stem_w // 2 - 4, second_bar_y,
right_stem_x + stem_w // 2 + 4, second_bar_y + int(bar_thick * 0.7)],
radius=bar_thick // 3, fill=color + (255,),
)
# Teste ellittiche: in basso, leggermente a sinistra dell'asta (inclinate)
def head_at(stem_x: int) -> None:
# Centro testa: poco sotto al fondo dell'asta, leggermente a sinistra
hx = stem_x - int(head_w * 0.42)
hy = bot_y - int(head_h * 0.20)
# Disegnata su layer rotato per dare l'inclinazione
tmp = Image.new("RGBA", (head_w + 40, head_h + 40), (0, 0, 0, 0))
td = ImageDraw.Draw(tmp)
td.ellipse([10, 10, 10 + head_w, 10 + head_h], fill=color + (255,))
rotated = tmp.rotate(-22, resample=Image.BICUBIC, expand=True)
rw, rh = rotated.size
layer.alpha_composite(rotated, (hx - rw // 2 + head_w // 2, hy - rh // 2 + head_h // 2))
head_at(left_stem_x)
head_at(right_stem_x)
# Glow morbido sotto la nota per profondita'
glow_src = layer.filter(ImageFilter.GaussianBlur(W // 22))
# Riduco un po' l'alpha del glow
alpha = glow_src.split()[3].point(lambda a: int(a * 0.45))
glow = Image.merge("RGBA", (*glow_src.split()[:3], alpha))
canvas.alpha_composite(glow)
canvas.alpha_composite(layer)
# ============================================================
# Thumbnail 1024x1024
# ============================================================
def make_thumbnail(path: Path) -> None:
W = H = 1024
img = vgradient((W, H), BG_TOP, BG_BOTTOM).convert("RGBA")
img.alpha_composite(radial_glow((W, H), (W // 2, H // 2 - 80), 430, GREEN_LIGHT, 100))
# Eyebrow in cima (testo semplice, no pill)
draw_text_centered(img, "DESKTOP APP - MAC e WINDOWS", (W // 2, 165),
size_px=30, color=GREEN_LIGHT, black=False, bold=True)
# Nota geometrica centrale
draw_music_note(img, (W // 2, H // 2 - 40), 360, color=WHITE)
# Titolo grande
draw_text_centered(img, "MusicTools", (W // 2, H - 280),
size_px=110, color=WHITE, black=True)
# Tagline
draw_text_centered(img, "Scarica - Modifica - Registra", (W // 2, H - 195),
size_px=38, color=MUTED, black=False, bold=True)
# Pill prezzo in basso
draw_pill(img, (W // 2, H - 100), "Licenza a vita 39,90 EUR",
pad_x=26, pad_y=14, font_size=30,
fill=GREEN_LIGHT + (255,), text_color=(10, 10, 10), bold=True)
img.convert("RGB").save(path, "PNG", optimize=True)
print(f"[ok] thumbnail -> {path}")
# ============================================================
# Cover/Hero 1920x1080
# ============================================================
def make_cover(path: Path) -> None:
W, H = 1920, 1080
img = vgradient((W, H), BG_TOP, BG_BOTTOM).convert("RGBA")
# Glow grosso a sinistra (zona del testo)
img.alpha_composite(radial_glow((W, H), (W // 3, H // 2), 640, GREEN_LIGHT, 85))
# Glow secondario a destra (zona nota)
img.alpha_composite(radial_glow((W, H), (int(W * 0.78), H // 2), 380, GREEN_LIGHT, 55))
LEFT_X = 140
# Eyebrow testo semplice
draw_text_left(img, "DESKTOP APP", (LEFT_X, 220),
size_px=30, color=GREEN_LIGHT, black=False, bold=True)
# Heading 2 righe (sinistra)
draw_text_left(img, "La tua musica.", (LEFT_X, 310),
size_px=120, color=WHITE, black=True)
draw_text_left(img, "In un'unica app.", (LEFT_X, 460),
size_px=120, color=GREEN_LIGHT, black=True)
# Sub-tagline
draw_text_left(img, "Scarica da Spotify e YouTube.", (LEFT_X, 640),
size_px=42, color=MUTED, black=False, bold=True)
draw_text_left(img, "Registra audio. Modifica metadati.", (LEFT_X, 700),
size_px=42, color=MUTED, black=False, bold=True)
# Pill prezzo (sinistra, basso)
draw_pill(img, (LEFT_X + 320, H - 160), "Licenza a vita - 39,90 EUR",
pad_x=30, pad_y=18, font_size=40,
fill=GREEN_LIGHT + (255,), text_color=(10, 10, 10), bold=True)
# Nota grande a destra
draw_music_note(img, (int(W * 0.78), H // 2 - 20), 540, color=WHITE)
img.convert("RGB").save(path, "PNG", optimize=True)
print(f"[ok] cover -> {path}")
# ============================================================
# OG image 1200x630
# ============================================================
def make_og(path: Path) -> None:
W, H = 1200, 630
img = vgradient((W, H), BG_TOP, BG_BOTTOM).convert("RGBA")
img.alpha_composite(radial_glow((W, H), (W // 2, H // 2 - 50), 420, GREEN_LIGHT, 95))
# Nota in alto centro
draw_music_note(img, (W // 2, 180), 180, color=WHITE)
# Titolo
draw_text_centered(img, "MusicTools", (W // 2, 360),
size_px=92, color=WHITE, black=True)
# Tagline
draw_text_centered(img, "Scarica - Modifica - Registra", (W // 2, 440),
size_px=32, color=MUTED, black=False, bold=True)
# Pill prezzo in basso
draw_pill(img, (W // 2, H - 80), "Licenza a vita 39,90 EUR - Mac e Windows",
pad_x=24, pad_y=13, font_size=28,
fill=GREEN_LIGHT + (255,), text_color=(10, 10, 10), bold=True)
img.convert("RGB").save(path, "PNG", optimize=True)
print(f"[ok] og -> {path}")
def main() -> None:
make_thumbnail(OUT_DIR / "ls_thumbnail.png")
make_cover(OUT_DIR / "ls_cover.png")
make_og(OUT_DIR / "ls_og.png")
if __name__ == "__main__":
main()
Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

+28
View File
@@ -775,3 +775,31 @@ a { color: inherit; text-decoration: none; }
}
.price-consent a { color: var(--text-muted); text-decoration: underline; }
.price-consent a:hover { color: var(--accent); }
/* ============================================================
"Hai gia acquistato? Scarica" — link discreti
============================================================ */
.hero-customer {
margin: 18px 0 0;
font-size: 13.5px;
color: var(--text-dim);
}
.hero-customer a {
color: var(--accent);
font-weight: 700;
text-decoration: none;
}
.hero-customer a:hover { text-decoration: underline; }
.price-already {
margin: 10px 0 0 !important;
font-size: 13px !important;
color: var(--text-muted) !important;
}
.price-already a {
color: var(--accent);
font-weight: 700;
text-decoration: none;
}
.price-already a:hover { text-decoration: underline; }
+221
View File
@@ -0,0 +1,221 @@
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Scarica MusicTools</title>
<link rel="icon" type="image/svg+xml" href="assets/favicon.svg" />
<link rel="stylesheet" href="css/style.css" />
<style>
.dl-page {
padding: 60px 24px 100px;
max-width: 900px;
margin: 0 auto;
}
.dl-head {
text-align: center;
margin-bottom: 48px;
}
.dl-head h1 {
font-size: clamp(28px, 4vw, 42px);
font-weight: 900;
letter-spacing: -0.02em;
margin: 12px 0 10px;
}
.dl-head p {
color: var(--text-muted);
font-size: 17px;
margin: 0;
}
.dl-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 18px;
margin-bottom: 40px;
}
@media (max-width: 700px) {
.dl-grid { grid-template-columns: 1fr; }
}
.dl-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 18px;
padding: 32px 28px;
text-align: center;
transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
}
.dl-card:hover {
transform: translateY(-3px);
border-color: #383838;
box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}
.dl-os { font-size: 64px; line-height: 1; margin-bottom: 12px; }
.dl-card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.dl-card .meta { color: var(--text-dim); font-size: 13px; margin: 0 0 24px; }
.dl-form {
max-width: 460px;
margin: 0 auto 32px;
padding: 28px 30px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 18px;
}
.dl-form h2 {
margin: 0 0 6px;
font-size: 18px;
font-weight: 800;
}
.dl-form p { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; }
.dl-form .field { margin-bottom: 12px; }
.dl-form .field-label { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.dl-form .input { width: 100%; padding: 12px 16px; border-radius: 999px; background: #0d0d0d; border: 1px solid var(--border); color: var(--text); font-size: 14px; font-family: inherit; box-sizing: border-box; }
.dl-form .input:focus { outline: none; border-color: var(--accent); }
.dl-form .submit { width: 100%; margin-top: 12px; }
.dl-steps {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 18px;
padding: 28px 32px;
margin-bottom: 18px;
}
.dl-steps h2 { font-size: 18px; font-weight: 800; margin: 0 0 14px; }
.dl-steps ol { margin: 0; padding-left: 22px; color: var(--text-muted); font-size: 14.5px; line-height: 1.7; }
.dl-steps li { margin-bottom: 4px; }
.dl-steps strong { color: var(--text); }
.dl-steps code { background: var(--bg-card-2); padding: 2px 7px; border-radius: 5px; font-size: 13px; font-family: ui-monospace, monospace; color: var(--accent); }
.dl-support { text-align: center; color: var(--text-muted); font-size: 14px; padding-top: 24px; border-top: 1px solid var(--divider); margin-top: 24px; }
.dl-support a { color: var(--accent); }
</style>
</head>
<body>
<header class="nav">
<div class="container nav-row">
<a href="/" class="brand">
<span class="brand-logo">♫</span>
<span class="brand-name">MusicTools</span>
</a>
<nav class="nav-links">
<a href="/">Home</a>
<a href="/#features">Funzioni</a>
<a href="/#faq">FAQ</a>
</nav>
<a href="mailto:info@djluza.com" class="btn btn-ghost btn-sm">Supporto</a>
</div>
</header>
<main class="dl-page">
<div class="dl-head">
<span class="eyebrow">SCARICA</span>
<h1>Scarica MusicTools</h1>
<p>Scegli il sistema operativo e procedi con l'installazione</p>
</div>
<!-- Form mostrato quando NON arrivi dall'email (no key/email in URL) -->
<div class="dl-form" id="dlForm">
<h2>Inserisci le tue credenziali</h2>
<p>Hai gia' acquistato? Inserisci l'email e la chiave per scaricare.</p>
<div class="field">
<label class="field-label" for="dlEmail">Email dell'acquisto</label>
<input type="email" id="dlEmail" class="input" autocomplete="email" />
</div>
<div class="field">
<label class="field-label" for="dlKey">Chiave di licenza</label>
<input type="text" id="dlKey" class="input" autocomplete="off" placeholder="XXXX-XXXX-XXXX-XXXX" />
</div>
<button class="btn btn-primary btn-lg submit" id="dlSubmitBtn">Mostra i link di download</button>
</div>
<!-- Cards di download (popolate dopo inserimento credenziali o da URL) -->
<div class="dl-grid" id="dlGrid" hidden>
<article class="dl-card">
<div class="dl-os">🍎</div>
<h2>macOS</h2>
<p class="meta">macOS 11 Big Sur o successivi · Apple Silicon e Intel</p>
<a class="btn btn-primary btn-lg btn-block" id="dlMacBtn" target="_blank" rel="noopener">
Scarica per Mac
</a>
</article>
<article class="dl-card">
<div class="dl-os">🪟</div>
<h2>Windows</h2>
<p class="meta">Windows 10 e 11 · 64-bit</p>
<a class="btn btn-primary btn-lg btn-block" id="dlWinBtn" target="_blank" rel="noopener">
Scarica per Windows
</a>
</article>
</div>
<div class="dl-steps">
<h2>Installazione macOS</h2>
<ol>
<li>Apri il file <code>.zip</code> scaricato — viene estratto in <code>MusicTools.app</code></li>
<li>Trascina <strong>MusicTools.app</strong> nella cartella <strong>Applicazioni</strong></li>
<li>Vai in Applicazioni, <strong>tasto destro</strong> su MusicTools → <strong>Apri</strong> → <strong>Apri</strong> (solo la prima volta, e' la procedura standard per app non firmate)</li>
<li>Inserisci email e chiave per attivare</li>
</ol>
</div>
<div class="dl-steps">
<h2>Installazione Windows</h2>
<ol>
<li>Estrai il file <code>.zip</code> in una cartella di tua scelta</li>
<li>Doppio click su <strong>MusicTools.exe</strong></li>
<li>Se Windows mostra "Windows ha protetto il PC": click su <strong>Ulteriori informazioni</strong> → <strong>Esegui comunque</strong></li>
<li>Inserisci email e chiave per attivare</li>
</ol>
</div>
<div class="dl-support">
Problemi con l'installazione o non hai ricevuto l'email con la chiave?<br>
Scrivi a <a href="mailto:info@djluza.com">info@djluza.com</a> — risposta entro 24 ore.
</div>
</main>
<script>
function getParam(name) {
const url = new URL(window.location.href);
return url.searchParams.get(name) || "";
}
function setDownloadLinks(email, key) {
const q = "key=" + encodeURIComponent(key) + "&email=" + encodeURIComponent(email);
document.getElementById("dlMacBtn").href = "/api/download/macos?" + q;
document.getElementById("dlWinBtn").href = "/api/download/windows?" + q;
document.getElementById("dlGrid").hidden = false;
document.getElementById("dlForm").hidden = true;
}
// Se arrivi dall'email con ?key=&email= mostra subito i bottoni
const urlKey = getParam("key");
const urlEmail = getParam("email");
if (urlKey && urlEmail) {
setDownloadLinks(urlEmail, urlKey);
}
// Form submit
document.getElementById("dlSubmitBtn").addEventListener("click", () => {
const email = document.getElementById("dlEmail").value.trim();
const key = document.getElementById("dlKey").value.trim();
if (!email || !key) {
alert("Inserisci email e chiave di licenza.");
return;
}
setDownloadLinks(email, key);
});
// Enter dentro i campi
["dlEmail", "dlKey"].forEach(id => {
document.getElementById(id).addEventListener("keydown", (e) => {
if (e.key === "Enter") document.getElementById("dlSubmitBtn").click();
});
});
</script>
</body>
</html>
+14 -6
View File
@@ -28,8 +28,9 @@
<a href="#how">Come funziona</a>
<a href="#pricing">Prezzo</a>
<a href="#faq">FAQ</a>
<a href="/download">Download</a>
</nav>
<a href="#pricing" class="btn btn-primary btn-sm">Compra — 39,90 €</a>
<a href="https://luza.lemonsqueezy.com/checkout/buy/8aca9e44-4775-424b-8ce3-583714044ac9?embed=1" class="btn btn-primary btn-sm lemonsqueezy-button">Compra — 39,90 €</a>
</div>
</header>
@@ -45,7 +46,7 @@
Modifica i metadati e le copertine. Tutto offline, senza account.
</p>
<div class="hero-cta">
<a href="#pricing" class="btn btn-primary btn-lg">Compra ora — 39,90 €</a>
<a href="https://luza.lemonsqueezy.com/checkout/buy/8aca9e44-4775-424b-8ce3-583714044ac9?embed=1" class="btn btn-primary btn-lg lemonsqueezy-button">Compra ora — 39,90 €</a>
<a href="#features" class="btn btn-ghost btn-lg">Scopri di più</a>
</div>
<ul class="hero-bullets">
@@ -53,6 +54,10 @@
<li>✓ Aggiornamenti gratuiti a vita</li>
<li>✓ Funziona offline · Su 3 dispositivi</li>
</ul>
<p class="hero-customer">
Hai già acquistato? <a href="/download">Scarica l'app →</a>
</p>
</div>
<div class="hero-art" aria-hidden="true">
@@ -190,9 +195,8 @@
<li>✓ <strong>Supporto via email</strong> a info@djluza.com</li>
<li>✓ <strong>Garanzia 14 giorni</strong> soddisfatti o rimborsati</li>
</ul>
<a href="#"
class="btn btn-primary btn-lg btn-block"
data-lemonsqueezy-url="REPLACE_WITH_LS_PRODUCT_URL"
<a href="https://luza.lemonsqueezy.com/checkout/buy/8aca9e44-4775-424b-8ce3-583714044ac9?embed=1"
class="btn btn-primary btn-lg btn-block lemonsqueezy-button"
id="buyBtn">
Acquista ora — 39,90 €
</a>
@@ -203,6 +207,9 @@
l'<a href="/legal/privacy.html">Informativa privacy</a> e la
<a href="/legal/refund.html">Politica rimborsi</a>.
</p>
<p class="price-already">
Hai già una licenza? <a href="/download">Scarica l'app →</a>
</p>
</div>
<div class="use-policy">
@@ -301,7 +308,7 @@
<div class="container cta-box">
<h2>Pronto a semplificarti la vita?</h2>
<p>Una sola app per tutto quello che fai con la musica.</p>
<a href="#pricing" class="btn btn-primary btn-lg">Compra ora — 39,90 €</a>
<a href="https://luza.lemonsqueezy.com/checkout/buy/8aca9e44-4775-424b-8ce3-583714044ac9?embed=1" class="btn btn-primary btn-lg lemonsqueezy-button">Compra ora — 39,90 €</a>
</div>
</section>
@@ -314,6 +321,7 @@
<span class="footer-by">by LuZa</span>
</div>
<nav class="footer-links">
<a href="/download">Download</a>
<a href="mailto:info@djluza.com">Supporto</a>
<a href="/legal/terms.html">Termini</a>
<a href="/legal/privacy.html">Privacy</a>
+3 -19
View File
@@ -8,25 +8,9 @@
if (el) el.textContent = String(new Date().getFullYear());
})();
// Lemon Squeezy overlay
// Lo script di Lemon (lemon.js) intercetta automaticamente i link con
// data-lemonsqueezy-url e apre l'overlay. Qui ci limitiamo a impedire
// che il click navighi via se l'URL non e' ancora stato configurato.
document.querySelectorAll("[data-lemonsqueezy-url]").forEach((el) => {
el.addEventListener("click", (e) => {
const url = el.getAttribute("data-lemonsqueezy-url");
if (!url || url === "REPLACE_WITH_LS_PRODUCT_URL") {
e.preventDefault();
alert(
"Il prodotto Lemon Squeezy non e' ancora configurato.\n" +
"Crea il prodotto su Lemon Squeezy e incolla l'URL dentro " +
"landing/index.html in data-lemonsqueezy-url."
);
}
// Se la pagina e' aperta via file:// lemon.js non riesce a inizializzare:
// in quel caso lasciamo che il link navighi via.
});
});
// Lemon Squeezy overlay: lemon.js intercetta automaticamente i link con
// data-lemonsqueezy-url e apre l'overlay di checkout. Niente codice nostro
// necessario qui — basta che lemon.js sia caricato (vedi <script> in index.html).
// Header che diventa piu' opaco mentre scorri (effetto subtle)
const nav = document.querySelector(".nav");
+71
View File
@@ -0,0 +1,71 @@
/**
* Endpoint "1-click download" per i clienti.
*
* URL: GET /api/download/:platform?key=XXXX&email=YYY
*
* Verifica la coppia (key, email) contro la tabella licenses, recupera
* l'ultima release attiva per la piattaforma, genera un signed URL e
* fa redirect 302. Il link nell'email viene cliccato dall'utente: con
* un click parte il download.
*
* Sicurezza:
* - Niente token sulla URL: la chiave e' gia "il segreto"
* - URL signed con scadenza breve (default 5 min)
* - Nessuna info di licenza leakata in risposta (ritorna solo redirect o 401/404)
*/
import crypto from "node:crypto";
import { one } from "./db.js";
const DOWNLOAD_TTL = Number(process.env.DOWNLOAD_URL_TTL_SECONDS || 300);
const PUBLIC_BASE = process.env.PUBLIC_BASE_URL || "https://musictools.djluza.com";
function signPayload(payload, secret) {
return crypto.createHmac("sha256", secret).update(payload).digest("base64url");
}
const normEmail = (s) => String(s || "").trim().toLowerCase();
const normKey = (s) => String(s || "").trim().toUpperCase();
export async function downloadByKey(req, res) {
const platform = String(req.params.platform || "").toLowerCase();
if (platform !== "macos" && platform !== "windows") {
return res.status(400).type("text/plain")
.send("Piattaforma non valida. Usa /api/download/macos o /api/download/windows.");
}
const key = normKey(req.query.key);
const email = normEmail(req.query.email);
if (!key || !email) {
return res.status(400).type("text/plain")
.send("Mancano email o chiave. Controlla il link nella tua email di acquisto.");
}
const license = await one(
"SELECT id, status FROM licenses WHERE license_key=? AND email=? LIMIT 1",
[key, email],
);
if (!license) {
return res.status(401).type("text/plain")
.send("Email o chiave non valide. Verifica il link nell'email o scrivici a info@djluza.com.");
}
if (license.status !== "active") {
return res.status(403).type("text/plain")
.send("Licenza non piu' attiva (rimborsata o revocata).");
}
const release = await one(
`SELECT file_path FROM releases
WHERE platform=? ORDER BY published_at DESC LIMIT 1`,
[platform],
);
if (!release) {
return res.status(503).type("text/plain")
.send(`Build ${platform} non ancora disponibile. Riprova fra qualche ora o scrivici a info@djluza.com.`);
}
const exp = Math.floor(Date.now() / 1000) + DOWNLOAD_TTL;
const sig = signPayload(`${release.file_path}.${exp}`, process.env.JWT_SECRET);
const url = `${PUBLIC_BASE}/api/download?file=${encodeURIComponent(release.file_path)}&exp=${exp}&sig=${sig}`;
res.redirect(302, url);
}
+29 -3
View File
@@ -8,6 +8,7 @@
*/
const FROM = process.env.EMAIL_FROM || "MusicTools <noreply@djluza.com>";
const BASE = process.env.PUBLIC_BASE_URL || "https://musictools.djluza.com";
export async function sendLicenseEmail(to, licenseKey) {
if (!process.env.RESEND_API_KEY) {
@@ -15,6 +16,10 @@ export async function sendLicenseEmail(to, licenseKey) {
return;
}
const q = `key=${encodeURIComponent(licenseKey)}&email=${encodeURIComponent(to)}`;
const macUrl = `${BASE}/api/download/macos?${q}`;
const winUrl = `${BASE}/api/download/windows?${q}`;
const html = `
<div style="font-family:-apple-system,Segoe UI,sans-serif;max-width:560px;margin:0 auto;padding:24px;color:#111">
<h1 style="color:#1db954;margin:0 0 14px;font-size:22px">Grazie per aver scelto MusicTools!</h1>
@@ -24,13 +29,34 @@ export async function sendLicenseEmail(to, licenseKey) {
<p style="font-size:22px;letter-spacing:2px;font-family:monospace;background:#f4f4f4;padding:16px;border-radius:10px;text-align:center;margin:0 0 24px;color:#000">
${licenseKey}
</p>
<p style="font-size:15px;margin:0 0 12px"><strong>Scarica l'app:</strong></p>
<table cellpadding="0" cellspacing="0" border="0" style="margin:0 0 24px">
<tr>
<td style="padding-right:10px">
<a href="${macUrl}" style="display:inline-block;background:#1db954;color:#fff;text-decoration:none;padding:12px 22px;border-radius:999px;font-weight:700;font-size:14px">
🍎 Scarica per Mac
</a>
</td>
<td>
<a href="${winUrl}" style="display:inline-block;background:#1db954;color:#fff;text-decoration:none;padding:12px 22px;border-radius:999px;font-weight:700;font-size:14px">
🪟 Scarica per Windows
</a>
</td>
</tr>
</table>
<p style="font-size:15px;margin:0 0 8px"><strong>Come attivare:</strong></p>
<ol style="font-size:14.5px;line-height:1.6;padding-left:22px">
<li>Scarica MusicTools per <a href="https://musictools.djluza.com#pricing">Mac o Windows</a></li>
<li>Apri l'app: alla prima schermata ti chiedera' email e chiave</li>
<li>Inserisci questa email (<code>${to}</code>) e la chiave qui sopra</li>
<li>Clicca uno dei bottoni qui sopra per scaricare l'installer</li>
<li>Installa l'app (su Mac: tasto destro → Apri → Apri; su Windows: Esegui comunque)</li>
<li>Apri MusicTools: la prima schermata ti chiede email e chiave</li>
<li>Inserisci <strong>${to}</strong> e la chiave qui sopra</li>
</ol>
<p style="font-size:14px;color:#555;margin:18px 0 0">Puoi attivare la licenza fino a 3 dispositivi (Mac e Windows mixati).</p>
<p style="font-size:13px;color:#888;margin:8px 0 0">
Hai bisogno di riscaricare in futuro? Vai su <a href="${BASE}/download" style="color:#1db954">${BASE.replace(/^https?:\/\//, "")}/download</a> e inserisci email + chiave.
</p>
<hr style="border:none;border-top:1px solid #eee;margin:28px 0"/>
<p style="color:#666;font-size:12px;margin:0">Hai problemi? Scrivici a <a href="mailto:info@djluza.com">info@djluza.com</a></p>
</div>
+4
View File
@@ -4,6 +4,7 @@ import express from "express";
import * as license from "./license.js";
import * as updates from "./updates.js";
import * as ls from "./lemonsqueezy.js";
import * as dl from "./downloads.js";
const app = express();
@@ -45,6 +46,9 @@ app.post("/api/license/deactivate", license.deactivate);
app.get("/api/latest", updates.latest);
app.get("/api/download", updates.download);
// 1-click download dall'email (key+email come query -> redirect signed)
app.get("/api/download/:platform", dl.downloadByKey);
// 404 JSON solo per /api/*
app.use("/api", (_req, res) => res.status(404).json({ error: "Not found" }));