aa8c4f875a0d
Browse files- README.md +0 -1
- app.py +8 -47
- pixrick/runner.py +2 -1
- web/backend.js +3 -13
- web/i18n/en.json +19 -2
- web/index.html +29 -19
- web/legal/privacy.html +1 -5
- web/online.js +84 -62
- web/style.css +37 -0
README.md
CHANGED
|
@@ -7,7 +7,6 @@ sdk: gradio
|
|
| 7 |
sdk_version: 6.32.0
|
| 8 |
python_version: "3.12"
|
| 9 |
app_file: app.py
|
| 10 |
-
hf_oauth: true
|
| 11 |
startup_duration_timeout: 1h
|
| 12 |
preload_from_hub:
|
| 13 |
- Tongyi-MAI/Z-Image-Turbo
|
|
|
|
| 7 |
sdk_version: 6.32.0
|
| 8 |
python_version: "3.12"
|
| 9 |
app_file: app.py
|
|
|
|
| 10 |
startup_duration_timeout: 1h
|
| 11 |
preload_from_hub:
|
| 12 |
- Tongyi-MAI/Z-Image-Turbo
|
app.py
CHANGED
|
@@ -19,8 +19,8 @@ except ImportError: # in locale, senza ZeroGPU
|
|
| 19 |
spaces = None
|
| 20 |
|
| 21 |
import gradio as gr
|
| 22 |
-
from fastapi import FastAPI, File, Form, HTTPException,
|
| 23 |
-
from fastapi.responses import FileResponse, HTMLResponse, JSONResponse,
|
| 24 |
from fastapi.staticfiles import StaticFiles
|
| 25 |
from PIL import Image
|
| 26 |
|
|
@@ -114,8 +114,7 @@ def _friendly(exc: BaseException) -> str:
|
|
| 114 |
if "out of memory" in text.lower() or "NVML_SUCCESS" in text:
|
| 115 |
return "La GPU è piena in questo momento. Riprova tra poco o scegli meno immagini."
|
| 116 |
log.error("Lavoro non riuscito", exc_info=exc)
|
| 117 |
-
|
| 118 |
-
return "Qualcosa è andato storto durante la generazione. Riprova." + detail
|
| 119 |
|
| 120 |
|
| 121 |
def _estimate(job: Job, *_: Any) -> int:
|
|
@@ -197,9 +196,6 @@ def scrivi(tipo: str, testo: str) -> str:
|
|
| 197 |
raise gr.Error(_friendly(exc), print_exception=False)
|
| 198 |
|
| 199 |
|
| 200 |
-
ON_SPACES = bool(os.environ.get("SPACE_ID"))
|
| 201 |
-
|
| 202 |
-
|
| 203 |
@gpu(40)
|
| 204 |
def _improve(text: str, kind: str) -> tuple[str, str]:
|
| 205 |
m = models()
|
|
@@ -223,32 +219,6 @@ def migliora(testo: str, modalita: str) -> dict[str, str]:
|
|
| 223 |
return {"prompt": english, "italiano": italian}
|
| 224 |
|
| 225 |
|
| 226 |
-
def _token_payload(request: gr.Request | None) -> dict[str, Any]:
|
| 227 |
-
"""Quello che ZeroGPU sa di chi chiede (account o solo indirizzo IP), senza l'IP."""
|
| 228 |
-
token = request.headers.get("x-ip-token") if request is not None else None
|
| 229 |
-
if not token:
|
| 230 |
-
return {}
|
| 231 |
-
try:
|
| 232 |
-
import base64
|
| 233 |
-
|
| 234 |
-
part = token.split(".")[1]
|
| 235 |
-
data = json.loads(base64.urlsafe_b64decode(part + "=" * (-len(part) % 4)))
|
| 236 |
-
except Exception: # noqa: BLE001
|
| 237 |
-
return {"errore": "token illeggibile"}
|
| 238 |
-
return {k: v for k, v in data.items() if "ip" not in k.lower()}
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
def chi_sono(profile: gr.OAuthProfile | None, request: gr.Request) -> dict[str, Any]:
|
| 242 |
-
gpu = _token_payload(request)
|
| 243 |
-
if profile is None:
|
| 244 |
-
return {"accesso": False, "gpu": gpu}
|
| 245 |
-
return {"accesso": True, "nome": profile.name or profile.username, "utente": profile.username, "gpu": gpu}
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
def chi_sono_locale() -> dict[str, Any]:
|
| 249 |
-
return {"accesso": False, "locale": True}
|
| 250 |
-
|
| 251 |
-
|
| 252 |
with gr.Blocks(title="PixRick · motore", analytics_enabled=False, delete_cache=(300, 900)) as motore:
|
| 253 |
gr.Markdown("Questo è il motore di PixRick. L'app è nella pagina principale.")
|
| 254 |
with gr.Column(visible=False):
|
|
@@ -260,14 +230,11 @@ with gr.Blocks(title="PixRick · motore", analytics_enabled=False, delete_cache=
|
|
| 260 |
tipo = gr.Textbox()
|
| 261 |
testo = gr.Textbox()
|
| 262 |
scritto = gr.Textbox()
|
| 263 |
-
|
| 264 |
-
if ON_SPACES:
|
| 265 |
-
gr.LoginButton()
|
| 266 |
go = gr.Button()
|
| 267 |
go.click(genera, [richiesta, immagini, maschera], [stato, risultati], api_name="genera", show_progress="hidden")
|
| 268 |
gr.Button().click(scrivi, [tipo, testo], scritto, api_name="scrivi", concurrency_limit=4)
|
| 269 |
-
gr.Button().click(migliora, [testo, tipo],
|
| 270 |
-
gr.Button().click(chi_sono if ON_SPACES else chi_sono_locale, None, profilo, api_name="chi_sono", queue=False)
|
| 271 |
|
| 272 |
motore.queue(default_concurrency_limit=6, max_size=80)
|
| 273 |
|
|
@@ -315,15 +282,9 @@ def terms() -> HTMLResponse:
|
|
| 315 |
return _legal("termini")
|
| 316 |
|
| 317 |
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
@app.get("/logout", include_in_schema=False)
|
| 322 |
-
def oauth_forward(request: Request) -> RedirectResponse:
|
| 323 |
-
target = "/motore" + request.url.path
|
| 324 |
-
if request.url.query:
|
| 325 |
-
target += "?" + request.url.query
|
| 326 |
-
return RedirectResponse(target, status_code=307)
|
| 327 |
|
| 328 |
|
| 329 |
@app.get("/sw.js", include_in_schema=False)
|
|
|
|
| 19 |
spaces = None
|
| 20 |
|
| 21 |
import gradio as gr
|
| 22 |
+
from fastapi import FastAPI, File, Form, HTTPException, UploadFile
|
| 23 |
+
from fastapi.responses import FileResponse, HTMLResponse, JSONResponse, Response
|
| 24 |
from fastapi.staticfiles import StaticFiles
|
| 25 |
from PIL import Image
|
| 26 |
|
|
|
|
| 114 |
if "out of memory" in text.lower() or "NVML_SUCCESS" in text:
|
| 115 |
return "La GPU è piena in questo momento. Riprova tra poco o scegli meno immagini."
|
| 116 |
log.error("Lavoro non riuscito", exc_info=exc)
|
| 117 |
+
return "Qualcosa è andato storto durante la generazione. Riprova."
|
|
|
|
| 118 |
|
| 119 |
|
| 120 |
def _estimate(job: Job, *_: Any) -> int:
|
|
|
|
| 196 |
raise gr.Error(_friendly(exc), print_exception=False)
|
| 197 |
|
| 198 |
|
|
|
|
|
|
|
|
|
|
| 199 |
@gpu(40)
|
| 200 |
def _improve(text: str, kind: str) -> tuple[str, str]:
|
| 201 |
m = models()
|
|
|
|
| 219 |
return {"prompt": english, "italiano": italian}
|
| 220 |
|
| 221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
with gr.Blocks(title="PixRick · motore", analytics_enabled=False, delete_cache=(300, 900)) as motore:
|
| 223 |
gr.Markdown("Questo è il motore di PixRick. L'app è nella pagina principale.")
|
| 224 |
with gr.Column(visible=False):
|
|
|
|
| 230 |
tipo = gr.Textbox()
|
| 231 |
testo = gr.Textbox()
|
| 232 |
scritto = gr.Textbox()
|
| 233 |
+
risposta = gr.JSON()
|
|
|
|
|
|
|
| 234 |
go = gr.Button()
|
| 235 |
go.click(genera, [richiesta, immagini, maschera], [stato, risultati], api_name="genera", show_progress="hidden")
|
| 236 |
gr.Button().click(scrivi, [tipo, testo], scritto, api_name="scrivi", concurrency_limit=4)
|
| 237 |
+
gr.Button().click(migliora, [testo, tipo], risposta, api_name="migliora", concurrency_limit=4)
|
|
|
|
| 238 |
|
| 239 |
motore.queue(default_concurrency_limit=6, max_size=80)
|
| 240 |
|
|
|
|
| 282 |
return _legal("termini")
|
| 283 |
|
| 284 |
|
| 285 |
+
@app.get("/guida.pdf", include_in_schema=False)
|
| 286 |
+
def guide_pdf() -> FileResponse:
|
| 287 |
+
return FileResponse(WEB / "guida" / "PixRick-Guida.pdf", media_type="application/pdf", filename="PixRick-Guida.pdf", content_disposition_type="inline")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
|
| 289 |
|
| 290 |
@app.get("/sw.js", include_in_schema=False)
|
pixrick/runner.py
CHANGED
|
@@ -170,7 +170,8 @@ class Models:
|
|
| 170 |
]
|
| 171 |
)
|
| 172 |
rgb = img.convert("RGB")
|
| 173 |
-
|
|
|
|
| 174 |
with torch.inference_mode():
|
| 175 |
pred = self.cutout(tensor)[-1].sigmoid().float().cpu()[0].squeeze()
|
| 176 |
alpha = transforms.ToPILImage()(pred).resize(rgb.size, Image.LANCZOS)
|
|
|
|
| 170 |
]
|
| 171 |
)
|
| 172 |
rgb = img.convert("RGB")
|
| 173 |
+
dtype = next(self.cutout.parameters()).dtype
|
| 174 |
+
tensor = prep(rgb).unsqueeze(0).to("cuda", dtype=dtype)
|
| 175 |
with torch.inference_mode():
|
| 176 |
pred = self.cutout(tensor)[-1].sigmoid().float().cpu()[0].squeeze()
|
| 177 |
alpha = transforms.ToPILImage()(pred).resize(rgb.size, Image.LANCZOS)
|
web/backend.js
CHANGED
|
@@ -305,6 +305,7 @@
|
|
| 305 |
}
|
| 306 |
|
| 307 |
const jobs = new Map();
|
|
|
|
| 308 |
const listeners = new Set();
|
| 309 |
const emit = (event) => listeners.forEach((fn) => { try { fn(event); } catch { /* ascoltatore rotto */ } });
|
| 310 |
|
|
@@ -340,6 +341,7 @@
|
|
| 340 |
const blob = await readBlob(payload.maschera);
|
| 341 |
if (blob) mask = new File([blob], "mask.png", { type: "image/png" });
|
| 342 |
}
|
|
|
|
| 343 |
const request = { ...payload, stili_utente: await userStyles() };
|
| 344 |
const client = await engine();
|
| 345 |
const { handle_file: handle } = await import("/web/vendor/gradio-client.js");
|
|
@@ -387,18 +389,6 @@
|
|
| 387 |
return state.job;
|
| 388 |
}
|
| 389 |
|
| 390 |
-
/* ---------- account ---------- */
|
| 391 |
-
|
| 392 |
-
async function whoAmI() {
|
| 393 |
-
try {
|
| 394 |
-
const client = await engine();
|
| 395 |
-
const res = await client.predict("/chi_sono", []);
|
| 396 |
-
return res.data[0] || { accesso: false };
|
| 397 |
-
} catch {
|
| 398 |
-
return { accesso: false };
|
| 399 |
-
}
|
| 400 |
-
}
|
| 401 |
-
|
| 402 |
/* ---------- router delle API ---------- */
|
| 403 |
|
| 404 |
const MODELS = {
|
|
@@ -592,5 +582,5 @@
|
|
| 592 |
return { serviceWorker: sw };
|
| 593 |
})();
|
| 594 |
|
| 595 |
-
window.PixBackend = { api, ready,
|
| 596 |
})();
|
|
|
|
| 305 |
}
|
| 306 |
|
| 307 |
const jobs = new Map();
|
| 308 |
+
let lastPayload = null;
|
| 309 |
const listeners = new Set();
|
| 310 |
const emit = (event) => listeners.forEach((fn) => { try { fn(event); } catch { /* ascoltatore rotto */ } });
|
| 311 |
|
|
|
|
| 341 |
const blob = await readBlob(payload.maschera);
|
| 342 |
if (blob) mask = new File([blob], "mask.png", { type: "image/png" });
|
| 343 |
}
|
| 344 |
+
lastPayload = payload;
|
| 345 |
const request = { ...payload, stili_utente: await userStyles() };
|
| 346 |
const client = await engine();
|
| 347 |
const { handle_file: handle } = await import("/web/vendor/gradio-client.js");
|
|
|
|
| 389 |
return state.job;
|
| 390 |
}
|
| 391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
/* ---------- router delle API ---------- */
|
| 393 |
|
| 394 |
const MODELS = {
|
|
|
|
| 582 |
return { serviceWorker: sw };
|
| 583 |
})();
|
| 584 |
|
| 585 |
+
window.PixBackend = { api, ready, engine, on: (fn) => listeners.add(fn), readBlob, get lastPayload() { return lastPayload; } };
|
| 586 |
})();
|
web/i18n/en.json
CHANGED
|
@@ -592,5 +592,22 @@
|
|
| 592 |
"Creata con": "Made with",
|
| 593 |
"I minuti tornano tra": "Minutes come back in",
|
| 594 |
"I minuti tornano entro 24 ore dal primo utilizzo.": "Minutes come back within 24 hours of your first use.",
|
| 595 |
-
"Le immagini restano sul tuo dispositivo.": "Your images stay on your device."
|
| 596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
"Creata con": "Made with",
|
| 593 |
"I minuti tornano tra": "Minutes come back in",
|
| 594 |
"I minuti tornano entro 24 ore dal primo utilizzo.": "Minutes come back within 24 hours of your first use.",
|
| 595 |
+
"Le immagini restano sul tuo dispositivo.": "Your images stay on your device.",
|
| 596 |
+
"Gratis, senza account": "Free, no account needed",
|
| 597 |
+
"Circa 2 minuti di GPU al giorno a testa. Le immagini restano nel tuo browser.": "About 2 GPU minutes a day per person. Your images stay in your browser.",
|
| 598 |
+
"Guida all'uso (PDF)": "User guide (PDF, Italian)",
|
| 599 |
+
"Guida all'uso": "User guide",
|
| 600 |
+
"Usi la GPU gratuita di Hugging Face: circa 2 minuti al giorno a testa, abbastanza per una quindicina di immagini. Niente registrazione.": "You use Hugging Face's free GPU: about 2 minutes a day per person, enough for around fifteen images. No sign-up.",
|
| 601 |
+
"Tutto quello che sa fare": "Everything it can do",
|
| 602 |
+
"Crea, ristila, modifica una zona, continua una storia, scontorna, vettorizza e componi locandine. La guida all'uso te lo mostra con esempi veri.": "Create, restyle, edit one area, continue a story, cut out, vectorize and compose posters. The user guide shows it all with real examples.",
|
| 603 |
+
"Inizia subito": "Start now",
|
| 604 |
+
"Menu": "Menu",
|
| 605 |
+
"Hai usato i minuti di GPU gratuiti di oggi. Le immagini che hai fatto restano nella galleria.": "You've used today's free GPU minutes. The images you made stay in your gallery.",
|
| 606 |
+
"Questa richiesta non si può fare": "This request can't be done",
|
| 607 |
+
"Il motore è sotto sforzo": "The engine is busy",
|
| 608 |
+
"Tante persone stanno generando in questo momento. Riprova tra qualche secondo.": "Lots of people are generating right now. Try again in a few seconds.",
|
| 609 |
+
"Manca un'immagine": "An image is missing",
|
| 610 |
+
"Non è andata": "That didn't work",
|
| 611 |
+
"Qualcosa si è inceppato mentre lavoravo. Riprova: di solito al secondo tentativo va.": "Something jammed while I was working. Try again: it usually works the second time.",
|
| 612 |
+
"Riprova": "Try again"
|
| 613 |
+
}
|
web/index.html
CHANGED
|
@@ -60,6 +60,8 @@
|
|
| 60 |
<symbol id="i-vector" viewBox="0 0 24 24"><rect x="3" y="3" width="5" height="5" rx="1"/><rect x="16" y="16" width="5" height="5" rx="1"/><path d="M8 5.5h4.5A3.5 3.5 0 0 1 16 9v0M18.5 16v-4.5A3.5 3.5 0 0 0 15 8"/><circle cx="16" cy="8" r="1.2"/></symbol>
|
| 61 |
<symbol id="i-help" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M9.6 9.3a2.5 2.5 0 0 1 4.8.9c0 1.7-2.4 2.1-2.4 3.6M12 17.2v.1"/></symbol>
|
| 62 |
<symbol id="i-sliders" viewBox="0 0 24 24"><path d="M4 7h10M18 7h2M4 17h4M12 17h8"/><circle cx="16" cy="7" r="2"/><circle cx="10" cy="17" r="2"/></symbol>
|
|
|
|
|
|
|
| 63 |
<symbol id="i-layers" viewBox="0 0 24 24"><path d="m12 4 8 4-8 4-8-4 8-4Z"/><path d="m4 12 8 4 8-4M4 16l8 4 8-4"/></symbol>
|
| 64 |
</svg>
|
| 65 |
|
|
@@ -76,19 +78,16 @@
|
|
| 76 |
<div class="top-status">
|
| 77 |
<button type="button" class="lang-btn" id="lang-btn" aria-label="Lingua: italiano. Passa all'inglese">EN</button>
|
| 78 |
<button type="button" class="icon-btn" id="help-btn" aria-label="Guida"><svg><use href="#i-help"/></svg></button>
|
| 79 |
-
<button type="button" class="
|
| 80 |
-
<span class="account-dot" aria-hidden="true"></span><span id="account-text">Ospite</span>
|
| 81 |
-
</button>
|
| 82 |
<div class="account-menu" id="account-menu" role="menu" hidden>
|
| 83 |
-
<p class="account-head"
|
| 84 |
-
<p class="account-note"
|
| 85 |
-
<a class="detail-btn primary" id="account-login" href="/motore/login/huggingface" role="menuitem">Accedi con Hugging Face</a>
|
| 86 |
-
<a class="detail-btn" id="account-logout" href="/motore/logout" role="menuitem" hidden>Esci</a>
|
| 87 |
<hr>
|
| 88 |
-
<button type="button" class="menu-link" id="
|
|
|
|
| 89 |
<a class="menu-link" href="/privacy" target="_blank" rel="noopener" role="menuitem">Privacy</a>
|
| 90 |
<a class="menu-link" href="/termini" target="_blank" rel="noopener" role="menuitem">Termini d'uso</a>
|
| 91 |
-
<button type="button" class="menu-link" id="
|
| 92 |
</div>
|
| 93 |
</div>
|
| 94 |
</header>
|
|
@@ -645,17 +644,17 @@
|
|
| 645 |
<p class="welcome-lead">Uno studio di immagini AI che gira gratis sulle GPU di Hugging Face. Niente abbonamenti, niente pubblicità.</p>
|
| 646 |
<dl class="welcome-facts">
|
| 647 |
<div>
|
| 648 |
-
<dt>
|
| 649 |
-
<dd>
|
| 650 |
-
</div>
|
| 651 |
-
<div>
|
| 652 |
-
<dt>Con un account Hugging Face</dt>
|
| 653 |
-
<dd>5 minuti al giorno e precedenza in coda. L'account è gratuito e PixRick non vede la tua password.</dd>
|
| 654 |
</div>
|
| 655 |
<div>
|
| 656 |
<dt>Le immagini restano tue</dt>
|
| 657 |
<dd>Galleria e bozze vivono nel tuo browser. Il server non conserva né immagini né prompt: scarica quello che vuoi tenere.</dd>
|
| 658 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 659 |
</dl>
|
| 660 |
<p class="welcome-rules">Qui niente nudo né contenuti sessuali, niente minori in contesti inappropriati, niente immagini di persone reali senza il loro consenso. Ogni immagine è marcata come generata con AI.</p>
|
| 661 |
<label class="welcome-check">
|
|
@@ -663,19 +662,30 @@
|
|
| 663 |
<span>Ho letto e accetto i <a href="/termini" target="_blank" rel="noopener">termini d'uso</a> e l'<a href="/privacy" target="_blank" rel="noopener">informativa privacy</a>.</span>
|
| 664 |
</label>
|
| 665 |
<div class="welcome-actions">
|
| 666 |
-
<a class="detail-btn
|
| 667 |
-
<button type="submit" class="detail-btn" id="welcome-start" value="ok">
|
| 668 |
</div>
|
| 669 |
</form>
|
| 670 |
</dialog>
|
| 671 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 672 |
<dialog class="confirm quota" id="quota" aria-labelledby="quota-title">
|
| 673 |
<h2 id="quota-title">Minuti finiti per oggi</h2>
|
| 674 |
<p id="quota-text"></p>
|
| 675 |
<p id="quota-when" class="quota-when"></p>
|
| 676 |
<div class="confirm-actions">
|
| 677 |
-
<button type="button" class="detail-btn" id="quota-close">Ho capito</button>
|
| 678 |
-
<a class="detail-btn primary" id="quota-login" href="/motore/login/huggingface">Accedi con Hugging Face</a>
|
| 679 |
</div>
|
| 680 |
</dialog>
|
| 681 |
|
|
|
|
| 60 |
<symbol id="i-vector" viewBox="0 0 24 24"><rect x="3" y="3" width="5" height="5" rx="1"/><rect x="16" y="16" width="5" height="5" rx="1"/><path d="M8 5.5h4.5A3.5 3.5 0 0 1 16 9v0M18.5 16v-4.5A3.5 3.5 0 0 0 15 8"/><circle cx="16" cy="8" r="1.2"/></symbol>
|
| 61 |
<symbol id="i-help" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M9.6 9.3a2.5 2.5 0 0 1 4.8.9c0 1.7-2.4 2.1-2.4 3.6M12 17.2v.1"/></symbol>
|
| 62 |
<symbol id="i-sliders" viewBox="0 0 24 24"><path d="M4 7h10M18 7h2M4 17h4M12 17h8"/><circle cx="16" cy="7" r="2"/><circle cx="10" cy="17" r="2"/></symbol>
|
| 63 |
+
<symbol id="i-menu" viewBox="0 0 24 24"><path d="M4 7h16M4 12h16M4 17h16"/></symbol>
|
| 64 |
+
<symbol id="i-alert" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 7.5v5.5M12 16.4v.1"/></symbol>
|
| 65 |
<symbol id="i-layers" viewBox="0 0 24 24"><path d="m12 4 8 4-8 4-8-4 8-4Z"/><path d="m4 12 8 4 8-4M4 16l8 4 8-4"/></symbol>
|
| 66 |
</svg>
|
| 67 |
|
|
|
|
| 78 |
<div class="top-status">
|
| 79 |
<button type="button" class="lang-btn" id="lang-btn" aria-label="Lingua: italiano. Passa all'inglese">EN</button>
|
| 80 |
<button type="button" class="icon-btn" id="help-btn" aria-label="Guida"><svg><use href="#i-help"/></svg></button>
|
| 81 |
+
<button type="button" class="icon-btn menu-btn" id="menu-btn" aria-haspopup="menu" aria-expanded="false" aria-label="Menu"><svg><use href="#i-menu"/></svg></button>
|
|
|
|
|
|
|
| 82 |
<div class="account-menu" id="account-menu" role="menu" hidden>
|
| 83 |
+
<p class="account-head">Gratis, senza account</p>
|
| 84 |
+
<p class="account-note">Circa 2 minuti di GPU al giorno a testa. Le immagini restano nel tuo browser.</p>
|
|
|
|
|
|
|
| 85 |
<hr>
|
| 86 |
+
<button type="button" class="menu-link" id="menu-welcome" role="menuitem">Come funziona</button>
|
| 87 |
+
<a class="menu-link" href="/guida.pdf" target="_blank" rel="noopener" role="menuitem">Guida all'uso (PDF)</a>
|
| 88 |
<a class="menu-link" href="/privacy" target="_blank" rel="noopener" role="menuitem">Privacy</a>
|
| 89 |
<a class="menu-link" href="/termini" target="_blank" rel="noopener" role="menuitem">Termini d'uso</a>
|
| 90 |
+
<button type="button" class="menu-link" id="menu-report" role="menuitem">Segnala un problema</button>
|
| 91 |
</div>
|
| 92 |
</div>
|
| 93 |
</header>
|
|
|
|
| 644 |
<p class="welcome-lead">Uno studio di immagini AI che gira gratis sulle GPU di Hugging Face. Niente abbonamenti, niente pubblicità.</p>
|
| 645 |
<dl class="welcome-facts">
|
| 646 |
<div>
|
| 647 |
+
<dt>Gratis, senza account</dt>
|
| 648 |
+
<dd>Usi la GPU gratuita di Hugging Face: circa 2 minuti al giorno a testa, abbastanza per una quindicina di immagini. Niente registrazione.</dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 649 |
</div>
|
| 650 |
<div>
|
| 651 |
<dt>Le immagini restano tue</dt>
|
| 652 |
<dd>Galleria e bozze vivono nel tuo browser. Il server non conserva né immagini né prompt: scarica quello che vuoi tenere.</dd>
|
| 653 |
</div>
|
| 654 |
+
<div>
|
| 655 |
+
<dt>Tutto quello che sa fare</dt>
|
| 656 |
+
<dd>Crea, ristila, modifica una zona, continua una storia, scontorna, vettorizza e componi locandine. La guida all'uso te lo mostra con esempi veri.</dd>
|
| 657 |
+
</div>
|
| 658 |
</dl>
|
| 659 |
<p class="welcome-rules">Qui niente nudo né contenuti sessuali, niente minori in contesti inappropriati, niente immagini di persone reali senza il loro consenso. Ogni immagine è marcata come generata con AI.</p>
|
| 660 |
<label class="welcome-check">
|
|
|
|
| 662 |
<span>Ho letto e accetto i <a href="/termini" target="_blank" rel="noopener">termini d'uso</a> e l'<a href="/privacy" target="_blank" rel="noopener">informativa privacy</a>.</span>
|
| 663 |
</label>
|
| 664 |
<div class="welcome-actions">
|
| 665 |
+
<a class="detail-btn" id="welcome-guide" href="/guida.pdf" target="_blank" rel="noopener"><svg><use href="#i-book"/></svg>Guida all'uso</a>
|
| 666 |
+
<button type="submit" class="detail-btn primary" id="welcome-start" value="ok">Inizia subito</button>
|
| 667 |
</div>
|
| 668 |
</form>
|
| 669 |
</dialog>
|
| 670 |
|
| 671 |
+
<div class="notice" id="notice" role="alert" hidden>
|
| 672 |
+
<svg class="notice-icon"><use href="#i-alert"/></svg>
|
| 673 |
+
<div class="notice-body">
|
| 674 |
+
<p class="notice-title" id="notice-title"></p>
|
| 675 |
+
<p class="notice-text" id="notice-text"></p>
|
| 676 |
+
</div>
|
| 677 |
+
<div class="notice-actions">
|
| 678 |
+
<button type="button" class="detail-btn" id="notice-retry" hidden>Riprova</button>
|
| 679 |
+
<button type="button" class="icon-btn" id="notice-close" aria-label="Chiudi"><svg><use href="#i-x"/></svg></button>
|
| 680 |
+
</div>
|
| 681 |
+
</div>
|
| 682 |
+
|
| 683 |
<dialog class="confirm quota" id="quota" aria-labelledby="quota-title">
|
| 684 |
<h2 id="quota-title">Minuti finiti per oggi</h2>
|
| 685 |
<p id="quota-text"></p>
|
| 686 |
<p id="quota-when" class="quota-when"></p>
|
| 687 |
<div class="confirm-actions">
|
| 688 |
+
<button type="button" class="detail-btn primary" id="quota-close">Ho capito</button>
|
|
|
|
| 689 |
</div>
|
| 690 |
</dialog>
|
| 691 |
|
web/legal/privacy.html
CHANGED
|
@@ -38,11 +38,9 @@
|
|
| 38 |
<h2>Cosa resta sul tuo dispositivo</h2>
|
| 39 |
<p>Galleria, bozze, stili che crei e preferenze sono salvati nel tuo browser (IndexedDB e localStorage). Non vengono inviati a nessuno. Puoi cancellarli quando vuoi dalla galleria o svuotando i dati del sito dalle impostazioni del browser. Le bozze non salvate si cancellano da sole dopo 24 ore.</p>
|
| 40 |
|
| 41 |
-
<h2>Accesso con Hugging Face</h2>
|
| 42 |
-
<p>Se scegli di accedere, Hugging Face ci comunica il tuo nome utente e il nome pubblico del profilo, che mostriamo nell'interfaccia. Non riceviamo né vediamo la tua password. L'accesso serve solo a darti più minuti di GPU e la precedenza in coda, che Hugging Face gestisce in base al tuo account. Il login usa un cookie tecnico di sessione, necessario al funzionamento.</p>
|
| 43 |
|
| 44 |
<h2>Infrastruttura</h2>
|
| 45 |
-
<p>PixRick è ospitato su Hugging Face Spaces (Hugging Face, Inc., Stati Uniti), che fornisce server e GPU. Come ogni servizio web, Hugging Face può registrare dati tecnici di connessione (indirizzo IP, browser, orario) per sicurezza e per calcolare i minuti di GPU usati. Questi dati sono trattati secondo la <a href="https://huggingface.co/privacy" target="_blank" rel="noopener">privacy policy di Hugging Face</a>.</p>
|
| 46 |
|
| 47 |
<h2>Base giuridica</h2>
|
| 48 |
<p>Trattiamo i dati strettamente necessari per fornirti il servizio che chiedi (art. 6.1.b GDPR) e per proteggerlo da abusi (art. 6.1.f GDPR, legittimo interesse).</p>
|
|
@@ -73,8 +71,6 @@
|
|
| 73 |
<h2>What stays on your device</h2>
|
| 74 |
<p>Gallery, drafts, the styles you create and your preferences are saved in your browser (IndexedDB and localStorage). They are not sent to anyone. You can delete them at any time from the gallery or by clearing this site's data in your browser settings. Unsaved drafts delete themselves after 24 hours.</p>
|
| 75 |
|
| 76 |
-
<h2>Signing in with Hugging Face</h2>
|
| 77 |
-
<p>If you choose to sign in, Hugging Face shares your username and public profile name with us, and we show them in the interface. We never receive or see your password. Signing in only gives you more GPU minutes and queue priority, which Hugging Face manages based on your account. Sign-in uses a technical session cookie that the service needs to work.</p>
|
| 78 |
|
| 79 |
<h2>Infrastructure</h2>
|
| 80 |
<p>PixRick is hosted on Hugging Face Spaces (Hugging Face, Inc., United States), which provides servers and GPUs. Like any web service, Hugging Face may log technical connection data (IP address, browser, time) for security and to count the GPU minutes used. That data is handled under <a href="https://huggingface.co/privacy" target="_blank" rel="noopener">Hugging Face's privacy policy</a>.</p>
|
|
|
|
| 38 |
<h2>Cosa resta sul tuo dispositivo</h2>
|
| 39 |
<p>Galleria, bozze, stili che crei e preferenze sono salvati nel tuo browser (IndexedDB e localStorage). Non vengono inviati a nessuno. Puoi cancellarli quando vuoi dalla galleria o svuotando i dati del sito dalle impostazioni del browser. Le bozze non salvate si cancellano da sole dopo 24 ore.</p>
|
| 40 |
|
|
|
|
|
|
|
| 41 |
|
| 42 |
<h2>Infrastruttura</h2>
|
| 43 |
+
<p>PixRick è ospitato su Hugging Face Spaces (Hugging Face, Inc., Stati Uniti), che fornisce server e GPU. Come ogni servizio web, Hugging Face può registrare dati tecnici di connessione (indirizzo IP, browser, orario) per sicurezza e per calcolare i minuti di GPU usati da ciascun visitatore. Questi dati sono trattati secondo la <a href="https://huggingface.co/privacy" target="_blank" rel="noopener">privacy policy di Hugging Face</a>.</p>
|
| 44 |
|
| 45 |
<h2>Base giuridica</h2>
|
| 46 |
<p>Trattiamo i dati strettamente necessari per fornirti il servizio che chiedi (art. 6.1.b GDPR) e per proteggerlo da abusi (art. 6.1.f GDPR, legittimo interesse).</p>
|
|
|
|
| 71 |
<h2>What stays on your device</h2>
|
| 72 |
<p>Gallery, drafts, the styles you create and your preferences are saved in your browser (IndexedDB and localStorage). They are not sent to anyone. You can delete them at any time from the gallery or by clearing this site's data in your browser settings. Unsaved drafts delete themselves after 24 hours.</p>
|
| 73 |
|
|
|
|
|
|
|
| 74 |
|
| 75 |
<h2>Infrastructure</h2>
|
| 76 |
<p>PixRick is hosted on Hugging Face Spaces (Hugging Face, Inc., United States), which provides servers and GPUs. Like any web service, Hugging Face may log technical connection data (IP address, browser, time) for security and to count the GPU minutes used. That data is handled under <a href="https://huggingface.co/privacy" target="_blank" rel="noopener">Hugging Face's privacy policy</a>.</p>
|
web/online.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
| 1 |
-
/* Solo online:
|
| 2 |
(() => {
|
| 3 |
"use strict";
|
| 4 |
|
| 5 |
const $ = (s) => document.querySelector(s);
|
| 6 |
-
const WELCOME_KEY = "pixrick.benvenuto.
|
| 7 |
-
const REPORT_URL = "https://huggingface.co/spaces/
|
| 8 |
-
const loginUrl = () => `/motore/login/huggingface?_target_url=${encodeURIComponent(location.pathname)}`;
|
| 9 |
-
const logoutUrl = () => `/motore/logout?_target_url=${encodeURIComponent(location.pathname)}`;
|
| 10 |
-
const t = (text) => text;
|
| 11 |
-
|
| 12 |
-
let user = { accesso: false };
|
| 13 |
|
| 14 |
function seenWelcome() {
|
| 15 |
try { return localStorage.getItem(WELCOME_KEY) === "1"; } catch { return false; }
|
|
@@ -18,86 +13,113 @@
|
|
| 18 |
try { localStorage.setItem(WELCOME_KEY, "1"); } catch { /* storage bloccato */ }
|
| 19 |
}
|
| 20 |
|
| 21 |
-
|
| 22 |
-
const btn = $("#account-btn");
|
| 23 |
-
btn.dataset.state = user.accesso ? "dentro" : "ospite";
|
| 24 |
-
$("#account-text").textContent = user.accesso ? user.nome || user.utente : t("Ospite");
|
| 25 |
-
$("#account-head").textContent = user.accesso ? t("Accesso con Hugging Face") + ": " + (user.utente || "") : t("Stai usando PixRick come ospite");
|
| 26 |
-
$("#account-note").textContent = user.accesso ? t("5 minuti di GPU al giorno e precedenza in coda.") : t("2 minuti di GPU al giorno, coda normale.");
|
| 27 |
-
$("#account-login").hidden = user.accesso;
|
| 28 |
-
$("#account-logout").hidden = !user.accesso;
|
| 29 |
-
$("#account-login").href = loginUrl();
|
| 30 |
-
$("#account-logout").href = logoutUrl();
|
| 31 |
-
document.body.dataset.account = user.accesso ? "dentro" : "ospite";
|
| 32 |
-
}
|
| 33 |
|
| 34 |
function toggleMenu(open) {
|
| 35 |
const menu = $("#account-menu");
|
| 36 |
const show = open ?? menu.hidden;
|
| 37 |
menu.hidden = !show;
|
| 38 |
-
$("#
|
| 39 |
-
if (show) menu.querySelector("
|
| 40 |
}
|
| 41 |
|
|
|
|
|
|
|
| 42 |
function openWelcome() {
|
| 43 |
toggleMenu(false);
|
| 44 |
-
|
| 45 |
-
$("#welcome-login").href = loginUrl();
|
| 46 |
-
$("#welcome-login").hidden = user.accesso;
|
| 47 |
-
$("#welcome-start").textContent = t(user.accesso ? "Inizia" : "Continua come ospite");
|
| 48 |
-
dlg.showModal();
|
| 49 |
}
|
| 50 |
|
|
|
|
|
|
|
| 51 |
function quota(retryIn) {
|
| 52 |
-
|
| 53 |
-
let when = "";
|
| 54 |
if (retryIn) {
|
| 55 |
const h = Math.floor(retryIn / 3600);
|
| 56 |
-
const m = Math.ceil((retryIn % 3600) / 60);
|
| 57 |
-
when = h ? `${h} h ${m} min` : `${m} min`;
|
| 58 |
}
|
| 59 |
-
$("#quota-
|
| 60 |
-
$("#quota-
|
| 61 |
-
$("#quota
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
}
|
| 67 |
|
|
|
|
|
|
|
| 68 |
function wire() {
|
| 69 |
-
$("#
|
| 70 |
document.addEventListener("click", (e) => { if (!e.target.closest("#account-menu")) toggleMenu(false); });
|
| 71 |
document.addEventListener("keydown", (e) => { if (e.key === "Escape") toggleMenu(false); });
|
| 72 |
-
$("#
|
| 73 |
-
$("#
|
| 74 |
const terms = $("#welcome-terms");
|
| 75 |
-
const sync = () => {
|
| 76 |
-
$("#welcome-start").disabled = !terms.checked;
|
| 77 |
-
$("#welcome-login").setAttribute("aria-disabled", String(!terms.checked));
|
| 78 |
-
};
|
| 79 |
terms.addEventListener("change", sync);
|
| 80 |
-
$("#welcome-login").addEventListener("click", (e) => {
|
| 81 |
-
if (!terms.checked) { e.preventDefault(); return; }
|
| 82 |
-
markWelcome();
|
| 83 |
-
});
|
| 84 |
$("#welcome").addEventListener("cancel", (e) => { if (!seenWelcome()) e.preventDefault(); });
|
| 85 |
-
$("#welcome-form").addEventListener("submit",
|
| 86 |
$("#quota-close").addEventListener("click", () => $("#quota").close());
|
| 87 |
if (seenWelcome()) terms.checked = true;
|
| 88 |
sync();
|
|
|
|
| 89 |
}
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
user = await window.PixBackend.whoAmI();
|
| 95 |
-
renderAccount();
|
| 96 |
-
if ($("#welcome").open) $("#welcome-login").hidden = user.accesso;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
window.PixOnline = { quota, openWelcome, refresh: async () => { user = await window.PixBackend.whoAmI(); renderAccount(); } };
|
| 100 |
-
document.addEventListener("pixrick:lang", renderAccount);
|
| 101 |
-
renderAccount();
|
| 102 |
-
boot();
|
| 103 |
})();
|
|
|
|
| 1 |
+
/* Solo online: benvenuto, menu, minuti finiti e avvisi d'errore comprensibili. */
|
| 2 |
(() => {
|
| 3 |
"use strict";
|
| 4 |
|
| 5 |
const $ = (s) => document.querySelector(s);
|
| 6 |
+
const WELCOME_KEY = "pixrick.benvenuto.v2";
|
| 7 |
+
const REPORT_URL = "https://huggingface.co/spaces/Algorick/pixrick/discussions/new";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
function seenWelcome() {
|
| 10 |
try { return localStorage.getItem(WELCOME_KEY) === "1"; } catch { return false; }
|
|
|
|
| 13 |
try { localStorage.setItem(WELCOME_KEY, "1"); } catch { /* storage bloccato */ }
|
| 14 |
}
|
| 15 |
|
| 16 |
+
/* ---------- menu ---------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
function toggleMenu(open) {
|
| 19 |
const menu = $("#account-menu");
|
| 20 |
const show = open ?? menu.hidden;
|
| 21 |
menu.hidden = !show;
|
| 22 |
+
$("#menu-btn").setAttribute("aria-expanded", String(show));
|
| 23 |
+
if (show) menu.querySelector("button, a")?.focus();
|
| 24 |
}
|
| 25 |
|
| 26 |
+
/* ---------- benvenuto ---------- */
|
| 27 |
+
|
| 28 |
function openWelcome() {
|
| 29 |
toggleMenu(false);
|
| 30 |
+
$("#welcome").showModal();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
+
/* ---------- minuti finiti ---------- */
|
| 34 |
+
|
| 35 |
function quota(retryIn) {
|
| 36 |
+
let when = "I minuti tornano entro 24 ore dal primo utilizzo.";
|
|
|
|
| 37 |
if (retryIn) {
|
| 38 |
const h = Math.floor(retryIn / 3600);
|
| 39 |
+
const m = Math.max(1, Math.ceil((retryIn % 3600) / 60));
|
| 40 |
+
when = `I minuti tornano tra ${h ? `${h} h ${m} min` : `${m} min`}.`;
|
| 41 |
}
|
| 42 |
+
$("#quota-text").textContent = "Hai usato i minuti di GPU gratuiti di oggi. Le immagini che hai fatto restano nella galleria.";
|
| 43 |
+
$("#quota-when").textContent = when;
|
| 44 |
+
$("#quota").showModal();
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/* ---------- avvisi d'errore ---------- */
|
| 48 |
+
|
| 49 |
+
const HINT = /^(Scrivi|Aggiungi|Scegli|Dipingi|Servono|Al massimo|Write|Add|Choose|Pick|Paint|First|At most|A name)/;
|
| 50 |
+
const BLOCKED = /bloccat|rifiutat|non si toccano|blocked|rejected|off limits/i;
|
| 51 |
+
const BUSY = /GPU è piena|troppe persone|non risponde|GPU is full|Too many people|isn't responding/i;
|
| 52 |
+
const LOST = /non c'è più|non sono arrivate|is gone|Not all starting/i;
|
| 53 |
+
|
| 54 |
+
function classify(text) {
|
| 55 |
+
if (HINT.test(text)) return null;
|
| 56 |
+
if (BLOCKED.test(text)) return { title: "Questa richiesta non si può fare", text, retry: false };
|
| 57 |
+
if (BUSY.test(text)) return { title: "Il motore è sotto sforzo", text: "Tante persone stanno generando in questo momento. Riprova tra qualche secondo.", retry: true };
|
| 58 |
+
if (LOST.test(text)) return { title: "Manca un'immagine", text, retry: false };
|
| 59 |
+
return { title: "Non è andata", text: "Qualcosa si è inceppato mentre lavoravo. Riprova: di solito al secondo tentativo va.", retry: true };
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
let hideTimer = null;
|
| 63 |
+
function showNotice(n) {
|
| 64 |
+
clearTimeout(hideTimer);
|
| 65 |
+
$("#notice-title").textContent = n.title;
|
| 66 |
+
$("#notice-text").textContent = n.text;
|
| 67 |
+
$("#notice-retry").hidden = !n.retry || !window.PixBackend?.lastPayload;
|
| 68 |
+
const box = $("#notice");
|
| 69 |
+
box.hidden = false;
|
| 70 |
+
requestAnimationFrame(() => box.classList.add("show"));
|
| 71 |
+
hideTimer = setTimeout(hideNotice, 12000);
|
| 72 |
+
}
|
| 73 |
+
function hideNotice() {
|
| 74 |
+
clearTimeout(hideTimer);
|
| 75 |
+
const box = $("#notice");
|
| 76 |
+
box.classList.remove("show");
|
| 77 |
+
setTimeout(() => { if (!box.classList.contains("show")) box.hidden = true; }, 220);
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
function watchErrors() {
|
| 81 |
+
const field = $("#form-error");
|
| 82 |
+
let busy = false;
|
| 83 |
+
new MutationObserver(() => {
|
| 84 |
+
if (busy) return;
|
| 85 |
+
const text = field.textContent.trim();
|
| 86 |
+
if (!text) return;
|
| 87 |
+
const notice = classify(text);
|
| 88 |
+
if (!notice) return;
|
| 89 |
+
busy = true;
|
| 90 |
+
field.textContent = "";
|
| 91 |
+
busy = false;
|
| 92 |
+
showNotice(notice);
|
| 93 |
+
}).observe(field, { childList: true, characterData: true, subtree: true });
|
| 94 |
+
$("#notice-close").addEventListener("click", hideNotice);
|
| 95 |
+
$("#notice-retry").addEventListener("click", () => {
|
| 96 |
+
hideNotice();
|
| 97 |
+
const payload = window.PixBackend?.lastPayload;
|
| 98 |
+
if (payload && typeof window.submit === "function") window.submit(payload);
|
| 99 |
+
});
|
| 100 |
+
$("#generate-btn").addEventListener("click", hideNotice);
|
| 101 |
}
|
| 102 |
|
| 103 |
+
/* ---------- avvio ---------- */
|
| 104 |
+
|
| 105 |
function wire() {
|
| 106 |
+
$("#menu-btn").addEventListener("click", (e) => { e.stopPropagation(); toggleMenu(); });
|
| 107 |
document.addEventListener("click", (e) => { if (!e.target.closest("#account-menu")) toggleMenu(false); });
|
| 108 |
document.addEventListener("keydown", (e) => { if (e.key === "Escape") toggleMenu(false); });
|
| 109 |
+
$("#menu-welcome").addEventListener("click", openWelcome);
|
| 110 |
+
$("#menu-report").addEventListener("click", () => { toggleMenu(false); window.open(REPORT_URL, "_blank", "noopener"); });
|
| 111 |
const terms = $("#welcome-terms");
|
| 112 |
+
const sync = () => { $("#welcome-start").disabled = !terms.checked; };
|
|
|
|
|
|
|
|
|
|
| 113 |
terms.addEventListener("change", sync);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
$("#welcome").addEventListener("cancel", (e) => { if (!seenWelcome()) e.preventDefault(); });
|
| 115 |
+
$("#welcome-form").addEventListener("submit", markWelcome);
|
| 116 |
$("#quota-close").addEventListener("click", () => $("#quota").close());
|
| 117 |
if (seenWelcome()) terms.checked = true;
|
| 118 |
sync();
|
| 119 |
+
watchErrors();
|
| 120 |
}
|
| 121 |
|
| 122 |
+
wire();
|
| 123 |
+
if (!seenWelcome()) openWelcome();
|
| 124 |
+
window.PixOnline = { quota, openWelcome };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
})();
|
web/style.css
CHANGED
|
@@ -1861,3 +1861,40 @@ body[data-scope="cestino"] .selection-bar [data-scope]:not([data-scope="cestino"
|
|
| 1861 |
.welcome { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
|
| 1862 |
.toast { top: calc(var(--topbar) + env(safe-area-inset-top) + 10px); width: max-content; max-width: calc(100vw - 24px); }
|
| 1863 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1861 |
.welcome { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
|
| 1862 |
.toast { top: calc(var(--topbar) + env(safe-area-inset-top) + 10px); width: max-content; max-width: calc(100vw - 24px); }
|
| 1863 |
}
|
| 1864 |
+
|
| 1865 |
+
/* ---------- avvisi ---------- */
|
| 1866 |
+
|
| 1867 |
+
.notice {
|
| 1868 |
+
position: fixed;
|
| 1869 |
+
z-index: 60;
|
| 1870 |
+
top: calc(var(--topbar) + env(safe-area-inset-top, 0px) + 12px);
|
| 1871 |
+
left: 50%;
|
| 1872 |
+
display: grid;
|
| 1873 |
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
| 1874 |
+
gap: 12px;
|
| 1875 |
+
align-items: start;
|
| 1876 |
+
width: min(460px, calc(100vw - 24px));
|
| 1877 |
+
padding: 14px 12px 14px 16px;
|
| 1878 |
+
border: 1px solid rgba(255, 143, 143, 0.28);
|
| 1879 |
+
border-radius: 14px;
|
| 1880 |
+
background: var(--bg-raised);
|
| 1881 |
+
box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9);
|
| 1882 |
+
opacity: 0;
|
| 1883 |
+
transform: translate(-50%, -8px);
|
| 1884 |
+
transition: opacity 0.2s, transform 0.2s var(--ease);
|
| 1885 |
+
}
|
| 1886 |
+
.notice.show { opacity: 1; transform: translate(-50%, 0); }
|
| 1887 |
+
.notice-icon { width: 20px; height: 20px; margin-top: 1px; color: var(--danger); }
|
| 1888 |
+
.notice-title { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
|
| 1889 |
+
.notice-text { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
|
| 1890 |
+
.notice-actions { display: flex; align-items: center; gap: 4px; }
|
| 1891 |
+
.notice-actions .detail-btn { height: 34px; padding: 0 12px; }
|
| 1892 |
+
.notice-actions .icon-btn { width: 34px; height: 34px; border: 0; }
|
| 1893 |
+
.composer-foot .error:not(:empty) { flex-basis: 100%; color: var(--muted); }
|
| 1894 |
+
.composer-foot .error:not(:empty)::before { content: "→ "; color: var(--accent); }
|
| 1895 |
+
@media (max-width: 760px) {
|
| 1896 |
+
.notice { grid-template-columns: auto minmax(0, 1fr); padding-right: 44px; }
|
| 1897 |
+
.notice-actions { grid-column: 2; justify-content: flex-start; }
|
| 1898 |
+
.notice-actions:has(#notice-retry[hidden]) { display: contents; }
|
| 1899 |
+
.notice-actions .icon-btn { position: absolute; top: 8px; right: 6px; }
|
| 1900 |
+
}
|