Compare commits
24
Commits
v1.9.4
..
e18a09e1da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e18a09e1da | ||
|
|
f3262a0497 | ||
|
|
690f7e636a | ||
|
|
5b95f18889 | ||
|
|
45dd205270 | ||
|
|
0764b0b625 | ||
|
|
8befcb8abf | ||
|
|
89aed8a458 | ||
|
|
ae861e78d2 | ||
|
|
77eb9943d0 | ||
|
|
a0ec72f6c0 | ||
|
|
21a1d57cab | ||
|
|
2833cd0487 | ||
|
|
865bfa2752 | ||
|
|
70ed8f0a61 | ||
|
|
ed42a41bcd | ||
|
|
6a3f931431 | ||
|
|
ef1bc92e67 | ||
|
|
343f171d6a | ||
|
|
61f0945db2 | ||
|
|
29724f5baf | ||
|
|
009fa51155 | ||
|
|
7b405ed78e | ||
|
|
79756d878d |
No files matched your search
@@ -1,15 +0,0 @@
|
||||
# Ciò che non serve nel contesto di build dell'immagine.
|
||||
.git
|
||||
.gitignore
|
||||
.gitattributes
|
||||
.vscode
|
||||
.claude
|
||||
.gitea
|
||||
**/bin
|
||||
**/obj
|
||||
**/TestResults
|
||||
out
|
||||
docs
|
||||
tools
|
||||
*.md
|
||||
dati
|
||||
@@ -1,14 +0,0 @@
|
||||
# I file che finiscono nel container o sul runner Linux restano LF anche su Windows:
|
||||
# uno script con CRLF nel shebang non parte ("bad interpreter").
|
||||
*.sh text eol=lf
|
||||
*.sql text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.yaml text eol=lf
|
||||
Dockerfile text eol=lf
|
||||
*.xml text eol=lf
|
||||
|
||||
*.png binary
|
||||
*.ico binary
|
||||
*.js text eol=lf
|
||||
*.woff2 binary
|
||||
*.ttf binary
|
||||
@@ -1,4 +0,0 @@
|
||||
# Proprietari del codice: Gitea chiede la loro revisione a ogni richiesta di unione che tocca i file indicati.
|
||||
# In Gitea le regole sono espressioni regolari di Go, non schemi alla maniera di .gitignore.
|
||||
# Alberto è il proprietario di tutto il repository.
|
||||
.* @Alby96
|
||||
@@ -1,5 +0,0 @@
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Guida di Mimante
|
||||
url: https://gitea.encke-hake.ts.net/Alby96/Mimante/src/branch/main/README.md
|
||||
about: Installazione su Unraid, primo avvio, modi e paletti, dati e problemi comuni
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
name: Difetto
|
||||
about: Mimante fa qualcosa di sbagliato, o non fa ciò che dovrebbe
|
||||
title: "Difetto: "
|
||||
labels: ["Kind/Bug"]
|
||||
---
|
||||
|
||||
<!--
|
||||
Mai in una segnalazione: password (DB_PASSWORD, UI_PASSWORD, Bidoo), cookie della sessione, token di Telegram,
|
||||
contenuto di /config/sessione. I registri di Mimante non li contengono: se ne incolli un pezzo, controlla comunque.
|
||||
-->
|
||||
|
||||
## Che cosa succede
|
||||
|
||||
<!-- Che cosa vedi, con il testo esatto dei messaggi. -->
|
||||
|
||||
## Che cosa ti aspettavi
|
||||
|
||||
## Come rifarlo
|
||||
|
||||
1.
|
||||
2.
|
||||
|
||||
## Dove
|
||||
|
||||
- Versione di Mimante (pagina Impostazioni o etichetta dell'immagine):
|
||||
- Sito vero o simulatore:
|
||||
- Asta (identificativo), se riguarda un'asta:
|
||||
|
||||
## Registro
|
||||
|
||||
<!-- Le righe del registro intorno al problema (/config/registri o la scheda Registro dell'asta). -->
|
||||
|
||||
```text
|
||||
```
|
||||
@@ -1,24 +0,0 @@
|
||||
---
|
||||
name: Proposta
|
||||
about: Una funzione nuova o un cambiamento di comportamento
|
||||
title: "Proposta: "
|
||||
labels: ["Kind/Feature"]
|
||||
---
|
||||
|
||||
## Il problema
|
||||
|
||||
<!-- Che cosa non riesci a fare oggi, o che cosa ti costa troppo. -->
|
||||
|
||||
## La proposta
|
||||
|
||||
## Regole toccate
|
||||
|
||||
<!-- Una proposta che mette un'euristica di strategia fuori dal modello, scrive sul percorso caldo, mette nel database
|
||||
qualcosa che non serve allo storico o al modello, o aggiunge una dipendenza va discussa prima di tutto (CLAUDE.md). -->
|
||||
|
||||
- [ ] Nessuna
|
||||
- [ ] Sì, quali e perché:
|
||||
|
||||
## Come capiremo che è fatta
|
||||
|
||||
-
|
||||
@@ -1,62 +0,0 @@
|
||||
<!--
|
||||
Una richiesta di unione per ramo. Titolo in italiano: che cosa cambia.
|
||||
Si unisce in main solo con la verifica verde sull'ultimo commit (docs/processo.md). Togli i commenti che non servono.
|
||||
-->
|
||||
|
||||
## Sintesi
|
||||
|
||||
<!-- Che cosa fa questa richiesta, in due o tre frasi. -->
|
||||
|
||||
## Perché
|
||||
|
||||
<!-- Il problema, la richiesta di Alberto o la issue (#numero) da cui nasce. -->
|
||||
|
||||
## Che cosa cambia
|
||||
|
||||
<!-- Per punti: comportamento, parti toccate, scelte nuove (con la riga in docs/decisioni.md o un ADR), migrazioni,
|
||||
impostazioni, effetti sull'immagine e su Unraid. -->
|
||||
|
||||
-
|
||||
|
||||
## Come è stato provato
|
||||
|
||||
<!-- Comandi e risultati, copiati così come sono usciti. Poi, con la stessa franchezza, che cosa NON è stato provato. -->
|
||||
|
||||
```text
|
||||
dotnet build Mimante.slnx -c Release -warnaserror
|
||||
dotnet test tests/Mimante.Tests -c Release --no-build
|
||||
bash .gitea/scripts/controlli.sh
|
||||
```
|
||||
|
||||
Non provato:
|
||||
|
||||
-
|
||||
|
||||
## Rischi e ritorno indietro
|
||||
|
||||
<!-- Che cosa può andare storto, come ce ne si accorge, come si torna indietro (di solito git revert -m 1 del commit
|
||||
di unione; le migrazioni sono solo additive e restano). -->
|
||||
|
||||
## Controlli prima di unire
|
||||
|
||||
Le regole di CLAUDE.md, che valgono sempre:
|
||||
|
||||
- [ ] Il modello è l'unico decisore: nessuna euristica di strategia fuori da `Strategy/BidStrategy` e `Ml/LearningService`
|
||||
- [ ] Nessuna puntata senza utente Bidoo collegato; i paletti fermano una puntata, non la provocano
|
||||
- [ ] Percorso caldo (`data.php` → `bid.php`) senza disco, database né lock lunghi; il database passa da `WriteQueue`
|
||||
- [ ] Nel database solo storico e modello; ogni tabella o colonna nuova ha il suo «serve a…» in `docs/architettura.md`
|
||||
- [ ] Migrazioni solo additive, in un file nuovo
|
||||
- [ ] Variabili del modello cambiate → `BidFeatures.Version` alzata
|
||||
- [ ] Nessun parametro cablato: `AppSettings` o `bidoo.json`; ciò che vale al riavvio è in `SettingsStore.RestartRequired`
|
||||
- [ ] Nessun pacchetto fuori dall'elenco chiuso, nessun componente esterno
|
||||
- [ ] Mai password, token o cookie nei registri, nelle esportazioni, in `docs/` o nell'output della CI
|
||||
- [ ] Simulatore e sito vero separati: nessun dato del simulatore nel modello vero
|
||||
- [ ] Interfaccia: `title` su ogni numero e campo, DOM aggiornato in modo chirurgico, colori solo dai token, niente
|
||||
notifiche ai lati; `tools/Mimante.Schermate` finisce con «Nessun errore JavaScript» e le schermate sono state guardate
|
||||
- [ ] Interfaccia, documenti e messaggi in italiano; identificatori e file di codice in inglese
|
||||
- [ ] La verifica è verde sull'ultimo commit: controlli, prove (nessuna saltata), immagine
|
||||
- [ ] Resoconto onesto: ciò che non è stato verificato è scritto qui sopra
|
||||
|
||||
### Per CHANGELOG.md e docs/stato.md
|
||||
|
||||
-
|
||||
@@ -1,168 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Controlli veloci prima di compilare (lavoro «controlli» della CI): pochi secondi, e fermano subito gli errori che
|
||||
# altrimenti si scoprirebbero dopo le prove. Si lanciano anche a mano, dalla radice del repository:
|
||||
#
|
||||
# bash .gitea/scripts/controlli.sh
|
||||
#
|
||||
# 1. ogni script di shell è sintassi valida (bash -n; sh -n per quelli in sh) e ha le righe Unix; gli script Node
|
||||
# della CI (.gitea/scripts/*.js) sono JavaScript valido (node --check);
|
||||
# 2. i flussi della CI non hanno tabulazioni (YAML non le accetta come rientro);
|
||||
# 3. nessun file contiene segni di conflitto rimasti da un'unione;
|
||||
# 4. la versione di Directory.Build.props è x.y.z[-qualcosa] ed è la stessa nel modello Unraid e negli esempi;
|
||||
# 5. CHANGELOG.md ha la sezione «## <versione>» (rilascio.yml la copia nelle note);
|
||||
# 6. ogni progetto elencato in Mimante.slnx esiste;
|
||||
# 7. elenco chiuso dei pacchetti (CLAUDE.md): solo Npgsql, xunit, xunit.runner.visualstudio, Microsoft.NET.Test.Sdk,
|
||||
# con la versione solo in Directory.Packages.props;
|
||||
# 8. l'interfaccia (src/Mimante/wwwroot) non carica nulla da fuori: niente http(s):// in src, href, url(), import;
|
||||
# e ogni suo file JavaScript si legge come modulo (node --check su una copia .mjs: su un .js con import node
|
||||
# non segnala gli errori di sintassi);
|
||||
# 9. ogni file JSON del repository si legge.
|
||||
set -uo pipefail
|
||||
|
||||
radice="$(git rev-parse --show-toplevel)" || exit 2
|
||||
cd "$radice" || exit 2
|
||||
errori=0
|
||||
|
||||
errore() {
|
||||
echo "ERRORE: $*" >&2
|
||||
errori=$((errori + 1))
|
||||
}
|
||||
|
||||
echo "== Script di shell"
|
||||
quanti=0
|
||||
while IFS= read -r -d '' script; do
|
||||
quanti=$((quanti + 1))
|
||||
bash -n "$script" || errore "$script: sintassi bash non valida."
|
||||
if head -n 1 "$script" | grep -Eq '^#!(/usr/bin/env )?/?(bin/)?sh( |$)'; then
|
||||
sh -n "$script" || errore "$script: sintassi sh non valida."
|
||||
fi
|
||||
if grep -q $'\r' "$script"; then
|
||||
errore "$script ha righe Windows (CR): bash non le regge (.gitattributes chiede eol=lf)."
|
||||
fi
|
||||
done < <(git ls-files -z -- '*.sh')
|
||||
echo " $quanti script controllati"
|
||||
|
||||
echo "== Script Node della CI"
|
||||
if command -v node > /dev/null; then
|
||||
quanti=0
|
||||
while IFS= read -r -d '' script; do
|
||||
quanti=$((quanti + 1))
|
||||
node --check "$script" || errore "$script: JavaScript non valido."
|
||||
done < <(git ls-files -z -- '.gitea/scripts/*.js')
|
||||
echo " $quanti script controllati"
|
||||
echo "== JavaScript dell'interfaccia"
|
||||
quanti=0
|
||||
copia="$(mktemp -d)"
|
||||
while IFS= read -r -d '' modulo; do
|
||||
quanti=$((quanti + 1))
|
||||
cp "$modulo" "$copia/modulo.mjs"
|
||||
node --check "$copia/modulo.mjs" 2>&1 | sed "s|$copia/modulo.mjs|$modulo|" || true
|
||||
node --check "$copia/modulo.mjs" 2> /dev/null || errore "$modulo: JavaScript non valido."
|
||||
done < <(git ls-files -z -- 'src/Mimante/wwwroot/*.js')
|
||||
rm -rf "$copia"
|
||||
echo " $quanti moduli controllati"
|
||||
else
|
||||
errore "manca node: gli script Node della CI e i moduli dell'interfaccia non si possono controllare."
|
||||
fi
|
||||
|
||||
echo "== Flussi della CI"
|
||||
while IFS= read -r -d '' flusso; do
|
||||
if grep -n $'\t' "$flusso" > /dev/null; then
|
||||
errore "$flusso contiene tabulazioni: in YAML il rientro si fa con gli spazi."
|
||||
fi
|
||||
done < <(git ls-files -z -- '.gitea/workflows/*.yml' '.gitea/workflows/*.yaml')
|
||||
|
||||
echo "== Segni di conflitto"
|
||||
if conflitti=$(git grep -n -I -E '^(<{7}|>{7})( |$)' -- . ':!*.png' ':!*.jpg'); then
|
||||
errore "segni di conflitto rimasti:"
|
||||
echo "$conflitti" >&2
|
||||
fi
|
||||
|
||||
echo "== Versione"
|
||||
versione=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' Directory.Build.props)
|
||||
if [[ "$(printf '%s\n' "$versione" | grep -c .)" != "1" ]]; then
|
||||
errore "Directory.Build.props deve avere una sola <Version>."
|
||||
elif [[ ! "$versione" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then
|
||||
errore "versione «$versione» non valida: serve x.y.z, eventualmente con -qualcosa."
|
||||
else
|
||||
echo " $versione"
|
||||
base="${versione%%[-+]*}"
|
||||
# Gli esempi di costruzione dicono la versione corrente, così chi li copia non costruisce un'etichetta vecchia.
|
||||
while IFS= read -r riga; do
|
||||
trovata=$(sed -n 's/.*VERSION=\([0-9][0-9.]*\).*/\1/p' <<< "$riga")
|
||||
[[ -z "$trovata" || "$trovata" == "$base" ]] || errore "esempio con VERSION=$trovata invece di $base: $riga"
|
||||
done < <(git grep -h -I -E 'VERSION=[0-9]+\.[0-9]+\.[0-9]+' -- CLAUDE.md README.md docs/docker.md docker/Dockerfile .vscode/tasks.json 2> /dev/null)
|
||||
echo "== Sezione del CHANGELOG"
|
||||
if grep -Eq "^## ${base//./\\.}( |$)" CHANGELOG.md; then
|
||||
echo " ## $base presente"
|
||||
else
|
||||
errore "CHANGELOG.md non ha la sezione «## $base»: rilascio.yml non avrebbe le note."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "== Progetti della soluzione"
|
||||
while IFS= read -r progetto; do
|
||||
[[ -f "$progetto" ]] || errore "Mimante.slnx elenca $progetto, che non esiste."
|
||||
done < <(sed -n 's:.*<Project Path="\([^"]*\)".*:\1:p' Mimante.slnx)
|
||||
echo " $(grep -c '<Project Path=' Mimante.slnx) progetti"
|
||||
while IFS= read -r progetto; do
|
||||
grep -q "Path=\"$progetto\"" Mimante.slnx || errore "$progetto non è in Mimante.slnx: la CI non lo compilerebbe."
|
||||
done < <(git ls-files -- '*.csproj')
|
||||
|
||||
echo "== Pacchetti (elenco chiuso)"
|
||||
ammessi='^(Npgsql|xunit|xunit\.runner\.visualstudio|Microsoft\.NET\.Test\.Sdk)$'
|
||||
while IFS= read -r pacchetto; do
|
||||
[[ "$pacchetto" =~ $ammessi ]] || errore "pacchetto fuori dall'elenco chiuso: $pacchetto (CLAUDE.md, «Solo C#»)."
|
||||
done < <(git grep -h -o -E '<Package(Reference|Version) (Include|Update)="[^"]+"' -- '*.csproj' '*.props' '*.targets' \
|
||||
| sed -E 's/.*="([^"]+)"/\1/' | sort -u)
|
||||
if git grep -n -E '<PackageReference [^>]*Version=' -- '*.csproj' > /dev/null; then
|
||||
errore "una PackageReference ha la versione nel progetto: le versioni stanno solo in Directory.Packages.props."
|
||||
git grep -n -E '<PackageReference [^>]*Version=' -- '*.csproj' >&2
|
||||
fi
|
||||
if git ls-files -- 'packages.config' '**/packages.config' 'package.json' '**/package.json' | grep -q .; then
|
||||
errore "packages.config o package.json nel repository: niente gestori di pacchetti oltre a NuGet centrale."
|
||||
fi
|
||||
|
||||
echo "== Risorse esterne nell'interfaccia"
|
||||
if esterne=$(git grep -n -I -E '(src|href)=["'"'"']https?://|url\(["'"'"']?https?://|@import +(url\()?["'"'"']https?://|import .* from ["'"'"']https?://' \
|
||||
-- 'src/Mimante/wwwroot' 'src/Mimante/Web/*.cs'); then
|
||||
errore "l'interfaccia carica risorse da fuori (caratteri, script, stili vanno copiati in wwwroot):"
|
||||
echo "$esterne" >&2
|
||||
fi
|
||||
|
||||
echo "== File JSON"
|
||||
if command -v node > /dev/null; then
|
||||
# Un solo processo per tutti i file; stampa i file che non si leggono, uno per riga. Commenti e virgole finali sono
|
||||
# ammessi come li ammette il programma (BidooReferences: JsonCommentHandling.Skip, AllowTrailingCommas) e VS Code.
|
||||
guasti=$(git ls-files -z -- '*.json' | node -e '
|
||||
const fs = require("fs");
|
||||
const jsonc = (s) => {
|
||||
let out = "", i = 0, str = false;
|
||||
while (i < s.length) {
|
||||
const c = s[i], d = s[i + 1];
|
||||
if (str) { out += c; if (c === "\\") { out += d; i += 2; continue; } if (c === "\"") str = false; i++; continue; }
|
||||
if (c === "\"") { str = true; out += c; i++; continue; }
|
||||
if (c === "/" && d === "/") { while (i < s.length && s[i] !== "\n") i++; continue; }
|
||||
if (c === "/" && d === "*") { i = s.indexOf("*/", i + 2); if (i < 0) throw new Error("commento non chiuso"); i += 2; continue; }
|
||||
out += c; i++;
|
||||
}
|
||||
return out.replace(/,(\s*[}\]])/g, "$1");
|
||||
};
|
||||
const files = fs.readFileSync(0, "utf8").split("\0").filter(Boolean);
|
||||
for (const f of files) {
|
||||
try { JSON.parse(jsonc(fs.readFileSync(f, "utf8").replace(/^/, ""))); } catch (e) { console.log(f + ": " + e.message); }
|
||||
}
|
||||
console.error(" " + files.length + " file controllati");')
|
||||
if [[ -n "$guasti" ]]; then
|
||||
errore "JSON non valido:"
|
||||
echo "$guasti" >&2
|
||||
fi
|
||||
else
|
||||
errore "manca node: i file JSON non si possono controllare."
|
||||
fi
|
||||
|
||||
if ((errori > 0)); then
|
||||
echo "Controlli falliti: $errori." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Controlli superati."
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Costruzione dell'immagine Docker di Mimante con il builder buildx dell'esecuzione (docker-container), sempre con gli
|
||||
# stessi argomenti e le stesse etichette: la costruzione che si pubblica esce intera dalla cache di quella che si è
|
||||
# provata e scansionata, quindi gli strati sono gli stessi.
|
||||
#
|
||||
# costruisci-immagine.sh archivio <file.tar> <nome locale> archivio dell'immagine, per docker load e per Trivy
|
||||
# costruisci-immagine.sh pubblica <nome:etichetta>... spinta sul registro da buildx: le credenziali sono
|
||||
# già nella configurazione del client, il demone non
|
||||
# parla mai con il registro (proverebbe HTTPS)
|
||||
#
|
||||
# Manifest semplice, senza attestazioni (--provenance=false --sbom=false): con un indice Gitea terrebbe ogni manifest
|
||||
# figlio come versione a sé, senza etichetta, e la pulizia delle :sha- non libererebbe gli strati.
|
||||
#
|
||||
# Variabili richieste: BUILDER, VERSIONE, GIT_COMMIT, FLUSSO (verifica o rilascio), ESECUZIONE (gitea.run_id).
|
||||
# Le etichette mimante.ci.* dicono quale flusso, esecuzione, ramo e commit hanno costruito l'immagine; stanno anche
|
||||
# nell'immagine pubblicata e Docker le copia in ogni contenitore, anche nel Mimante vero di Unraid. Per questo qui non
|
||||
# si mette mai mimante.ci.prova, il segno dei soli contenitori di prova (prova-immagine.sh): lo controlla PipelineTests.
|
||||
set -euo pipefail
|
||||
|
||||
modo="${1:?Indica il modo: archivio o pubblica.}"
|
||||
shift
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
comuni=(--builder "${BUILDER:?}" -f docker/Dockerfile --provenance=false --sbom=false
|
||||
--build-arg "VERSION=${VERSIONE:?}" --build-arg "GIT_COMMIT=${GIT_COMMIT:?}"
|
||||
--label "mimante.ci.workflow=${FLUSSO:?}" --label "mimante.ci.run=${ESECUZIONE:?}"
|
||||
--label "mimante.ci.ref=${GITHUB_REF_NAME:-}" --label "mimante.ci.commit=${GITHUB_SHA:-}")
|
||||
|
||||
case "$modo" in
|
||||
archivio)
|
||||
archivio="${1:?Indica il file .tar da scrivere.}"
|
||||
nome="${2:?Indica il nome locale, per esempio mimante-ci:123.}"
|
||||
mkdir -p "$(dirname "$archivio")"
|
||||
docker buildx build "${comuni[@]}" --output "type=docker,name=$nome,dest=$archivio" .
|
||||
echo "Archivio dell'immagine: $archivio ($(du -h "$archivio" | cut -f1))"
|
||||
;;
|
||||
pubblica)
|
||||
(($# > 0)) || { echo "Indica almeno un nome:etichetta da pubblicare." >&2; exit 2; }
|
||||
etichette=()
|
||||
for nome in "$@"; do
|
||||
etichette+=(-t "$nome")
|
||||
done
|
||||
docker buildx build "${comuni[@]}" "${etichette[@]}" --push .
|
||||
printf 'Pubblicata: %s\n' "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Modo sconosciuto: «$modo» (archivio o pubblica)." >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
@@ -1,114 +0,0 @@
|
||||
// Pilota della prova di carico (prova-carico.sh): gira in un contenitore node sulla rete interna della prova, entra
|
||||
// nell'interfaccia come un browser e usa lo stesso canale WebSocket (comandi con rid, ack, blocco di stato «export»).
|
||||
// INDIRIZZO http://mimante-prova-<esecuzione>:8080
|
||||
// UI_PASSWORD la password casuale della prova (non si stampa mai)
|
||||
// RIGHE righe massime dell'esportazione (1.000.000)
|
||||
// Codice di uscita 0 solo se l'esportazione finisce con esattamente RIGHE righe e la seconda si annulla entro 5 s.
|
||||
|
||||
const base = process.env.INDIRIZZO;
|
||||
const password = process.env.UI_PASSWORD;
|
||||
const rows = Number(process.env.RIGHE || 1000000);
|
||||
const minutes = 40;
|
||||
|
||||
function fail(message) {
|
||||
console.error(message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
main().catch(e => fail(`Prova interrotta: ${e.message}`));
|
||||
|
||||
async function main() {
|
||||
const login = await fetch(base + '/accesso', {
|
||||
method: 'POST',
|
||||
body: new URLSearchParams({ password }),
|
||||
redirect: 'manual'
|
||||
});
|
||||
const cookie = (login.headers.getSetCookie?.() || []).map(c => c.split(';')[0]).find(c => c.startsWith('mimante_sessione='));
|
||||
if (!cookie) fail(`Accesso all'interfaccia non riuscito (HTTP ${login.status}).`);
|
||||
console.log('accesso all\'interfaccia: ok');
|
||||
|
||||
// Origin come la manderebbe il browser: senza, il bot rifiuta il canale (WebServer, OriginCheck).
|
||||
const ws = new WebSocket(base.replace(/^http/, 'ws') + '/ws', { headers: { Cookie: cookie, Origin: new URL(base).origin } });
|
||||
const pending = new Map();
|
||||
const watchers = new Set();
|
||||
let nextRid = 1;
|
||||
|
||||
ws.onmessage = ev => {
|
||||
let m;
|
||||
try { m = JSON.parse(ev.data); } catch { return; }
|
||||
if (m.t === 'ack' && pending.has(m.rid)) {
|
||||
pending.get(m.rid)(m);
|
||||
pending.delete(m.rid);
|
||||
return;
|
||||
}
|
||||
const exp = m.t === 'export' ? m : m.export;
|
||||
if (exp) for (const w of watchers) w(exp);
|
||||
};
|
||||
ws.onclose = () => { for (const w of watchers) w({ state: 'closed' }); };
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
ws.onopen = resolve;
|
||||
ws.onerror = () => reject(new Error('WebSocket non aperto'));
|
||||
}).catch(e => fail(e.message));
|
||||
|
||||
function send(msg) {
|
||||
const rid = nextRid++;
|
||||
return new Promise(resolve => {
|
||||
pending.set(rid, resolve);
|
||||
ws.send(JSON.stringify({ ...msg, rid }));
|
||||
});
|
||||
}
|
||||
|
||||
/** Aspetta che il blocco «export» arrivi a uno stato finale, entro ms; scrive le fasi una volta sola. */
|
||||
function until(states, ms) {
|
||||
return new Promise(resolve => {
|
||||
let phase = '';
|
||||
let last = 0;
|
||||
const timer = setTimeout(() => { watchers.delete(w); resolve({ state: 'timeout' }); }, ms);
|
||||
const w = s => {
|
||||
if (s.state === 'closed') { clearTimeout(timer); watchers.delete(w); resolve(s); return; }
|
||||
if (s.phase && s.phase !== phase) { phase = s.phase; console.log(` fase: ${phase}`); }
|
||||
if (s.state === 'running' && Date.now() - last > 30000) {
|
||||
last = Date.now();
|
||||
console.log(` ${s.rows ?? 0} righe su ${s.total ?? '?'}`);
|
||||
}
|
||||
if (states.includes(s.state)) { clearTimeout(timer); watchers.delete(w); resolve(s); }
|
||||
};
|
||||
watchers.add(w);
|
||||
});
|
||||
}
|
||||
|
||||
const day = d => d.toISOString().slice(0, 10);
|
||||
const now = Date.now();
|
||||
const request = {
|
||||
t: 'export.start', what: 'dati_modello', from: day(new Date(now - 35 * 86400000)), to: day(new Date(now + 86400000)),
|
||||
onlyMyBids: false, maxRows: rows
|
||||
};
|
||||
|
||||
const started = Date.now();
|
||||
const done = until(['done', 'failed', 'cancelled'], minutes * 60000);
|
||||
const ack = await send(request);
|
||||
if (!ack.ok) fail(`L'esportazione non parte: ${ack.msg}`);
|
||||
const end = await done;
|
||||
const seconds = Math.round((Date.now() - started) / 1000);
|
||||
if (end.state !== 'done') fail(`Esportazione finita come «${end.state}» dopo ${seconds} s: ${end.message ?? ''}`);
|
||||
console.log(`esportazione finita in ${seconds} s: ${end.rows} righe, campionata: ${end.sampled ? 'sì' : 'no'}, file: ${(end.files || []).join(', ')}`);
|
||||
if (end.rows !== rows) fail(`Righe scritte ${end.rows}, attese ${rows}.`);
|
||||
|
||||
// Una seconda, annullata dopo 3 secondi: deve fermarsi entro 5 senza lasciare file a metà.
|
||||
const running = until(['running'], 10000);
|
||||
const ack2 = await send(request);
|
||||
if (!ack2.ok) fail(`La seconda esportazione non parte: ${ack2.msg}`);
|
||||
await running;
|
||||
await new Promise(r => setTimeout(r, 3000));
|
||||
const stopped = until(['cancelled', 'done', 'failed'], 5000);
|
||||
const asked = Date.now();
|
||||
const ack3 = await send({ t: 'export.cancel' });
|
||||
if (!ack3.ok) fail(`Annullamento rifiutato: ${ack3.msg}`);
|
||||
const after = await stopped;
|
||||
if (after.state !== 'cancelled') fail(`Dopo l'annullamento lo stato è «${after.state}» invece di «cancelled».`);
|
||||
console.log(`annullata in ${((Date.now() - asked) / 1000).toFixed(1)} s`);
|
||||
|
||||
ws.close();
|
||||
process.exit(0);
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Prova di carico delle esportazioni (#25): l'immagine appena costruita, con il tetto di memoria del modello Unraid,
|
||||
# esporta un milione di righe da un archivio sintetico e non deve né cadere né gonfiarsi.
|
||||
#
|
||||
# .gitea/scripts/prova-carico.sh <immagine> [esecuzione] [decisioni]
|
||||
#
|
||||
# Come prova-immagine.sh: rete Docker INTERNA dell'esecuzione (niente Internet, nessuna richiesta a Bidoo), PostgreSQL
|
||||
# 18 usa e getta senza porte pubblicate, password casuali che vivono solo nell'ambiente e non si stampano, segno
|
||||
# mimante.ci.prova=<esecuzione> e nomi mimante-prova-<esecuzione>[-db] che pulizia-docker.sh riconosce.
|
||||
#
|
||||
# 1. Mimante parte con --memory=1g (come il modello Unraid) e crea tabelle e partizioni del mese;
|
||||
# 2. l'archivio si riempie in SQL: 1.000 aste, <decisioni> decisioni (1.200.000) e una puntata per decisione, tutte
|
||||
# nel mese corrente, tipo «normal» (il sito vero: il simulatore non va nel contenitore);
|
||||
# 3. prova-carico.js, in un contenitore node sulla stessa rete, entra con la password, chiede «dati del modello» con
|
||||
# 1.000.000 righe al massimo (si campiona) e aspetta la fine; poi ne fa partire un'altra e la annulla;
|
||||
# 4. durante tutto il lavoro si legge la memoria residente del processo; si ferma se il contenitore cade, se Docker lo
|
||||
# uccide per memoria, se le righe non sono 1.000.000, se il picco supera SOGLIA_MB (768) o se restano file .tmp.
|
||||
set -euo pipefail
|
||||
|
||||
immagine="${1:?Indica quale immagine provare.}"
|
||||
esecuzione="${2:-${ESECUZIONE:-locale}}"
|
||||
decisioni="${3:-1200000}"
|
||||
righe=1000000
|
||||
soglia_mb="${SOGLIA_MB:-768}"
|
||||
cartella_script="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
segno=(--label "mimante.ci.prova=$esecuzione")
|
||||
nome="mimante-prova-$esecuzione"
|
||||
db="$nome-db"
|
||||
rete="$nome"
|
||||
memoria_file="$(mktemp)"
|
||||
|
||||
togli() {
|
||||
local oggetto valore
|
||||
[[ -n "${campionatore:-}" ]] && kill "$campionatore" 2> /dev/null || true
|
||||
rm -f "$memoria_file"
|
||||
for oggetto in "$nome" "$db"; do
|
||||
valore=$(docker container inspect -f '{{index .Config.Labels "mimante.ci.prova"}}' "$oggetto" 2> /dev/null) || continue
|
||||
[[ "$valore" == "$esecuzione" ]] && docker rm -f -v "$oggetto" > /dev/null 2>&1 || true
|
||||
done
|
||||
valore=$(docker network inspect -f '{{index .Labels "mimante.ci.prova"}}' "$rete" 2> /dev/null) || return 0
|
||||
[[ "$valore" == "$esecuzione" ]] && docker network rm "$rete" > /dev/null 2>&1 || true
|
||||
}
|
||||
trap togli EXIT
|
||||
togli
|
||||
memoria_file="$(mktemp)"
|
||||
|
||||
registro() {
|
||||
echo "Registro di Mimante:" >&2
|
||||
docker logs --tail 80 "$nome" >&2 || true
|
||||
}
|
||||
|
||||
# La memoria residente del processo di Mimante (non quella del contenitore, che conta anche la cache dei file scritti):
|
||||
# «VmRSS VmHWM» in kB, il valore attuale e il picco dall'avvio.
|
||||
memoria() {
|
||||
docker exec "$nome" sh -c 'for p in /proc/[0-9]*; do
|
||||
c=$(tr "\0" " " < "$p/cmdline" 2> /dev/null) || continue
|
||||
case "$c" in *Mimante.dll*--salute*) ;; *Mimante.dll*) awk "/^VmHWM/ {h = \$2} /^VmRSS/ {r = \$2} END {print r, h}" "$p/status"; exit 0 ;; esac
|
||||
done; exit 1' 2> /dev/null
|
||||
}
|
||||
|
||||
echo "== Immagine"
|
||||
echo "dimensione: $(($(docker image inspect -f '{{.Size}}' "$immagine") / 1024 / 1024)) MB"
|
||||
|
||||
echo "== Rete interna e PostgreSQL usa e getta"
|
||||
docker network create --internal "${segno[@]}" "$rete" > /dev/null
|
||||
DB_PASSWORD="$(head -c 32 /dev/urandom | base64 | tr -dc 'A-Za-z0-9')"
|
||||
UI_PASSWORD="$(head -c 32 /dev/urandom | base64 | tr -dc 'A-Za-z0-9')"
|
||||
POSTGRES_PASSWORD="$DB_PASSWORD"
|
||||
export DB_PASSWORD UI_PASSWORD POSTGRES_PASSWORD
|
||||
docker run -d --name "$db" --network "$rete" "${segno[@]}" --shm-size=256m \
|
||||
-e POSTGRES_USER=admin -e POSTGRES_DB=autobidder -e POSTGRES_PASSWORD postgres:18 > /dev/null
|
||||
unset POSTGRES_PASSWORD
|
||||
pronto() { docker exec "$db" pg_isready -h 127.0.0.1 -U admin -d autobidder > /dev/null 2>&1; }
|
||||
for _ in $(seq 1 60); do
|
||||
pronto && break
|
||||
sleep 2
|
||||
done
|
||||
pronto || { echo "PostgreSQL di prova non pronto." >&2; docker logs --tail 40 "$db" >&2 || true; exit 1; }
|
||||
|
||||
echo "== Mimante con --memory=1g"
|
||||
docker run -d --name "$nome" --network "$rete" "${segno[@]}" --memory=1g --memory-swap=1g --stop-timeout 15 \
|
||||
-e DB_HOST="$db" -e DB_PASSWORD -e UI_PASSWORD "$immagine" > /dev/null
|
||||
unset DB_PASSWORD
|
||||
stato=""
|
||||
for _ in $(seq 1 36); do
|
||||
[[ "$(docker inspect -f '{{.State.Running}}' "$nome")" == "true" ]] || { echo "Mimante si è fermato da solo." >&2; registro; exit 1; }
|
||||
stato="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{end}}' "$nome")"
|
||||
[[ "$stato" == "healthy" || "$stato" == "unhealthy" ]] && break
|
||||
sleep 5
|
||||
done
|
||||
[[ "$stato" == "healthy" ]] || { echo "Il controllo di salute dice «${stato:-niente}»." >&2; registro; exit 1; }
|
||||
echo "salute: healthy"
|
||||
|
||||
echo "== Archivio sintetico: 1.000 aste, $decisioni decisioni e altrettante puntate"
|
||||
inizio=$(date +%s)
|
||||
docker exec -i "$db" psql -q -U admin -d autobidder -v ON_ERROR_STOP=1 -v decisioni="$decisioni" <<'SQL'
|
||||
INSERT INTO auctions(auction_id, name, product_key, type, outcome, final_price, end_time, my_bids)
|
||||
SELECT 'C' || a, 'Carico ' || a, 'carico-' || (a % 50), 'normal', 'lost', 12.00, now(), 0 FROM generate_series(1, 1000) a;
|
||||
CREATE TEMP TABLE periodo AS SELECT greatest(date_trunc('month', now()), now() - interval '3 days') AS t0, now() AS t1;
|
||||
INSERT INTO bot_decisions(decision_id, auction_id, ts, created_at, price, timer, action, kind, outcome, shadow, reason_detail,
|
||||
p_model, p_win, ev, value, bid_cost)
|
||||
SELECT g, 'C' || (g % 1000 + 1), x.t, x.t, 1.00 + (g / 1000) * 0.01, (g % 10) * 0.1, 'NO-OP', 'ev-negativo',
|
||||
CASE WHEN g % 10 = 0 THEN 'missed' WHEN g % 10 = 1 THEN 'right_bid' ELSE 'right_skip' END, true,
|
||||
'valore atteso negativo, servirebbe una probabilità più alta', 0.1, 0.1, -0.2, 50, 0.5
|
||||
FROM generate_series(1, :decisioni) g, periodo p, LATERAL (SELECT p.t0 + (p.t1 - p.t0) * (g::float8 / :decisioni) AS t) x;
|
||||
INSERT INTO bids(auction_id, username, price_after, bid_type, server_ts, created_at)
|
||||
SELECT d.auction_id, 'utente' || (d.decision_id % 37), d.price + 0.01, 'auto', extract(epoch FROM d.ts)::bigint + 1, d.ts
|
||||
FROM bot_decisions d;
|
||||
ANALYZE auctions;
|
||||
ANALYZE bot_decisions;
|
||||
ANALYZE bids;
|
||||
SQL
|
||||
echo "archivio pronto in $(($(date +%s) - inizio)) s"
|
||||
|
||||
read -r rss_kb _ < <(memoria) || { echo "Non trovo il processo di Mimante nel contenitore." >&2; exit 1; }
|
||||
echo "memoria residente prima delle esportazioni: $((rss_kb / 1024)) MB"
|
||||
|
||||
# Un campione ogni 2 secondi, finché il pilota lavora.
|
||||
(
|
||||
while sleep 2; do
|
||||
valori=$(memoria) || continue
|
||||
echo "$(date +%s) $valori" >> "$memoria_file"
|
||||
done
|
||||
) &
|
||||
campionatore=$!
|
||||
|
||||
echo "== Esportazione di $righe righe, poi una annullata"
|
||||
inizio=$(date +%s)
|
||||
esito=0
|
||||
INDIRIZZO="http://$nome:8080" RIGHE="$righe" docker run --rm -i --network "$rete" "${segno[@]}" \
|
||||
-e INDIRIZZO -e UI_PASSWORD -e RIGHE node:24-trixie node - < "$cartella_script/prova-carico.js" || esito=$?
|
||||
unset UI_PASSWORD
|
||||
kill "$campionatore" 2> /dev/null || true
|
||||
wait "$campionatore" 2> /dev/null || true
|
||||
campionatore=""
|
||||
echo "durata: $(($(date +%s) - inizio)) s"
|
||||
|
||||
echo "== Memoria"
|
||||
if [[ "$(docker inspect -f '{{.State.OOMKilled}}' "$nome")" == "true" ]]; then
|
||||
echo "Docker ha ucciso Mimante per memoria (--memory=1g)." >&2
|
||||
registro
|
||||
exit 1
|
||||
fi
|
||||
[[ "$(docker inspect -f '{{.State.Running}}' "$nome")" == "true" ]] || { echo "Mimante è caduto durante l'esportazione." >&2; registro; exit 1; }
|
||||
read -r rss_dopo hwm_kb < <(memoria) || { echo "Non leggo più la memoria di Mimante." >&2; exit 1; }
|
||||
primo=$(head -n 1 "$memoria_file" | cut -d' ' -f1)
|
||||
awk -v p="${primo:-0}" 'NR % 10 == 1 { printf " +%4d s %5d MB\n", $1 - p, $2 / 1024 }' "$memoria_file"
|
||||
echo "residente prima: $((rss_kb / 1024)) MB; dopo: $((rss_dopo / 1024)) MB; picco: $((hwm_kb / 1024)) MB (soglia $soglia_mb MB)"
|
||||
|
||||
residui=$(docker exec "$nome" sh -c 'find /config -name "*.tmp" | head -n 5')
|
||||
[[ -z "$residui" ]] || { echo "File a metà rimasti in /config: $residui" >&2; esito=1; }
|
||||
docker exec "$nome" sh -c 'ls -l /config/esportazioni 2> /dev/null || true'
|
||||
|
||||
((esito == 0)) || { echo "Il pilota delle esportazioni si è fermato con codice $esito." >&2; registro; exit 1; }
|
||||
if ((hwm_kb / 1024 > soglia_mb)); then
|
||||
echo "Il picco di memoria residente supera la soglia di $soglia_mb MB." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Prova di carico superata."
|
||||
@@ -1,119 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Prova dell'immagine appena costruita, sul demone Docker del runner, che è quello di Unraid: lo stesso dove gira il
|
||||
# PostgreSQL vero di Mimante. Per questo:
|
||||
# - tutto sta su una rete Docker INTERNA di questa esecuzione (--internal): niente Internet, quindi nessuna
|
||||
# richiesta a Bidoo, e nessun contenitore raggiunge la rete di casa;
|
||||
# - il database è un PostgreSQL 18 usa e getta su quella rete, senza porte pubblicate, con una password casuale che
|
||||
# vive solo nell'ambiente del client Docker e non si stampa mai;
|
||||
# - ogni oggetto porta l'etichetta mimante.ci.prova=<esecuzione> (messa qui, mai nell'immagine) e un nome
|
||||
# mimante-prova-<esecuzione>[-db]: sono i segni con cui pulizia-docker.sh li riconosce.
|
||||
#
|
||||
# .gitea/scripts/prova-immagine.sh <immagine> [esecuzione]
|
||||
#
|
||||
# 1. /app/Mimante.dll c'è e Chromium no (la sessione si incolla, ADR 0017);
|
||||
# 2. il contenitore parte come dice il modello Unraid (PUID/PGID predefiniti, /config), le migrazioni passano, il
|
||||
# controllo di salute dell'immagine diventa «healthy» e «--salute» risponde;
|
||||
# 3. i file scritti in /config sono dell'utente 99:100, come serve alla share appdata di Unraid;
|
||||
# 4. allo stop si ferma da solo entro i 15 secondi del modello (--stop-timeout 15).
|
||||
set -euo pipefail
|
||||
|
||||
immagine="${1:?Indica quale immagine provare.}"
|
||||
esecuzione="${2:-${ESECUZIONE:-locale}}"
|
||||
segno=(--label "mimante.ci.prova=$esecuzione")
|
||||
nome="mimante-prova-$esecuzione"
|
||||
db="$nome-db"
|
||||
rete="$nome"
|
||||
|
||||
# Toglie gli oggetti di prova di questa esecuzione (anche quelli di un tentativo precedente), ma solo se portano il
|
||||
# segno della prova: un oggetto con lo stesso nome e senza segno resta, e il comando che lo crea si ferma.
|
||||
togli() {
|
||||
local oggetto valore
|
||||
for oggetto in "$nome" "$db"; do
|
||||
valore=$(docker container inspect -f '{{index .Config.Labels "mimante.ci.prova"}}' "$oggetto" 2> /dev/null) || continue
|
||||
[[ "$valore" == "$esecuzione" ]] && docker rm -f -v "$oggetto" > /dev/null 2>&1 || true
|
||||
done
|
||||
valore=$(docker network inspect -f '{{index .Labels "mimante.ci.prova"}}' "$rete" 2> /dev/null) || return 0
|
||||
[[ "$valore" == "$esecuzione" ]] && docker network rm "$rete" > /dev/null 2>&1 || true
|
||||
}
|
||||
trap togli EXIT
|
||||
togli
|
||||
|
||||
registro() {
|
||||
echo "Registro di Mimante:" >&2
|
||||
docker logs --tail 80 "$nome" >&2 || true
|
||||
}
|
||||
|
||||
echo "== Programma, senza browser"
|
||||
docker run --rm --network none "${segno[@]}" --entrypoint sh "$immagine" -c 'test -s /app/Mimante.dll && echo "/app/Mimante.dll presente"'
|
||||
docker run --rm --network none "${segno[@]}" --entrypoint sh "$immagine" -c 'test ! -e /usr/bin/chromium && echo "nessun Chromium nell immagine"'
|
||||
|
||||
echo "== Rete interna e PostgreSQL usa e getta"
|
||||
docker network create --internal "${segno[@]}" "$rete" > /dev/null
|
||||
DB_PASSWORD="$(head -c 32 /dev/urandom | base64 | tr -dc 'A-Za-z0-9')"
|
||||
UI_PASSWORD="$(head -c 32 /dev/urandom | base64 | tr -dc 'A-Za-z0-9')"
|
||||
POSTGRES_PASSWORD="$DB_PASSWORD"
|
||||
export DB_PASSWORD UI_PASSWORD POSTGRES_PASSWORD
|
||||
docker run -d --name "$db" --network "$rete" "${segno[@]}" \
|
||||
-e POSTGRES_USER=admin -e POSTGRES_DB=autobidder -e POSTGRES_PASSWORD postgres:18 > /dev/null
|
||||
unset POSTGRES_PASSWORD
|
||||
# Su TCP e non sul socket: al primo avvio l'immagine accende un server temporaneo solo sul socket per l'inizializzazione,
|
||||
# lo spegne e riparte; chiedendo sul socket si vede «pronto» proprio prima di quella pausa.
|
||||
pronto() { docker exec "$db" pg_isready -h 127.0.0.1 -U admin -d autobidder > /dev/null 2>&1; }
|
||||
for _ in $(seq 1 60); do
|
||||
pronto && break
|
||||
sleep 2
|
||||
done
|
||||
if ! pronto; then
|
||||
echo "PostgreSQL di prova non pronto." >&2
|
||||
docker logs --tail 40 "$db" >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
echo "PostgreSQL di prova pronto"
|
||||
|
||||
echo "== Avvio, salute, file e arresto"
|
||||
docker run -d --name "$nome" --network "$rete" "${segno[@]}" --stop-timeout 15 \
|
||||
-e DB_HOST="$db" -e DB_PASSWORD -e UI_PASSWORD "$immagine" > /dev/null
|
||||
unset DB_PASSWORD UI_PASSWORD
|
||||
|
||||
# Il primo controllo di salute arriva dopo l'intervallo dell'immagine (30 s, con 60 s di avvio): fino a 3 minuti.
|
||||
stato=""
|
||||
for _ in $(seq 1 36); do
|
||||
if [[ "$(docker inspect -f '{{.State.Running}}' "$nome")" != "true" ]]; then
|
||||
echo "Il contenitore si è fermato da solo (codice $(docker inspect -f '{{.State.ExitCode}}' "$nome"))." >&2
|
||||
registro
|
||||
exit 1
|
||||
fi
|
||||
stato="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{end}}' "$nome")"
|
||||
[[ "$stato" == "healthy" || "$stato" == "unhealthy" ]] && break
|
||||
sleep 5
|
||||
done
|
||||
if [[ "$stato" != "healthy" ]]; then
|
||||
echo "Il controllo di salute dice «${stato:-niente}» invece di «healthy»." >&2
|
||||
registro
|
||||
exit 1
|
||||
fi
|
||||
if ! docker exec "$nome" dotnet /app/Mimante.dll --salute > /dev/null; then
|
||||
echo "«--salute» non risponde dentro il contenitore." >&2
|
||||
registro
|
||||
exit 1
|
||||
fi
|
||||
echo "salute: healthy, e --salute risponde"
|
||||
|
||||
estranei=$(docker exec "$nome" sh -c 'find /config \( ! -user 99 -o ! -group 100 \) -print | head -n 20')
|
||||
if [[ -n "$estranei" ]]; then
|
||||
echo "File di /config che non sono di 99:100 (la share appdata di Unraid non li leggerebbe):" >&2
|
||||
echo "$estranei" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "file di /config: tutti di 99:100"
|
||||
|
||||
inizio=$(date +%s)
|
||||
docker stop -t 15 "$nome" > /dev/null
|
||||
durata=$(($(date +%s) - inizio))
|
||||
codice="$(docker inspect -f '{{.State.ExitCode}}' "$nome")"
|
||||
echo "arresto in ${durata} s (codice di uscita $codice)"
|
||||
if ((durata >= 15)); then
|
||||
echo "Mimante non si è fermato da solo entro 15 secondi: Docker l'ha dovuto uccidere." >&2
|
||||
registro
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,226 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pulizia di ciò che la CI di Mimante lascia sul demone Docker del runner (quello di Unraid, dove girano anche il
|
||||
# PostgreSQL vero e il Mimante vero) e delle etichette sha- vecchie del pacchetto mimante sul registro di Gitea.
|
||||
# Tocca solo oggetti con i segni della CI di Mimante; il resto del demone (immagini senza nome, cache di tutti i
|
||||
# progetti, resti di act_runner) lo pulisce la pulizia di Febe.
|
||||
#
|
||||
# pulizia-docker.sh esecuzione <run_id> ciò che ha creato un'esecuzione: contenitori e rete di prova (anche
|
||||
# accesi), il nome locale mimante-ci:<run_id>, il builder buildx
|
||||
# pulizia-docker.sh residui [minuti] lo stesso per le esecuzioni interrotte, più vecchie di N minuti (90):
|
||||
# contenitori di prova fermi, reti senza contenitori, nomi, builder
|
||||
# pulizia-docker.sh registro [--prova] etichette sha- oltre le 10 più recenti; mai main, latest o X.Y.Z
|
||||
# pulizia-docker.sh completa [--prova] residui e registro
|
||||
#
|
||||
# Con --prova elenca e non toglie nulla. Mai system prune, container prune, volume prune o network prune; mai un
|
||||
# oggetto senza il segno mimante.ci.prova=<esecuzione> e il nome mimante-prova-<esecuzione> (contenitori, reti) o il
|
||||
# nome mimante-ci:<esecuzione> / mimante-ci-<esecuzione> (immagini, builder). Un contenitore di prova ancora acceso
|
||||
# di un'esecuzione vecchia si segnala e non si tocca.
|
||||
set -uo pipefail
|
||||
|
||||
cartella_script="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
modo="${1:-}"
|
||||
shift || true
|
||||
prova=0
|
||||
argomenti=()
|
||||
for a in "$@"; do
|
||||
if [[ "$a" == --prova ]]; then prova=1; else argomenti+=("$a"); fi
|
||||
done
|
||||
avvisi=0
|
||||
|
||||
avviso() {
|
||||
echo "::warning::$*"
|
||||
avvisi=$((avvisi + 1))
|
||||
}
|
||||
|
||||
eta_minuti() {
|
||||
local creato="$1" secondi
|
||||
secondi=$(date -d "$creato" +%s 2> /dev/null) || { echo 0; return; }
|
||||
echo $((($(date +%s) - secondi) / 60))
|
||||
}
|
||||
|
||||
togli() {
|
||||
local descrizione="$1"
|
||||
shift
|
||||
if ((prova)); then
|
||||
echo " toglierei $descrizione"
|
||||
return 0
|
||||
fi
|
||||
if "$@" > /dev/null 2>&1; then
|
||||
echo " $descrizione tolto"
|
||||
return 0
|
||||
fi
|
||||
avviso "Non riesco a togliere $descrizione."
|
||||
return 1
|
||||
}
|
||||
|
||||
# Contenitori di prova, uno per riga «id nome stato»: segno mimante.ci.prova (dell'esecuzione indicata o di qualunque)
|
||||
# e nome esatto mimante-prova-<valore> o mimante-prova-<valore>-db.
|
||||
contenitori_di_prova() {
|
||||
local run="$1" elenco id nome valore stato
|
||||
elenco=$(docker ps -a --no-trunc --filter "label=mimante.ci.prova${run:+=$run}" \
|
||||
--format '{{.ID}} {{.Names}} {{.Label "mimante.ci.prova"}} {{.State}}') || return 1
|
||||
while read -r id nome valore stato; do
|
||||
[[ -n "${id:-}" && "${valore:-}" =~ ^[0-9]+$ ]] || continue
|
||||
[[ "$nome" == "mimante-prova-$valore" || "$nome" == "mimante-prova-$valore-db" ]] || continue
|
||||
echo "$id $nome $stato"
|
||||
done <<< "$elenco"
|
||||
}
|
||||
|
||||
reti_di_prova() {
|
||||
local run="$1" elenco id nome valore
|
||||
elenco=$(docker network ls --no-trunc --filter "label=mimante.ci.prova${run:+=$run}" \
|
||||
--format '{{.ID}} {{.Name}} {{.Label "mimante.ci.prova"}}') || return 1
|
||||
while read -r id nome valore; do
|
||||
[[ -n "${id:-}" && "${valore:-}" =~ ^[0-9]+$ && "$nome" == "mimante-prova-$valore" ]] && echo "$id $nome"
|
||||
done <<< "$elenco"
|
||||
}
|
||||
|
||||
togli_builder() {
|
||||
local builder="$1"
|
||||
[[ "$builder" =~ ^mimante-ci-[0-9]+$ ]] || { avviso "Nome di builder inatteso: «$builder»."; return 1; }
|
||||
local contenitore="buildx_buildkit_${builder}0" volume="buildx_buildkit_${builder}0_state" immagine
|
||||
((prova)) || docker buildx rm -f "$builder" > /dev/null 2>&1 || true
|
||||
if immagine=$(docker container inspect -f '{{.Config.Image}}' "$contenitore" 2> /dev/null); then
|
||||
[[ "$immagine" == *moby/buildkit* ]] || { avviso "$contenitore non è un builder buildx: resta."; return 1; }
|
||||
togli "il contenitore $contenitore" docker rm -f -v "$contenitore"
|
||||
fi
|
||||
if docker volume inspect "$volume" > /dev/null 2>&1; then
|
||||
togli "il volume $volume" docker volume rm -f "$volume"
|
||||
fi
|
||||
}
|
||||
|
||||
togli_nome_locale() {
|
||||
local riferimento="$1"
|
||||
[[ "$riferimento" =~ ^mimante-ci:[0-9]+$ ]] || { avviso "Nome di immagine inatteso: «$riferimento»."; return 1; }
|
||||
docker image inspect "$riferimento" > /dev/null 2>&1 || return 0
|
||||
# Senza -f: se un contenitore la usa, Docker la lascia.
|
||||
togli "il nome $riferimento" docker image rm "$riferimento"
|
||||
}
|
||||
|
||||
esecuzione() {
|
||||
local run="${1:-}" elenco id nome stato
|
||||
[[ "$run" =~ ^[0-9]+$ ]] || { echo "Indica il numero dell'esecuzione (gitea.run_id), non «$run»." >&2; exit 2; }
|
||||
echo "== Pulizia dell'esecuzione $run"
|
||||
if elenco=$(contenitori_di_prova "$run"); then
|
||||
while read -r id nome stato; do
|
||||
[[ -n "${id:-}" ]] && togli "il contenitore $nome" docker rm -f -v "$id"
|
||||
done <<< "$elenco"
|
||||
else
|
||||
avviso "Non riesco a elencare i contenitori di prova dell'esecuzione $run."
|
||||
fi
|
||||
if elenco=$(reti_di_prova "$run"); then
|
||||
while read -r id nome; do
|
||||
[[ -n "${id:-}" ]] && togli "la rete $nome" docker network rm "$id"
|
||||
done <<< "$elenco"
|
||||
fi
|
||||
togli_nome_locale "mimante-ci:$run"
|
||||
togli_builder "mimante-ci-$run"
|
||||
}
|
||||
|
||||
residui() {
|
||||
local minuti="${1:-90}" elenco id nome stato eta riferimento
|
||||
[[ "$minuti" =~ ^[0-9]+$ ]] || { echo "I minuti devono essere un numero, non «$minuti»." >&2; exit 2; }
|
||||
echo "== Resti di esecuzioni interrotte della CI di Mimante, più vecchi di $minuti minuti"
|
||||
if elenco=$(contenitori_di_prova ""); then
|
||||
while read -r id nome stato; do
|
||||
[[ -n "${id:-}" ]] || continue
|
||||
eta=$(eta_minuti "$(docker container inspect -f '{{.Created}}' "$id" 2> /dev/null)")
|
||||
((eta >= minuti)) || continue
|
||||
case "$stato" in
|
||||
running | restarting | paused)
|
||||
avviso "Il contenitore di prova $nome è acceso da $eta minuti: la sua esecuzione si è interrotta. Non lo tocco; se nessuno lo usa più: docker rm -f -v $nome" ;;
|
||||
*) togli "il contenitore $nome" docker rm -v "$id" ;;
|
||||
esac
|
||||
done <<< "$elenco"
|
||||
else
|
||||
avviso "Non riesco a elencare i contenitori di prova."
|
||||
fi
|
||||
if elenco=$(reti_di_prova ""); then
|
||||
while read -r id nome; do
|
||||
[[ -n "${id:-}" ]] || continue
|
||||
[[ -z "$(docker ps -a -q --filter "network=$id")" ]] || continue
|
||||
eta=$(eta_minuti "$(docker network inspect -f '{{.Created}}' "$id" 2> /dev/null)")
|
||||
((eta >= minuti)) && togli "la rete $nome" docker network rm "$id"
|
||||
done <<< "$elenco"
|
||||
fi
|
||||
if elenco=$(docker image ls --filter "reference=mimante-ci" --format '{{.Repository}}:{{.Tag}}'); then
|
||||
while read -r riferimento; do
|
||||
[[ "${riferimento:-}" =~ ^mimante-ci:[0-9]+$ ]] || continue
|
||||
eta=$(eta_minuti "$(docker image inspect -f '{{.Created}}' "$riferimento" 2> /dev/null)")
|
||||
((eta >= minuti)) && togli_nome_locale "$riferimento"
|
||||
done <<< "$elenco"
|
||||
fi
|
||||
if elenco=$(docker ps -a --no-trunc --filter "name=buildx_buildkit_mimante-ci-" --format '{{.ID}} {{.Names}}'); then
|
||||
while read -r id nome; do
|
||||
[[ "${nome:-}" =~ ^buildx_buildkit_(mimante-ci-[0-9]+)0$ ]] || continue
|
||||
eta=$(eta_minuti "$(docker container inspect -f '{{.Created}}' "$id" 2> /dev/null)")
|
||||
((eta >= minuti)) && togli_builder "${BASH_REMATCH[1]}"
|
||||
done <<< "$elenco"
|
||||
fi
|
||||
}
|
||||
|
||||
registro() {
|
||||
local tenere=10
|
||||
echo "== Registro: etichette sha- del pacchetto mimante oltre le $tenere più recenti"
|
||||
if [[ -z "${REGISTRY_TOKEN:-}" ]]; then
|
||||
echo " Manca il segreto REGISTRY_TOKEN: il registro non si tocca."
|
||||
return 0
|
||||
fi
|
||||
if [[ -z "${GITEA_API:-}" || -z "${PROPRIETARIO:-}" ]]; then
|
||||
avviso "Mancano GITEA_API o PROPRIETARIO: il registro non si tocca."
|
||||
return 0
|
||||
fi
|
||||
local base="${GITEA_API%/}/packages/$PROPRIETARIO/container/mimante" cartella pagina codice scelte versione creata
|
||||
cartella=$(mktemp -d)
|
||||
for ((pagina = 1; pagina <= 200; pagina++)); do
|
||||
# Il token passa da un file di intestazioni, non dalla riga di comando (si vedrebbe in ps).
|
||||
codice=$(curl -s -o "$cartella/pagina-$pagina.json" -w '%{http_code}' -H @<(printf 'Authorization: token %s\n' "$REGISTRY_TOKEN") \
|
||||
"$base?page=$pagina&limit=50") || codice=000
|
||||
if [[ "$codice" == 404 && "$pagina" == 1 ]]; then
|
||||
echo " Il pacchetto mimante non è ancora sul registro: niente da togliere."
|
||||
rm -rf "$cartella"
|
||||
return 0
|
||||
fi
|
||||
if [[ "$codice" != 200 ]]; then
|
||||
avviso "L'API dei pacchetti risponde $codice alla pagina $pagina: il registro non si tocca."
|
||||
rm -rf "$cartella"
|
||||
return 0
|
||||
fi
|
||||
case "$(tr -d '[:space:]' < "$cartella/pagina-$pagina.json")" in "[]" | null) break ;; esac
|
||||
done
|
||||
if ! scelte=$(node "$cartella_script/versioni-registro.js" "$tenere" "$cartella"/pagina-*.json); then
|
||||
avviso "Non riesco a leggere le versioni del pacchetto mimante: il registro non si tocca."
|
||||
rm -rf "$cartella"
|
||||
return 0
|
||||
fi
|
||||
rm -rf "$cartella"
|
||||
[[ -n "$scelte" ]] || { echo " niente da togliere"; return 0; }
|
||||
while IFS=$'\t' read -r versione creata; do
|
||||
[[ "${versione:-}" =~ ^sha-[0-9a-f]{7,40}$ ]] || { avviso "Versione inattesa «${versione:-}»: resta."; continue; }
|
||||
if ((prova)); then
|
||||
echo " toglierei $versione (pubblicata il $creata)"
|
||||
continue
|
||||
fi
|
||||
codice=$(curl -s -o /dev/null -w '%{http_code}' -X DELETE -H @<(printf 'Authorization: token %s\n' "$REGISTRY_TOKEN") \
|
||||
"$base/$versione") || codice=000
|
||||
if [[ "$codice" == 204 ]]; then
|
||||
echo " $versione tolta (pubblicata il $creata)"
|
||||
else
|
||||
avviso "Non riesco a togliere $versione dal registro: l'API risponde $codice."
|
||||
fi
|
||||
done <<< "$scelte"
|
||||
}
|
||||
|
||||
case "$modo" in
|
||||
esecuzione) esecuzione "${argomenti[0]:-}" ;;
|
||||
residui) residui "${argomenti[0]:-90}" ;;
|
||||
registro) registro ;;
|
||||
completa) residui 90; registro ;;
|
||||
*)
|
||||
echo "Uso: pulizia-docker.sh esecuzione <run_id> | residui [minuti] | registro [--prova] | completa [--prova]" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
((prova)) && echo "Solo prova: non ho tolto nulla."
|
||||
echo "Pulizia finita ($avvisi avvisi)."
|
||||
exit 0
|
||||
@@ -1,106 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Riepilogo dei risultati delle prove (file .trx di «dotnet test --logger trx»): superate, fallite e saltate per ogni
|
||||
# file, i nomi delle fallite e i motivi delle saltate. Lo scrive nel registro e, se il runner lo offre, nel riepilogo
|
||||
# del lavoro (GITHUB_STEP_SUMMARY). Nessun corpo di risposta né dato personale: solo nomi di prove e messaggi.
|
||||
#
|
||||
# .gitea/scripts/riepilogo-prove.sh <cartella dei .trx> [saltate ammesse]
|
||||
#
|
||||
# Esce con 1 se una prova è fallita, se le saltate sono più di quelle ammesse (predefinito 0: nella CI c'è
|
||||
# PostgreSQL, quindi nessuna prova ha motivo di saltarsi) o se non c'è nessun risultato.
|
||||
set -euo pipefail
|
||||
|
||||
cartella="${1:?Indica la cartella con i file .trx.}"
|
||||
ammesse="${2:-${PROVE_SALTATE_AMMESSE:-0}}"
|
||||
[[ "$ammesse" =~ ^[0-9]+$ ]] || { echo "Il numero di prove saltate ammesse deve essere un intero, non «$ammesse»." >&2; exit 2; }
|
||||
|
||||
shopt -s nullglob
|
||||
file=("$cartella"/*.trx)
|
||||
if (( ${#file[@]} == 0 )); then
|
||||
echo "Nessun risultato delle prove in $cartella: le prove non sono partite." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
riepilogo="$(mktemp)"
|
||||
trap 'rm -f "$riepilogo"' EXIT
|
||||
|
||||
fallite_totali=0
|
||||
saltate_totali=0
|
||||
{
|
||||
echo "### Prove"
|
||||
echo
|
||||
echo "| Risultati | Totale | Superate | Fallite | Saltate |"
|
||||
echo "|---|---:|---:|---:|---:|"
|
||||
} > "$riepilogo"
|
||||
|
||||
for trx in "${file[@]}"; do
|
||||
nome="$(basename "$trx")"
|
||||
# Un risultato per riga (i .trx sono XML su più righe), poi nome, esito e primo messaggio di ciascuno.
|
||||
righe="$(tr '\r\n' ' ' < "$trx" | sed 's/<UnitTestResult /\n<UnitTestResult /g' | awk '
|
||||
function attributo(testo, chiave, inizio) {
|
||||
if (match(testo, chiave "=\"[^\"]*\"")) {
|
||||
return substr(testo, RSTART + length(chiave) + 2, RLENGTH - length(chiave) - 3)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
function testo_xml(s) {
|
||||
gsub(/
/, "", s); gsub(/
/, " ", s); gsub(/'/, "\047", s); gsub(/"/, "\"", s)
|
||||
gsub(/</, "<", s); gsub(/>/, ">", s); gsub(/&/, "\\&", s); gsub(/[ \t]+/, " ", s)
|
||||
return s
|
||||
}
|
||||
/^<UnitTestResult / {
|
||||
testata = $0
|
||||
sub(/>.*/, "", testata)
|
||||
messaggio = ""
|
||||
if (match($0, /<Message>[^<]*<\/Message>/)) {
|
||||
messaggio = substr($0, RSTART + 9, RLENGTH - 19)
|
||||
}
|
||||
printf "%s\t%s\t%s\n", attributo(testata, "outcome"), testo_xml(attributo(testata, "testName")), testo_xml(messaggio)
|
||||
}')"
|
||||
|
||||
totale=0; superate=0; fallite=0; saltate=0
|
||||
if [[ -n "$righe" ]]; then
|
||||
totale=$(printf '%s\n' "$righe" | wc -l)
|
||||
superate=$(printf '%s\n' "$righe" | awk -F'\t' '$1 == "Passed"' | wc -l)
|
||||
fallite=$(printf '%s\n' "$righe" | awk -F'\t' '$1 == "Failed" || $1 == "Error" || $1 == "Timeout" || $1 == "Aborted"' | wc -l)
|
||||
fi
|
||||
saltate=$((totale - superate - fallite))
|
||||
fallite_totali=$((fallite_totali + fallite))
|
||||
saltate_totali=$((saltate_totali + saltate))
|
||||
|
||||
echo "== $nome: totale $totale · superate $superate · fallite $fallite · saltate $saltate"
|
||||
echo "| \`$nome\` | $totale | $superate | $fallite | $saltate |" >> "$riepilogo"
|
||||
|
||||
if (( fallite > 0 )); then
|
||||
echo " Fallite:"
|
||||
# Le righe in più si leggono e si scartano (niente «head»: con pipefail il SIGPIPE fermerebbe lo script).
|
||||
printf '%s\n' "$righe" | awk -F'\t' '$1 == "Failed" || $1 == "Error" || $1 == "Timeout" || $1 == "Aborted" {
|
||||
if (++n > 50) next; m = $3; if (length(m) > 300) m = substr(m, 1, 300) "…"; print " - " $2 ": " m }'
|
||||
fi
|
||||
|
||||
if (( saltate > 0 )); then
|
||||
echo " Saltate, per motivo:"
|
||||
# Il motivo senza la cornice di xUnit o MSTest («Il metodo … ha generato un'eccezione. Assert.Inconclusive.»).
|
||||
printf '%s\n' "$righe" | awk -F'\t' '$1 != "Passed" && $1 != "Failed" && $1 != "Error" && $1 != "Timeout" && $1 != "Aborted" {
|
||||
m = $3; sub(/^.*Assert\.Inconclusive\. */, "", m); if (m == "") m = "(nessun motivo)"; print m }' \
|
||||
| sort | uniq -c | sort -rn | awk 'NR <= 30 { sub(/^ */, " "); print }'
|
||||
fi
|
||||
done
|
||||
|
||||
esito=0
|
||||
{
|
||||
echo
|
||||
echo "Fallite: $fallite_totali · saltate: $saltate_totali (ammesse: $ammesse)."
|
||||
} >> "$riepilogo"
|
||||
if (( fallite_totali > 0 )); then
|
||||
echo "Prove fallite: $fallite_totali (i file .trx sono fra gli artefatti dell'esecuzione)." >&2
|
||||
esito=1
|
||||
fi
|
||||
if (( saltate_totali > ammesse )); then
|
||||
echo "Prove saltate: $saltate_totali, più delle $ammesse ammesse. Qui c'è PostgreSQL: una prova che si salta segnala un ambiente rotto, non una prova superata." >&2
|
||||
esito=1
|
||||
fi
|
||||
|
||||
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
|
||||
cat "$riepilogo" >> "$GITHUB_STEP_SUMMARY" || true
|
||||
fi
|
||||
exit "$esito"
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Scansione delle vulnerabilità dell'immagine Docker con Trivy, a versione fissa (strumento.sh), sull'archivio prodotto
|
||||
# dalla costruzione (docker save o buildx --output type=docker): non serve il demone, e si scansiona proprio
|
||||
# l'immagine provata. Pacchetti di Debian e dipendenze .NET di Mimante (i file *.deps.json).
|
||||
#
|
||||
# .gitea/scripts/scansione-immagine.sh <immagine.tar> [cartella dei rapporti]
|
||||
#
|
||||
# La regola (docs/processo.md, «Rilievi di sicurezza»):
|
||||
# - CRITICAL con una correzione disponibile: il lavoro fallisce e l'immagine non si pubblica;
|
||||
# - HIGH, e CRITICAL ancora senza correzione: si riportano nel registro e in trivy.json, senza fermare nulla.
|
||||
# Le eccezioni stanno solo in .trivyignore, alla radice del repository: un identificativo per riga, con la scadenza
|
||||
# (exp:AAAA-MM-GG) e, sulla riga sopra, il motivo scritto e chi l'ha deciso.
|
||||
set -euo pipefail
|
||||
|
||||
radice="$(git rev-parse --show-toplevel)"
|
||||
archivio="${1:?Manca il file .tar da scansionare.}"
|
||||
rapporti="${2:-$radice/out/sicurezza}"
|
||||
lavoro="${RUNNER_TEMP:-/tmp}"
|
||||
strumenti="$lavoro/mimante-strumenti"
|
||||
|
||||
[[ -s "$archivio" ]] || { echo "Manca l'archivio dell'immagine: $archivio" >&2; exit 2; }
|
||||
bash "$radice/.gitea/scripts/strumento.sh" trivy "$strumenti"
|
||||
mkdir -p "$rapporti"
|
||||
|
||||
# Niente barre di avanzamento, niente controllo di versioni nuove, niente dati d'uso.
|
||||
export TRIVY_NO_PROGRESS=true TRIVY_SKIP_VERSION_CHECK=true TRIVY_DISABLE_TELEMETRY=true
|
||||
export TRIVY_CACHE_DIR="$lavoro/mimante-trivy-cache"
|
||||
comuni=(image --input "$archivio" --scanners vuln --timeout 20m)
|
||||
if [[ -f "$radice/.trivyignore" ]]; then
|
||||
comuni+=(--ignorefile "$radice/.trivyignore")
|
||||
echo "Eccezioni in .trivyignore: $(grep -c -E '^[^#[:space:]]' "$radice/.trivyignore" || true)"
|
||||
fi
|
||||
|
||||
echo "== Vulnerabilità HIGH e CRITICAL (rapporto: non fermano il lavoro)"
|
||||
"$strumenti/trivy" "${comuni[@]}" --severity HIGH,CRITICAL --format json --output "$rapporti/trivy.json" --exit-code 0
|
||||
"$strumenti/trivy" convert --format table "$rapporti/trivy.json"
|
||||
|
||||
if command -v jq > /dev/null; then
|
||||
conteggio=$(jq -r '[.Results[]?.Vulnerabilities[]?] as $v
|
||||
| "HIGH \([$v[] | select(.Severity == "HIGH")] | length) · CRITICAL \([$v[] | select(.Severity == "CRITICAL")] | length), di cui correggibili \([$v[] | select(.Severity == "CRITICAL" and ((.FixedVersion // "") != ""))] | length)"' "$rapporti/trivy.json")
|
||||
echo "Trovate: $conteggio."
|
||||
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
|
||||
printf "### Sicurezza dell'immagine (Trivy)\n\n%s.\n" "$conteggio" >> "$GITHUB_STEP_SUMMARY" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "== CRITICAL con una correzione disponibile (fermano il lavoro)"
|
||||
if "$strumenti/trivy" "${comuni[@]}" --skip-db-update --skip-java-db-update --severity CRITICAL --ignore-unfixed \
|
||||
--format table --exit-code 1; then
|
||||
echo "Nessuna vulnerabilità CRITICAL con una correzione disponibile."
|
||||
else
|
||||
echo "Vulnerabilità CRITICAL con una correzione disponibile: l'immagine non passa. Aggiorna il pacchetto o la dipendenza (docs/processo.md, «Rilievi di sicurezza»)." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Cerca segreti (gettoni, chiavi, password) con gitleaks, a versione fissa (strumento.sh), in tutta la storia del
|
||||
# commit verificato: ogni commit da cui discende, non solo l'ultimo. Ogni ramo si controlla al suo push (main a ogni
|
||||
# unione), così un rilievo su un ramo non blocca gli altri. Un segreto non compare mai per intero: --redact lo
|
||||
# sostituisce con REDACTED nel registro e nel rapporto, e qui si stampano solo regola, file, riga, commit e impronta.
|
||||
#
|
||||
# .gitea/scripts/segreti.sh [cartella del rapporto]
|
||||
#
|
||||
# Che cosa fare con un rilievo: docs/processo.md, «Rilievi di sicurezza». In breve: un segreto vero si revoca subito
|
||||
# (toglierlo dalla storia non basta); un falso allarme già controllato (un dato di prova finto) si mette in
|
||||
# .gitleaksignore con la sua impronta e, sulla riga sopra, un commento che dice che cos'è e chi l'ha controllato.
|
||||
set -euo pipefail
|
||||
|
||||
radice="$(git rev-parse --show-toplevel)"
|
||||
rapporti="${1:-$radice/out/sicurezza}"
|
||||
strumenti="${RUNNER_TEMP:-/tmp}/mimante-strumenti"
|
||||
|
||||
if [[ "$(git -C "$radice" rev-parse --is-shallow-repository)" == "true" ]]; then
|
||||
echo "Il clone è parziale: per cercare in tutta la storia serve actions/checkout con fetch-depth: 0." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
bash "$radice/.gitea/scripts/strumento.sh" gitleaks "$strumenti"
|
||||
mkdir -p "$rapporti"
|
||||
rapporto="$rapporti/gitleaks.json"
|
||||
|
||||
argomenti=(git "$radice" --log-opts="--full-history HEAD" --redact --no-banner --no-color --exit-code 1 --log-level warn
|
||||
--report-format json --report-path "$rapporto")
|
||||
[[ -f "$radice/.gitleaks.toml" ]] && argomenti+=(--config "$radice/.gitleaks.toml")
|
||||
[[ -f "$radice/.gitleaksignore" ]] && argomenti+=(--gitleaks-ignore-path "$radice/.gitleaksignore")
|
||||
|
||||
commit=$(git -C "$radice" rev-list --count HEAD)
|
||||
stato=0
|
||||
"$strumenti/gitleaks" "${argomenti[@]}" || stato=$?
|
||||
if ((stato == 0)); then
|
||||
echo "Nessun segreto in $commit commit."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -s "$rapporto" ]] && command -v jq > /dev/null; then
|
||||
quanti=$(jq 'length' "$rapporto")
|
||||
echo "Possibili segreti: $quanti (in $commit commit). Regola, file:riga, commit, impronta per .gitleaksignore:" >&2
|
||||
jq -r '.[] | " \(.RuleID) \(.File):\(.StartLine) commit \(.Commit[0:12]) impronta \(.Fingerprint)"' "$rapporto" >&2
|
||||
else
|
||||
echo "gitleaks è uscito con $stato: vedi il registro qui sopra e il rapporto $rapporto." >&2
|
||||
fi
|
||||
exit "$stato"
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installa uno dei due strumenti esterni della CI, gli unici approvati da Alberto e solo per la CI (in Febe il 20 ottobre
|
||||
# 2026, in Mimante con il piano della 2.0.0): gitleaks (segreti nella storia) e Trivy (vulnerabilità dell'immagine). Versione fissa, archivio scaricato dalla
|
||||
# release del progetto e installato solo se la sua impronta SHA-256 coincide con quella scritta qui. Le impronte sono
|
||||
# quelle dei file *_checksums.txt delle release, ricontrollate il 20 ottobre 2026 sull'archivio scaricato e
|
||||
# sull'impronta che GitHub mostra per l'allegato.
|
||||
#
|
||||
# .gitea/scripts/strumento.sh gitleaks|trivy <cartella>
|
||||
#
|
||||
# Per aggiornare uno strumento si cambiano versione e impronta insieme, in un commit solo, con una riga in
|
||||
# docs/decisioni.md. Mai «latest», mai le azioni di terzi (trivy-action fu compromessa a marzo 2026, CVE-2026-33634),
|
||||
# mai uno script di installazione scaricato al volo.
|
||||
set -euo pipefail
|
||||
|
||||
nome="${1:?Indica lo strumento: gitleaks o trivy.}"
|
||||
cartella="${2:?Indica la cartella in cui installarlo.}"
|
||||
|
||||
case "$nome" in
|
||||
gitleaks)
|
||||
versione="8.30.1"
|
||||
archivio="gitleaks_${versione}_linux_x64.tar.gz"
|
||||
indirizzo="https://github.com/gitleaks/gitleaks/releases/download/v${versione}/${archivio}"
|
||||
sha256="551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb"
|
||||
;;
|
||||
trivy)
|
||||
versione="0.75.0"
|
||||
archivio="trivy_${versione}_Linux-64bit.tar.gz"
|
||||
indirizzo="https://github.com/aquasecurity/trivy/releases/download/v${versione}/${archivio}"
|
||||
sha256="c6e65abddb348e25f10549df887045629cf28cc72453cd1c63acb717316b3f3f"
|
||||
;;
|
||||
*)
|
||||
echo "Strumento sconosciuto: «$nome» (gitleaks o trivy)." >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
piattaforma="$(uname -s)-$(uname -m)"
|
||||
if [[ "$piattaforma" != "Linux-x86_64" ]]; then
|
||||
echo "Gli archivi fissati qui sono per Linux x86_64, non per $piattaforma." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ -x "$cartella/$nome" ]] && [[ -f "$cartella/$nome.sha256" ]] && [[ "$(cat "$cartella/$nome.sha256")" == "$sha256" ]]; then
|
||||
echo "== $nome $versione già installato in $cartella"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
temporanea="$(mktemp -d)"
|
||||
trap 'rm -rf "$temporanea"' EXIT
|
||||
echo "== $nome $versione"
|
||||
curl -fsSL --retry 3 --retry-delay 5 --max-time 600 -o "$temporanea/$archivio" "$indirizzo"
|
||||
if ! echo "$sha256 $temporanea/$archivio" | sha256sum -c --quiet -; then
|
||||
echo "L'impronta SHA-256 di $archivio non è quella attesa: $nome non si installa." >&2
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$cartella"
|
||||
tar -xzf "$temporanea/$archivio" -C "$cartella" "$nome"
|
||||
chmod 0755 "$cartella/$nome"
|
||||
echo "$sha256" > "$cartella/$nome.sha256"
|
||||
"$cartella/$nome" --version | head -n 1 || true
|
||||
@@ -1,82 +0,0 @@
|
||||
"use strict";
|
||||
// Chooses the tags to remove from Gitea's container registry (pulizia-docker.sh, mode «completa»). It only reads the
|
||||
// files it is given: no network, no writes, so it is tested with a JSON file.
|
||||
//
|
||||
// node versioni-registro.js <how many to keep> <page.json>...
|
||||
// node versioni-registro.js senza-etichetta <page.json>...
|
||||
//
|
||||
// Each file is a page of the answer of GET /api/v1/packages/{owner}/container/mimante of Gitea 28: a list of versions with
|
||||
// «type», «name», «version» and «created_at» (an empty page may be «[]» or «null»). Only the versions of the container
|
||||
// package «mimante» count, and a version found in two pages counts once. Both forms print, oldest first and one per line,
|
||||
// «version<TAB>created».
|
||||
//
|
||||
// With a number N: the sha-<7 to 40 hex digits> tags beyond the N newest by creation date. Everything else always
|
||||
// stays: main, latest, the X.Y.Z releases (X.Y.Z-rc.N too), the digests (sha256:…), any other tag and a sha- tag
|
||||
// without a date that can be read.
|
||||
//
|
||||
// With «senza-etichetta»: the untagged versions, sha256:<64 hex digits>. They are the manifests of an image index,
|
||||
// which Gitea keeps as versions of their own with the configuration and the layers; nothing here removes them (Gitea
|
||||
// cannot be asked through this API whether a tag still uses one), the cleanup only says how many there are.
|
||||
//
|
||||
// If a file is not a JSON list it exits with 2 and prints nothing: when in doubt nothing is removed.
|
||||
// Messages are in Italian, like every message of the CI.
|
||||
const fs = require("fs");
|
||||
|
||||
const [mode, ...pages] = process.argv.slice(2);
|
||||
const untagged = mode === "senza-etichetta";
|
||||
if (!(untagged || /^[0-9]+$/.test(mode || "")) || pages.length === 0) {
|
||||
console.error("Uso: node versioni-registro.js <quante tenere> | senza-etichetta <pagina.json>...");
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
const shaTag = /^sha-[0-9a-f]{7,40}$/;
|
||||
const digest = /^sha256:[0-9a-f]{64}$/;
|
||||
const versions = new Map();
|
||||
for (const file of pages) {
|
||||
let page;
|
||||
try {
|
||||
page = JSON.parse(fs.readFileSync(file, "utf8").replace(/^/, ""));
|
||||
} catch (error) {
|
||||
console.error(`${file}: ${error.message}`);
|
||||
process.exit(2);
|
||||
}
|
||||
if (page === null) {
|
||||
continue;
|
||||
}
|
||||
if (!Array.isArray(page)) {
|
||||
console.error(`${file}: non è un elenco di versioni`);
|
||||
process.exit(2);
|
||||
}
|
||||
for (const version of page) {
|
||||
if (version && version.type === "container" && version.name === "mimante" && typeof version.version === "string") {
|
||||
versions.set(version.version, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const dated = (version) => ({
|
||||
name: version.version,
|
||||
created: String(version.created_at),
|
||||
time: Date.parse(version.created_at),
|
||||
id: Number(version.id) || 0,
|
||||
});
|
||||
|
||||
let chosen;
|
||||
if (untagged) {
|
||||
chosen = [...versions.values()]
|
||||
.filter((version) => digest.test(version.version))
|
||||
.map(dated)
|
||||
.sort((a, b) => (Number.isFinite(a.time) ? a.time : 0) - (Number.isFinite(b.time) ? b.time : 0) || a.id - b.id);
|
||||
} else {
|
||||
chosen = [...versions.values()]
|
||||
.filter((version) => shaTag.test(version.version))
|
||||
.map(dated)
|
||||
.filter((version) => Number.isFinite(version.time))
|
||||
.sort((a, b) => b.time - a.time || b.id - a.id)
|
||||
.slice(Number(mode))
|
||||
.reverse();
|
||||
}
|
||||
|
||||
for (const version of chosen) {
|
||||
process.stdout.write(`${version.name}\t${version.created}\n`);
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
# Prove a mano: solo da Actions ▸ prove-a-mano ▸ Esegui, prima di un rilascio o dopo un cambio a esportazioni e
|
||||
# interfaccia. Non sono controlli richiesti per unire (durano e scaricano molto), ma il loro esito va in docs/stato.md.
|
||||
# carico l'immagine costruita come in verifica.yml, con --memory=1g come il modello Unraid, esporta un milione di
|
||||
# righe da un archivio sintetico su una rete interna, poi ne annulla una seconda (prova-carico.sh, #25);
|
||||
# dice anche quanto pesa l'immagine;
|
||||
# schermate il bot con --simulatore dentro il lavoro (non nell'immagine), contro un PostgreSQL di servizio, e
|
||||
# tools/Mimante.Schermate con il Chromium di Debian: deve finire con «Nessun errore JavaScript» e le
|
||||
# schermate restano come artefatto da guardare (e da copiare in docs/schermate per il README);
|
||||
# prestazioni dopo gli altri due (la misura vuole la macchina libera), il bot con --simulatore --simulatore-aste 60
|
||||
# e tools/Mimante.Schermate --misura 120: i criteri della specifica §9.11 sulla pagina Aste (#34), con
|
||||
# misura.json e misura.txt come artefatto; fallisce se un criterio vincolante fallisce o la misura non vale.
|
||||
# Stesso demone Docker del PostgreSQL vero: nessuna porta pubblicata, prove dell'immagine su rete interna, pulizia sempre.
|
||||
name: prove-a-mano
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: prove-a-mano-${{ gitea.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
env:
|
||||
DOTNET_NOLOGO: "1"
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
|
||||
|
||||
jobs:
|
||||
carico:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
env:
|
||||
FLUSSO: prove-a-mano
|
||||
ESECUZIONE: ${{ gitea.run_id }}
|
||||
NUMERO: ${{ gitea.run_number }}
|
||||
BUILDER: mimante-ci-${{ gitea.run_id }}
|
||||
PROVA: mimante-ci:${{ gitea.run_id }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Resti di esecuzioni interrotte
|
||||
run: |
|
||||
bash .gitea/scripts/pulizia-docker.sh residui 90
|
||||
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
|
||||
|
||||
- name: Versione e nomi
|
||||
run: |
|
||||
V=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' Directory.Build.props | head -n 1)
|
||||
{
|
||||
echo "VERSIONE=$V-prova.$NUMERO"
|
||||
echo "GIT_COMMIT=${GITHUB_SHA::12}"
|
||||
echo "ARCHIVIO=${RUNNER_TEMP:-/tmp}/mimante-$ESECUZIONE.tar"
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
- name: Builder buildx dell'esecuzione
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
name: mimante-ci-${{ gitea.run_id }}
|
||||
driver: docker-container
|
||||
|
||||
- name: Costruzione dell'immagine
|
||||
run: |
|
||||
bash .gitea/scripts/costruisci-immagine.sh archivio "$ARCHIVIO" "$PROVA"
|
||||
docker load -i "$ARCHIVIO"
|
||||
|
||||
- name: Un milione di righe con --memory=1g
|
||||
run: bash .gitea/scripts/prova-carico.sh "$PROVA" "$ESECUZIONE"
|
||||
|
||||
- name: Pulizia (sempre)
|
||||
if: always()
|
||||
run: |
|
||||
if [ -n "${ARCHIVIO:-}" ]; then rm -f "$ARCHIVIO"; fi
|
||||
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
|
||||
|
||||
schermate:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 40
|
||||
container:
|
||||
image: node:24-trixie
|
||||
# PostgreSQL di servizio come in verifica.yml: solo il lavoro lo vede, con il nome «postgres», senza porte.
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18
|
||||
env:
|
||||
POSTGRES_USER: admin
|
||||
POSTGRES_DB: autobidder
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U admin -d autobidder"
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 20
|
||||
env:
|
||||
DB_HOST: postgres
|
||||
# Il servizio accetta tutti senza password (vive quanto il lavoro); il bot ne vuole comunque una.
|
||||
DB_PASSWORD: prova
|
||||
UI_PASSWORD: prova
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "10.0.x"
|
||||
|
||||
- name: Chromium e caratteri di Debian
|
||||
run: |
|
||||
apt-get update -qq
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends chromium fonts-liberation fonts-dejavu-core > /dev/null
|
||||
chromium --version
|
||||
|
||||
- name: Compilazione
|
||||
run: dotnet build Mimante.slnx -c Release -nologo
|
||||
|
||||
# Con --simulatore e senza utente Bidoo collegato gira solo il simulatore interno (Bot.Services.cs, SwitchWorldAsync):
|
||||
# nessuna richiesta al sito vero.
|
||||
- name: Bot con --simulatore
|
||||
run: |
|
||||
mkdir -p out
|
||||
nohup dotnet src/Mimante/bin/Release/net10.0/Mimante.dll --config "$PWD/out/config" --simulatore > out/bot.log 2>&1 &
|
||||
for _ in $(seq 1 60); do
|
||||
curl -fsS http://localhost:8080/salute > /dev/null 2>&1 && break
|
||||
sleep 2
|
||||
done
|
||||
curl -fsS http://localhost:8080/salute > /dev/null
|
||||
echo "bot pronto"
|
||||
|
||||
- name: Schermate e controllo JavaScript
|
||||
run: dotnet tools/Mimante.Schermate/bin/Release/net10.0/Mimante.Schermate.dll http://localhost:8080 "$UI_PASSWORD" out/schermate
|
||||
|
||||
- name: Schermate
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: schermate
|
||||
path: out/schermate
|
||||
retention-days: 14
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Registro del bot
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: registro-bot
|
||||
path: out/bot.log
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
# La misura delle prestazioni dell'interfaccia (specifica §9.11, #34). Un lavoro a sé, dopo carico e schermate: due
|
||||
# lavori in parallelo sullo stesso runner si rubano la CPU e la misura non direbbe nulla dell'interfaccia. Parte anche
|
||||
# se gli altri due falliscono. La password dell'interfaccia arriva allo strumento da UI_PASSWORD, non dalla riga.
|
||||
prestazioni:
|
||||
needs: [carico, schermate]
|
||||
if: ${{ !cancelled() }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
container:
|
||||
image: node:24-trixie
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18
|
||||
env:
|
||||
POSTGRES_USER: admin
|
||||
POSTGRES_DB: autobidder
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U admin -d autobidder"
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 20
|
||||
env:
|
||||
DB_HOST: postgres
|
||||
DB_PASSWORD: prova
|
||||
UI_PASSWORD: prova
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "10.0.x"
|
||||
|
||||
- name: Chromium e caratteri di Debian
|
||||
run: |
|
||||
apt-get update -qq
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends chromium fonts-liberation fonts-dejavu-core > /dev/null
|
||||
chromium --version
|
||||
|
||||
- name: Compilazione
|
||||
run: dotnet build Mimante.slnx -c Release -nologo
|
||||
|
||||
# Sessanta aste, tre su quattro in Attiva, ciclo di 5 s: almeno dieci insieme sotto i 4 s (SimulatorPlan.ForLoad).
|
||||
- name: Bot con --simulatore --simulatore-aste 60
|
||||
run: |
|
||||
mkdir -p out
|
||||
nohup dotnet src/Mimante/bin/Release/net10.0/Mimante.dll --config "$PWD/out/config" --simulatore --simulatore-aste 60 > out/bot.log 2>&1 &
|
||||
for _ in $(seq 1 60); do
|
||||
curl -fsS http://localhost:8080/salute > /dev/null 2>&1 && break
|
||||
sleep 2
|
||||
done
|
||||
curl -fsS http://localhost:8080/salute > /dev/null
|
||||
echo "bot pronto"
|
||||
|
||||
- name: Misura delle prestazioni (120 s)
|
||||
run: dotnet tools/Mimante.Schermate/bin/Release/net10.0/Mimante.Schermate.dll http://localhost:8080 out/prestazioni --misura 120
|
||||
|
||||
- name: Risultati della misura
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: prestazioni
|
||||
path: out/prestazioni
|
||||
retention-days: 30
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Registro del bot (prestazioni)
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: registro-bot-prestazioni
|
||||
path: out/bot.log
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
@@ -1,53 +0,0 @@
|
||||
# Pulizia notturna (alle 4:47, ora del server di Gitea) e a mano (Actions ▸ pulizia ▸ Esegui) di ciò che la CI di
|
||||
# Mimante lascia: contenitori, reti, nomi locali e builder delle esecuzioni interrotte, ed etichette sha- del pacchetto
|
||||
# mimante oltre le 10 più recenti (mai main, latest o X.Y.Z). A mano, con «Solo prova», elenca e non toglie nulla.
|
||||
# Il resto del demone Docker di Unraid (immagini senza nome, cache di tutti i progetti, resti di act_runner) lo pulisce
|
||||
# la pulizia di Febe: qui non si tocca nulla che non porti i segni della CI di Mimante (pulizia-docker.sh).
|
||||
name: pulizia
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "47 4 * * *"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
prova:
|
||||
description: "Solo prova: elenca che cosa toglierebbe e non toglie nulla"
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: pulizia
|
||||
cancel-in-progress: false
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Gitea mette nell'evento la casella «prova» come testo, "true" o "false"; di notte l'evento non ha input. Il token
|
||||
# del registro va solo nell'ambiente di questo passo e non si stampa mai.
|
||||
- name: Resti della CI e registro
|
||||
env:
|
||||
PROVA: ${{ gitea.event.inputs.prova }}
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
GITEA_API: ${{ gitea.server_url }}/api/v1
|
||||
PROPRIETARIO: ${{ gitea.repository_owner }}
|
||||
run: |
|
||||
case "${PROVA:-}" in
|
||||
true) bash .gitea/scripts/pulizia-docker.sh completa --prova ;;
|
||||
"" | false) bash .gitea/scripts/pulizia-docker.sh completa ;;
|
||||
*)
|
||||
echo "::error::La casella «prova» vale true o false: non tolgo nulla."
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
@@ -1,261 +0,0 @@
|
||||
# Rilascio a ogni tag vX.Y.Z (vX.Y.Z-rc.N per una prova del rilascio):
|
||||
# 1. prove: il tag coincide con <Version> di Directory.Build.props (la parte prima del trattino per un rc), la
|
||||
# soluzione si compila con gli avvisi come errori e tutte le prove passano, anche quelle su PostgreSQL;
|
||||
# 2. immagine: costruita, provata su una rete interna e scansionata come nella verifica, poi pubblicata come
|
||||
# <registro>/<proprietario>/mimante:X.Y.Z e :latest. Un tag con il trattino pubblica solo :X.Y.Z-rc.N: :latest
|
||||
# non si sposta. Alla fine toglie sempre ciò che ha creato;
|
||||
# 3. release: solo dopo prove e immagine. Crea la release (o ne aggiorna le note) con la sezione del CHANGELOG e il
|
||||
# modello Unraid mimante-unraid-X.Y.Z.xml; un rc è una pre-release.
|
||||
#
|
||||
# Segreto (del repository o dell'utente): REGISTRY_TOKEN, token di Gitea con «package» e «repository» in lettura e
|
||||
# scrittura. Senza, l'immagine si costruisce e si prova ma non si pubblica, e le note lo dicono.
|
||||
# Variabile facoltativa: REGISTRY (per esempio 192.168.30.23:3000); se manca, l'host dell'indirizzo del server.
|
||||
name: rilascio
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
env:
|
||||
DOTNET_NOLOGO: "1"
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
||||
|
||||
jobs:
|
||||
prove:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
container:
|
||||
image: node:24-trixie
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18
|
||||
env:
|
||||
POSTGRES_USER: admin
|
||||
POSTGRES_DB: mimante_test
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U admin -d mimante_test"
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 20
|
||||
env:
|
||||
TEST_DB_HOST: postgres
|
||||
TEST_DB_USER: admin
|
||||
TEST_DB_NAME: mimante_test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Versione coerente con il tag
|
||||
run: |
|
||||
V=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' Directory.Build.props | head -n 1)
|
||||
T="${GITHUB_REF_NAME#v}"
|
||||
case "$T" in
|
||||
"$V") echo "Rilascio $T" ;;
|
||||
"$V"-rc.[0-9]*) echo "Prova del rilascio $T (immagine :$T, :latest resta dov'è)" ;;
|
||||
*) echo "Il tag ${GITHUB_REF_NAME} non coincide con <Version> $V (né con $V-rc.N)."; exit 1 ;;
|
||||
esac
|
||||
grep -Eq "^## ${V//./\\.}( |$)" CHANGELOG.md || { echo "CHANGELOG.md non ha la sezione ## $V."; exit 1; }
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "10.0.x"
|
||||
|
||||
- name: Compilazione (avvisi = errori)
|
||||
run: dotnet build Mimante.slnx -c Release -nologo -warnaserror
|
||||
|
||||
- name: Prove
|
||||
run: >-
|
||||
dotnet test tests/Mimante.Tests -c Release --no-build --nologo
|
||||
--logger "trx;LogFileName=prove.trx" --results-directory out/prove
|
||||
|
||||
- name: Riepilogo delle prove (nessuna saltata)
|
||||
if: ${{ !cancelled() }}
|
||||
run: bash .gitea/scripts/riepilogo-prove.sh out/prove 0
|
||||
|
||||
- name: Risultati
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: risultati-prove
|
||||
path: out/prove/*.trx
|
||||
if-no-files-found: ignore
|
||||
|
||||
immagine:
|
||||
runs-on: ubuntu-latest
|
||||
needs: prove
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
FLUSSO: rilascio
|
||||
ESECUZIONE: ${{ gitea.run_id }}
|
||||
BUILDER: mimante-ci-${{ gitea.run_id }}
|
||||
PROVA: mimante-ci:${{ gitea.run_id }}
|
||||
outputs:
|
||||
immagine: ${{ steps.nome.outputs.immagine }}
|
||||
pubblicata: ${{ steps.pubblicazione.outputs.pubblicata }}
|
||||
motivo: ${{ steps.segreto.outputs.motivo }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Resti di esecuzioni interrotte
|
||||
run: |
|
||||
bash .gitea/scripts/pulizia-docker.sh residui 90
|
||||
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
|
||||
|
||||
- name: Versione, registro e nome dell'immagine
|
||||
id: nome
|
||||
env:
|
||||
REGISTRO_SCELTO: ${{ vars.REGISTRY }}
|
||||
SERVER: ${{ gitea.server_url }}
|
||||
PROPRIETARIO: ${{ gitea.repository_owner }}
|
||||
run: |
|
||||
V="${GITHUB_REF_NAME#v}"
|
||||
REGISTRY="$REGISTRO_SCELTO"
|
||||
[ -n "$REGISTRY" ] || REGISTRY=$(echo "$SERVER" | sed -E 's#^https?://##; s#/.*$##')
|
||||
OWNER=$(echo "$PROPRIETARIO" | tr '[:upper:]' '[:lower:]')
|
||||
{
|
||||
echo "VERSION=$V"
|
||||
echo "VERSIONE=$V"
|
||||
echo "GIT_COMMIT=${GITHUB_SHA::12}"
|
||||
echo "ARCHIVIO=${RUNNER_TEMP:-/tmp}/mimante-$ESECUZIONE.tar"
|
||||
echo "REGISTRY=$REGISTRY"
|
||||
echo "IMAGE=$REGISTRY/$OWNER/mimante"
|
||||
} >> "$GITHUB_ENV"
|
||||
echo "registro=$REGISTRY" >> "$GITHUB_OUTPUT"
|
||||
echo "immagine=$REGISTRY/$OWNER/mimante" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
name: mimante-ci-${{ gitea.run_id }}
|
||||
driver: docker-container
|
||||
buildkitd-config-inline: |
|
||||
[registry."${{ steps.nome.outputs.registro }}"]
|
||||
http = true
|
||||
insecure = true
|
||||
|
||||
- name: Costruzione dell'immagine
|
||||
run: |
|
||||
bash .gitea/scripts/costruisci-immagine.sh archivio "$ARCHIVIO" "$PROVA"
|
||||
docker load -i "$ARCHIVIO"
|
||||
|
||||
- name: Prova del contenitore su una rete interna
|
||||
run: bash .gitea/scripts/prova-immagine.sh "$PROVA" "$ESECUZIONE"
|
||||
|
||||
- name: Vulnerabilità dell'immagine (Trivy)
|
||||
run: bash .gitea/scripts/scansione-immagine.sh "$ARCHIVIO" out/sicurezza
|
||||
|
||||
- name: Rapporto di Trivy
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: sicurezza-immagine
|
||||
path: out/sicurezza/trivy.json
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Segreto per il registro
|
||||
id: segreto
|
||||
env:
|
||||
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "::warning::Manca il segreto REGISTRY_TOKEN: l'immagine è stata costruita e provata ma non pubblicata. La release esce lo stesso e lo dice."
|
||||
echo "presente=no" >> "$GITHUB_OUTPUT"
|
||||
echo "motivo=manca il segreto REGISTRY_TOKEN" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "presente=si" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Pubblicazione sul registro di Gitea
|
||||
id: pubblicazione
|
||||
if: steps.segreto.outputs.presente == 'si'
|
||||
env:
|
||||
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
UTENTE: ${{ gitea.actor }}
|
||||
run: |
|
||||
set -eu
|
||||
CONFIG="${DOCKER_CONFIG:-$HOME/.docker}"
|
||||
mkdir -p "$CONFIG"
|
||||
[ -s "$CONFIG/config.json" ] || echo '{}' > "$CONFIG/config.json"
|
||||
AUTH=$(printf '%s:%s' "$UTENTE" "$TOKEN" | base64 -w0)
|
||||
jq --arg r "$REGISTRY" --arg a "$AUTH" '.auths[$r].auth = $a' "$CONFIG/config.json" > "$CONFIG/config.json.nuovo"
|
||||
mv "$CONFIG/config.json.nuovo" "$CONFIG/config.json"
|
||||
NOMI=("$IMAGE:$VERSION")
|
||||
case "$VERSION" in
|
||||
*-*) echo "Prova del rilascio: :latest non si sposta." ;;
|
||||
*) NOMI+=("$IMAGE:latest") ;;
|
||||
esac
|
||||
bash .gitea/scripts/costruisci-immagine.sh pubblica "${NOMI[@]}"
|
||||
echo "pubblicata=si" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Pulizia (sempre)
|
||||
if: always()
|
||||
run: |
|
||||
CONFIG="${DOCKER_CONFIG:-$HOME/.docker}/config.json"
|
||||
if [ -s "$CONFIG" ] && [ -n "${REGISTRY:-}" ]; then
|
||||
jq --arg r "$REGISTRY" 'if .auths then .auths |= del(.[$r]) else . end' "$CONFIG" > "$CONFIG.nuovo" && mv "$CONFIG.nuovo" "$CONFIG"
|
||||
fi
|
||||
if [ -n "${ARCHIVIO:-}" ]; then rm -f "$ARCHIVIO"; fi
|
||||
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prove, immagine]
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Release con le note del CHANGELOG e il modello Unraid
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
IMMAGINE: ${{ needs.immagine.outputs.immagine }}
|
||||
PUBBLICATA: ${{ needs.immagine.outputs.pubblicata }}
|
||||
MOTIVO: ${{ needs.immagine.outputs.motivo }}
|
||||
run: |
|
||||
set -eu
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
VERSION="${TAG#v}"
|
||||
BASE="${VERSION%%-*}"
|
||||
case "$VERSION" in *-*) PRE=true ;; *) PRE=false ;; esac
|
||||
NOTE=$(awk -v v="$BASE" '/^## /{p=($2==v)} p' CHANGELOG.md || true)
|
||||
[ -n "$NOTE" ] || NOTE="Mimante $VERSION"
|
||||
if [ "$PUBBLICATA" = "si" ]; then
|
||||
case "$VERSION" in
|
||||
*-*) DOVE="\`$IMMAGINE:$VERSION\` (prova del rilascio: \`:latest\` resta sulla versione precedente)" ;;
|
||||
*) DOVE="\`$IMMAGINE:$VERSION\` e \`$IMMAGINE:latest\`" ;;
|
||||
esac
|
||||
IMMAGINE_NOTA="Immagine Docker: $DOVE. Il registro risponde in HTTP: su Unraid serve \`--insecure-registry\` (docs/docker.md)."
|
||||
else
|
||||
IMMAGINE_NOTA="**L'immagine di questa versione non è stata pubblicata** (${MOTIVO:-motivo sconosciuto}): Unraid resta sulla versione precedente. Rilancia il flusso di questo tag dopo aver risolto: le note si aggiornano."
|
||||
fi
|
||||
NOTE=$(printf '%s\n\n### Immagine Docker\n\n%s\n' "$NOTE" "$IMMAGINE_NOTA")
|
||||
|
||||
ID=$(curl -sf -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" | jq -r '.id // empty' || true)
|
||||
if [ -z "$ID" ]; then
|
||||
ID=$(jq -n --arg t "$TAG" --arg n "Mimante $VERSION" --arg b "$NOTE" --argjson p "$PRE" \
|
||||
'{tag_name:$t, name:$n, body:$b, draft:false, prerelease:$p}' \
|
||||
| curl -sf -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||
--data-binary @- "$API/releases" | jq -r .id)
|
||||
echo "Release $TAG creata (id $ID)"
|
||||
else
|
||||
jq -n --arg b "$NOTE" '{body:$b}' \
|
||||
| curl -sf -X PATCH -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||
--data-binary @- "$API/releases/$ID" > /dev/null
|
||||
echo "Release $TAG già presente (id $ID): note aggiornate"
|
||||
fi
|
||||
|
||||
mkdir -p out
|
||||
cp docker/unraid/mimante.xml "out/mimante-unraid-$VERSION.xml"
|
||||
ESISTENTI=$(curl -sf -H "Authorization: token $TOKEN" "$API/releases/$ID/assets" | jq -r '.[].name')
|
||||
for f in "out/mimante-unraid-$VERSION.xml"; do
|
||||
n=$(basename "$f")
|
||||
if echo "$ESISTENTI" | grep -qx "$n"; then echo "$n già allegato"; continue; fi
|
||||
curl -sf -X POST -H "Authorization: token $TOKEN" -F "attachment=@$f" "$API/releases/$ID/assets?name=$n" > /dev/null
|
||||
echo "$n allegato"
|
||||
done
|
||||
@@ -1,243 +0,0 @@
|
||||
# Verifica: a ogni push su qualunque ramo (i tag li prende rilascio.yml) e a mano (Actions ▸ verifica ▸ Esegui).
|
||||
# I suoi tre lavori sono i controlli richiesti per unire in main (docs/processo.md):
|
||||
# controlli sintassi di script e flussi, segni di conflitto, versione ed esempi, sezione del CHANGELOG, progetti della
|
||||
# soluzione, elenco chiuso dei pacchetti, niente risorse esterne nell'interfaccia, JSON; segreti in tutta
|
||||
# la storia con gitleaks (versione e impronta fissate);
|
||||
# prove compilazione con gli avvisi come errori e TUTTE le prove di tests/Mimante.Tests, con un PostgreSQL 18 di
|
||||
# servizio: nessuna prova deve saltarsi (anche quelle sul database girano);
|
||||
# immagine l'immagine Docker costruita con buildx (dentro girano compilazione e prove di logica), provata su una
|
||||
# rete interna con un PostgreSQL usa e getta (salute, file di /config, arresto) e scansionata con Trivy
|
||||
# (si ferma per una CRITICAL con correzione); solo dopo un push su main la pubblica come :main e
|
||||
# :sha-<7 caratteri> (:latest resta ai rilasci). Alla fine, sempre, toglie ciò che ha creato.
|
||||
#
|
||||
# Niente «pull_request»: in Gitea una richiesta di unione mostra lo stato del suo ultimo commit, già verificato dal push.
|
||||
# Runner: act_runner ubuntu-latest su Unraid, che parla con il demone Docker di Unraid, lo stesso del PostgreSQL vero
|
||||
# di Mimante. Per questo nessun servizio e nessun contenitore di prova pubblica porte (niente «ports:»), e le prove
|
||||
# dell'immagine stanno su una rete interna (PipelineTests lo controlla).
|
||||
name: verifica
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# Su un ramo conta l'ultimo push: l'esecuzione precedente si annulla. Su main ogni commit ha il suo gruppo, così ogni
|
||||
# unione arriva fino in fondo e pubblica la sua :sha-.
|
||||
concurrency:
|
||||
group: verifica-${{ gitea.event_name }}-${{ gitea.ref }}${{ gitea.ref == 'refs/heads/main' && format('-{0}', gitea.sha) || '' }}
|
||||
cancel-in-progress: ${{ gitea.ref != 'refs/heads/main' }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
env:
|
||||
DOTNET_NOLOGO: "1"
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
|
||||
|
||||
jobs:
|
||||
controlli:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
# Tutta la storia: gitleaks legge ogni commit da cui discende quello verificato.
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Script, flussi, conflitti, versione, soluzione, pacchetti, interfaccia e JSON
|
||||
run: bash .gitea/scripts/controlli.sh
|
||||
|
||||
- name: Segreti in tutta la storia (gitleaks)
|
||||
run: bash .gitea/scripts/segreti.sh out/sicurezza
|
||||
|
||||
- name: Rapporto di gitleaks (segreti oscurati)
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: rapporto-gitleaks
|
||||
path: out/sicurezza/gitleaks.json
|
||||
retention-days: 14
|
||||
if-no-files-found: ignore
|
||||
|
||||
prove:
|
||||
needs: controlli
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
# Debian 13 con Node 24 (per le azioni): lo stesso Debian dell'immagine di Mimante.
|
||||
container:
|
||||
image: node:24-trixie
|
||||
# PostgreSQL 18 come su Unraid, raggiungibile solo dal lavoro con il nome «postgres». Nessuna porta pubblicata: il
|
||||
# demone è quello di Unraid. Accesso senza password: il database vive quanto il lavoro e nessuno fuori lo vede.
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18
|
||||
env:
|
||||
POSTGRES_USER: admin
|
||||
POSTGRES_DB: mimante_test
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U admin -d mimante_test"
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 20
|
||||
env:
|
||||
TEST_DB_HOST: postgres
|
||||
TEST_DB_USER: admin
|
||||
TEST_DB_NAME: mimante_test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "10.0.x"
|
||||
|
||||
- name: Compilazione di tutta la soluzione (avvisi = errori)
|
||||
run: dotnet build Mimante.slnx -c Release -nologo -warnaserror
|
||||
|
||||
- name: Prove (anche quelle su PostgreSQL)
|
||||
run: >-
|
||||
dotnet test tests/Mimante.Tests -c Release --no-build --nologo
|
||||
--logger "trx;LogFileName=prove.trx" --results-directory out/prove
|
||||
|
||||
- name: Riepilogo delle prove (nessuna saltata)
|
||||
if: ${{ !cancelled() }}
|
||||
run: bash .gitea/scripts/riepilogo-prove.sh out/prove 0
|
||||
|
||||
- name: Risultati delle prove
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: risultati-prove
|
||||
path: out/prove/*.trx
|
||||
retention-days: 14
|
||||
if-no-files-found: warn
|
||||
|
||||
immagine:
|
||||
needs: prove
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
FLUSSO: verifica
|
||||
ESECUZIONE: ${{ gitea.run_id }}
|
||||
NUMERO: ${{ gitea.run_number }}
|
||||
BUILDER: mimante-ci-${{ gitea.run_id }}
|
||||
PROVA: mimante-ci:${{ gitea.run_id }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Resti di esecuzioni interrotte
|
||||
run: |
|
||||
bash .gitea/scripts/pulizia-docker.sh residui 90
|
||||
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
|
||||
|
||||
# Registro: la variabile REGISTRY delle Actions, se c'è, altrimenti l'host dell'indirizzo del server (ROOT_URL).
|
||||
- name: Versione, registro e nomi
|
||||
id: nome
|
||||
env:
|
||||
REGISTRO_SCELTO: ${{ vars.REGISTRY }}
|
||||
SERVER: ${{ gitea.server_url }}
|
||||
PROPRIETARIO: ${{ gitea.repository_owner }}
|
||||
run: |
|
||||
V=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' Directory.Build.props | head -n 1)
|
||||
REGISTRY="$REGISTRO_SCELTO"
|
||||
[ -n "$REGISTRY" ] || REGISTRY=$(echo "$SERVER" | sed -E 's#^https?://##; s#/.*$##')
|
||||
OWNER=$(echo "$PROPRIETARIO" | tr '[:upper:]' '[:lower:]')
|
||||
{
|
||||
echo "VERSIONE=$V-ci.$NUMERO"
|
||||
echo "GIT_COMMIT=${GITHUB_SHA::12}"
|
||||
echo "REGISTRY=$REGISTRY"
|
||||
echo "IMAGE=$REGISTRY/$OWNER/mimante"
|
||||
echo "ARCHIVIO=${RUNNER_TEMP:-/tmp}/mimante-$ESECUZIONE.tar"
|
||||
} >> "$GITHUB_ENV"
|
||||
echo "registro=$REGISTRY" >> "$GITHUB_OUTPUT"
|
||||
echo "Immagine $V-ci.$NUMERO del commit ${GITHUB_SHA::12}, provata come $PROVA; registro $REGISTRY/$OWNER/mimante"
|
||||
|
||||
# Un builder buildx di questa esecuzione, che sa che il registro di casa risponde in HTTP.
|
||||
- name: Builder buildx dell'esecuzione
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
name: mimante-ci-${{ gitea.run_id }}
|
||||
driver: docker-container
|
||||
buildkitd-config-inline: |
|
||||
[registry."${{ steps.nome.outputs.registro }}"]
|
||||
http = true
|
||||
insecure = true
|
||||
|
||||
- name: Costruzione dell'immagine (dentro girano compilazione e prove di logica)
|
||||
run: |
|
||||
bash .gitea/scripts/costruisci-immagine.sh archivio "$ARCHIVIO" "$PROVA"
|
||||
docker load -i "$ARCHIVIO"
|
||||
|
||||
- name: Prova del contenitore su una rete interna
|
||||
run: bash .gitea/scripts/prova-immagine.sh "$PROVA" "$ESECUZIONE"
|
||||
|
||||
- name: Vulnerabilità dell'immagine (Trivy)
|
||||
run: bash .gitea/scripts/scansione-immagine.sh "$ARCHIVIO" out/sicurezza
|
||||
|
||||
- name: Rapporto di Trivy
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: sicurezza-immagine
|
||||
path: out/sicurezza/trivy.json
|
||||
retention-days: 14
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Pubblicare?
|
||||
id: segreto
|
||||
env:
|
||||
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
EVENTO: ${{ gitea.event_name }}
|
||||
RIFERIMENTO: ${{ gitea.ref }}
|
||||
run: |
|
||||
if [ "$EVENTO" != push ] || [ "$RIFERIMENTO" != refs/heads/main ]; then
|
||||
echo "Si pubblica solo dopo un push su main: qui l'immagine è costruita, provata e scansionata."
|
||||
echo "presente=no" >> "$GITHUB_OUTPUT"
|
||||
elif [ -z "$TOKEN" ]; then
|
||||
echo "::warning::Manca il segreto REGISTRY_TOKEN: l'immagine di main è costruita, provata e scansionata ma non pubblicata."
|
||||
echo "presente=no" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "presente=si" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Pubblicazione come :main e :sha-<commit>
|
||||
if: steps.segreto.outputs.presente == 'si'
|
||||
env:
|
||||
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
UTENTE: ${{ gitea.actor }}
|
||||
run: |
|
||||
# Le credenziali vanno nella configurazione del client: buildx le passa al builder, il demone non c'entra (e
|
||||
# proverebbe HTTPS). Non si stampano mai.
|
||||
CONFIG="${DOCKER_CONFIG:-$HOME/.docker}"
|
||||
mkdir -p "$CONFIG"
|
||||
[ -s "$CONFIG/config.json" ] || echo '{}' > "$CONFIG/config.json"
|
||||
AUTH=$(printf '%s:%s' "$UTENTE" "$TOKEN" | base64 -w0)
|
||||
jq --arg r "$REGISTRY" --arg a "$AUTH" '.auths[$r].auth = $a' "$CONFIG/config.json" > "$CONFIG/config.json.nuovo"
|
||||
mv "$CONFIG/config.json.nuovo" "$CONFIG/config.json"
|
||||
NOMI=("$IMAGE:sha-${GITHUB_SHA::7}")
|
||||
# :main solo se main è ancora a questo commit: un'esecuzione arrivata in ritardo non lo riporta indietro.
|
||||
CIMA=$(git ls-remote origin refs/heads/main 2> /dev/null | cut -f1) || CIMA=""
|
||||
if [ "$CIMA" = "$GITHUB_SHA" ]; then
|
||||
NOMI+=("$IMAGE:main")
|
||||
elif [ -z "$CIMA" ]; then
|
||||
echo "::warning::Non riesco a leggere la cima di main: si pubblica solo :sha-${GITHUB_SHA::7}."
|
||||
else
|
||||
echo "main è già andato avanti (${CIMA::7}): si pubblica solo :sha-${GITHUB_SHA::7}."
|
||||
fi
|
||||
bash .gitea/scripts/costruisci-immagine.sh pubblica "${NOMI[@]}"
|
||||
|
||||
- name: Pulizia (sempre)
|
||||
if: always()
|
||||
run: |
|
||||
CONFIG="${DOCKER_CONFIG:-$HOME/.docker}/config.json"
|
||||
if [ -s "$CONFIG" ] && [ -n "${REGISTRY:-}" ]; then
|
||||
jq --arg r "$REGISTRY" 'if .auths then .auths |= del(.[$r]) else . end' "$CONFIG" > "$CONFIG.nuovo" \
|
||||
&& mv "$CONFIG.nuovo" "$CONFIG" || echo "::warning::Non riesco a togliere le credenziali da $CONFIG."
|
||||
fi
|
||||
if [ -n "${ARCHIVIO:-}" ]; then rm -f "$ARCHIVIO"; fi
|
||||
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
|
||||
+11
-22
@@ -379,6 +379,17 @@ MigrationBackup/
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
@@ -390,14 +401,12 @@ FodyWeavers.xsd
|
||||
*.sln.iml
|
||||
|
||||
# ---> VisualStudioCode
|
||||
# Della cartella .vscode entra nel repository solo la configurazione condivisa (guida: Sviluppo, «Da VS Code»).
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
@@ -405,23 +414,3 @@ FodyWeavers.xsd
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
|
||||
# ---> Mimante
|
||||
# Uscite locali di build, pubblicazione e prove
|
||||
out/
|
||||
*.trx
|
||||
# Configurazioni e dati delle prove locali (tools/dev): mai nel repository
|
||||
tools/dev/config/
|
||||
tools/dev/config-simulatore/
|
||||
tools/dev/config-release/
|
||||
tools/dev/release.env
|
||||
# Dati scaricati dal database per l'analisi (tools/Mimante.Dati): restano su questo PC
|
||||
/dati/
|
||||
# Spazi di lavoro di Claude Code
|
||||
.claude/worktrees/
|
||||
# Configurazione di rilascio della vecchia app desktop: conteneva un token di Gitea
|
||||
gitea.json
|
||||
# Rider / JetBrains, Windows
|
||||
.idea/
|
||||
Thumbs.db
|
||||
Desktop.ini
|
||||
@@ -1,11 +0,0 @@
|
||||
# Falsi positivi di gitleaks, uno per riga con l'impronta e sopra il motivo (segreti.sh).
|
||||
# Controllati il 24/11/2026 con i valori oscurati: nessuno è un segreto di Mimante o di un utente.
|
||||
|
||||
# Pagina di Bidoo salvata come esempio (cartella Examples, tolta poi dal repository): «sitekey» di reCAPTCHA,
|
||||
# chiave pubblica per costruzione, scritta nella pagina che chiunque scarica.
|
||||
ee67bedc31c37b961aeecfa5a139aa59d3cc803f:Mimante/Examples/Pensofal Biostone Tegamino - Bidoo_files/login_17_it.js.download:generic-api-key:395
|
||||
ee67bedc31c37b961aeecfa5a139aa59d3cc803f:Mimante/Examples/Pensofal Biostone Tegamino - Bidoo_files/login_17_it.js.download:generic-api-key:541
|
||||
# Stessa pagina: SDK di Smartech (analitica di Bidoo), nomi di chiavi di archivio nel codice minimizzato.
|
||||
ee67bedc31c37b961aeecfa5a139aa59d3cc803f:Mimante/Examples/Pensofal Biostone Tegamino - Bidoo_files/smartech-sdk.js.download:generic-api-key:2
|
||||
# Registrazione HAR di puntateaste.it salvata come esempio: script pubblico di Google (Funding Choices) nella risposta.
|
||||
7ca504a70adab5cf8a01427671f9735b395b84a2:Mimante/Examples/puntateaste.it.txt:generic-api-key:2769
|
||||
Vendored
-47
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mimante (locale, PostgreSQL di sviluppo)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/src/Mimante/bin/Debug/net10.0/Mimante.dll",
|
||||
// --simulatore: senza utente Bidoo collegato mostra il simulatore (modalità debug).
|
||||
"args": ["--config", "${workspaceFolder}/tools/dev/config", "--simulatore"],
|
||||
"cwd": "${workspaceFolder}/src/Mimante",
|
||||
"env": { "DB_HOST": "localhost", "DB_PASSWORD": "dev", "UI_PASSWORD": "dev" },
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false
|
||||
},
|
||||
{
|
||||
// Compilato in Release, contro il PostgreSQL di Unraid, con la sua cartella dati e la
|
||||
// porta 8090 (--porta, convive con quello di sviluppo). Le variabili, password comprese,
|
||||
// stanno in tools/dev/release.env, ignorato da git: si crea copiando release.env.example.
|
||||
// Meglio Ctrl+F5 (senza debugger); con F5 i breakpoint non scattano sul codice ottimizzato.
|
||||
"name": "Mimante (release, PostgreSQL di Unraid)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build release",
|
||||
"program": "${workspaceFolder}/src/Mimante/bin/Release/net10.0/Mimante.dll",
|
||||
"args": ["--config", "${workspaceFolder}/tools/dev/config-release", "--porta", "8090"],
|
||||
"cwd": "${workspaceFolder}/src/Mimante",
|
||||
"envFile": "${workspaceFolder}/tools/dev/release.env",
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false,
|
||||
// 127.0.0.1 e non localhost: il cookie dell'interfaccia non si mescola con quello del bot
|
||||
// di sviluppo, che sta su localhost:8080.
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "Interfaccia in ascolto su http://0\\.0\\.0\\.0:(\\d+)",
|
||||
"uriFormat": "http://127.0.0.1:%s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Collegati al bot già avviato",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processName": "Mimante.exe"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
-69
@@ -1,69 +0,0 @@
|
||||
{
|
||||
// Mimante: compilazione, test, PostgreSQL di sviluppo, bot in locale, schermate.
|
||||
// I valori «dev» sono solo quelli del compose di sviluppo (docker/compose.yml).
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"detail": "Compila soluzione, servizio, test e strumento delle schermate.",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": ["build", "${workspaceFolder}/Mimante.slnx", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary"],
|
||||
"group": { "kind": "build", "isDefault": true },
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "build release",
|
||||
"detail": "Compila il servizio in Release (codice ottimizzato) per l'ambiente di release.",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": ["build", "${workspaceFolder}/src/Mimante/Mimante.csproj", "-c", "Release", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary"],
|
||||
"group": "build",
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "postgres",
|
||||
"detail": "Avvia PostgreSQL 18 di sviluppo (utente admin, password dev, porta 5432).",
|
||||
"type": "process",
|
||||
"command": "docker",
|
||||
"args": ["compose", "-f", "${workspaceFolder}/docker/compose.yml", "up", "-d", "postgres"],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "verifica",
|
||||
"detail": "Compila e lancia tutti i test, compresi quelli su PostgreSQL (serve il task «postgres»).",
|
||||
"type": "process",
|
||||
"command": "dotnet",
|
||||
"args": ["test", "${workspaceFolder}/tests/Mimante.Tests", "--nologo"],
|
||||
"options": { "env": { "TEST_DB_HOST": "localhost", "TEST_DB_PASSWORD": "dev" } },
|
||||
"group": { "kind": "test", "isDefault": true },
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "bot in locale",
|
||||
"detail": "Il bot contro il PostgreSQL di sviluppo, in modalità debug (--simulatore), interfaccia su http://localhost:8080 (password dev).",
|
||||
"type": "process",
|
||||
"command": "dotnet",
|
||||
"args": ["run", "--project", "${workspaceFolder}/src/Mimante", "--", "--config", "${workspaceFolder}/tools/dev/config", "--simulatore"],
|
||||
"options": { "env": { "DB_HOST": "localhost", "DB_PASSWORD": "dev", "UI_PASSWORD": "dev" } },
|
||||
"isBackground": true,
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "schermate",
|
||||
"detail": "Schermate del README dal bot in locale; fallisce se l'interfaccia ha errori JavaScript.",
|
||||
"type": "process",
|
||||
"command": "dotnet",
|
||||
"args": ["run", "--project", "${workspaceFolder}/tools/Mimante.Schermate", "--", "http://localhost:8080", "dev", "${workspaceFolder}/docs/schermate"],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "immagine",
|
||||
"detail": "Costruisce l'immagine Docker mimante:dev (i test girano dentro la build).",
|
||||
"type": "process",
|
||||
"command": "docker",
|
||||
"args": ["build", "-f", "${workspaceFolder}/docker/Dockerfile", "--build-arg", "VERSION=1.9.4", "-t", "mimante:dev", "${workspaceFolder}"],
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
-254
@@ -1,254 +0,0 @@
|
||||
# Novità
|
||||
|
||||
Il formato segue le versioni `MAJOR.MINOR.PATCH` di `Directory.Build.props`; il workflow di rilascio
|
||||
copia nella release la sezione della versione.
|
||||
|
||||
## 1.9.4
|
||||
|
||||
- **Telegram** (#35): in Impostazioni ▸ Telegram, accanto a «Invia messaggio di prova», il bottone **«Prova gli
|
||||
avvisi»** manda un esempio di ognuno dei 13 avvisi veri (asta vinta e persa, sessione scaduta, HALT e ripresa,
|
||||
spazio dati, errore ripetuto del motore, database non raggiungibile, riepilogo, puntate gratis, pausa del
|
||||
riscatto, forziere), costruito come il messaggio vero ma con dati finti. Il titolo comincia con «Prova:», i
|
||||
messaggi partono uno ogni secondo e mezzo, anche quelli con l'interruttore spento (il testo lo dice), e alla fine
|
||||
Mimante dice quanti ne sono partiti e perché si è fermato.
|
||||
- **Prove** (#51): le prove del monitor contro il simulatore puntano con un anticipo fisso di 1,5 s, così un runner
|
||||
carico non fa più perdere l'asta che devono vincere; se succede, il messaggio dice perché.
|
||||
- **Documenti**: il 28/11/2026 Alberto ha provato dal vivo utente e saldo, la sessione incollata e il primo
|
||||
riscatto delle puntate gratis (#33, #27); chiuse con le sue decisioni anche l'anticipo (#37, massimo 500 ms) e
|
||||
le prestazioni dell'interfaccia (#34, bastano i numeri della CI).
|
||||
|
||||
## 1.9.3
|
||||
|
||||
Le dieci discordanze fra codice e regole trovate scrivendo la guida, sistemate secondo le decisioni di
|
||||
Alberto del 27/11/2026.
|
||||
|
||||
- **Sicurezza dell'interfaccia** (#46): il canale degli aggiornamenti (`/ws`), da cui passano anche le
|
||||
puntate, si apre solo dalla pagina di Mimante (stesso indirizzo e stessa porta di `Host` o di
|
||||
`X-Forwarded-Host`); un'altra pagina riceve 403 e il registro lo dice. Dietro un proxy HTTPS il cookie è
|
||||
`Secure` (`X-Forwarded-Proto`). Chi usa un proxy deve passargli nome e porta: vedi la guida Sicurezza.
|
||||
- **Telegram** (#47): via `/halt` (il freno a distanza è `/osserva`); `/riprendi` toglie il blocco solo con
|
||||
`/riprendi si`. Il riepilogo torna a dire spesa e saldo netto del giorno. Nuovo avviso «errore ripetuto
|
||||
del motore»: 5 errori della stessa asta in 10 minuti danno un solo messaggio (Impostazioni → Telegram).
|
||||
Sul sito vero una sessione illeggibile non scrive più «si parte dal simulatore».
|
||||
- **Interfaccia** (#48): nella finestra «Aggiungi asta» la prima scelta è «Predefinito», che applica il modo
|
||||
della scheda del prodotto e poi l'impostazione «Modo delle aste aggiunte a mano». Tolte dalle
|
||||
Impostazioni «Menu compresso» e «Tema scuro»: restano i bottoni, ricordati da ogni browser.
|
||||
- **Regole e dati** (#49):
|
||||
- scritto che prima del modello pronto, con il valore del prodotto ignoto e con l'apprendimento spento
|
||||
un'asta in Attiva punta entro i soli paletti (ADR 0018): il comportamento non cambia;
|
||||
- le ricompense del conto (`account_rewards`) entrano nel backup notturno;
|
||||
- i documenti dicono come nascono davvero le partizioni (a ogni manutenzione, non «dal 25»);
|
||||
- **`DB_PORT` e `PORT` non si leggono più** (ADR 0019): la porta del database si scrive in `DB_HOST`
|
||||
(`host:porta`), l'interfaccia ascolta sempre sulla 8080 del contenitore. Se il tuo modello Unraid ha
|
||||
`DB_PORT` e `DB_HOST` senza porta, sposta la porta in `DB_HOST` prima di aggiornare; una variabile
|
||||
rimasta viene ignorata e il registro lo dice. Fuori dal container `--porta` sostituisce `PORT`.
|
||||
|
||||
## 1.9.2
|
||||
|
||||
- **Aste: via il bottone del registro del bot** accanto ai contatori, doppione della scheda «Registro del
|
||||
bot» del pannello di destra (#43). Sotto i 1100 px, dove il pannello è un cassetto, una doppia freccia
|
||||
in fondo alla barra lo apre sull'asta selezionata o, senza selezione, sul registro.
|
||||
- **Pagine del conto di Bidoo** (#33): se `buy_bids.php` o `update_credits_status.php` smettono di
|
||||
leggersi il registro lo dice, una riga per problema e mai il contenuto della risposta; saldo e credito
|
||||
si leggono anche come «1.407», «15,00» o «15 €», e la correzione arriva anche al `bidoo.json` già
|
||||
copiato in `/config/riferimenti` (una voce scritta a mano resta com'è).
|
||||
- **Nessuna puntata finché la sessione incollata non dice chi sei** (#33): prima il bot avrebbe potuto
|
||||
puntare contro sé stesso. La sezione Accesso a Bidoo e la barra dicono «Può puntare: no, utente da
|
||||
riconoscere»; all'incollo parte una sola verifica del conto.
|
||||
- **Telegram** (#35): il messaggio di prova dice sempre il motivo vero, anche quando Telegram non
|
||||
risponde; nuova impostazione «Tempo massimo di una richiesta» (15 s di fabbrica).
|
||||
- **Mimante.Dati** (#44): riassunti e dossier contano solo le aste del sito vero; il `LEGGIMI.md` dice il
|
||||
mondo di ogni file.
|
||||
- **Misura delle prestazioni dell'interfaccia** (#34): argomento di sviluppo `--simulatore-aste N`,
|
||||
modalità `--misura` di `tools/Mimante.Schermate` e lavoro «prestazioni» in `prove-a-mano`.
|
||||
- Guida: anticipo e puntate tardive controllati sui dati veri (#37).
|
||||
|
||||
## 1.9.1
|
||||
|
||||
- **L'accesso a Bidoo sta nelle Impostazioni**, come prima sezione: serve quasi solo la prima volta e
|
||||
quando la sessione scade, quindi non ha più una voce nel menu. Con un utente collegato il riquadro per
|
||||
incollare la sessione resta chiuso; il clic sull'utente in fondo al menu e i vecchi indirizzi
|
||||
`#/accesso` e `#/browser` portano lì.
|
||||
- **Guida completa nel wiki** del repository (sorgenti in `docs/guida`): installazione, primo avvio, aste,
|
||||
prodotti e paletti, come decide il modello, rischio, storico ed esportazioni, puntate gratis,
|
||||
impostazioni, Telegram, dati e backup, sicurezza, problemi comuni, sviluppo.
|
||||
- La nota della Gestione del rischio dice com'è davvero: il tetto di spesa del giorno ferma la puntata che
|
||||
lo supererebbe, solo stop-loss e drawdown fanno scattare l'HALT.
|
||||
|
||||
## 1.9.0
|
||||
|
||||
Il lavoro della 2.0.0 (milestone «2.0.0 — Mimante»), pubblicato come `:latest` per provarlo su Unraid
|
||||
con il sito vero: la 2.0.0 arriva dopo le prove dal vivo (primo riscatto, formati di acquisto e
|
||||
crediti, Telegram, anticipo e prestazioni con le aste vere).
|
||||
|
||||
- **Il programma si chiama Mimante** e il repository ha tutto alla radice, come gli altri progetti
|
||||
(ADR 0014). Cambiano l'immagine (`alby96/mimante`) e il modello Unraid, non il database né `/config`:
|
||||
per aggiornare da Bidoo BidBot 1.x segui [docs/docker.md](docs/docker.md), «Aggiornare da Bidoo BidBot».
|
||||
Dopo l'aggiornamento ogni browser rifà l'accesso all'interfaccia una volta.
|
||||
- **CI su Gitea come Febe**: verifica a ogni push (controlli, segreti, tutte le prove con PostgreSQL,
|
||||
immagine provata e scansionata), rilascio sul tag, pulizia notturna. Nessun flusso pubblica porte sul
|
||||
Docker di Unraid.
|
||||
- **Esportazioni a memoria costante**: non cadono più con molti dati. Il campione per esito lo sceglie
|
||||
PostgreSQL e le righe vanno sul file una alla volta, con un tempo massimo e un controllo dello spazio
|
||||
libero (Impostazioni ▸ Dati e conservazione); sopra 50 MB il file si scarica in `.zip`. Un'esportazione
|
||||
alla volta, di fondo: la finestra mostra fase e righe, si chiude e si riapre, ha **Annulla** e non
|
||||
lascia file a metà. Le puntate di risposta si cercano con l'indice (anche alla chiusura delle aste), e
|
||||
la pagina Apprendimento legge i suoi tre rapporti con una sola lettura invece di tre.
|
||||
- **Scaricamento dei dati** (`tools/Mimante.Dati`): porta l'archivio sul PC in una cartella da analizzare,
|
||||
in sola lettura. Le tabelle grandi un file `.csv.gz` per giorno, i riassunti già aggregati (aste,
|
||||
prodotti, mie puntate, latenza, calibrazione, previsioni, orari, avversari, cicli, qualità, rischio),
|
||||
un dossier JSONL per ogni asta su cui il bot ha puntato e il `LEGGIMI.md` con ogni colonna. Riprende
|
||||
da dove si era fermato, controlla le impronte (`verifica --contro-db`), rallenta e si ferma durante la
|
||||
manutenzione notturna; gli altri utenti diventano pseudonimi e i segreti non escono. Il backup notturno
|
||||
usa la stessa copia in blocco.
|
||||
- **Registro delle decisioni più ricco e più leggero** (migrazione 0004, solo colonne nuove). Le decisioni
|
||||
uguali di fila (lo stesso paletto ciclo dopo ciclo) sono una riga con il numero di ripetizioni e
|
||||
l'ultimo prezzo, e l'esito guarda l'ultimo prezzo. In Osserva, quando un paletto ferma la puntata, il
|
||||
modello registra lo stesso il suo parere: lo Storico e il «Perché» dicono se senza il paletto avrebbe
|
||||
puntato. Ogni mia puntata ha i millisecondi alla scadenza al verdetto, all'invio e alla risposta, lo
|
||||
stato HTTP, la risposta di Bidoo e le letture intorno; una puntata decisa e non partita dice perché.
|
||||
Le decisioni hanno l'ora in cui sono state prese, e ogni asta chiusa conta le sue decisioni.
|
||||
- **Puntate gratis** (pagina nuova, ADR 0015, migrazione 0005): il bot riscatta da solo i codici
|
||||
gratuiti pubblicati ogni giorno, con i due passi che Bidoo vuole, e tiene l'elenco delle puntate
|
||||
riscattate, dei forzieri visti e il registro delle operazioni. Spento di fabbrica; uno alla volta finché
|
||||
il primo accredito non si vede nel saldo, tetti per giro e per giorno, solo nelle ore scelte, pausa da
|
||||
sola se Bidoo chiede una verifica. Si può anche incollare un collegamento e riscattarlo subito. I
|
||||
forzieri si segnalano su Telegram, non si aprono. I collegamenti arrivano anche dalla campanella di
|
||||
Bidoo, letta senza segnare le notifiche come lette; a intervalli il bot legge le ricompense e la
|
||||
cronologia crediti di Bidoo (scheda «Ricompense di Bidoo», migrazione 0006) e scrive nel registro se i
|
||||
conti con i suoi riscatti tornano.
|
||||
- **Grafica nuova, sulla linea di Febe** (ADR 0016): grigio caldo, carte bianche, accento blu petrolio,
|
||||
carattere Archivo, righe più ariose. La barra laterale tiene in fondo il mondo (sito vero o simulatore) e
|
||||
l'utente Bidoo; elenco e pannello stanno in due riquadri. Il tema di fabbrica segue quello del sistema:
|
||||
il bottone in alto passa fra automatico, chiaro e scuro. Ogni colore ha la sua variante per il testo, e
|
||||
una prova controlla il contrasto in tutti e due i temi.
|
||||
- **Niente più browser nel bot** (ADR 0017): la pagina Browser diventa **Accesso a Bidoo**, dove si incolla
|
||||
la sessione copiata da Chrome. Basta «Copia come cURL» dalla scheda Rete degli strumenti per
|
||||
sviluppatori: il bot ne prende cookie e User-Agent da solo. Vanno bene anche le intestazioni, la riga
|
||||
Cookie o il solo valore di `__stattrb`. Chromium esce dall'immagine, che diventa molto più leggera;
|
||||
al primo avvio il bot cancella il vecchio profilo `/config/browser`, che teneva una copia dei cookie.
|
||||
|
||||
## 1.2.0
|
||||
|
||||
- **Fasce orarie di un'ora sugli orari di Bidoo**: il modello legge l'ora della puntata e quella
|
||||
dell'aggancio con una fascia per ogni ora di apertura (dalle 9 all'1: 9-10, …, 23-24, 0-1) e una sola
|
||||
per le ore chiuse (1-9), invece delle 6 fasce larghe di prima. Le variabili passano alla versione 3:
|
||||
**al primo avvio l'archivio si ristudia da solo**, e finché il ristudio non è finito nessuna asta
|
||||
punta (le decisioni si registrano, con il motivo). Anche il bandit si ricostruisce con le fasce nuove.
|
||||
La previsione usa l'ora esatta se ci sono abbastanza chiusure sopra il prezzo attuale, altrimenti
|
||||
allarga alle ore vicine (fino a due per parte, senza scavalcare la chiusura notturna).
|
||||
- **Paletti del prodotto sulle aste in corso solo per scelta**: una modifica alla scheda, il ricalcolo
|
||||
delle statistiche o un'asta chiusa non cambiano più da soli i paletti delle aste già in elenco. Le aste
|
||||
nuove li prendono quando entrano; quelle in corso con **«Applica alle aste in corso»** (pagina Prodotti,
|
||||
per tutte o per un prodotto, con conferma che dice quante aste cambiano) o con **«Torna ai paletti del
|
||||
prodotto»** sulla singola asta. Entrambi tolgono anche la fascia oraria scritta sull'asta.
|
||||
- **«Ricalcola i paletti»** (pagina Prodotti): scrive sulle schede prezzo minimo, prezzo massimo e
|
||||
puntate massime calcolati dallo storico, sovrascrivendo quelli scritti prima, dopo una conferma con il
|
||||
conto dei prodotti che cambiano. Le aste in corso non cambiano. Se per il calcolo un prodotto non
|
||||
conviene a nessun prezzo, il massimo calcolato vale 0,01 € e ferma le puntate, invece di diventare
|
||||
«nessun limite».
|
||||
- **Statistiche nuove per prodotto**: puntatori distinti per asta, quota di puntate fatte a mano, durata
|
||||
mediana, quota del puntatore più attivo (colonne della griglia e scheda Statistiche del pannello).
|
||||
- **Griglia dei prodotti**: i valori calcolati o predefiniti si leggono come gli altri numeri (niente
|
||||
più grigio né corsivo; se un valore è scritto a mano lo dicono il title e un puntino); il valore reale
|
||||
si legge ma non si modifica (si scrive dal pannello di un'asta del prodotto); «Predefinito» per il
|
||||
modo delle aste aggiunte.
|
||||
- **Bottoni a icona** nelle barre di Prodotti, Apprendimento e Storico, ognuno con il suo title (per
|
||||
esempio il libro è «Studia adesso»).
|
||||
- **Barra laterale** con il nome e l'icona del programma in cima; si comprime e si espande solo con le
|
||||
frecce in fondo. Il titolo della scheda del browser comincia con il nome del programma.
|
||||
- **Ping «tipico/picco»** ovunque si mostri (per esempio 55/77 ms: la mediana e il valore sotto cui sta
|
||||
il 99% delle letture), con il colore verde, ambra o rosso, senza sigle come «p99». **Saldo solo come
|
||||
totale** delle puntate: la divisione fra a pagamento e gratuite resta interna al costo della puntata.
|
||||
- **Aste**: la griglia non ha più le colonne Paletti e Rilanci (i paletti stanno nel pannello) né il
|
||||
filtro per nome; le colonne hanno larghezze fisse (un testo lungo non sposta le altre) e la colonna
|
||||
Azioni resta sempre visibile. In cima al pannello
|
||||
il selettore **«Asta | Registro del bot»**: il registro del bot non è più una scheda dell'asta.
|
||||
- **Pannelli di Aste e Storico** solo ridimensionabili con la maniglia, come quello dei Prodotti: non si
|
||||
ripiegano più.
|
||||
- **Impostazioni** con una sezione sotto l'altra. Quasi tutto vale subito; ciò che vale solo dal
|
||||
prossimo riavvio (oggi lo studio all'avvio) lo dice il messaggio dopo il salvataggio.
|
||||
- **Apprendimento**: la griglia delle ultime decisioni occupa tutta l'altezza del riquadro.
|
||||
|
||||
## 1.1.1
|
||||
|
||||
- **Tipo delle puntate corretto**: i codici sono quelli della pagina d'asta di Bidoo (1 e 2 manuale, 3, 4
|
||||
e 7 automatica, 5 Killer, 6 Shock). Il codice 2 (manuale) finiva «non dichiarato» e compariva come
|
||||
«—»: circa il 12% delle puntate registrate. La puntata in testa ricostruita prende il tipo dalla
|
||||
risposta stessa. Nella scheda Puntate i tipi si leggono per intero (Manuale, Automatica, Killer, Shock).
|
||||
- Tolta la colonna **Rilanci** dalla griglia delle aste (il conteggio resta nel pannello, scheda Motore).
|
||||
- **Prezzo minimo predefinito** in Impostazioni ▸ Paletti, accanto al massimo: il prezzo da cui il bot
|
||||
comincia a puntare quando il prodotto non ne ha uno suo, scritto o calcolato. Nella griglia dei
|
||||
prodotti le colonne dei paletti si chiamano «Prezzo min €», «Prezzo max €», «Punt. max», quelle delle
|
||||
chiusure «Chius. media/min/max», per non confonderle.
|
||||
|
||||
## 1.1.0
|
||||
|
||||
- **Attiva punta e basta**: sparisce la modalità globale OSSERVA/DAL VIVO con le sue conferme. Le aste
|
||||
in Attiva puntano quando il modello lo ritiene giusto, dentro paletti e tetti di rischio; Osserva è
|
||||
l'allenamento. Tolti il bottone HALT (resta il blocco automatico dei tetti di rischio, che si toglie da
|
||||
Impostazioni) e la scritta sulla modalità.
|
||||
- **Puntate virtuali in Osserva**, accese di fabbrica: il modello decide come se puntasse e impara
|
||||
dall'esito senza spendere. Si possono spegnere (Impostazioni ▸ Puntate e costi).
|
||||
- **Sito vero anche senza utente**: senza sessione Bidoo il bot segue le aste, registra, fa previsioni e
|
||||
allena il modello; solo le puntate non partono. Il simulatore si vede solo in modalità debug
|
||||
(`--simulatore`), mai nel container.
|
||||
- **Browser** (era «Accesso a Bidoo»): naviga dentro Bidoo con indietro, avanti, ricarica, home e barra
|
||||
dell'indirizzo; resta aperto dopo il login; «Aggiungi al monitor» mette in elenco l'asta aperta.
|
||||
- **Paletti calcolati dal prodotto**: scritti sulla scheda > calcolati dallo storico (almeno 5 aste) >
|
||||
predefiniti, campo per campo. Nuovo paletto **prezzo minimo** (sotto non si punta). Le aste che seguono
|
||||
il prodotto si riallineano da sole; «Torna ai paletti del prodotto» sull'asta.
|
||||
- **Prodotti come nella versione desktop**: paletti scritti direttamente nelle celle della griglia (in
|
||||
grigio i valori calcolati), statistiche di vincita (media, minima, massima, percentuale, puntate del
|
||||
vincitore, costo reale, risparmio); il pannello laterale si ridimensiona ma non si ripiega.
|
||||
- **Aste**: registro del bot in una scheda del pannello laterale (niente più registro in basso); azioni
|
||||
a icone colorate (manina per la puntata a mano, senza conferma; Attiva verde, Osserva blu, Ferma rosso);
|
||||
pulsanti per tutte le aste e contatori solo a icone.
|
||||
- **Anticipo più stretto**: margine di partenza 80 ms (era 300), anticipo minimo 100 ms. Con ~60 ms di
|
||||
rete l'anticipo scende da ~400 a ~170 ms; si alza da solo dopo una puntata tardiva.
|
||||
- **Riavvio e aggiornamento**: ogni asta riprende da dove era (modo, paletti, contatori).
|
||||
- **Nessun tetto di richieste al secondo di fabbrica** (era 40): tagliava le letture quando molte aste
|
||||
sono agli ultimi secondi, come misurato nella versione desktop; frena il server con 429/503.
|
||||
- **Prodotti**: statistiche di mercato dalla versione desktop (costo reale tipico di una vittoria,
|
||||
risparmio, aste in utile, ogni quanto passa un'asta, percentili delle chiusure e delle puntate).
|
||||
- **Attese visibili**: barra di elaborazione sotto la barra in alto quando si aspetta il bot; nella
|
||||
pagina Cerca l'elenco si vela mentre si legge la categoria, e l'ultima categoria scelta vince.
|
||||
- Impostazioni più compatte, in colonne senza spazi vuoti. Tolto il guadagno/perdita di oggi (anche dal
|
||||
riepilogo Telegram). Icona di Bidoo come icona del programma.
|
||||
- Tolta la cartella `legacy/`: ciò che serviva è nel codice nuovo; il riscatto delle puntate gratuite è
|
||||
conservato come riferimento commentato.
|
||||
|
||||
## 1.0.0
|
||||
|
||||
Prima versione di **Bidoo BidBot**, la riscrittura di AutoBidder come servizio Docker per Unraid.
|
||||
|
||||
- **Un solo container** con motore, interfaccia web e Chromium; PostgreSQL 18 esterno. Configurazione
|
||||
con tre variabili obbligatorie (`DB_HOST`, `DB_PASSWORD`, `UI_PASSWORD`); schermata d'errore con la
|
||||
causa esatta e nuovo tentativo ogni 30 secondi; `/salute` per il controllo di Unraid.
|
||||
- **Motore di precisione** portato dal legacy: orologio agganciato a quello di Bidoo, un thread dedicato
|
||||
per la finestra critica, attesa di precisione con l'errore misurato, corsia dedicata alle puntate con
|
||||
un solo ripiego sul pool, cadenza del polling per distanza dalla scadenza.
|
||||
- **Il modello è l'unico decisore**: valore atteso con la probabilità appresa (logistica campione, rete
|
||||
sfidante, bandit di Thompson per l'esplorazione, correzione sulle mie puntate, anticipo adattivo). I
|
||||
paletti dell'utente sono tutti a zero di fabbrica.
|
||||
- **OSSERVA di fabbrica**: DAL VIVO si accende con due conferme; HALT persistente con stop-loss,
|
||||
drawdown e tetto di spesa del giorno.
|
||||
- **Allenamento in Osserva e previsione dell'asta**: chiusura attesa con intervallo 10-90, puntate del
|
||||
vincitore, durata, «se entrassi ora»; confronto con la realtà alla chiusura.
|
||||
- **Interfaccia web** senza framework: Aste, Cerca, Prodotti, Storico, Apprendimento, Accesso a Bidoo,
|
||||
Impostazioni, Registro; countdown animati dal browser, aggiornamenti a delta via WebSocket, pannelli
|
||||
ridimensionabili, tema chiaro e scuro, finestra stretta. Nessuna notifica che compare ai lati mentre
|
||||
si lavora: le conferme di routine si vedono nell'interfaccia stessa, e solo errori e informazioni
|
||||
importanti (puntate, sessione, risultati di studio, verifica, manutenzione) aprono un messaggio al
|
||||
centro da chiudere con OK.
|
||||
- **Accesso assistito** a Bidoo con il browser del bot in streaming nell'interfaccia (CDP scritto a
|
||||
mano); sessione cifrata AES-256-GCM; ripiego «incolla i cookie».
|
||||
- **Simulatore interno** con lo stesso formato del sito: primo avvio senza sessione, riscaldamento del
|
||||
motore, test, schermate. Dati e modello del simulatore separati da quelli veri.
|
||||
- **Dati**: storico completo in PostgreSQL con partizioni mensili, nessuna interrogazione registrata,
|
||||
tetto di 50 GB con ordine di sacrificio, backup notturno delle tabelle di riepilogo.
|
||||
- **Esportazioni CSV per la revisione**: dati del modello (una riga per decisione con tutte le
|
||||
variabili) e storico delle aste, con legenda.
|
||||
- **Telegram**: vincite, perdite, sessione scaduta, HALT, spazio, riepilogo periodico; comandi facoltativi.
|
||||
- **Prodotti seguiti** con aggiunta automatica delle aste, limiti consigliati (solo consigli) e recupero
|
||||
delle puntate dei vincitori.
|
||||
@@ -1,118 +0,0 @@
|
||||
# Mimante
|
||||
|
||||
Fino alla 1.2.0 si chiamava Bidoo BidBot (ADR 0014). Servizio Linux in un solo container Docker (Unraid) che segue le aste al centesimo di Bidoo,
|
||||
decide con un modello appreso se puntare, punta negli ultimi millisecondi, registra su
|
||||
PostgreSQL ciò che serve allo storico e al modello, si comanda da un'interfaccia web protetta
|
||||
da password e avvisa su Telegram. C# / .NET 10, interfaccia HTML/CSS/JS senza framework.
|
||||
|
||||
- Specifica completa e decisioni prese: [docs/SPECIFICA.md](docs/SPECIFICA.md) (il documento
|
||||
da cui è nata la riscrittura; le domande aperte sono al §16).
|
||||
- Stato del lavoro, decisioni provvisorie, cosa manca: [docs/stato.md](docs/stato.md). Va
|
||||
aggiornato a fine sessione.
|
||||
- Architettura per chi tocca il codice: [docs/architettura.md](docs/architettura.md). Decisioni
|
||||
non ovvie: [docs/adr/](docs/adr/). Guida utente: [README.md](README.md),
|
||||
[docs/come-funziona.md](docs/come-funziona.md) e il wiki del repository (sorgenti in
|
||||
[docs/guida/](docs/guida/Home.md), una pagina per file, prova `GuideTests`): una modifica che cambia
|
||||
ciò che vede l'utente aggiorna anche la pagina del wiki e la ripubblica (docs/guida/Sviluppo.md).
|
||||
- Come si lavora (rami, commit, issue, CI, rilascio): [docs/processo.md](docs/processo.md); registro
|
||||
delle decisioni di Alberto: [docs/decisioni.md](docs/decisioni.md); immagine e Unraid:
|
||||
[docs/docker.md](docs/docker.md). Il lavoro si traccia su Gitea (milestone, issue con le
|
||||
etichette `Area/`, `Kind/`, `Priority/`, `Status/`).
|
||||
- La vecchia app WPF (`legacy/`) è stata eliminata nella 1.1.0: la sua conoscenza è nel codice; il
|
||||
riferimento del riscatto e il formato SQLite della versione desktop sono leggibili al tag `v1.2.0`.
|
||||
|
||||
## Regole del progetto
|
||||
|
||||
- **Il modello è l'unico decisore.** L'utente ha solo paletti (prezzo massimo, puntate
|
||||
massime, soglia sul saldo, fascia oraria, rischio), tutti a zero = nessun limite. Nessuna
|
||||
euristica di strategia fuori da `Strategy/BidStrategy` e `Ml/LearningService`.
|
||||
**Unica eccezione** ([ADR 0018](docs/adr/0018-puntate-prima-del-modello-pronto.md)): prima che il modello sia
|
||||
pronto (`LearningMinAuctions`), con valore del prodotto ignoto (`SenzaStima`) e con l'apprendimento spento, un'asta
|
||||
in Attiva punta entro i soli paletti e tetti di rischio (che di fabbrica sono a zero: nessun tetto alla spesa).
|
||||
- **Attiva punta, Osserva impara.** Nessuna modalità globale: un'asta in Attiva punta quando il
|
||||
modello lo ritiene giusto, dentro paletti e rischio, senza conferme; le aste entrano in Osserva, dove
|
||||
le decisioni sono virtuali (`ShadowDecisionsInWatch`). Nessuna puntata senza utente Bidoo collegato
|
||||
(`MonitorDeps.CanBid`). L'HALT esiste solo come blocco automatico dei tetti di rischio, persistente.
|
||||
- **Paletti dei prodotti:** scritti > calcolati dallo storico (`Products/ProductLimits`, almeno 5 aste) >
|
||||
predefiniti, campo per campo; fermano una puntata, non la provocano. Un'asta li prende quando entra in
|
||||
elenco; alle aste in corso arrivano solo con «Applica alle aste in corso» o «Torna ai paletti del
|
||||
prodotto» (ADR 0012), mai da soli: né la scheda, né il ricalcolo, né un'asta chiusa li cambiano.
|
||||
- **Solo C#** (più SQL, YAML, JSON, HTML/CSS/JS dell'interfaccia e lo shell dell'immagine).
|
||||
Pacchetti ammessi, con le versioni solo in `Directory.Packages.props`: `Npgsql`, `xunit`,
|
||||
`xunit.runner.visualstudio`, `Microsoft.NET.Test.Sdk`. Tutto il resto si scrive (anche ffmpeg,
|
||||
SQLite e simili: niente componenti esterni). La CI (`.gitea/scripts/controlli.sh`) rifiuta gli altri.
|
||||
- **Lingua:** interfaccia, documentazione, registri, messaggi e commenti in italiano;
|
||||
identificatori, file di codice, chiavi JSON e tabelle in inglese.
|
||||
- **Registri:** una riga per evento, niente emoji né simboli (tutto passa da `LogText.Clean`),
|
||||
niente righe ripetute per la stessa decisione (`AuctionLog.AddDecision`). Le singole
|
||||
interrogazioni a Bidoo non si registrano mai.
|
||||
- **Percorso caldo** (risposta di `data.php` → invio di `bid.php`): niente disco, niente
|
||||
database, niente lock lunghi. Tutto ciò che va su PostgreSQL passa da `Data/WriteQueue`.
|
||||
- **Nel database solo storico e modello.** Ogni tabella ha il suo «serve al modello per…» o
|
||||
«serve allo storico per…» in `docs/architettura.md`; registri, diagnostica e stato
|
||||
dell'interfaccia stanno in memoria o su file.
|
||||
- **Migrazioni solo additive:** un file nuovo `src/Mimante/Data/Migrations/NNNN_nome.sql`,
|
||||
mai riscrivere tabelle esistenti. Le tabelle partizionate (`bids`, `resets`, `bot_decisions`)
|
||||
hanno le partizioni mensili create dal programma.
|
||||
- **Variabili del modello:** se cambia una fascia di `Ml/BidFeatures`, alza `Version`;
|
||||
l'archivio si ristudia da solo, e finché il ristudio non finisce le aste non puntano (ADR 0013), salvo con
|
||||
l'apprendimento spento, che non consulta il modello (ADR 0018).
|
||||
- **Nessun parametro cablato:** i valori vivono in `Settings/AppSettings` (nel database) o in
|
||||
`/config/riferimenti/bidoo.json` (endpoint ed espressioni del sito). Le impostazioni valgono subito;
|
||||
una proprietà letta una volta sola (costruttore, periodo di un timer, lavoro d'avvio) va in
|
||||
`SettingsStore.RestartRequired` con l'etichetta della pagina, così il salvataggio lo dice.
|
||||
- **Segreti:** `DB_PASSWORD` e `UI_PASSWORD` solo in ambiente; mai nei registri, nelle
|
||||
esportazioni, in `docs/`. Il token Telegram sta nel database e in `/config/cache` (0600).
|
||||
- **Test accanto a ogni pezzo di logica pura** (`tests/Mimante.Tests`, xUnit). I test su
|
||||
PostgreSQL usano `[Collection("Database")]` e saltano se manca `TEST_DB_HOST`.
|
||||
- **Interfaccia:** ogni numero, campo e intestazione ha un `title` che dice esattamente cos'è;
|
||||
aggiornamento chirurgico del DOM (mai ri-renderizzare la griglia, vedi `wwwroot/js/grid.js`);
|
||||
layout fluido con maniglie; token di colore solo da `wwwroot/css/tokens.css`. **Niente
|
||||
notifiche che compaiono ai lati**: una conferma di routine si vede già nell'interfaccia
|
||||
(stella, bottone del modo, riga); un messaggio al centro (`notice`, `report(ack, { important: true })`
|
||||
in `wwwroot/js/util.js`) solo per errori e informazioni importanti. Dopo ogni
|
||||
modifica all'interfaccia: `tools/Mimante.Schermate` contro il bot in locale deve finire con
|
||||
«Nessun errore JavaScript», e le schermate vanno guardate.
|
||||
- **Due mondi separati:** sito vero (sempre, anche senza utente) e simulatore (`Host/BotWorld`), che
|
||||
si vede solo con l'argomento `--simulatore` (modalità debug: VS Code, test, schermate; mai nel
|
||||
container). I dati del simulatore hanno `auctions.type = 'sim'` e il modello in `ml-sim/*`; ogni
|
||||
lettura dell'archivio filtra per mondo. Nessun dato del simulatore deve finire nel modello vero.
|
||||
- **Riavvio:** ogni asta riprende modo, paletti e contatori dall'elenco salvato (`AuctionSnapshot`);
|
||||
un campo nuovo di `AuctionInfo` che conta va aggiunto anche lì.
|
||||
|
||||
## Comandi
|
||||
|
||||
```
|
||||
dotnet build Mimante.slnx -c Release
|
||||
dotnet test tests/Mimante.Tests -c Release --no-build
|
||||
|
||||
# PostgreSQL 18 per sviluppo e test del database
|
||||
docker compose -f docker/compose.yml up -d postgres
|
||||
$env:TEST_DB_HOST="localhost"; $env:TEST_DB_PASSWORD="dev" # poi dotnet test
|
||||
|
||||
# Il bot in locale (senza Docker), contro il PostgreSQL del compose; --simulatore = modalità debug
|
||||
$env:DB_HOST="localhost"; $env:DB_PASSWORD="dev"; $env:UI_PASSWORD="dev"
|
||||
dotnet run --project src/Mimante -- --config "$PWD/tools/dev/config" --simulatore # percorso assoluto
|
||||
|
||||
# Ambiente di release (prove sul sito vero): VS Code «Mimante (release, PostgreSQL di Unraid)»,
|
||||
# Ctrl+F5. Release, PostgreSQL di Unraid, tools/dev/config-release, --porta 8090; variabili in
|
||||
# tools/dev/release.env (ignorato da git, modello in release.env.example). Non stamparne mai le password.
|
||||
|
||||
# Immagine e screenshot per il README
|
||||
docker build -f docker/Dockerfile --build-arg VERSION=1.9.4 -t mimante:dev .
|
||||
dotnet run --project tools/Mimante.Schermate -- http://localhost:8080 dev docs/schermate # bot con --simulatore; Chrome o Edge del PC; --messaggio il messaggio a schermo
|
||||
|
||||
# Prestazioni dell'interfaccia (specifica §9.11): bot con --simulatore --simulatore-aste 60, password da UI_PASSWORD
|
||||
dotnet run --project tools/Mimante.Schermate -- http://localhost:8080 out/prestazioni --misura 120
|
||||
```
|
||||
|
||||
`--config <cartella>`, `--porta <N>` (porta dell'interfaccia, predefinita 8080; la usa anche la sonda `--salute`),
|
||||
`--simulatore` e, con questo, `--simulatore-aste <N>` (N aste in elenco, per la misura delle prestazioni) servono solo
|
||||
allo sviluppo fuori dal container (predefinito `/config`, porta 8080, sito vero): nessuna variabile d'ambiente oltre a
|
||||
quelle di §10.1 della specifica meno `DB_PORT` e `PORT`, tolte dall'[ADR 0019](docs/adr/0019-niente-db-port-e-port.md)
|
||||
(la porta del database sta in `DB_HOST`).
|
||||
Il rilascio è un tag `vX.Y.Z` uguale a `<Version>` in `Directory.Build.props`
|
||||
(`.gitea/workflows/rilascio.yml`). Non stampare mai token o password.
|
||||
|
||||
Un commit per lavoro, con un messaggio che dice cosa cambia e perché e il numero della issue; il push
|
||||
del ramo fa partire `verifica.yml`, che deve essere verde prima di unire a `main` (docs/processo.md).
|
||||
@@ -1,42 +0,0 @@
|
||||
<Project>
|
||||
|
||||
<!--
|
||||
Unica origine della versione: la leggono il binario (/salute, barra dell'interfaccia,
|
||||
/config/versione.txt), l'immagine Docker (build-arg VERSION) e il workflow di rilascio,
|
||||
che rifiuta un tag vX.Y.Z diverso da questo numero.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<Version>1.9.4</Version>
|
||||
<Product>Mimante</Product>
|
||||
<Company>Alberto Balbo</Company>
|
||||
<Copyright>Uso personale</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Deterministic>true</Deterministic>
|
||||
<!-- Le versioni dei pacchetti stanno solo in Directory.Packages.props (elenco chiuso). -->
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<NeutralLanguage>it-IT</NeutralLanguage>
|
||||
<SatelliteResourceLanguages>it</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
Motore a bassa latenza (specifica §6.3). GC di workstation concorrente: pause brevi e
|
||||
prevedibili contano più del rendimento; il GC di server alloca un heap per core e fa
|
||||
pause più lunghe, ed è pensato per molte richieste indipendenti, non per un thread
|
||||
cecchino che deve svegliarsi al millisecondo. Globalizzazione vera (non invariante):
|
||||
numeri e date all'italiana.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
||||
<TieredPGO>true</TieredPGO>
|
||||
<InvariantGlobalization>false</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,12 +0,0 @@
|
||||
<Project>
|
||||
<!--
|
||||
Dipendenze a elenco chiuso (CLAUDE.md, «Solo C#»): il driver di PostgreSQL per il servizio,
|
||||
xunit per le prove. Per aggiungerne una si chiede prima; controlli.sh rifiuta le altre.
|
||||
-->
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Npgsql" Version="10.0.3" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
<PackageVersion Include="xunit" Version="2.9.3" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,12 +0,0 @@
|
||||
<Solution>
|
||||
<Folder Name="/src/">
|
||||
<Project Path="src/Mimante/Mimante.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/tests/">
|
||||
<Project Path="tests/Mimante.Tests/Mimante.Tests.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/tools/">
|
||||
<Project Path="tools/Mimante.Dati/Mimante.Dati.csproj" />
|
||||
<Project Path="tools/Mimante.Schermate/Mimante.Schermate.csproj" />
|
||||
</Folder>
|
||||
</Solution>
|
||||
@@ -0,0 +1,87 @@
|
||||
**Dockerignore file**
|
||||
|
||||
# Build artifacts
|
||||
**/bin/
|
||||
**/obj/
|
||||
**/out/
|
||||
**/publish/
|
||||
|
||||
# User-specific files
|
||||
*.user
|
||||
*.suo
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# IDE files
|
||||
.vs/
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# NuGet packages
|
||||
*.nupkg
|
||||
*.snupkg
|
||||
**/packages/*
|
||||
!**/packages/build/
|
||||
|
||||
# Test results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# Data and databases (exclude from image)
|
||||
**/data/*.db
|
||||
**/data/*.db-shm
|
||||
**/data/*.db-wal
|
||||
**/data/backups/
|
||||
**/data/logs/
|
||||
|
||||
# Git files
|
||||
.git
|
||||
.gitignore
|
||||
.gitattributes
|
||||
.github/
|
||||
|
||||
# CI/CD files
|
||||
.gitea/
|
||||
|
||||
# Documentation
|
||||
*.md
|
||||
!README.md
|
||||
|
||||
# Docker files
|
||||
Dockerfile*
|
||||
docker-compose*
|
||||
.dockerignore
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.temp
|
||||
*.cache
|
||||
*.bak
|
||||
*.log
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -0,0 +1,92 @@
|
||||
# AutoBidder Environment Variables
|
||||
# Copia questo file in .env e configura i valori
|
||||
|
||||
# === ASP.NET Core Configuration ===
|
||||
ASPNETCORE_ENVIRONMENT=Production
|
||||
ASPNETCORE_URLS=http://+:8080
|
||||
|
||||
# === AUTENTICAZIONE APPLICAZIONE (SICUREZZA) ===
|
||||
# Username amministratore
|
||||
ADMIN_USERNAME=admin
|
||||
|
||||
# Password amministratore (OBBLIGATORIO in produzione!)
|
||||
# REQUISITI: min 12 caratteri, maiuscole, minuscole, numeri, simboli
|
||||
# Esempio: Admin@SecurePass2024!
|
||||
ADMIN_PASSWORD=
|
||||
|
||||
# === NOTA: SESSIONE BIDOO ===
|
||||
# Non servono credenziali Bidoo!
|
||||
# Il cookie di sessione Bidoo viene configurato manualmente
|
||||
# dall'interfaccia web in Settings ? Sessione Bidoo
|
||||
|
||||
# === PostgreSQL Database (Statistiche) ===
|
||||
# Username PostgreSQL
|
||||
POSTGRES_USER=autobidder
|
||||
|
||||
# Password PostgreSQL (CAMBIA IN PRODUZIONE!)
|
||||
POSTGRES_PASSWORD=autobidder_password
|
||||
|
||||
# Database name
|
||||
POSTGRES_DB=autobidder_stats
|
||||
|
||||
# Usa PostgreSQL per statistiche (true/false)
|
||||
USE_POSTGRES=true
|
||||
|
||||
# === Application Settings ===
|
||||
# Logging level (Debug, Information, Warning, Error)
|
||||
LOG_LEVEL=Information
|
||||
|
||||
# Porta applicazione (default: 8080 container, mappata su host)
|
||||
APP_PORT=5000
|
||||
|
||||
# === Database Configuration ===
|
||||
# Path database SQLite locale (default: /app/data/autobidder.db in container)
|
||||
# DATABASE_PATH=/app/data/autobidder.db
|
||||
|
||||
# Giorni di retention backup database (default: 30)
|
||||
DB_BACKUP_RETENTION_DAYS=30
|
||||
|
||||
# Auto-ottimizzazione database (VACUUM automatico)
|
||||
DB_AUTO_OPTIMIZE=true
|
||||
|
||||
# === Logging ===
|
||||
# Livello log: Trace, Debug, Information, Warning, Error, Critical
|
||||
LOG_LEVEL=Information
|
||||
|
||||
# Livello log Microsoft: Trace, Debug, Information, Warning, Error, Critical
|
||||
LOG_LEVEL_MICROSOFT=Warning
|
||||
|
||||
# Livello log Entity Framework: Trace, Debug, Information, Warning, Error, Critical
|
||||
LOG_LEVEL_EF=Warning
|
||||
|
||||
# === Application Settings ===
|
||||
# Numero massimo connessioni concorrenti HTTP
|
||||
# MAX_HTTP_CONNECTIONS=10
|
||||
|
||||
# Timeout richieste HTTP (secondi)
|
||||
# HTTP_TIMEOUT=30
|
||||
|
||||
# === Backup Configuration ===
|
||||
# Directory backup (default: /app/data/backups)
|
||||
# BACKUP_DIR=/app/data/backups
|
||||
|
||||
# Numero giorni backup da mantenere
|
||||
# BACKUP_RETENTION_DAYS=30
|
||||
|
||||
# === Security ===
|
||||
# Chiave segreta per DataProtection (genera random se non specificato)
|
||||
# DATA_PROTECTION_KEY=your-random-key-here
|
||||
|
||||
# === Monitoring ===
|
||||
# Abilita metriche Prometheus (true/false)
|
||||
# ENABLE_METRICS=false
|
||||
|
||||
# Porta metriche (se ENABLE_METRICS=true)
|
||||
# METRICS_PORT=9090
|
||||
|
||||
# === Advanced ===
|
||||
# Numero thread worker per polling aste
|
||||
# AUCTION_WORKER_THREADS=4
|
||||
|
||||
# Intervallo pulizia cache (minuti)
|
||||
# CACHE_CLEANUP_INTERVAL=60
|
||||
@@ -0,0 +1,71 @@
|
||||
name: Database Backup
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Esegui backup ogni giorno alle 2:00 AM UTC
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch: # Permette trigger manuale
|
||||
|
||||
jobs:
|
||||
backup-database:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Execute remote backup
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_HOST }}
|
||||
username: ${{ secrets.DEPLOY_USER }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
script: |
|
||||
echo "??? Starting database backup..."
|
||||
|
||||
cd /opt/autobidder
|
||||
|
||||
# Directory backup
|
||||
BACKUP_DIR="./data/backups"
|
||||
mkdir -p $BACKUP_DIR
|
||||
|
||||
# Timestamp
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
# Backup database
|
||||
if [ -f ./data/autobidder.db ]; then
|
||||
echo "?? Backing up autobidder.db..."
|
||||
cp ./data/autobidder.db $BACKUP_DIR/autobidder_backup_$TIMESTAMP.db
|
||||
|
||||
# Verifica backup
|
||||
if [ -f $BACKUP_DIR/autobidder_backup_$TIMESTAMP.db ]; then
|
||||
SIZE=$(du -h $BACKUP_DIR/autobidder_backup_$TIMESTAMP.db | cut -f1)
|
||||
echo "? Backup created successfully: $SIZE"
|
||||
else
|
||||
echo "? Backup failed!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "?? Database file not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Cleanup backup vecchi (mantieni ultimi 30 giorni)
|
||||
echo "?? Cleaning up old backups..."
|
||||
find $BACKUP_DIR -name "autobidder_backup_*.db" -mtime +30 -delete
|
||||
|
||||
# Conta backup rimanenti
|
||||
BACKUP_COUNT=$(find $BACKUP_DIR -name "autobidder_backup_*.db" | wc -l)
|
||||
echo "?? Total backups: $BACKUP_COUNT"
|
||||
|
||||
# Mostra dimensione totale backup
|
||||
TOTAL_SIZE=$(du -sh $BACKUP_DIR | cut -f1)
|
||||
echo "?? Total backup size: $TOTAL_SIZE"
|
||||
|
||||
echo "?? Backup completed successfully!"
|
||||
|
||||
- name: Backup summary
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ job.status }}" == "success" ]; then
|
||||
echo "? Database backup SUCCESSFUL"
|
||||
else
|
||||
echo "? Database backup FAILED"
|
||||
fi
|
||||
@@ -0,0 +1,222 @@
|
||||
name: Build and Deploy AutoBidder
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- docker
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch: # Permette trigger manuale
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '8.0.x'
|
||||
REGISTRY: ${{ secrets.GITEA_REGISTRY }}
|
||||
|
||||
jobs:
|
||||
# Job 1: Build e Test .NET
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Fetch completo per analisi
|
||||
|
||||
- name: Set up .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Cache NuGet packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget-
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
|
||||
- name: Run tests
|
||||
run: dotnet test --no-restore --verbosity normal --logger "console;verbosity=detailed"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Publish artifacts
|
||||
run: dotnet publish --configuration Release --no-build --output ./publish
|
||||
|
||||
- name: Upload publish artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: publish-artifacts
|
||||
path: ./publish
|
||||
retention-days: 7
|
||||
|
||||
# Job 2: Build e Push Docker Image
|
||||
build-docker:
|
||||
needs: build-and-test
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.GITEA_USERNAME }}
|
||||
password: ${{ secrets.GITEA_PASSWORD }}
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/autobidder
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix=,format=short
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
labels: |
|
||||
org.opencontainers.image.title=AutoBidder
|
||||
org.opencontainers.image.description=Sistema automatizzato gestione aste Blazor
|
||||
org.opencontainers.image.vendor=Alby96
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/autobidder:buildcache
|
||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/autobidder:buildcache,mode=max
|
||||
build-args: |
|
||||
BUILD_DATE=${{ github.event.head_commit.timestamp }}
|
||||
VCS_REF=${{ github.sha }}
|
||||
VERSION=${{ steps.meta.outputs.version }}
|
||||
|
||||
# Job 3: Security Scan (opzionale)
|
||||
security-scan:
|
||||
needs: build-docker
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
image-ref: ${{ env.REGISTRY }}/autobidder:latest
|
||||
format: 'sarif'
|
||||
output: 'trivy-results.sarif'
|
||||
|
||||
- name: Upload Trivy results
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
if: always()
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
||||
|
||||
# Job 4: Deploy su Server
|
||||
deploy:
|
||||
needs: build-docker
|
||||
runs-on: ubuntu-latest
|
||||
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker') && github.event_name == 'push'
|
||||
environment:
|
||||
name: production
|
||||
url: https://${{ secrets.DEPLOY_HOST }}:5001
|
||||
|
||||
steps:
|
||||
- name: Deploy to server
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_HOST }}
|
||||
username: ${{ secrets.DEPLOY_USER }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
script: |
|
||||
echo "?? Starting deployment..."
|
||||
|
||||
# Vai alla directory deploy
|
||||
cd /opt/autobidder || exit 1
|
||||
|
||||
# Carica variabili ambiente
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | grep -v '^#' | xargs)
|
||||
fi
|
||||
|
||||
# Login al registry
|
||||
echo "$GITEA_PASSWORD" | docker login $GITEA_REGISTRY -u $GITEA_USERNAME --password-stdin
|
||||
|
||||
# Backup database prima del deploy
|
||||
echo "?? Creating database backup..."
|
||||
if [ -f data/autobidder.db ]; then
|
||||
mkdir -p data/backups
|
||||
cp data/autobidder.db data/backups/autobidder_predeploy_$(date +%Y%m%d_%H%M%S).db
|
||||
fi
|
||||
|
||||
# Pull nuova immagine
|
||||
echo "?? Pulling latest image..."
|
||||
docker-compose pull
|
||||
|
||||
# Stop vecchi container
|
||||
echo "?? Stopping old containers..."
|
||||
docker-compose down
|
||||
|
||||
# Start nuovi container
|
||||
echo "?? Starting new containers..."
|
||||
docker-compose up -d
|
||||
|
||||
# Attendi healthcheck
|
||||
echo "?? Waiting for healthcheck..."
|
||||
sleep 15
|
||||
|
||||
# Verifica status
|
||||
echo "?? Container status:"
|
||||
docker-compose ps
|
||||
|
||||
# Verifica healthcheck
|
||||
if docker inspect --format='{{.State.Health.Status}}' autobidder | grep -q "healthy"; then
|
||||
echo "? Deploy successful! Container is healthy."
|
||||
else
|
||||
echo "?? Warning: Container may not be healthy yet. Check logs."
|
||||
fi
|
||||
|
||||
# Mostra ultimi log
|
||||
echo "?? Recent logs:"
|
||||
docker-compose logs --tail=30
|
||||
|
||||
echo "?? Deployment completed!"
|
||||
|
||||
- name: Notify deployment status
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ job.status }}" == "success" ]; then
|
||||
echo "? Deployment SUCCESSFUL"
|
||||
else
|
||||
echo "? Deployment FAILED"
|
||||
fi
|
||||
|
||||
# Job 5: Cleanup (rimuove vecchie immagini dal registry)
|
||||
cleanup:
|
||||
needs: deploy
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- name: Cleanup old images
|
||||
run: |
|
||||
echo "?? Cleanup task completed (manual cleanup required on Gitea)"
|
||||
@@ -0,0 +1,70 @@
|
||||
name: Health Check Monitor
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Verifica ogni ora
|
||||
- cron: '0 * * * *'
|
||||
workflow_dispatch: # Permette trigger manuale
|
||||
|
||||
jobs:
|
||||
health-check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check application health
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_HOST }}
|
||||
username: ${{ secrets.DEPLOY_USER }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
script: |
|
||||
echo "?? Health Check Starting..."
|
||||
|
||||
# Verifica container running
|
||||
if ! docker ps | grep -q "autobidder"; then
|
||||
echo "? Container NOT running!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verifica Docker healthcheck
|
||||
HEALTH_STATUS=$(docker inspect --format='{{.State.Health.Status}}' autobidder 2>/dev/null || echo "unknown")
|
||||
echo "Docker Health: $HEALTH_STATUS"
|
||||
|
||||
if [ "$HEALTH_STATUS" != "healthy" ]; then
|
||||
echo "?? Container not healthy!"
|
||||
echo "Recent logs:"
|
||||
docker logs autobidder --tail=50
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test HTTP endpoint
|
||||
if curl -f -s http://localhost:5000/health > /dev/null; then
|
||||
echo "? HTTP endpoint: OK"
|
||||
else
|
||||
echo "? HTTP endpoint: FAILED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verifica database
|
||||
cd /opt/autobidder
|
||||
if [ -f ./data/autobidder.db ]; then
|
||||
DB_SIZE=$(du -h ./data/autobidder.db | cut -f1)
|
||||
echo "?? Database size: $DB_SIZE"
|
||||
else
|
||||
echo "?? Database file not found!"
|
||||
fi
|
||||
|
||||
# Verifica risorse container
|
||||
echo "?? Container resources:"
|
||||
docker stats autobidder --no-stream --format " CPU: {{.CPUPerc}}\n Memory: {{.MemUsage}}"
|
||||
|
||||
echo "? All health checks passed!"
|
||||
|
||||
- name: Health check summary
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ job.status }}" == "success" ]; then
|
||||
echo "? Health check PASSED"
|
||||
else
|
||||
echo "? Health check FAILED - Check server status!"
|
||||
fi
|
||||
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
name: AutoBidder CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, docker ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
REGISTRY: 192.168.30.23/Alby96
|
||||
IMAGE_NAME: autobidder
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
|
||||
- name: Test
|
||||
run: dotnet test --no-restore --verbosity normal
|
||||
continue-on-error: true
|
||||
|
||||
- name: Publish
|
||||
run: dotnet publish --configuration Release --no-build --output ./publish
|
||||
|
||||
docker-build-push:
|
||||
needs: build-and-test
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ secrets.GITEA_REGISTRY }}
|
||||
username: ${{ secrets.GITEA_USERNAME }}
|
||||
password: ${{ secrets.GITEA_PASSWORD }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=sha
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
|
||||
|
||||
deploy:
|
||||
needs: docker-build-push
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/docker' || github.ref == 'refs/heads/main'
|
||||
|
||||
steps:
|
||||
- name: Deploy to server
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_HOST }}
|
||||
username: ${{ secrets.DEPLOY_USER }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
script: |
|
||||
cd /opt/autobidder
|
||||
source .env
|
||||
echo "$GITEA_PASSWORD" | docker login $GITEA_REGISTRY -u $GITEA_USERNAME --password-stdin
|
||||
docker-compose pull
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
sleep 10
|
||||
docker-compose ps
|
||||
docker-compose logs --tail=30
|
||||
@@ -0,0 +1,456 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
*.ncb
|
||||
*.aps
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
.idea/
|
||||
|
||||
# ============================================
|
||||
# AutoBidder Specific
|
||||
# ============================================
|
||||
|
||||
# Database files (local development)
|
||||
*.db
|
||||
*.db-shm
|
||||
*.db-wal
|
||||
data/*.db
|
||||
data/*.db-*
|
||||
|
||||
# Backups (keep structure, ignore files)
|
||||
data/backups/*.db
|
||||
data/backups/*.json
|
||||
|
||||
# Logs
|
||||
logs/*.log
|
||||
logs/*.txt
|
||||
*.log
|
||||
|
||||
# Environment files with secrets
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Certificates and keys
|
||||
*.pfx
|
||||
*.key
|
||||
*.crt
|
||||
*.pem
|
||||
cert/*
|
||||
!cert/.gitkeep
|
||||
|
||||
# Docker volumes data
|
||||
test-data/
|
||||
|
||||
# Published artifacts
|
||||
publish/
|
||||
PublishProfiles/
|
||||
|
||||
# Temp directories
|
||||
temp/
|
||||
tmp/
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Keep important empty directories
|
||||
!data/.gitkeep
|
||||
!data/backups/.gitkeep
|
||||
!logs/.gitkeep
|
||||
!cert/.gitkeep
|
||||
@@ -0,0 +1,36 @@
|
||||
<CascadingAuthenticationState>
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
|
||||
<NotAuthorized>
|
||||
@if (context.User.Identity?.IsAuthenticated != true)
|
||||
{
|
||||
<RedirectToLogin />
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>Non sei autorizzato ad accedere a questa risorsa.</p>
|
||||
}
|
||||
</NotAuthorized>
|
||||
</AuthorizeRouteView>
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<PageTitle>Non trovato</PageTitle>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<div style="padding: 2rem; text-align: center;">
|
||||
<svg style="width: 64px; height: 64px; margin-bottom: 1rem; opacity: 0.5;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<line x1="12" y1="8" x2="12" y2="12"></line>
|
||||
<line x1="12" y1="16" x2="12.01" y2="16"></line>
|
||||
</svg>
|
||||
<h1 style="font-size: 1.5rem; margin-bottom: 0.5rem;">Pagina non trovata</h1>
|
||||
<p style="color: var(--text-muted);">Spiacenti, non c'è nulla a questo indirizzo.</p>
|
||||
<a href="/" style="color: var(--primary-color); text-decoration: none; margin-top: 1rem; display: inline-block;">
|
||||
?? Torna alla Home
|
||||
</a>
|
||||
</div>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
</CascadingAuthenticationState>
|
||||
@@ -0,0 +1,29 @@
|
||||
<Application x:Class="Mimante.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Mimante"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<!-- Stile pulsanti globale -->
|
||||
<Style x:Key="SmallButtonStyle" TargetType="Button">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="12"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace Mimante
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
@@ -0,0 +1,157 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>AutoBidder</AssemblyName>
|
||||
<RootNamespace>AutoBidder</RootNamespace>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
<DockerfileFile>Dockerfile</DockerfileFile>
|
||||
|
||||
<!-- Versioning per Docker & Gitea Registry -->
|
||||
<!-- v1.3.0: Database management + bug fixes (duplicates, race conditions, warnings) -->
|
||||
<Version>1.3.0</Version>
|
||||
<AssemblyVersion>1.3.0.0</AssemblyVersion>
|
||||
<FileVersion>1.3.0.0</FileVersion>
|
||||
<InformationalVersion>1.3.0</InformationalVersion>
|
||||
|
||||
<!-- Metadata immagine Docker -->
|
||||
<ContainerImageName>autobidder</ContainerImageName>
|
||||
<ContainerImageTag>$(Version)</ContainerImageTag>
|
||||
<!-- CORRETTO: Convenzione Gitea {registro}/{proprietario}/{immagine} -->
|
||||
<ContainerRegistry>gitea.encke-hake.ts.net/alby96</ContainerRegistry>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Exclude WPF files from compilation -->
|
||||
<Compile Remove=".github\**" />
|
||||
<Compile Remove=".vscode\**" />
|
||||
<Compile Remove="obj\**" />
|
||||
<Compile Remove="Controls\**" />
|
||||
<Compile Remove="Dialogs\**" />
|
||||
<Compile Remove="Core\**" />
|
||||
<Compile Remove="MainWindow.xaml.cs" />
|
||||
<Compile Remove="App.xaml.cs" />
|
||||
<Compile Remove="AssemblyInfo.cs" />
|
||||
<Compile Remove="ViewModels\**" />
|
||||
<Compile Remove="Utilities\NumericTextBoxHelper.cs" />
|
||||
<Compile Remove="Utilities\BooleanToOpacityConverter.cs" />
|
||||
<Compile Remove="Utilities\RelayCommand.cs" />
|
||||
|
||||
<Content Remove=".github\**" />
|
||||
<Content Remove=".vscode\**" />
|
||||
<Content Remove="obj\**" />
|
||||
<Content Remove="Controls\**" />
|
||||
<Content Remove="Dialogs\**" />
|
||||
<Content Remove="**\*.xaml" />
|
||||
|
||||
<EmbeddedResource Remove=".github\**" />
|
||||
<EmbeddedResource Remove=".vscode\**" />
|
||||
<EmbeddedResource Remove="obj\**" />
|
||||
<EmbeddedResource Remove="Controls\**" />
|
||||
<EmbeddedResource Remove="Dialogs\**" />
|
||||
|
||||
<None Remove=".github\**" />
|
||||
<None Remove=".vscode\**" />
|
||||
<None Remove="obj\**" />
|
||||
<None Remove="Controls\**" />
|
||||
<None Remove="Dialogs\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Icon\favicon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Icon\favicon.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include=".gitea\workflows\backup.yml" />
|
||||
<None Include=".gitea\workflows\deploy.yml" />
|
||||
<None Include=".gitea\workflows\health-check.yml" />
|
||||
<None Include=".github\workflows\ci-cd.yml" />
|
||||
<None Include="Dockerfile" />
|
||||
<None Include=".dockerignore" />
|
||||
<None Include="Properties\PublishProfiles\GiteaRegistry-Versioned.pubxml.user" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ============================================ -->
|
||||
<!-- POST-BUILD TARGET: Push automatico su Gitea -->
|
||||
<!-- con versionamento da <Version> della solution -->
|
||||
<!-- ============================================ -->
|
||||
<Target Name="PushDockerImageToGitea" AfterTargets="Publish" Condition="'$(PushToGiteaRegistry)' == 'true'">
|
||||
<PropertyGroup>
|
||||
<GiteaRegistry>gitea.encke-hake.ts.net/alby96</GiteaRegistry>
|
||||
<LocalImageName>autobidder</LocalImageName>
|
||||
<GiteaImageLatest>$(GiteaRegistry)/$(LocalImageName):latest</GiteaImageLatest>
|
||||
<GiteaImageVersion>$(GiteaRegistry)/$(LocalImageName):$(Version)</GiteaImageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="+-------------------------------------------------------------------+" />
|
||||
<Message Importance="high" Text="¦ POST-BUILD: Pubblicazione su Gitea Container Registry ¦" />
|
||||
<Message Importance="high" Text="+-------------------------------------------------------------------+" />
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="?? Solution Version: $(Version)" />
|
||||
<Message Importance="high" Text="?? Local Image: $(LocalImageName):latest" />
|
||||
<Message Importance="high" Text="??? Target Tags:" />
|
||||
<Message Importance="high" Text=" • $(GiteaImageLatest)" />
|
||||
<Message Importance="high" Text=" • $(GiteaImageVersion)" />
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="-------------------------------------------------------------------" />
|
||||
<Message Importance="high" Text="??? Tagging images..." />
|
||||
<Message Importance="high" Text="-------------------------------------------------------------------" />
|
||||
|
||||
<!-- Tag immagine locale per Gitea (latest) -->
|
||||
<Exec Command="docker tag $(LocalImageName):latest $(GiteaImageLatest)" />
|
||||
<Message Importance="high" Text="? Tagged: $(GiteaImageLatest)" />
|
||||
|
||||
<!-- Tag immagine locale per Gitea (versione solution) -->
|
||||
<Exec Command="docker tag $(LocalImageName):latest $(GiteaImageVersion)" />
|
||||
<Message Importance="high" Text="? Tagged: $(GiteaImageVersion)" />
|
||||
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="-------------------------------------------------------------------" />
|
||||
<Message Importance="high" Text="?? Pushing to Gitea Registry..." />
|
||||
<Message Importance="high" Text="-------------------------------------------------------------------" />
|
||||
|
||||
<!-- Push latest -->
|
||||
<Exec Command="docker push $(GiteaImageLatest)" />
|
||||
<Message Importance="high" Text="? Pushed: $(GiteaImageLatest)" />
|
||||
|
||||
<!-- Push version -->
|
||||
<Exec Command="docker push $(GiteaImageVersion)" />
|
||||
<Message Importance="high" Text="? Pushed: $(GiteaImageVersion)" />
|
||||
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="+-------------------------------------------------------------------+" />
|
||||
<Message Importance="high" Text="¦ ? PUBBLICAZIONE COMPLETATA CON SUCCESSO! ¦" />
|
||||
<Message Importance="high" Text="+-------------------------------------------------------------------+" />
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="?? Visualizza su Gitea:" />
|
||||
<Message Importance="high" Text=" https://gitea.encke-hake.ts.net/Alby96/-/packages/container/autobidder" />
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="?? Tag pubblicati:" />
|
||||
<Message Importance="high" Text=" • latest (sempre aggiornato all'ultima versione)" />
|
||||
<Message Importance="high" Text=" • $(Version) (versione solution corrente)" />
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="?? Pull command:" />
|
||||
<Message Importance="high" Text=" docker pull $(GiteaImageLatest)" />
|
||||
<Message Importance="high" Text=" docker pull $(GiteaImageVersion)" />
|
||||
<Message Importance="high" Text="" />
|
||||
<Message Importance="high" Text="-------------------------------------------------------------------" />
|
||||
<Message Importance="high" Text="" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 18
|
||||
VisualStudioVersion = 18.0.11217.181 d18.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoBidder", "AutoBidder.csproj", "{9BBAEF93-DF66-432C-9349-459E272D6538}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9BBAEF93-DF66-432C-9349-459E272D6538}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1C55CA56-D270-4D9A-91DA-410BF131E905}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,964 @@
|
||||
<UserControl x:Class="AutoBidder.Controls.AuctionMonitorControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:util="clr-namespace:AutoBidder.Utilities"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="800" d:DesignWidth="1200"
|
||||
Background="#1E1E1E">
|
||||
|
||||
<UserControl.Resources>
|
||||
<!-- Converters -->
|
||||
<util:BooleanToOpacityConverter x:Key="BoolToOpacity"/>
|
||||
|
||||
<!-- Rounded Button Style -->
|
||||
<Style x:Key="RoundedButton" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="8"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Padding" Value="15,10"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
</Style>
|
||||
|
||||
<!-- Small Rounded Button -->
|
||||
<Style x:Key="SmallRoundedButton" TargetType="Button" BasedOn="{StaticResource RoundedButton}">
|
||||
<Setter Property="Padding" Value="12,6"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
</Style>
|
||||
|
||||
<!-- Card Style -->
|
||||
<Style x:Key="CardBorder" TargetType="Border">
|
||||
<Setter Property="Background" Value="#252526"/>
|
||||
<Setter Property="BorderBrush" Value="#3E3E42"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="4"/>
|
||||
<Setter Property="Margin" Value="5"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header - COMPATTO SU 3 RIGHE -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="15,8" BorderBrush="#3E3E42" BorderThickness="0,0,0,1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Riga 1: Solo Puntate -->
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,3">
|
||||
<TextBlock Text="Puntate: "
|
||||
Foreground="#999999"
|
||||
FontSize="13"
|
||||
Margin="0,0,5,0"/>
|
||||
|
||||
<!-- 🎯 StackPanel per includere indicatore limite -->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Name="RemainingBidsText"
|
||||
Text="0"
|
||||
Foreground="#00D800"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Margin="0,0,0,0"/>
|
||||
|
||||
<!-- 🎯 Indicatore limite minimo puntate (solo numero tra parentesi) -->
|
||||
<TextBlock x:Name="MinBidsLimitIndicator"
|
||||
Text="(20)"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="Collapsed"
|
||||
ToolTip="Limite minimo puntate attivo"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Riga 2: Solo Credito Shop -->
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,3">
|
||||
<TextBlock Text="Credito Shop: "
|
||||
Foreground="#999999"
|
||||
FontSize="12"
|
||||
Margin="0,0,5,0"/>
|
||||
<TextBlock x:Name="ShopCreditText"
|
||||
Text="EUR 0.00"
|
||||
Foreground="#00D800"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Riga 3: Solo Aste vinte -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock Text="Aste vinte da confermare: "
|
||||
Foreground="#999999"
|
||||
FontSize="12"
|
||||
Margin="0,0,5,0"/>
|
||||
<TextBlock x:Name="BannerAsteDaRiscattare"
|
||||
Text="0"
|
||||
Foreground="#FFB700"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Control Buttons (Right) - Su tutte e 3 le righe -->
|
||||
<StackPanel Grid.Row="0" Grid.RowSpan="3" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Button x:Name="StartButton"
|
||||
Content="Avvia Tutti"
|
||||
Background="#00D800"
|
||||
Style="{StaticResource RoundedButton}"
|
||||
Margin="5,0"
|
||||
Click="StartButton_Click"/>
|
||||
|
||||
<Button x:Name="PauseAllButton"
|
||||
Content="Pausa Tutti"
|
||||
Background="#FFB700"
|
||||
Style="{StaticResource RoundedButton}"
|
||||
Margin="5,0"
|
||||
Click="PauseAllButton_Click"/>
|
||||
|
||||
<Button x:Name="StopButton"
|
||||
Content="Ferma Tutti"
|
||||
Background="#E81123"
|
||||
Style="{StaticResource RoundedButton}"
|
||||
Margin="5,0"
|
||||
Click="StopButton_Click"/>
|
||||
|
||||
<!-- Separator -->
|
||||
<Border Width="1"
|
||||
Background="#3E3E42"
|
||||
Margin="10,5"/>
|
||||
|
||||
<!-- Export Button -->
|
||||
<Button x:Name="ExportButton"
|
||||
Content="Esporta"
|
||||
Background="#007ACC"
|
||||
Style="{StaticResource RoundedButton}"
|
||||
Margin="5,0"
|
||||
Click="ExportButton_Click"
|
||||
ToolTip="Esporta dati aste monitorate"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Main Layout: 2 rows -->
|
||||
<Grid Grid.Row="1" Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="5"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- TOP ROW: Auction Grid (2/3) + Global Log (1/3) -->
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="5"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- TOP LEFT: Auction Grid -->
|
||||
<Border Grid.Column="0" Style="{StaticResource CardBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Grid Header -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="10,8" CornerRadius="4,4,0,0">
|
||||
<Grid>
|
||||
<TextBlock x:Name="MonitorateTitle"
|
||||
Text="Aste monitorate: 0"
|
||||
Foreground="#00D800"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="Aggiungi"
|
||||
x:Name="AddUrlButton"
|
||||
Background="#007ACC"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="10,5"
|
||||
FontSize="11"
|
||||
Margin="3,0"
|
||||
Click="AddUrlButton_Click"
|
||||
ToolTip="Aggiungi nuova asta"/>
|
||||
|
||||
<!-- NUOVO: Pulsanti per riordinare le aste (senza emoji) -->
|
||||
<Button Content="Sposta Su"
|
||||
x:Name="MoveUpButton"
|
||||
Background="#9B4F96"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="10,5"
|
||||
FontSize="11"
|
||||
Margin="3,0"
|
||||
Click="MoveUpButton_Click"
|
||||
ToolTip="Sposta l'asta selezionata verso l'alto"/>
|
||||
|
||||
<Button Content="Sposta Giù"
|
||||
x:Name="MoveDownButton"
|
||||
Background="#9B4F96"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="10,5"
|
||||
FontSize="11"
|
||||
Margin="3,0"
|
||||
Click="MoveDownButton_Click"
|
||||
ToolTip="Sposta l'asta selezionata verso il basso"/>
|
||||
|
||||
<Button Content="Rimuovi"
|
||||
x:Name="RemoveUrlButton"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="10,5"
|
||||
FontSize="11"
|
||||
Margin="3,0"
|
||||
Click="RemoveUrlButton_Click"
|
||||
ToolTip="Rimuovi asta selezionata"/>
|
||||
|
||||
<Button Content="Rimuovi Tutte"
|
||||
x:Name="RemoveAllButton"
|
||||
Background="#E81123"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="10,5"
|
||||
FontSize="11"
|
||||
Margin="3,0"
|
||||
Click="RemoveAllButton_Click"
|
||||
ToolTip="Rimuovi tutte le aste monitorate"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Auction DataGrid -->
|
||||
<DataGrid Grid.Row="1"
|
||||
x:Name="MultiAuctionsGrid"
|
||||
AutoGenerateColumns="False"
|
||||
SelectionMode="Single"
|
||||
CanUserAddRows="False"
|
||||
IsReadOnly="True"
|
||||
GridLinesVisibility="Horizontal"
|
||||
HeadersVisibility="Column"
|
||||
Background="#1E1E1E"
|
||||
Foreground="#CCCCCC"
|
||||
RowBackground="#1E1E1E"
|
||||
AlternatingRowBackground="#252526"
|
||||
BorderThickness="0"
|
||||
SelectionChanged="MultiAuctionsGrid_SelectionChanged"
|
||||
PreviewKeyDown="MultiAuctionsGrid_PreviewKeyDown"
|
||||
Focusable="True"
|
||||
FocusVisualStyle="{x:Null}">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#2D2D30"/>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Padding" Value="8,6"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,1,1"/>
|
||||
<Setter Property="BorderBrush" Value="#3E3E42"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="8,4"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#094771"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="ID" Binding="{Binding AuctionId}" Width="90"/>
|
||||
<DataGridTextColumn Header="Asta" Binding="{Binding Name}" Width="2*"/>
|
||||
<DataGridTextColumn Header="Latenza" Binding="{Binding LatencyDisplay}" Width="70"/>
|
||||
<DataGridTextColumn Header="Stato" Binding="{Binding StatusDisplay}" Width="100"/>
|
||||
<DataGridTextColumn Header="Timer" Binding="{Binding TimerDisplay}" Width="90"/>
|
||||
<DataGridTextColumn Header="Prezzo" Binding="{Binding PriceDisplay}" Width="70"/>
|
||||
<DataGridTextColumn Header="Ultimo" Binding="{Binding LastBidder}" Width="110"/>
|
||||
<DataGridTextColumn Header="Clicks" Binding="{Binding MyClicks}" Width="60"/>
|
||||
<DataGridTemplateColumn Header="Azioni" Width="260">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Avvia"
|
||||
Command="{Binding DataContext.GridStartCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{Binding CanStart}"
|
||||
Opacity="{Binding CanStart, Converter={StaticResource BoolToOpacity}}"
|
||||
Background="#00D800"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="6,3"
|
||||
FontSize="10"
|
||||
Margin="1"/>
|
||||
<Button Content="Pausa"
|
||||
Command="{Binding DataContext.GridPauseCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{Binding CanPause}"
|
||||
Opacity="{Binding CanPause, Converter={StaticResource BoolToOpacity}}"
|
||||
Background="#FFB700"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="6,3"
|
||||
FontSize="10"
|
||||
Margin="1"/>
|
||||
<Button Content="Ferma"
|
||||
Command="{Binding DataContext.GridStopCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{Binding CanStop}"
|
||||
Opacity="{Binding CanStop, Converter={StaticResource BoolToOpacity}}"
|
||||
Background="#E81123"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="6,3"
|
||||
FontSize="10"
|
||||
Margin="1"/>
|
||||
<Button Content="Punta"
|
||||
Command="{Binding DataContext.GridBidCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{Binding CanBid}"
|
||||
Opacity="{Binding CanBid, Converter={StaticResource BoolToOpacity}}"
|
||||
Background="#9B4F96"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="6,3"
|
||||
FontSize="10"
|
||||
Margin="1"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Vertical Splitter -->
|
||||
<GridSplitter Grid.Column="1"
|
||||
Width="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="#3E3E42"
|
||||
ResizeBehavior="PreviousAndNext"/>
|
||||
|
||||
<!-- TOP RIGHT: Global Log -->
|
||||
<Border Grid.Column="2" Style="{StaticResource CardBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="10,8" CornerRadius="4,4,0,0">
|
||||
<Grid>
|
||||
<TextBlock Text="Log Globale"
|
||||
Foreground="#00D800"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
VerticalAlignment="Center"/>
|
||||
<Button x:Name="ClearGlobalLogButton"
|
||||
Content="Pulisci"
|
||||
HorizontalAlignment="Right"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="8,4"
|
||||
FontSize="10"
|
||||
Click="ClearGlobalLogButton_Click"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Log Box -->
|
||||
<RichTextBox Grid.Row="1"
|
||||
x:Name="LogBox"
|
||||
IsReadOnly="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Background="#1E1E1E"
|
||||
Foreground="#00D800"
|
||||
BorderThickness="0"
|
||||
FontFamily="Consolas"
|
||||
FontSize="10"
|
||||
Padding="8"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Horizontal Splitter -->
|
||||
<GridSplitter Grid.Row="1"
|
||||
Height="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="#3E3E42"
|
||||
ResizeBehavior="PreviousAndNext"/>
|
||||
|
||||
<!-- BOTTOM ROW: Settings (1/3) + Bidders (1/3) + Auction Log (1/3) -->
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="5"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="5"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- BOTTOM LEFT: Settings (Impostazioni) -->
|
||||
<Border Grid.Column="0" Style="{StaticResource CardBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="10,8" CornerRadius="4,4,0,0">
|
||||
<TextBlock Text="Impostazioni"
|
||||
Foreground="#00D800"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"/>
|
||||
</Border>
|
||||
|
||||
<!-- Settings Content -->
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock x:Name="SelectedAuctionName"
|
||||
Text="Seleziona un'asta"
|
||||
Foreground="White"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<TextBox x:Name="SelectedAuctionUrl"
|
||||
IsReadOnly="True"
|
||||
Background="#1E1E1E"
|
||||
Foreground="#999999"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="1"
|
||||
Padding="6"
|
||||
FontSize="10"
|
||||
Margin="0,0,0,8"
|
||||
TextWrapping="Wrap"
|
||||
MaxHeight="50"/>
|
||||
|
||||
<!-- Pulsanti azione asta - RIORDINATI E FUNZIONANTI -->
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Riga 1: Browser -->
|
||||
<Button Grid.Row="0" Grid.Column="0"
|
||||
x:Name="OpenAuctionInternalButton"
|
||||
Content="Browser Interno"
|
||||
Background="#007ACC"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="8,5"
|
||||
FontSize="10"
|
||||
Margin="0,0,2,3"
|
||||
ToolTip="Apri asta nel browser integrato"
|
||||
Click="OpenAuctionInternalButton_Click"/>
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="1"
|
||||
x:Name="OpenAuctionExternalButton"
|
||||
Content="Browser Esterno"
|
||||
Background="#0078D7"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="8,5"
|
||||
FontSize="10"
|
||||
Margin="2,0,0,3"
|
||||
ToolTip="Apri asta nel browser predefinito di sistema"
|
||||
Click="OpenAuctionExternalButton_Click"/>
|
||||
|
||||
<!-- Riga 2: Azioni -->
|
||||
<Button Grid.Row="1" Grid.Column="0"
|
||||
x:Name="CopyAuctionUrlButton"
|
||||
Content="Copia URL"
|
||||
Background="#9B4F96"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="8,5"
|
||||
FontSize="10"
|
||||
Margin="0,0,2,0"
|
||||
ToolTip="Copia URL negli appunti"
|
||||
Click="CopyAuctionUrlButton_Click"/>
|
||||
|
||||
<Button Grid.Row="1" Grid.Column="1"
|
||||
x:Name="ExportAuctionButton"
|
||||
Content="Esporta"
|
||||
Background="#106EBE"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="8,5"
|
||||
FontSize="10"
|
||||
Margin="2,0,0,0"
|
||||
ToolTip="Esporta dati asta"
|
||||
Click="ExportAuctionButton_Click"/>
|
||||
</Grid>
|
||||
|
||||
<!-- NUOVA SEZIONE: Info Prodotto - SEZIONE FISSA -->
|
||||
<Border BorderBrush="#3E3E42"
|
||||
BorderThickness="1"
|
||||
Background="#2D2D30"
|
||||
Padding="10"
|
||||
CornerRadius="4"
|
||||
Margin="0,0,0,10">
|
||||
<StackPanel>
|
||||
<!-- Header fisso -->
|
||||
<TextBlock Text="Informazioni Prodotto"
|
||||
FontWeight="Bold"
|
||||
FontSize="12"
|
||||
Foreground="#CCCCCC"
|
||||
Margin="0,0,0,10"/>
|
||||
|
||||
<!-- Dati Prodotto -->
|
||||
<Grid x:Name="ProductInfoGrid" Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Valore -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="Valore:"
|
||||
FontWeight="Bold"
|
||||
Foreground="#CCCCCC"
|
||||
FontSize="11"
|
||||
Margin="0,3"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1"
|
||||
x:Name="ProductBuyNowPriceText"
|
||||
Text="-"
|
||||
Foreground="#007ACC"
|
||||
FontSize="11"
|
||||
FontWeight="Bold"
|
||||
Margin="5,3"/>
|
||||
|
||||
<!-- Extra (Spedizione/Transazione) -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="Extra:"
|
||||
FontWeight="Bold"
|
||||
Foreground="#CCCCCC"
|
||||
FontSize="11"
|
||||
Margin="0,3"
|
||||
ToolTip="Spese di spedizione o transazione"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1"
|
||||
x:Name="ProductShippingCostText"
|
||||
Text="-"
|
||||
Foreground="#FFB700"
|
||||
FontSize="11"
|
||||
Margin="5,3"/>
|
||||
|
||||
<!-- Limite Vincita -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="Limite:"
|
||||
FontWeight="Bold"
|
||||
Foreground="#CCCCCC"
|
||||
FontSize="11"
|
||||
Margin="0,3"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1"
|
||||
x:Name="ProductWinLimitText"
|
||||
Text="-"
|
||||
Foreground="#999999"
|
||||
FontSize="11"
|
||||
TextWrapping="Wrap"
|
||||
Margin="5,3"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Pulsante Applica Limiti -->
|
||||
<Button x:Name="RefreshProductInfoButton"
|
||||
Content="Applica Limiti Suggeriti"
|
||||
Background="#007ACC"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="10,6"
|
||||
FontSize="11"
|
||||
Margin="0,0,0,0"
|
||||
Click="RefreshProductInfoButton_Click"
|
||||
ToolTip="Calcola e applica limiti Max EUR e Max Clicks basati sul valore del prodotto"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Settings Grid - Campi aggiornati -->
|
||||
<Grid Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="15"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Row 1: Anticipo ms -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Anticipo (ms):" Foreground="#CCCCCC" FontSize="11" Margin="0,6" VerticalAlignment="Center" ToolTip="Millisecondi prima della scadenza per puntare"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="SelectedBidBeforeDeadlineMs" Background="#1E1E1E" Foreground="White" BorderBrush="#3E3E42" Padding="6" Margin="5,6" FontSize="11" TextChanged="SelectedBidBeforeDeadlineMs_TextChanged"/>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="3" Text="Min EUR:" Foreground="#CCCCCC" FontSize="11" Margin="0,6" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="4" x:Name="SelectedMinPrice" Background="#1E1E1E" Foreground="White" BorderBrush="#3E3E42" Padding="6" Margin="5,6" FontSize="11" TextChanged="SelectedMinPrice_TextChanged"/>
|
||||
|
||||
<!-- Row 2 -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Max EUR:" Foreground="#CCCCCC" FontSize="11" Margin="0,6" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" x:Name="SelectedMaxPrice" Background="#1E1E1E" Foreground="White" BorderBrush="#3E3E42" Padding="6" Margin="5,6" FontSize="11" TextChanged="SelectedMaxPrice_TextChanged"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="3" Text="Max Clicks:" Foreground="#CCCCCC" FontSize="11" Margin="0,6" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="4" x:Name="SelectedMaxClicks" Background="#1E1E1E" Foreground="White" BorderBrush="#3E3E42" Padding="6" Margin="5,6" FontSize="11" TextChanged="SelectedMaxClicks_TextChanged"/>
|
||||
|
||||
<!-- Row 3: Check Auction Open -->
|
||||
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5"
|
||||
x:Name="SelectedCheckAuctionOpen"
|
||||
Content="Verifica stato asta prima di puntare"
|
||||
Foreground="#CCCCCC"
|
||||
FontSize="11"
|
||||
Margin="0,10,0,0"
|
||||
Checked="SelectedCheckAuctionOpen_Changed"
|
||||
Unchecked="SelectedCheckAuctionOpen_Changed"
|
||||
ToolTip="Aggiunge una chiamata API extra per verificare che l'asta sia ancora aperta"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Footer Button (bottom like other panels) -->
|
||||
<Button Grid.Row="2"
|
||||
x:Name="ResetSettingsButton"
|
||||
Content="Reset"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="5"
|
||||
Click="ResetSettingsButton_Click"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Vertical Splitter 1 -->
|
||||
<GridSplitter Grid.Column="1"
|
||||
Width="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="#3E3E42"
|
||||
ResizeBehavior="PreviousAndNext"/>
|
||||
|
||||
<!-- BOTTOM CENTER: Tab Control (Utenti + Storia Puntate) -->
|
||||
<Border Grid.Column="2" Style="{StaticResource CardBorder}">
|
||||
<TabControl Background="#252526" BorderThickness="0">
|
||||
<TabControl.Resources>
|
||||
<!-- Tab Header Style -->
|
||||
<Style TargetType="TabItem">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TabItem">
|
||||
<Border Name="Border"
|
||||
Background="#2D2D30"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="0,0,1,0"
|
||||
Padding="15,8">
|
||||
<ContentPresenter x:Name="ContentSite"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
ContentSource="Header"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#094771"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#3E3E42"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
</Style>
|
||||
</TabControl.Resources>
|
||||
|
||||
<!-- Tab 1: Utenti -->
|
||||
<TabItem Header="Utenti">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="10,8">
|
||||
<TextBlock x:Name="SelectedAuctionBiddersCount"
|
||||
Text="Utenti: 0"
|
||||
Foreground="#00D800"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"/>
|
||||
</Border>
|
||||
|
||||
<!-- Bidders Grid -->
|
||||
<DataGrid Grid.Row="1"
|
||||
x:Name="SelectedAuctionBiddersGrid"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
Background="#1E1E1E"
|
||||
Foreground="#CCCCCC"
|
||||
RowBackground="#1E1E1E"
|
||||
AlternatingRowBackground="#252526"
|
||||
GridLinesVisibility="None"
|
||||
HeadersVisibility="Column"
|
||||
BorderThickness="0"
|
||||
FontSize="11">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#2D2D30"/>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Padding" Value="8,5"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Utente" Binding="{Binding Username}" Width="*"/>
|
||||
<DataGridTextColumn Header="Punt." Binding="{Binding BidCount}" Width="50"/>
|
||||
<DataGridTextColumn Header="Ultima" Binding="{Binding LastBidTimeDisplay}" Width="70"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<!-- Footer Button -->
|
||||
<Button Grid.Row="2"
|
||||
x:Name="ClearBiddersButton"
|
||||
Content="Pulisci"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="5"
|
||||
Click="ClearBiddersButton_Click"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<!-- Tab 2: Storia Puntate -->
|
||||
<TabItem Header="Storia Puntate">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="10,8">
|
||||
<TextBlock x:Name="BidHistoryCount"
|
||||
Text="Ultime puntate: 0"
|
||||
Foreground="#00D800"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"/>
|
||||
</Border>
|
||||
|
||||
<!-- Storia Puntate Grid -->
|
||||
<DataGrid Grid.Row="1"
|
||||
x:Name="BidHistoryGrid"
|
||||
ItemsSource="{Binding ElementName=MultiAuctionsGrid, Path=SelectedItem.BidHistoryEntries}"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
CanUserAddRows="False"
|
||||
CanUserDeleteRows="False"
|
||||
CanUserResizeRows="False"
|
||||
HeadersVisibility="Column"
|
||||
GridLinesVisibility="Horizontal"
|
||||
HorizontalGridLinesBrush="#3E3E42"
|
||||
Background="#1E1E1E"
|
||||
Foreground="#CCCCCC"
|
||||
BorderThickness="0"
|
||||
RowHeight="28">
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!-- Colonna Prezzo -->
|
||||
<DataGridTextColumn Header="PREZZO"
|
||||
Binding="{Binding PriceFormatted}"
|
||||
Width="70">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#00D800"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<!-- Colonna Modalita' -->
|
||||
<DataGridTextColumn Header="TIPO"
|
||||
Binding="{Binding BidType}"
|
||||
Width="65">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="FontSize" Value="10"/>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding BidType}" Value="Auto">
|
||||
<Setter Property="Foreground" Value="#FFC107"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding BidType}" Value="Manuale">
|
||||
<Setter Property="Foreground" Value="#03A9F4"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<!-- Colonna Orario -->
|
||||
<DataGridTextColumn Header="ORARIO"
|
||||
Binding="{Binding TimeFormatted}"
|
||||
Width="70">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#9E9E9E"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="FontSize" Value="10"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<!-- Colonna Utente -->
|
||||
<DataGridTextColumn Header="UTENTE"
|
||||
Binding="{Binding Username}"
|
||||
Width="*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="Margin" Value="8,0,0,0"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMyBid}" Value="True">
|
||||
<Setter Property="Foreground" Value="#00D800"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
|
||||
<!-- Stili righe -->
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="#1E1E1E"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#3E3E42"/>
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding IsMyBid}" Value="True">
|
||||
<Setter Property="Background" Value="#1A4D1A"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
<!-- Stile header -->
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#252526"/>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="FontSize" Value="10"/>
|
||||
<Setter Property="Padding" Value="8,6"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,1,1"/>
|
||||
<Setter Property="BorderBrush" Value="#3E3E42"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Border>
|
||||
|
||||
<!-- Vertical Splitter 2 -->
|
||||
<GridSplitter Grid.Column="3"
|
||||
Width="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="#3E3E42"
|
||||
ResizeBehavior="PreviousAndNext"/>
|
||||
|
||||
<!-- BOTTOM RIGHT: Auction Log -->
|
||||
<Border Grid.Column="4" Style="{StaticResource CardBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="10,8" CornerRadius="4,4,0,0">
|
||||
<Grid>
|
||||
<TextBlock Text="Log Asta"
|
||||
Foreground="#00D800"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
VerticalAlignment="Center"/>
|
||||
<Button x:Name="ClearLogButton"
|
||||
Content="Pulisci"
|
||||
HorizontalAlignment="Right"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource SmallRoundedButton}"
|
||||
Padding="8,4"
|
||||
FontSize="10"
|
||||
Click="ClearLogButton_Click"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Auction Log Box -->
|
||||
<RichTextBox Grid.Row="1"
|
||||
x:Name="SelectedAuctionLog"
|
||||
IsReadOnly="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Background="#1E1E1E"
|
||||
Foreground="#CCCCCC"
|
||||
BorderThickness="0"
|
||||
FontFamily="Consolas"
|
||||
FontSize="10"
|
||||
Padding="8"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- Hidden user info panel for compatibility -->
|
||||
<Border x:Name="UserInfoPanel"
|
||||
Visibility="Collapsed">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Name="UsernameText" Text=""/>
|
||||
<TextBlock x:Name="UserIdText" Text=""/>
|
||||
</StackPanel>
|
||||
<TextBlock x:Name="UserEmailText" Text=""/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,461 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AutoBidder.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AuctionMonitorControl.xaml
|
||||
/// </summary>
|
||||
public partial class AuctionMonitorControl : UserControl
|
||||
{
|
||||
public AuctionMonitorControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
// Dependency Properties per Commands (da bindare al MainWindow)
|
||||
public static readonly DependencyProperty GridStartCommandProperty =
|
||||
DependencyProperty.Register(nameof(GridStartCommand), typeof(ICommand), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly DependencyProperty GridPauseCommandProperty =
|
||||
DependencyProperty.Register(nameof(GridPauseCommand), typeof(ICommand), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly DependencyProperty GridStopCommandProperty =
|
||||
DependencyProperty.Register(nameof(GridStopCommand), typeof(ICommand), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly DependencyProperty GridBidCommandProperty =
|
||||
DependencyProperty.Register(nameof(GridBidCommand), typeof(ICommand), typeof(AuctionMonitorControl));
|
||||
|
||||
public ICommand? GridStartCommand
|
||||
{
|
||||
get => (ICommand?)GetValue(GridStartCommandProperty);
|
||||
set => SetValue(GridStartCommandProperty, value);
|
||||
}
|
||||
|
||||
public ICommand? GridPauseCommand
|
||||
{
|
||||
get => (ICommand?)GetValue(GridPauseCommandProperty);
|
||||
set => SetValue(GridPauseCommandProperty, value);
|
||||
}
|
||||
|
||||
public ICommand? GridStopCommand
|
||||
{
|
||||
get => (ICommand?)GetValue(GridStopCommandProperty);
|
||||
set => SetValue(GridStopCommandProperty, value);
|
||||
}
|
||||
|
||||
public ICommand? GridBidCommand
|
||||
{
|
||||
get => (ICommand?)GetValue(GridBidCommandProperty);
|
||||
set => SetValue(GridBidCommandProperty, value);
|
||||
}
|
||||
|
||||
// Event handlers - these will bubble up to MainWindow
|
||||
private void StartButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(StartClickedEvent, this));
|
||||
}
|
||||
|
||||
private void PauseAllButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(PauseAllClickedEvent, this));
|
||||
}
|
||||
|
||||
private void StopButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(StopClickedEvent, this));
|
||||
}
|
||||
|
||||
private void AddUrlButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(AddUrlClickedEvent, this));
|
||||
}
|
||||
|
||||
private void RemoveUrlButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(RemoveUrlClickedEvent, this));
|
||||
}
|
||||
|
||||
private void RemoveAllButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(RemoveAllClickedEvent, this));
|
||||
}
|
||||
|
||||
private void ExportButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(ExportClickedEvent, this));
|
||||
}
|
||||
|
||||
private void MultiAuctionsGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
// Forza il focus sul DataGrid quando viene selezionata una riga
|
||||
// Questo assicura che il tasto Canc venga catturato
|
||||
if (sender is DataGrid grid && grid.SelectedItem != null)
|
||||
{
|
||||
// Attende che il rendering sia completo prima di dare il focus
|
||||
grid.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
if (!grid.IsFocused)
|
||||
{
|
||||
grid.Focus();
|
||||
System.Diagnostics.Debug.WriteLine("[FOCUS] DataGrid ora ha il focus keyboard");
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
|
||||
RaiseEvent(new RoutedEventArgs(AuctionSelectionChangedEvent, this));
|
||||
}
|
||||
|
||||
// Usato PreviewKeyDown invece di KeyDown per catturare l'evento prima che venga consumato
|
||||
private void MultiAuctionsGrid_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Delete && MultiAuctionsGrid.SelectedItem != null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("[DELETE KEY] Tasto Canc premuto su asta selezionata");
|
||||
|
||||
// Lancia direttamente l'evento senza chiedere conferma
|
||||
// La conferma verrà mostrata dal gestore RemoveUrlButton_Click
|
||||
System.Diagnostics.Debug.WriteLine("[DELETE KEY] Lancio evento RemoveUrlClicked");
|
||||
RaiseEvent(new RoutedEventArgs(RemoveUrlClickedEvent, this));
|
||||
|
||||
// Previeni che l'evento venga gestito da altri controlli
|
||||
e.Handled = true;
|
||||
}
|
||||
// NUOVO: Gestione esplicita frecce Su/Giù per navigazione
|
||||
else if (e.Key == Key.Up && MultiAuctionsGrid.Items.Count > 0)
|
||||
{
|
||||
int currentIndex = MultiAuctionsGrid.SelectedIndex;
|
||||
if (currentIndex > 0)
|
||||
{
|
||||
MultiAuctionsGrid.SelectedIndex = currentIndex - 1;
|
||||
MultiAuctionsGrid.ScrollIntoView(MultiAuctionsGrid.SelectedItem);
|
||||
e.Handled = true; // Previeni ridimensionamento pannelli
|
||||
}
|
||||
}
|
||||
else if (e.Key == Key.Down && MultiAuctionsGrid.Items.Count > 0)
|
||||
{
|
||||
int currentIndex = MultiAuctionsGrid.SelectedIndex;
|
||||
if (currentIndex < MultiAuctionsGrid.Items.Count - 1)
|
||||
{
|
||||
MultiAuctionsGrid.SelectedIndex = currentIndex + 1;
|
||||
MultiAuctionsGrid.ScrollIntoView(MultiAuctionsGrid.SelectedItem);
|
||||
e.Handled = true; // Previeni ridimensionamento pannelli
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveUpButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(MoveUpClickedEvent, this));
|
||||
}
|
||||
|
||||
private void MoveDownButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(MoveDownClickedEvent, this));
|
||||
}
|
||||
|
||||
private void CopyAuctionUrlButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(CopyUrlClickedEvent, this));
|
||||
}
|
||||
|
||||
private void ResetSettingsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(ResetSettingsClickedEvent, this));
|
||||
}
|
||||
|
||||
private void ClearBiddersButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(ClearBiddersClickedEvent, this));
|
||||
}
|
||||
|
||||
private void ClearLogButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(ClearLogClickedEvent, this));
|
||||
}
|
||||
|
||||
private void ClearGlobalLogButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(ClearGlobalLogClickedEvent, this));
|
||||
}
|
||||
|
||||
private void OpenAuctionInternalButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(OpenAuctionInternalClickedEvent, this));
|
||||
}
|
||||
|
||||
private void OpenAuctionExternalButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(OpenAuctionExternalClickedEvent, this));
|
||||
}
|
||||
|
||||
private void ExportAuctionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(ExportAuctionClickedEvent, this));
|
||||
}
|
||||
|
||||
private void RefreshProductInfoButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(RefreshProductInfoClickedEvent, this));
|
||||
}
|
||||
|
||||
private void ConnectionStatusButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(ConnectionStatusClickedEvent, this));
|
||||
}
|
||||
|
||||
private void SelectedBidBeforeDeadlineMs_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(BidBeforeDeadlineMsChangedEvent, this));
|
||||
}
|
||||
|
||||
private void SelectedCheckAuctionOpen_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(CheckAuctionOpenChangedEvent, this));
|
||||
}
|
||||
|
||||
private void SelectedMinPrice_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(MinPriceChangedEvent, this));
|
||||
}
|
||||
|
||||
private void SelectedMaxPrice_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(MaxPriceChangedEvent, this));
|
||||
}
|
||||
|
||||
private void SelectedMaxClicks_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(MaxClicksChangedEvent, this));
|
||||
}
|
||||
|
||||
// Routed Events
|
||||
public static readonly RoutedEvent StartClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"StartClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent PauseAllClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"PauseAllClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent StopClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"StopClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent AddUrlClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"AddUrlClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent RemoveUrlClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"RemoveUrlClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent RemoveAllClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"RemoveAllClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent ExportClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"ExportClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent AuctionSelectionChangedEvent = EventManager.RegisterRoutedEvent(
|
||||
"AuctionSelectionChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent CopyUrlClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"CopyUrlClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent ResetSettingsClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"ResetSettingsClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent ClearBiddersClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"ClearBiddersClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent ClearLogClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"ClearLogClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent ClearGlobalLogClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"ClearGlobalLogClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent BidBeforeDeadlineMsChangedEvent = EventManager.RegisterRoutedEvent(
|
||||
"BidBeforeDeadlineMsChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent CheckAuctionOpenChangedEvent = EventManager.RegisterRoutedEvent(
|
||||
"CheckAuctionOpenChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent MinPriceChangedEvent = EventManager.RegisterRoutedEvent(
|
||||
"MinPriceChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent MaxPriceChangedEvent = EventManager.RegisterRoutedEvent(
|
||||
"MaxPriceChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent MaxClicksChangedEvent = EventManager.RegisterRoutedEvent(
|
||||
"MaxClicksChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent OpenAuctionInternalClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"OpenAuctionInternalClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent OpenAuctionExternalClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"OpenAuctionExternalClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent ExportAuctionClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"ExportAuctionClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent RefreshProductInfoClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"RefreshProductInfoClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent ConnectionStatusClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"ConnectionStatusClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
// NUOVO: Eventi per riordinamento aste
|
||||
public static readonly RoutedEvent MoveUpClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"MoveUpClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public static readonly RoutedEvent MoveDownClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"MoveDownClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AuctionMonitorControl));
|
||||
|
||||
public event RoutedEventHandler StartClicked
|
||||
{
|
||||
add { AddHandler(StartClickedEvent, value); }
|
||||
remove { RemoveHandler(StartClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler PauseAllClicked
|
||||
{
|
||||
add { AddHandler(PauseAllClickedEvent, value); }
|
||||
remove { RemoveHandler(PauseAllClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler StopClicked
|
||||
{
|
||||
add { AddHandler(StopClickedEvent, value); }
|
||||
remove { RemoveHandler(StopClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler AddUrlClicked
|
||||
{
|
||||
add { AddHandler(AddUrlClickedEvent, value); }
|
||||
remove { RemoveHandler(AddUrlClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler RemoveUrlClicked
|
||||
{
|
||||
add { AddHandler(RemoveUrlClickedEvent, value); }
|
||||
remove { RemoveHandler(RemoveUrlClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler RemoveAllClicked
|
||||
{
|
||||
add { AddHandler(RemoveAllClickedEvent, value); }
|
||||
remove { RemoveHandler(RemoveAllClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler ExportClicked
|
||||
{
|
||||
add { AddHandler(ExportClickedEvent, value); }
|
||||
remove { RemoveHandler(ExportClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler AuctionSelectionChanged
|
||||
{
|
||||
add { AddHandler(AuctionSelectionChangedEvent, value); }
|
||||
remove { RemoveHandler(AuctionSelectionChangedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler CopyUrlClicked
|
||||
{
|
||||
add { AddHandler(CopyUrlClickedEvent, value); }
|
||||
remove { RemoveHandler(CopyUrlClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler ResetSettingsClicked
|
||||
{
|
||||
add { AddHandler(ResetSettingsClickedEvent, value); }
|
||||
remove { RemoveHandler(ResetSettingsClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler ClearBiddersClicked
|
||||
{
|
||||
add { AddHandler(ClearBiddersClickedEvent, value); }
|
||||
remove { RemoveHandler(ClearBiddersClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler ClearLogClicked
|
||||
{
|
||||
add { AddHandler(ClearLogClickedEvent, value); }
|
||||
remove { RemoveHandler(ClearLogClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler ClearGlobalLogClicked
|
||||
{
|
||||
add { AddHandler(ClearGlobalLogClickedEvent, value); }
|
||||
remove { RemoveHandler(ClearGlobalLogClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler BidBeforeDeadlineMsChanged
|
||||
{
|
||||
add { AddHandler(BidBeforeDeadlineMsChangedEvent, value); }
|
||||
remove { RemoveHandler(BidBeforeDeadlineMsChangedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler CheckAuctionOpenChanged
|
||||
{
|
||||
add { AddHandler(CheckAuctionOpenChangedEvent, value); }
|
||||
remove { RemoveHandler(CheckAuctionOpenChangedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler MinPriceChanged
|
||||
{
|
||||
add { AddHandler(MinPriceChangedEvent, value); }
|
||||
remove { RemoveHandler(MinPriceChangedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler MaxPriceChanged
|
||||
{
|
||||
add { AddHandler(MaxPriceChangedEvent, value); }
|
||||
remove { RemoveHandler(MaxPriceChangedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler MaxClicksChanged
|
||||
{
|
||||
add { AddHandler(MaxClicksChangedEvent, value); }
|
||||
remove { RemoveHandler(MaxClicksChangedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler OpenAuctionInternalClicked
|
||||
{
|
||||
add { AddHandler(OpenAuctionInternalClickedEvent, value); }
|
||||
remove { RemoveHandler(OpenAuctionInternalClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler OpenAuctionExternalClicked
|
||||
{
|
||||
add { AddHandler(OpenAuctionExternalClickedEvent, value); }
|
||||
remove { RemoveHandler(OpenAuctionExternalClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler ExportAuctionClicked
|
||||
{
|
||||
add { AddHandler(ExportAuctionClickedEvent, value); }
|
||||
remove { RemoveHandler(ExportAuctionClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler RefreshProductInfoClicked
|
||||
{
|
||||
add { AddHandler(RefreshProductInfoClickedEvent, value); }
|
||||
remove { RemoveHandler(RefreshProductInfoClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler ConnectionStatusClicked
|
||||
{
|
||||
add { AddHandler(ConnectionStatusClickedEvent, value); }
|
||||
remove { RemoveHandler(ConnectionStatusClickedEvent, value); }
|
||||
}
|
||||
|
||||
// NUOVO: Handler per eventi riordinamento
|
||||
public event RoutedEventHandler MoveUpClicked
|
||||
{
|
||||
add { AddHandler(MoveUpClickedEvent, value); }
|
||||
remove { RemoveHandler(MoveUpClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler MoveDownClicked
|
||||
{
|
||||
add { AddHandler(MoveDownClickedEvent, value); }
|
||||
remove { RemoveHandler(MoveDownClickedEvent, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<UserControl x:Class="AutoBidder.Controls.BrowserControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="800" d:DesignWidth="1200"
|
||||
Background="#1E1E1E">
|
||||
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="RoundedButton" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
</Style>
|
||||
|
||||
<!-- Nav Button Style (text only) -->
|
||||
<Style x:Key="NavButton" TargetType="Button" BasedOn="{StaticResource RoundedButton}">
|
||||
<Setter Property="MinWidth" Value="50"/>
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
<Setter Property="Padding" Value="8,0"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Browser Toolbar -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="10" BorderBrush="#3E3E42" BorderThickness="0,0,0,1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Navigation Buttons (TEXT ONLY - NO SYMBOLS) -->
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<Button x:Name="BrowserBackButton"
|
||||
Content="Indietro"
|
||||
Margin="0,0,5,0"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource NavButton}"
|
||||
Click="BrowserBackButton_Click"
|
||||
ToolTip="Torna alla pagina precedente"/>
|
||||
|
||||
<Button x:Name="BrowserForwardButton"
|
||||
Content="Avanti"
|
||||
Margin="0,0,5,0"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource NavButton}"
|
||||
Click="BrowserForwardButton_Click"
|
||||
ToolTip="Vai alla pagina successiva"/>
|
||||
|
||||
<Button x:Name="BrowserRefreshButton"
|
||||
Content="Ricarica"
|
||||
Margin="0,0,5,0"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource NavButton}"
|
||||
Click="BrowserRefreshButton_Click"
|
||||
ToolTip="Ricarica la pagina corrente"/>
|
||||
|
||||
<Button x:Name="BrowserHomeButton"
|
||||
Content="Home"
|
||||
Margin="0,0,10,0"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource NavButton}"
|
||||
Click="BrowserHomeButton_Click"
|
||||
ToolTip="Vai alla homepage Bidoo"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Address Bar -->
|
||||
<Border Grid.Column="1"
|
||||
Background="#1E1E1E"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Margin="10,0">
|
||||
<TextBox x:Name="BrowserAddress"
|
||||
VerticalAlignment="Center"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
Foreground="#CCCCCC"
|
||||
Padding="10,0"
|
||||
FontSize="13"
|
||||
IsReadOnly="True"
|
||||
Cursor="Arrow"
|
||||
ToolTip="Indirizzo della pagina corrente (non editabile)"/>
|
||||
</Border>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="10,0,0,0">
|
||||
<Button x:Name="BrowserAddAuctionButton"
|
||||
Content="Aggiungi Asta"
|
||||
Padding="20,7"
|
||||
FontSize="13"
|
||||
Background="#00D800"
|
||||
Style="{StaticResource RoundedButton}"
|
||||
Click="BrowserAddAuctionButton_Click"
|
||||
ToolTip="Aggiungi l'asta corrente al monitoraggio"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- WebView2 -->
|
||||
<Border Grid.Row="1" Background="#1E1E1E">
|
||||
<wv2:WebView2 x:Name="EmbeddedWebView"
|
||||
PreviewMouseRightButtonUp="EmbeddedWebView_PreviewMouseRightButtonUp"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,157 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
|
||||
namespace AutoBidder.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for BrowserControl.xaml
|
||||
/// REFACTORED: Gestione semplificata e diretta degli eventi WebView2
|
||||
/// </summary>
|
||||
public partial class BrowserControl : UserControl
|
||||
{
|
||||
public BrowserControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// ? NUOVO: Collega eventi NavigationStarting e NavigationCompleted direttamente qui
|
||||
EmbeddedWebView.NavigationStarting += WebView_NavigationStarting;
|
||||
EmbeddedWebView.NavigationCompleted += WebView_NavigationCompleted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ? NUOVO: Aggiorna address bar quando inizia la navigazione
|
||||
/// </summary>
|
||||
private void WebView_NavigationStarting(object? sender, CoreWebView2NavigationStartingEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Aggiorna immediatamente l'address bar con l'URL di destinazione
|
||||
if (!string.IsNullOrEmpty(e.Uri))
|
||||
{
|
||||
BrowserAddress.Text = e.Uri;
|
||||
}
|
||||
|
||||
// Propaga l'evento al MainWindow
|
||||
var args = new BrowserNavigationEventArgs(BrowserNavigationStartingEvent, this)
|
||||
{
|
||||
Uri = e.Uri
|
||||
};
|
||||
RaiseEvent(args);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ? NUOVO: Aggiorna address bar quando la navigazione è completata
|
||||
/// </summary>
|
||||
private void WebView_NavigationCompleted(object? sender, CoreWebView2NavigationCompletedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Aggiorna l'address bar con l'URL finale (dopo eventuali redirect)
|
||||
var finalUrl = EmbeddedWebView?.Source?.ToString();
|
||||
if (!string.IsNullOrEmpty(finalUrl))
|
||||
{
|
||||
BrowserAddress.Text = finalUrl;
|
||||
}
|
||||
|
||||
// Propaga l'evento al MainWindow
|
||||
RaiseEvent(new RoutedEventArgs(BrowserNavigationCompletedEvent, this));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void BrowserBackButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(BrowserBackClickedEvent, this));
|
||||
}
|
||||
|
||||
private void BrowserForwardButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(BrowserForwardClickedEvent, this));
|
||||
}
|
||||
|
||||
private void BrowserRefreshButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(BrowserRefreshClickedEvent, this));
|
||||
}
|
||||
|
||||
private void BrowserHomeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(BrowserHomeClickedEvent, this));
|
||||
}
|
||||
|
||||
private void BrowserAddAuctionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(BrowserAddAuctionClickedEvent, this));
|
||||
}
|
||||
|
||||
private void EmbeddedWebView_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
// Routed Events
|
||||
public static readonly RoutedEvent BrowserBackClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"BrowserBackClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BrowserControl));
|
||||
|
||||
public static readonly RoutedEvent BrowserForwardClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"BrowserForwardClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BrowserControl));
|
||||
|
||||
public static readonly RoutedEvent BrowserRefreshClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"BrowserRefreshClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BrowserControl));
|
||||
|
||||
public static readonly RoutedEvent BrowserHomeClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"BrowserHomeClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BrowserControl));
|
||||
|
||||
public static readonly RoutedEvent BrowserAddAuctionClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"BrowserAddAuctionClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BrowserControl));
|
||||
|
||||
public static readonly RoutedEvent BrowserNavigationStartingEvent = EventManager.RegisterRoutedEvent(
|
||||
"BrowserNavigationStarting", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BrowserControl));
|
||||
|
||||
public static readonly RoutedEvent BrowserNavigationCompletedEvent = EventManager.RegisterRoutedEvent(
|
||||
"BrowserNavigationCompleted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BrowserControl));
|
||||
|
||||
public event RoutedEventHandler BrowserBackClicked
|
||||
{
|
||||
add { AddHandler(BrowserBackClickedEvent, value); }
|
||||
remove { RemoveHandler(BrowserBackClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler BrowserForwardClicked
|
||||
{
|
||||
add { AddHandler(BrowserForwardClickedEvent, value); }
|
||||
remove { RemoveHandler(BrowserForwardClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler BrowserRefreshClicked
|
||||
{
|
||||
add { AddHandler(BrowserRefreshClickedEvent, value); }
|
||||
remove { RemoveHandler(BrowserRefreshClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler BrowserHomeClicked
|
||||
{
|
||||
add { AddHandler(BrowserHomeClickedEvent, value); }
|
||||
remove { RemoveHandler(BrowserHomeClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler BrowserAddAuctionClicked
|
||||
{
|
||||
add { AddHandler(BrowserAddAuctionClickedEvent, value); }
|
||||
remove { RemoveHandler(BrowserAddAuctionClickedEvent, value); }
|
||||
}
|
||||
}
|
||||
|
||||
public class BrowserNavigationEventArgs : RoutedEventArgs
|
||||
{
|
||||
public string? Uri { get; set; }
|
||||
|
||||
public BrowserNavigationEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,520 @@
|
||||
<UserControl x:Class="AutoBidder.Controls.SettingsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="800" d:DesignWidth="1200"
|
||||
Background="#1E1E1E">
|
||||
|
||||
<UserControl.Resources>
|
||||
<!-- Modern Button Style -->
|
||||
<Style x:Key="ModernButton" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Padding" Value="20,10"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
</Style>
|
||||
|
||||
<!-- Section Header Style -->
|
||||
<Style x:Key="SectionHeader" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="16"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="Margin" Value="0,0,0,15"/>
|
||||
</Style>
|
||||
|
||||
<!-- Label Style -->
|
||||
<Style x:Key="FieldLabel" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="Margin" Value="0,0,0,5"/>
|
||||
</Style>
|
||||
|
||||
<!-- TextBox Style -->
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="Background" Value="#252526"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="BorderBrush" Value="#3E3E42"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
</Style>
|
||||
|
||||
<!-- CheckBox Style -->
|
||||
<Style TargetType="CheckBox">
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="Margin" Value="0,6"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
</Style>
|
||||
|
||||
<!-- RadioButton Style -->
|
||||
<Style TargetType="RadioButton">
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="Margin" Value="0,0,20,0"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
</Style>
|
||||
|
||||
<!-- Info Box Style -->
|
||||
<Style x:Key="InfoBox" TargetType="Border">
|
||||
<Setter Property="Background" Value="#2D2D30"/>
|
||||
<Setter Property="BorderBrush" Value="#3E3E42"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="4"/>
|
||||
<Setter Property="Padding" Value="15"/>
|
||||
<Setter Property="Margin" Value="0,10,0,0"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Scrollable Content -->
|
||||
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="30,20">
|
||||
|
||||
<!-- SEZIONE 1: Impostazioni Predefinite Aste -->
|
||||
<Border Background="#252526"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Padding="20"
|
||||
Margin="0,0,0,20">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Impostazioni Predefinite Aste"
|
||||
Style="{StaticResource SectionHeader}"/>
|
||||
|
||||
<TextBlock Text="Queste impostazioni verranno applicate automaticamente alle nuove aste."
|
||||
Foreground="#999999"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Anticipo Puntata (millisecondi)" Foreground="#CCCCCC" Margin="0,10" VerticalAlignment="Center" ToolTip="Millisecondi prima della scadenza per puntare"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="DefaultBidBeforeDeadlineMsTextBox" Text="200" Margin="10,10"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Verifica Stato Prima Di Puntare" Foreground="#CCCCCC" Margin="0,10" VerticalAlignment="Center" ToolTip="Controlla che l'asta sia ancora aperta prima di puntare"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="1" x:Name="DefaultCheckAuctionOpenCheckBox" Margin="10,10" VerticalAlignment="Center"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="Prezzo Minimo (€)" Foreground="#CCCCCC" Margin="0,10" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" x:Name="DefaultMinPriceTextBox" Text="0" Margin="10,10"/>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Prezzo Massimo (€)" Foreground="#CCCCCC" Margin="0,10" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" x:Name="DefaultMaxPriceTextBox" Text="0" Margin="10,10"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="Max Click" Foreground="#CCCCCC" Margin="0,10" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" x:Name="DefaultMaxClicksTextBox" Text="0" Margin="10,10"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- SEZIONE 2: Stato Iniziale Aste -->
|
||||
<Border Background="#252526"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Padding="20"
|
||||
Margin="0,0,0,20">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Stato Iniziale Aste"
|
||||
Style="{StaticResource SectionHeader}"/>
|
||||
|
||||
<TextBlock Text="Configura come devono comportarsi le aste quando vengono caricate o aggiunte."
|
||||
Foreground="#999999"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<!-- Stato all'apertura applicazione -->
|
||||
<TextBlock Text="Stato aste al caricamento dell'applicazione"
|
||||
Style="{StaticResource FieldLabel}"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
|
||||
<RadioButton x:Name="LoadAuctionsStopped"
|
||||
Content="Fermate"
|
||||
GroupName="LoadState"
|
||||
IsChecked="True"
|
||||
ToolTip="Le aste salvate verranno caricate in stato fermo"/>
|
||||
<RadioButton x:Name="LoadAuctionsPaused"
|
||||
Content="In Pausa"
|
||||
GroupName="LoadState"
|
||||
ToolTip="Le aste salvate verranno caricate in pausa (pronte ad essere avviate)"/>
|
||||
<RadioButton x:Name="LoadAuctionsActive"
|
||||
Content="Attive"
|
||||
GroupName="LoadState"
|
||||
ToolTip="Le aste salvate verranno avviate automaticamente all'apertura"/>
|
||||
<RadioButton x:Name="LoadAuctionsRemember"
|
||||
Content="Ricorda Stato"
|
||||
GroupName="LoadState"
|
||||
ToolTip="Ogni asta ripristina lo stato che aveva alla chiusura (attiva/pausa/ferma)"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Stato nuove aste -->
|
||||
<TextBlock Text="Stato iniziale di una nuova asta aggiunta"
|
||||
Style="{StaticResource FieldLabel}"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,0">
|
||||
<RadioButton x:Name="NewAuctionStopped"
|
||||
Content="Fermata"
|
||||
GroupName="NewAuctionState"
|
||||
IsChecked="True"
|
||||
ToolTip="Le nuove aste verranno aggiunte in stato fermo"/>
|
||||
<RadioButton x:Name="NewAuctionPaused"
|
||||
Content="In Pausa"
|
||||
GroupName="NewAuctionState"
|
||||
ToolTip="Le nuove aste verranno aggiunte in pausa"/>
|
||||
<RadioButton x:Name="NewAuctionActive"
|
||||
Content="Attiva"
|
||||
GroupName="NewAuctionState"
|
||||
ToolTip="Le nuove aste verranno avviate automaticamente"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Info Box -->
|
||||
<Border Style="{StaticResource InfoBox}" Margin="0,15,0,0">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Informazioni"
|
||||
FontWeight="Bold"
|
||||
Foreground="#007ACC"
|
||||
Margin="0,0,0,10"/>
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
LineHeight="18">
|
||||
• <Bold>Fermata:</Bold> L'asta non viene monitorata fino all'avvio manuale.<LineBreak/>
|
||||
• <Bold>In Pausa:</Bold> L'asta è pronta ma non punta automaticamente (utile per preparare le aste).<LineBreak/>
|
||||
• <Bold>Attiva:</Bold> L'asta viene monitorata e punta automaticamente quando necessario.<LineBreak/>
|
||||
• <Bold>Ricorda Stato:</Bold> Ogni asta ripristina lo stato esatto che aveva alla chiusura (SOVRASCRIVE le altre opzioni).<LineBreak/>
|
||||
<LineBreak/>
|
||||
<Bold>Consiglio:</Bold> Usa "Fermata" per caricare le aste senza avviarle, poi avvia manualmente quelle desiderate.<LineBreak/>
|
||||
Usa "Ricorda Stato" per riprendere esattamente da dove avevi lasciato.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- SEZIONE 3: Protezione Account -->
|
||||
<Border Background="#252526"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Padding="20"
|
||||
Margin="0,0,0,20">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Protezione Account"
|
||||
Style="{StaticResource SectionHeader}"/>
|
||||
|
||||
<TextBlock Text="Impostazioni di sicurezza per proteggere il tuo account dalle puntate eccessive."
|
||||
Foreground="#999999"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Puntate Minime da Mantenere -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="Puntate Minime da Mantenere"
|
||||
Foreground="#CCCCCC"
|
||||
Margin="0,10"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="Numero minimo di puntate residue da mantenere sull'account. Se > 0, non punterà se scende sotto questa soglia (0 = nessun limite)"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
x:Name="MinimumRemainingBidsTextBox"
|
||||
Text="0"
|
||||
Margin="10,10"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Info Box -->
|
||||
<Border Style="{StaticResource InfoBox}" Margin="0,15,0,0">
|
||||
<StackPanel>
|
||||
<TextBlock Text="🛡️ Protezione Puntate"
|
||||
FontWeight="Bold"
|
||||
Foreground="#00D800"
|
||||
Margin="0,0,0,10"/>
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
LineHeight="18">
|
||||
• Se impostato > 0, il sistema non punterà se le puntate residue scenderebbero sotto questa soglia.<LineBreak/>
|
||||
• Utile per mantenere sempre un "cuscinetto" di sicurezza sull'account.<LineBreak/>
|
||||
• Nel banner principale apparirà un indicatore colorato: <LineBreak/>
|
||||
- <Bold>Verde:</Bold> Puntate abbondanti (oltre +10 dal limite)<LineBreak/>
|
||||
- <Bold>Giallo:</Bold> Vicino al limite (entro 10 puntate)<LineBreak/>
|
||||
- <Bold>Rosso:</Bold> Al limite o sotto (puntate bloccate)<LineBreak/>
|
||||
• Valore 0 = nessun limite (comportamento default).
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- SEZIONE 4: Limiti Log -->
|
||||
<Border Background="#252526"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Padding="20">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Limiti Log"
|
||||
Style="{StaticResource SectionHeader}"/>
|
||||
|
||||
<TextBlock Text="Configura il numero massimo di righe di log da mantenere in memoria per ottimizzare le performance."
|
||||
Foreground="#999999"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="Max Righe Log per Asta"
|
||||
Foreground="#CCCCCC"
|
||||
Margin="0,10"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="Numero massimo di righe di log da mantenere per ogni singola asta (raccomandato: 500-1000)"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
x:Name="MaxLogLinesPerAuctionTextBox"
|
||||
Text="500"
|
||||
Margin="10,10"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="Max Righe Log Globale"
|
||||
Foreground="#CCCCCC"
|
||||
Margin="0,10"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="Numero massimo di righe di log da mantenere nel log globale dell'applicazione (raccomandato: 1000-2000)"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
x:Name="MaxGlobalLogLinesTextBox"
|
||||
Text="1000"
|
||||
Margin="10,10"/>
|
||||
|
||||
<!-- 📊 NUOVO: Max Storia Puntate -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="Max Puntate da Visualizzare"
|
||||
Foreground="#CCCCCC"
|
||||
Margin="0,10"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="Numero massimo di puntate da mostrare nella scheda Storia Puntate (raccomandato: 20-50, 0 = tutte)"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1"
|
||||
x:Name="MaxBidHistoryEntriesTextBox"
|
||||
Text="20"
|
||||
Margin="10,10"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Info Box -->
|
||||
<Border Style="{StaticResource InfoBox}" Margin="0,15,0,0">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Informazioni"
|
||||
FontWeight="Bold"
|
||||
Foreground="#007ACC"
|
||||
Margin="0,0,0,10"/>
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
LineHeight="18">
|
||||
• I log più vecchi verranno automaticamente rimossi quando si raggiunge il limite.<LineBreak/>
|
||||
• Valori più bassi = meno memoria utilizzata, ma meno storico disponibile.<LineBreak/>
|
||||
• Valori più alti = più storico disponibile, ma maggiore uso di memoria.<LineBreak/>
|
||||
• Valori consigliati: 500-1000 per asta, 1000-2000 per log globale.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- SEZIONE 5: Livello di Dettaglio Log -->
|
||||
<Border Background="#252526"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Padding="20"
|
||||
Margin="0,20,0,0">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Livello di Dettaglio Log"
|
||||
Style="{StaticResource SectionHeader}"/>
|
||||
|
||||
<TextBlock Text="Configura il livello minimo dei messaggi da visualizzare nel log. Livelli più bassi mostrano solo messaggi critici, livelli più alti mostrano tutti i dettagli (utile per debug)."
|
||||
Foreground="#999999"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<!-- Radio Buttons per livello log -->
|
||||
<StackPanel>
|
||||
<RadioButton x:Name="LogLevelErrorOnly"
|
||||
Content="Solo Errori"
|
||||
GroupName="LogLevel"
|
||||
Margin="0,5"
|
||||
ToolTip="Mostra solo errori critici (uso minimo per produzione)"/>
|
||||
|
||||
<RadioButton x:Name="LogLevelNormal"
|
||||
Content="Normale (Errori + Avvisi)"
|
||||
GroupName="LogLevel"
|
||||
IsChecked="True"
|
||||
Margin="0,5"
|
||||
ToolTip="Mostra errori e avvisi (uso giornaliero raccomandato)"/>
|
||||
|
||||
<RadioButton x:Name="LogLevelInformational"
|
||||
Content="Informativo (Include operazioni completate)"
|
||||
GroupName="LogLevel"
|
||||
Margin="0,5"
|
||||
ToolTip="Mostra anche messaggi informativi e conferme (uso dettagliato)"/>
|
||||
|
||||
<RadioButton x:Name="LogLevelDebug"
|
||||
Content="Debug (Include dettagli tecnici)"
|
||||
GroupName="LogLevel"
|
||||
Margin="0,5"
|
||||
ToolTip="Mostra anche messaggi di debug per sviluppo"/>
|
||||
|
||||
<RadioButton x:Name="LogLevelTrace"
|
||||
Content="Trace (Tutto - molto verboso)"
|
||||
GroupName="LogLevel"
|
||||
Margin="0,5"
|
||||
ToolTip="Mostra ogni singola operazione (debug avanzato)"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Info Box -->
|
||||
<Border Style="{StaticResource InfoBox}" Margin="0,15,0,0">
|
||||
<StackPanel>
|
||||
<TextBlock Text="🔍 Guida alla Scelta"
|
||||
FontWeight="Bold"
|
||||
Foreground="#FFB700"
|
||||
Margin="0,0,0,10"/>
|
||||
<TextBlock Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,5">
|
||||
<Run>Solo Errori: Usa in produzione per vedere solo problemi critici.</Run>
|
||||
</TextBlock>
|
||||
<TextBlock Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,5">
|
||||
<Run>Normale: Raccomandato per uso giornaliero. Mostra errori e avvisi importanti.</Run>
|
||||
</TextBlock>
|
||||
<TextBlock Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,5">
|
||||
<Run>Informativo: Utile per seguire le operazioni principali (aggiunte aste, puntate).</Run>
|
||||
</TextBlock>
|
||||
<TextBlock Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,5">
|
||||
<Run>Debug: Per sviluppo. Mostra parametri chiamate API e valori interni.</Run>
|
||||
</TextBlock>
|
||||
<TextBlock Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,10">
|
||||
<Run>Trace: Debug avanzato. Mostra ogni singola chiamata (molto verboso).</Run>
|
||||
</TextBlock>
|
||||
|
||||
<TextBlock Foreground="#CCCCCC"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Margin="0,5,0,5">Legenda colori log:</TextBlock>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="11" Margin="0,2">
|
||||
<Run Foreground="#E81123">■ ROSSO</Run>
|
||||
<Run Foreground="#CCCCCC"> = Errori critici</Run>
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="11" Margin="0,2">
|
||||
<Run Foreground="#FFB700">■ ARANCIONE</Run>
|
||||
<Run Foreground="#CCCCCC"> = Avvisi</Run>
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="11" Margin="0,2">
|
||||
<Run Foreground="#64B4FF">■ BLU</Run>
|
||||
<Run Foreground="#CCCCCC"> = Informazioni</Run>
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="11" Margin="0,2">
|
||||
<Run Foreground="#00D800">■ VERDE</Run>
|
||||
<Run Foreground="#CCCCCC"> = Operazioni riuscite</Run>
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="11" Margin="0,2">
|
||||
<Run Foreground="#FF8CFF">■ MAGENTA</Run>
|
||||
<Run Foreground="#CCCCCC"> = Debug</Run>
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="11" Margin="0,2">
|
||||
<Run Foreground="#A0A0A0">■ GRIGIO</Run>
|
||||
<Run Foreground="#CCCCCC"> = Trace</Run>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Fixed Bottom Bar with Save/Cancel -->
|
||||
<Border Grid.Row="1"
|
||||
Background="#2D2D30"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="0,1,0,0"
|
||||
Padding="30,15">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="Salva"
|
||||
Background="#00D800"
|
||||
Style="{StaticResource ModernButton}"
|
||||
Margin="0,0,10,0"
|
||||
Padding="40,10"
|
||||
Click="SaveAllSettings_Click"/>
|
||||
|
||||
<Button Content="Annulla"
|
||||
Background="#3E3E42"
|
||||
Style="{StaticResource ModernButton}"
|
||||
Padding="40,10"
|
||||
Click="CancelAllSettings_Click"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,90 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace AutoBidder.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SettingsControl.xaml
|
||||
/// </summary>
|
||||
public partial class SettingsControl : UserControl
|
||||
{
|
||||
public SettingsControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
// Non servono proprietà wrapper - MainWindow.xaml.cs accede direttamente ai controlli tramite:
|
||||
// Settings.DefaultBidBeforeDeadlineMsTextBox (definito nel XAML con x:Name)
|
||||
// Settings.MaxLogLinesPerAuctionTextBox (definito nel XAML con x:Name)
|
||||
// etc.
|
||||
|
||||
// Proprietà per limiti log
|
||||
public TextBox MaxLogLinesPerAuction => MaxLogLinesPerAuctionTextBox;
|
||||
public TextBox MaxGlobalLogLines => MaxGlobalLogLinesTextBox;
|
||||
|
||||
// ?? NUOVO: Proprietà per limite storia puntate
|
||||
public TextBox MaxBidHistoryEntries => MaxBidHistoryEntriesTextBox;
|
||||
|
||||
private void SaveDefaultsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(SaveDefaultsClickedEvent, this));
|
||||
}
|
||||
|
||||
private void CancelDefaultsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(CancelDefaultsClickedEvent, this));
|
||||
}
|
||||
|
||||
// Nuovo evento unificato - SALVA TUTTE LE IMPOSTAZIONI
|
||||
private void SaveAllSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Salva impostazioni predefinite aste (export rimosso)
|
||||
RaiseEvent(new RoutedEventArgs(SaveDefaultsClickedEvent, this));
|
||||
|
||||
// UNICO MessageBox di conferma
|
||||
MessageBox.Show(
|
||||
"Tutte le impostazioni sono state salvate con successo.\n\nLe nuove impostazioni verranno applicate alle aste future.",
|
||||
"Impostazioni Salvate",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information
|
||||
);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Errore durante il salvataggio: " + ex.Message,
|
||||
"Errore",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelAllSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Annulla tutte le modifiche
|
||||
RaiseEvent(new RoutedEventArgs(CancelDefaultsClickedEvent, this));
|
||||
}
|
||||
|
||||
// Routed Events
|
||||
public static readonly RoutedEvent SaveDefaultsClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"SaveDefaultsClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(SettingsControl));
|
||||
|
||||
public static readonly RoutedEvent CancelDefaultsClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"CancelDefaultsClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(SettingsControl));
|
||||
|
||||
public event RoutedEventHandler SaveDefaultsClicked
|
||||
{
|
||||
add { AddHandler(SaveDefaultsClickedEvent, value); }
|
||||
remove { RemoveHandler(SaveDefaultsClickedEvent, value); }
|
||||
}
|
||||
|
||||
public event RoutedEventHandler CancelDefaultsClicked
|
||||
{
|
||||
add { AddHandler(CancelDefaultsClickedEvent, value); }
|
||||
remove { RemoveHandler(CancelDefaultsClickedEvent, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="AutoBidder.Controls.SimpleToolbar"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="48" d:DesignWidth="800">
|
||||
<Grid Background="Transparent">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Content="{Binding LeftContent, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Center" />
|
||||
<ContentPresenter Grid.Column="1" Content="{Binding RightContent, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace AutoBidder.Controls
|
||||
{
|
||||
public partial class SimpleToolbar : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty LeftContentProperty = DependencyProperty.Register("LeftContent", typeof(object), typeof(SimpleToolbar));
|
||||
public static readonly DependencyProperty RightContentProperty = DependencyProperty.Register("RightContent", typeof(object), typeof(SimpleToolbar));
|
||||
|
||||
public object? LeftContent
|
||||
{
|
||||
get => GetValue(LeftContentProperty);
|
||||
set => SetValue(LeftContentProperty, value);
|
||||
}
|
||||
|
||||
public object? RightContent
|
||||
{
|
||||
get => GetValue(RightContentProperty);
|
||||
set => SetValue(RightContentProperty, value);
|
||||
}
|
||||
|
||||
public SimpleToolbar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<UserControl x:Class="AutoBidder.Controls.StatisticsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="800" d:DesignWidth="1200"
|
||||
Background="#1E1E1E">
|
||||
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="RoundedButton" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="8"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Padding" Value="15,10"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="#2D2D30" Padding="15" BorderBrush="#3E3E42" BorderThickness="0,0,0,1">
|
||||
<Grid>
|
||||
<TextBlock Text="📊 Dati Statistici - Analisi Aste Chiuse"
|
||||
Foreground="#00D800"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<Button x:Name="LoadClosedAuctionsButton"
|
||||
Content="🔄 Carica Statistiche"
|
||||
HorizontalAlignment="Right"
|
||||
Background="#007ACC"
|
||||
Style="{StaticResource RoundedButton}"
|
||||
Click="LoadClosedAuctionsButton_Click"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- DataGrid Statistiche -->
|
||||
<DataGrid Grid.Row="1"
|
||||
x:Name="StatsDataGrid"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
Background="#1E1E1E"
|
||||
Foreground="#CCCCCC"
|
||||
RowBackground="#1E1E1E"
|
||||
AlternatingRowBackground="#252526"
|
||||
GridLinesVisibility="Horizontal"
|
||||
HeadersVisibility="Column"
|
||||
BorderThickness="0"
|
||||
Margin="15">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#2D2D30"/>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,1,1"/>
|
||||
<Setter Property="BorderBrush" Value="#3E3E42"/>
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="10,5"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#CCCCCC"/>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Prodotto" Binding="{Binding ProductName}" Width="3*"/>
|
||||
<DataGridTextColumn Header="Prezzo Medio" Binding="{Binding AverageFinalPrice, StringFormat=€{0:F2}}" Width="120"/>
|
||||
<DataGridTextColumn Header="Click Medi" Binding="{Binding AverageBidsUsed, StringFormat={}{0:F0}}" Width="100"/>
|
||||
<DataGridTextColumn Header="Vincitore Frequente" Binding="{Binding Winner}" Width="150"/>
|
||||
<DataGridTextColumn Header="# Aste" Binding="{Binding Count}" Width="80"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<!-- Footer: Status -->
|
||||
<Border Grid.Row="2"
|
||||
Background="#252526"
|
||||
Padding="15"
|
||||
BorderBrush="#3E3E42"
|
||||
BorderThickness="0,1,0,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock x:Name="StatsStatusText"
|
||||
Text="Pronto per caricare statistiche"
|
||||
FontSize="13"
|
||||
Foreground="#CCCCCC"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<TextBlock x:Name="ExportProgressText"
|
||||
Text=""
|
||||
FontSize="11"
|
||||
Foreground="#999999"
|
||||
Margin="0,5,0,0"
|
||||
Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
|
||||
<ProgressBar Grid.Column="1"
|
||||
x:Name="ExportProgressBar"
|
||||
Width="200"
|
||||
Height="20"
|
||||
IsIndeterminate="True"
|
||||
Foreground="#007ACC"
|
||||
Background="#1E1E1E"
|
||||
BorderBrush="#3E3E42"
|
||||
Visibility="Collapsed"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace AutoBidder.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for StatisticsControl.xaml
|
||||
/// </summary>
|
||||
public partial class StatisticsControl : UserControl
|
||||
{
|
||||
public StatisticsControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void LoadClosedAuctionsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(LoadClosedAuctionsClickedEvent, this));
|
||||
}
|
||||
|
||||
// Routed Events
|
||||
public static readonly RoutedEvent LoadClosedAuctionsClickedEvent = EventManager.RegisterRoutedEvent(
|
||||
"LoadClosedAuctionsClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(StatisticsControl));
|
||||
|
||||
public event RoutedEventHandler LoadClosedAuctionsClicked
|
||||
{
|
||||
add { AddHandler(LoadClosedAuctionsClickedEvent, value); }
|
||||
remove { RemoveHandler(LoadClosedAuctionsClickedEvent, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Browser event handlers and navigation
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void BrowserBackButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (EmbeddedWebView?.CoreWebView2 != null && EmbeddedWebView.CoreWebView2.CanGoBack)
|
||||
EmbeddedWebView.CoreWebView2.GoBack();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void BrowserForwardButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (EmbeddedWebView?.CoreWebView2 != null && EmbeddedWebView.CoreWebView2.CanGoForward)
|
||||
EmbeddedWebView.CoreWebView2.GoForward();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void BrowserRefreshButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
EmbeddedWebView?.Reload();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void BrowserHomeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
EmbeddedWebView?.CoreWebView2?.Navigate("https://it.bidoo.com/");
|
||||
BrowserAddress.Text = "https://it.bidoo.com/";
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void BrowserAddAuctionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = BrowserAddress.Text?.Trim() ?? EmbeddedWebView?.Source?.ToString();
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
_ = AddAuctionFromUrl(url);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void EmbeddedWebView_NavigationStarting(object sender, CoreWebView2NavigationStartingEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
BrowserAddress.Text = e.Uri ?? string.Empty;
|
||||
var btn = this.FindName("BrowserAddAuctionButton") as Button;
|
||||
if (btn != null)
|
||||
btn.IsEnabled = IsValidAuctionUrl(e.Uri ?? string.Empty);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void EmbeddedWebView_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var uri = EmbeddedWebView?.Source?.ToString() ?? BrowserAddress.Text;
|
||||
BrowserAddress.Text = uri;
|
||||
var btn = this.FindName("BrowserAddAuctionButton") as Button;
|
||||
if (btn != null)
|
||||
btn.IsEnabled = IsValidAuctionUrl(uri);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void EmbeddedWebView_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void CoreWebView2_ContextMenuRequested(object? sender, CoreWebView2ContextMenuRequestedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Prevent default native menu
|
||||
e.Handled = true;
|
||||
|
||||
var target = e.ContextMenuTarget;
|
||||
string? link = null;
|
||||
try
|
||||
{
|
||||
link = target?.LinkUri;
|
||||
if (string.IsNullOrEmpty(link)) link = target?.PageUri;
|
||||
}
|
||||
catch { }
|
||||
|
||||
// Show WPF ContextMenu on UI thread
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var menu = new ContextMenu();
|
||||
|
||||
var canAdd = !string.IsNullOrEmpty(link) || IsValidAuctionUrl(EmbeddedWebView?.Source?.ToString() ?? BrowserAddress.Text);
|
||||
|
||||
var addItem = new MenuItem { Header = "Aggiungi Asta", IsEnabled = canAdd };
|
||||
addItem.Click += async (s, args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string? urlToAdd = link;
|
||||
if (string.IsNullOrEmpty(urlToAdd))
|
||||
urlToAdd = EmbeddedWebView?.Source?.ToString() ?? BrowserAddress.Text;
|
||||
|
||||
if (!string.IsNullOrEmpty(urlToAdd))
|
||||
{
|
||||
await AddAuctionFromUrl(urlToAdd);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Aggiungi Asta dal menu: {ex.Message}");
|
||||
}
|
||||
};
|
||||
|
||||
menu.Items.Add(addItem);
|
||||
|
||||
var copyLink = new MenuItem { Header = "Copia link", IsEnabled = !string.IsNullOrEmpty(link) };
|
||||
copyLink.Click += (s, args) =>
|
||||
{
|
||||
try { if (!string.IsNullOrEmpty(link)) Clipboard.SetText(link); }
|
||||
catch { }
|
||||
};
|
||||
menu.Items.Add(copyLink);
|
||||
|
||||
menu.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
|
||||
menu.IsOpen = true;
|
||||
}
|
||||
catch { }
|
||||
}));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using AutoBidder.Utilities;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings and configuration event handlers - REFACTORED
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Carica TUTTE le impostazioni salvate nei controlli UI
|
||||
/// </summary>
|
||||
private void LoadDefaultSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
var settings = Utilities.SettingsManager.Load();
|
||||
|
||||
// Carica impostazioni predefinite aste
|
||||
DefaultBidBeforeDeadlineMs.Text = settings.DefaultBidBeforeDeadlineMs.ToString();
|
||||
DefaultCheckAuctionOpen.IsChecked = settings.DefaultCheckAuctionOpenBeforeBid;
|
||||
DefaultMinPrice.Text = settings.DefaultMinPrice.ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
|
||||
DefaultMaxPrice.Text = settings.DefaultMaxPrice.ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
|
||||
DefaultMaxClicks.Text = settings.DefaultMaxClicks.ToString();
|
||||
|
||||
// Carica limiti log
|
||||
Settings.MaxLogLinesPerAuctionTextBox.Text = settings.MaxLogLinesPerAuction.ToString();
|
||||
Settings.MaxGlobalLogLinesTextBox.Text = settings.MaxGlobalLogLines.ToString();
|
||||
|
||||
// ?? NUOVO: Carica limite storia puntate
|
||||
Settings.MaxBidHistoryEntriesTextBox.Text = settings.MaxBidHistoryEntries.ToString();
|
||||
|
||||
// ?? NUOVO: Carica limite minimo puntate
|
||||
MinimumRemainingBidsTextBox.Text = settings.MinimumRemainingBids.ToString();
|
||||
|
||||
// ?? NUOVO: Carica livello log
|
||||
var logLevelErrorOnly = Settings.FindName("LogLevelErrorOnly") as System.Windows.Controls.RadioButton;
|
||||
var logLevelNormal = Settings.FindName("LogLevelNormal") as System.Windows.Controls.RadioButton;
|
||||
var logLevelInformational = Settings.FindName("LogLevelInformational") as System.Windows.Controls.RadioButton;
|
||||
var logLevelDebug = Settings.FindName("LogLevelDebug") as System.Windows.Controls.RadioButton;
|
||||
var logLevelTrace = Settings.FindName("LogLevelTrace") as System.Windows.Controls.RadioButton;
|
||||
|
||||
switch (settings.MinLogLevel)
|
||||
{
|
||||
case "ErrorOnly":
|
||||
if (logLevelErrorOnly != null) logLevelErrorOnly.IsChecked = true;
|
||||
break;
|
||||
case "Informational":
|
||||
if (logLevelInformational != null) logLevelInformational.IsChecked = true;
|
||||
break;
|
||||
case "Debug":
|
||||
if (logLevelDebug != null) logLevelDebug.IsChecked = true;
|
||||
break;
|
||||
case "Trace":
|
||||
if (logLevelTrace != null) logLevelTrace.IsChecked = true;
|
||||
break;
|
||||
case "Normal":
|
||||
default:
|
||||
if (logLevelNormal != null) logLevelNormal.IsChecked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Aggiorna indicatore visivo
|
||||
UpdateMinBidsIndicator(settings.MinimumRemainingBids);
|
||||
|
||||
// Carica stato iniziale aste
|
||||
// ? NUOVO: Se RememberAuctionStates è attivo, seleziona "Ricorda Stato"
|
||||
if (settings.RememberAuctionStates)
|
||||
{
|
||||
Settings.LoadAuctionsRemember.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Altrimenti usa DefaultStartAuctionsOnLoad
|
||||
switch (settings.DefaultStartAuctionsOnLoad)
|
||||
{
|
||||
case "Active":
|
||||
Settings.LoadAuctionsActive.IsChecked = true;
|
||||
break;
|
||||
case "Paused":
|
||||
Settings.LoadAuctionsPaused.IsChecked = true;
|
||||
break;
|
||||
case "Stopped":
|
||||
default:
|
||||
Settings.LoadAuctionsStopped.IsChecked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (settings.DefaultNewAuctionState)
|
||||
{
|
||||
case "Active":
|
||||
Settings.NewAuctionActive.IsChecked = true;
|
||||
break;
|
||||
case "Paused":
|
||||
Settings.NewAuctionPaused.IsChecked = true;
|
||||
break;
|
||||
case "Stopped":
|
||||
default:
|
||||
Settings.NewAuctionStopped.IsChecked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Log($"[OK] Impostazioni caricate: Anticipo={settings.DefaultBidBeforeDeadlineMs}ms, LogAsta={settings.MaxLogLinesPerAuction}, LogGlobale={settings.MaxGlobalLogLines}, MinBids={settings.MinimumRemainingBids}", Utilities.LogLevel.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Caricamento impostazioni predefinite: {ex.Message}", Utilities.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveDefaultsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// ? Carica le impostazioni esistenti per non perdere gli altri valori
|
||||
var settings = Utilities.SettingsManager.Load() ?? new Utilities.AppSettings();
|
||||
|
||||
// === SEZIONE DEFAULTS: Validazione e Salvataggio ===
|
||||
if (int.TryParse(DefaultBidBeforeDeadlineMs.Text, out var bidMs) && bidMs >= 0 && bidMs <= 5000)
|
||||
{
|
||||
settings.DefaultBidBeforeDeadlineMs = bidMs;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[ERRORE] Valore anticipo puntata non valido (deve essere 0-5000ms)", LogLevel.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
settings.DefaultCheckAuctionOpenBeforeBid = DefaultCheckAuctionOpen.IsChecked ?? false;
|
||||
|
||||
if (double.TryParse(DefaultMinPrice.Text.Replace(',', '.'), System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out var minPrice))
|
||||
{
|
||||
settings.DefaultMinPrice = minPrice;
|
||||
}
|
||||
|
||||
if (double.TryParse(DefaultMaxPrice.Text.Replace(',', '.'), System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out var maxPrice))
|
||||
{
|
||||
settings.DefaultMaxPrice = maxPrice;
|
||||
}
|
||||
|
||||
if (int.TryParse(DefaultMaxClicks.Text, out var maxClicks))
|
||||
{
|
||||
settings.DefaultMaxClicks = maxClicks;
|
||||
}
|
||||
|
||||
// === SEZIONE DEFAULTS: Limiti Log ===
|
||||
if (int.TryParse(Settings.MaxLogLinesPerAuctionTextBox.Text, out var maxLogPerAuction) && maxLogPerAuction > 0)
|
||||
{
|
||||
settings.MaxLogLinesPerAuction = maxLogPerAuction;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[ERRORE] Valore max log per asta non valido (deve essere > 0)", LogLevel.Error);
|
||||
}
|
||||
|
||||
if (int.TryParse(Settings.MaxGlobalLogLinesTextBox.Text, out var maxGlobalLog) && maxGlobalLog > 0)
|
||||
{
|
||||
settings.MaxGlobalLogLines = maxGlobalLog;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[ERRORE] Valore max log globale non valido (deve essere > 0)", LogLevel.Error);
|
||||
}
|
||||
|
||||
// ?? NUOVO: Salva limite storia puntate
|
||||
if (int.TryParse(Settings.MaxBidHistoryEntriesTextBox.Text, out var maxBidHistory) && maxBidHistory >= 0)
|
||||
{
|
||||
settings.MaxBidHistoryEntries = maxBidHistory;
|
||||
|
||||
if (maxBidHistory > 0)
|
||||
{
|
||||
Log($"[HISTORY] Impostato limite storia puntate: {maxBidHistory}", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[HISTORY] Limite storia puntate disabilitato (mostra tutte)", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[ERRORE] Valore limite storia puntate non valido (deve essere >= 0)", LogLevel.Error);
|
||||
}
|
||||
|
||||
// ?? NUOVO: Salva limite minimo puntate
|
||||
if (int.TryParse(MinimumRemainingBidsTextBox.Text, out var minBids) && minBids >= 0)
|
||||
{
|
||||
settings.MinimumRemainingBids = minBids;
|
||||
|
||||
// Aggiorna indicatore visivo
|
||||
UpdateMinBidsIndicator(minBids);
|
||||
|
||||
if (minBids > 0)
|
||||
{
|
||||
Log($"[LIMIT] Impostato limite minimo puntate: {minBids}", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[ERRORE] Valore limite minimo puntate non valido (deve essere >= 0)", LogLevel.Error);
|
||||
}
|
||||
|
||||
// ?? NUOVO: Salva livello log
|
||||
var logLevelErrorOnly = Settings.FindName("LogLevelErrorOnly") as System.Windows.Controls.RadioButton;
|
||||
var logLevelNormal = Settings.FindName("LogLevelNormal") as System.Windows.Controls.RadioButton;
|
||||
var logLevelInformational = Settings.FindName("LogLevelInformational") as System.Windows.Controls.RadioButton;
|
||||
var logLevelDebug = Settings.FindName("LogLevelDebug") as System.Windows.Controls.RadioButton;
|
||||
var logLevelTrace = Settings.FindName("LogLevelTrace") as System.Windows.Controls.RadioButton;
|
||||
|
||||
string selectedLogLevel = "Normal"; // Default
|
||||
if (logLevelErrorOnly?.IsChecked == true)
|
||||
selectedLogLevel = "ErrorOnly";
|
||||
else if (logLevelInformational?.IsChecked == true)
|
||||
selectedLogLevel = "Informational";
|
||||
else if (logLevelDebug?.IsChecked == true)
|
||||
selectedLogLevel = "Debug";
|
||||
else if (logLevelTrace?.IsChecked == true)
|
||||
selectedLogLevel = "Trace";
|
||||
else if (logLevelNormal?.IsChecked == true)
|
||||
selectedLogLevel = "Normal";
|
||||
|
||||
settings.MinLogLevel = selectedLogLevel;
|
||||
|
||||
Log($"[LOG] Livello log impostato: {selectedLogLevel}", LogLevel.Info);
|
||||
|
||||
// === SEZIONE DEFAULTS: Stati Iniziali Aste ===
|
||||
var loadAuctionsRemember = Settings.FindName("LoadAuctionsRemember") as System.Windows.Controls.RadioButton;
|
||||
var loadAuctionsActive = Settings.FindName("LoadAuctionsActive") as System.Windows.Controls.RadioButton;
|
||||
var loadAuctionsPaused = Settings.FindName("LoadAuctionsPaused") as System.Windows.Controls.RadioButton;
|
||||
|
||||
// ? NUOVO: Gestione "Ricorda Stato"
|
||||
if (loadAuctionsRemember?.IsChecked == true)
|
||||
{
|
||||
// Attiva RememberAuctionStates
|
||||
settings.RememberAuctionStates = true;
|
||||
// DefaultStartAuctionsOnLoad diventa irrilevante, ma lo lasciamo a "Stopped" per compatibilità
|
||||
settings.DefaultStartAuctionsOnLoad = "Stopped";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Disattiva RememberAuctionStates e usa DefaultStartAuctionsOnLoad
|
||||
settings.RememberAuctionStates = false;
|
||||
settings.DefaultStartAuctionsOnLoad = loadAuctionsActive?.IsChecked == true ? "Active" :
|
||||
loadAuctionsPaused?.IsChecked == true ? "Paused" :
|
||||
"Stopped";
|
||||
}
|
||||
|
||||
var newAuctionActive = Settings.FindName("NewAuctionActive") as System.Windows.Controls.RadioButton;
|
||||
var newAuctionPaused = Settings.FindName("NewAuctionPaused") as System.Windows.Controls.RadioButton;
|
||||
|
||||
settings.DefaultNewAuctionState = newAuctionActive?.IsChecked == true ? "Active" :
|
||||
newAuctionPaused?.IsChecked == true ? "Paused" :
|
||||
"Stopped";
|
||||
|
||||
Utilities.SettingsManager.Save(settings);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Salvataggio impostazioni: {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelDefaultsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Ricarica defaults salvati
|
||||
LoadDefaultSettings();
|
||||
MessageBox.Show(this, "Impostazioni predefinite ripristinate.", "Annulla", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Ripristino impostazioni: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show(this, "Errore durante ripristino: " + ex.Message, "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
// === HANDLER PER PULSANTI UNIFICATI ===
|
||||
|
||||
private void SaveAllSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Salva tutte le impostazioni (ora solo defaults, export rimosso)
|
||||
SaveDefaultsButton_Click(sender, e);
|
||||
|
||||
MessageBox.Show(
|
||||
"Tutte le impostazioni sono state salvate con successo.\n\nLe nuove impostazioni verranno applicate alle aste future.",
|
||||
"Impostazioni Salvate",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Salvataggio impostazioni: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show(this, "Errore durante salvataggio: " + ex.Message, "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelAllSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Annulla tutte le modifiche
|
||||
LoadDefaultSettings();
|
||||
MessageBox.Show(this, "Impostazioni ripristinate alle ultime salvate.", "Annulla", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Ripristino impostazioni: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show(this, "Errore durante ripristino: " + ex.Message, "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Xml.Linq;
|
||||
using AutoBidder.Models;
|
||||
using AutoBidder.Utilities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Statistics and closed auctions event handlers
|
||||
/// NOTA: Funzionalità statistiche temporaneamente disabilitate - in sviluppo
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void ExportStatsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Funzionalità statistiche in sviluppo", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
private async void LoadClosedAuctionsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Funzionalità statistiche in sviluppo", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
|
||||
/* CODICE TEMPORANEAMENTE DISABILITATO - Statistiche in sviluppo
|
||||
try
|
||||
{
|
||||
StatsStatusText.Text = "Avvio caricamento statistiche...";
|
||||
var settings = Utilities.SettingsManager.Load();
|
||||
if (settings == null || string.IsNullOrWhiteSpace(settings.ExportPath) || !Directory.Exists(settings.ExportPath))
|
||||
{
|
||||
MessageBox.Show(this, "Percorso export non configurato o non valido. Configuralo nelle impostazioni.", "Carica Statistiche", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
StatsStatusText.Text = "Percorso export non valido";
|
||||
return;
|
||||
}
|
||||
|
||||
ExportProgressBar.Visibility = Visibility.Visible;
|
||||
ExportProgressText.Visibility = Visibility.Visible;
|
||||
ExportProgressText.Text = "Caricamento statistiche...";
|
||||
|
||||
var folder = settings.ExportPath!;
|
||||
var files = Directory.GetFiles(folder, "auction_*.*");
|
||||
if (files.Length == 0)
|
||||
{
|
||||
MessageBox.Show(this, "Nessun file di aste trovato nella cartella di export.", "Carica Statistiche", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
StatsStatusText.Text = "Nessun file trovato";
|
||||
ExportProgressBar.Visibility = Visibility.Collapsed;
|
||||
ExportProgressText.Visibility = Visibility.Collapsed;
|
||||
return;
|
||||
}
|
||||
|
||||
var aggregated = new Dictionary<string, List<ClosedAuctionRecord>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
foreach (var f in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ext = Path.GetExtension(f).ToLowerInvariant();
|
||||
if (ext == ".json")
|
||||
{
|
||||
var txt = File.ReadAllText(f, Encoding.UTF8);
|
||||
try
|
||||
{
|
||||
var rec = System.Text.Json.JsonSerializer.Deserialize<ClosedAuctionRecord>(txt);
|
||||
if (rec != null)
|
||||
{
|
||||
var key = (rec.ProductName ?? ExtractProductFromFilename(f) ?? "<unknown>").Trim();
|
||||
if (!aggregated.ContainsKey(key)) aggregated[key] = new List<ClosedAuctionRecord>();
|
||||
aggregated[key].Add(rec);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
var arr = System.Text.Json.JsonSerializer.Deserialize<List<ClosedAuctionRecord>>(txt);
|
||||
if (arr != null)
|
||||
{
|
||||
foreach (var r in arr)
|
||||
{
|
||||
var key = (r.ProductName ?? ExtractProductFromFilename(f) ?? "<unknown>").Trim();
|
||||
if (!aggregated.ContainsKey(key)) aggregated[key] = new List<ClosedAuctionRecord>();
|
||||
aggregated[key].Add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
else if (ext == ".xml")
|
||||
{
|
||||
try
|
||||
{
|
||||
var doc = XDocument.Load(f);
|
||||
var auctionElems = doc.Descendants("Auction");
|
||||
if (!auctionElems.Any()) auctionElems = doc.Descendants("AuctionExport");
|
||||
foreach (var n in auctionElems)
|
||||
{
|
||||
var name = n.Descendants("Name").FirstOrDefault()?.Value ?? n.Descendants("ProductName").FirstOrDefault()?.Value;
|
||||
double d = 0; double.TryParse(n.Descendants("FinalPrice").FirstOrDefault()?.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out d);
|
||||
int bids = 0; int.TryParse(n.Descendants("TotalBids").FirstOrDefault()?.Value, out bids);
|
||||
var winner = n.Descendants("Winner").FirstOrDefault()?.Value ?? string.Empty;
|
||||
var url = n.Descendants("OriginalUrl").FirstOrDefault()?.Value ?? string.Empty;
|
||||
var rec = new ClosedAuctionRecord { ProductName = name, FinalPrice = d == 0 ? null : (double?)d, Winner = winner, BidsUsed = bids, AuctionUrl = url };
|
||||
var key = (rec.ProductName ?? ExtractProductFromFilename(f) ?? "<unknown>").Trim();
|
||||
if (!aggregated.ContainsKey(key)) aggregated[key] = new List<ClosedAuctionRecord>();
|
||||
aggregated[key].Add(rec);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
else // CSV or text
|
||||
{
|
||||
try
|
||||
{
|
||||
var lines = File.ReadAllLines(f, Encoding.UTF8);
|
||||
string product = ExtractProductFromFilename(f) ?? "<unknown>";
|
||||
double? price = null; int? bids = null; string winner = string.Empty; string url = string.Empty;
|
||||
foreach (var l in lines)
|
||||
{
|
||||
var line = l.Trim();
|
||||
if (line.StartsWith("Name,") || line.StartsWith("ProductName,"))
|
||||
{
|
||||
var parts = line.Split(',', 2);
|
||||
if (parts.Length == 2) product = parts[1].Trim('"');
|
||||
}
|
||||
else if (line.StartsWith("FinalPrice", StringComparison.OrdinalIgnoreCase) || line.StartsWith("Price,"))
|
||||
{
|
||||
var parts = line.Split(',', 2);
|
||||
if (parts.Length == 2 && double.TryParse(parts[1].Trim('"').Replace('€', ' ').Trim(), NumberStyles.Any, CultureInfo.InvariantCulture, out var p)) price = p;
|
||||
}
|
||||
else if (line.StartsWith("TotalBids", StringComparison.OrdinalIgnoreCase) || line.StartsWith("BidsUsed", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var parts = line.Split(',', 2);
|
||||
if (parts.Length == 2 && int.TryParse(parts[1].Trim('"'), out var b)) bids = b;
|
||||
}
|
||||
else if (line.StartsWith("Winner", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var parts = line.Split(',', 2);
|
||||
if (parts.Length == 2) winner = parts[1].Trim('"');
|
||||
}
|
||||
else if (line.StartsWith("OriginalUrl", StringComparison.OrdinalIgnoreCase) || line.StartsWith("AuctionUrl", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var parts = line.Split(',', 2);
|
||||
if (parts.Length == 2) url = parts[1].Trim('"');
|
||||
}
|
||||
}
|
||||
var rec = new ClosedAuctionRecord { ProductName = product, FinalPrice = price, BidsUsed = bids, Winner = winner, AuctionUrl = url };
|
||||
var key = (rec.ProductName ?? ExtractProductFromFilename(f) ?? "<unknown>").Trim();
|
||||
if (!aggregated.ContainsKey(key)) aggregated[key] = new List<ClosedAuctionRecord>();
|
||||
aggregated[key].Add(rec);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
});
|
||||
|
||||
var stats = new List<object>();
|
||||
foreach (var kv in aggregated)
|
||||
{
|
||||
var list = kv.Value.Where(x => x.FinalPrice.HasValue || x.BidsUsed.HasValue).ToList();
|
||||
if (list.Count == 0) continue;
|
||||
var avgPrice = list.Where(x => x.FinalPrice.HasValue).Select(x => x.FinalPrice!.Value).DefaultIfEmpty(0).Average();
|
||||
var avgBids = list.Where(x => x.BidsUsed.HasValue).Select(x => x.BidsUsed!.Value).DefaultIfEmpty(0).Average();
|
||||
var winner = list.Where(x => !string.IsNullOrEmpty(x.Winner)).GroupBy(x => x.Winner).OrderByDescending(g => g.Count()).Select(g => g.Key).FirstOrDefault() ?? string.Empty;
|
||||
var example = list.FirstOrDefault(x => !string.IsNullOrEmpty(x.AuctionUrl))?.AuctionUrl ?? string.Empty;
|
||||
|
||||
stats.Add(new
|
||||
{
|
||||
ProductName = kv.Key,
|
||||
FinalPrice = avgPrice,
|
||||
Winner = winner,
|
||||
BidsUsed = (int)Math.Round(avgBids),
|
||||
AuctionUrl = example,
|
||||
Count = list.Count,
|
||||
AverageFinalPrice = avgPrice,
|
||||
AverageBidsUsed = avgBids
|
||||
});
|
||||
}
|
||||
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
StatsDataGrid.ItemsSource = stats.OrderByDescending(s => (int)s.GetType().GetProperty("Count")!.GetValue(s)).ToList();
|
||||
StatsStatusText.Text = $"Caricati {stats.Count} prodotti ({files.Length} file analizzati)";
|
||||
ExportProgressBar.Visibility = Visibility.Collapsed;
|
||||
ExportProgressText.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StatsStatusText.Text = "Errore caricamento statistiche";
|
||||
Log($"[ERRORE] Carica statistiche: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show(this, "Errore durante caricamento statistiche: " + ex.Message, "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
ExportProgressBar.Visibility = Visibility.Collapsed;
|
||||
ExportProgressText.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private static string? ExtractProductFromFilename(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
var name = Path.GetFileNameWithoutExtension(path);
|
||||
var m = Regex.Match(name, @"auction_(.+)");
|
||||
if (m.Success)
|
||||
{
|
||||
var v = m.Groups[1].Value;
|
||||
if (Regex.IsMatch(v, "^\\d+$")) return null;
|
||||
return v.Replace('_', ' ');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch { return null; }
|
||||
}
|
||||
|
||||
private async void ApplyInsightsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Funzionalità statistiche in sviluppo", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
|
||||
/* CODICE TEMPORANEAMENTE DISABILITATO
|
||||
try
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show(this, "Seleziona un'asta prima di applicare le raccomandazioni.", "Applica Raccomandazioni", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var optionsBuilder = new Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<Data.StatisticsContext>();
|
||||
var dbPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "stats.db");
|
||||
optionsBuilder.UseSqlite($"Data Source={dbPath}");
|
||||
using var ctx = new Data.StatisticsContext(optionsBuilder.Options);
|
||||
var svc = new Services.StatsService(ctx);
|
||||
|
||||
var (recBids, recPrice) = await svc.GetRecommendationAsync(_selectedAuction.AuctionInfo.Name, _selectedAuction.AuctionInfo.OriginalUrl);
|
||||
_selectedAuction.MaxClicks = Math.Max(_selectedAuction.MaxClicks, recBids);
|
||||
_selectedAuction.MaxPrice = Math.Max(_selectedAuction.MaxPrice, recPrice);
|
||||
Log($"[OK] Raccomandazioni: MaxClicks={recBids}, MaxPrice={recPrice:F2} applicate a {_selectedAuction.Name}", LogLevel.Success);
|
||||
UpdateSelectedAuctionDetails(_selectedAuction);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] ApplyInsights: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show(this, "Errore applicazione raccomandazioni: " + ex.Message, "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void FreeBidsStart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Funzionalità non ancora implementata", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
private void FreeBidsStop_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Funzionalità non ancora implementata", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Stub event handlers for XAML binding - actual implementations are in dedicated partial files
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
// These methods exist only to satisfy XAML event bindings
|
||||
// The actual implementations are in the appropriate partial class files:
|
||||
// - MainWindow.ButtonHandlers.cs for button clicks
|
||||
// - MainWindow.EventHandlers.Browser.cs for browser events
|
||||
// - MainWindow.EventHandlers.Export.cs for export events
|
||||
// - MainWindow.EventHandlers.Settings.cs for settings events
|
||||
// - MainWindow.EventHandlers.Stats.cs for statistics events
|
||||
|
||||
private void MultiAuctionsGrid_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Optional: Add keyboard shortcuts for grid navigation
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,657 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using AutoBidder.Models;
|
||||
using AutoBidder.ViewModels;
|
||||
using AutoBidder.Utilities;
|
||||
using AutoBidder.Services; // ? AGGIUNTO per RequestPriority e HtmlResponse
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Auction management: Add, Remove, Update
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private async Task AddAuctionById(string input)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
{
|
||||
MessageBox.Show("Input non valido!", "Errore", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
string auctionId;
|
||||
string? productName = null;
|
||||
string originalUrl;
|
||||
|
||||
// Verifica se è un URL o solo un ID
|
||||
if (input.Contains("bidoo.com") || input.Contains("http"))
|
||||
{
|
||||
// È un URL - estrai ID e nome prodotto dall'URL stesso
|
||||
originalUrl = input.Trim();
|
||||
auctionId = ExtractAuctionId(originalUrl);
|
||||
if (string.IsNullOrEmpty(auctionId))
|
||||
{
|
||||
MessageBox.Show("Impossibile estrarre ID dall'URL!", "Errore", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
productName = ExtractProductName(originalUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
// È solo un ID numerico - costruisci URL generico
|
||||
auctionId = input.Trim();
|
||||
originalUrl = $"https://it.bidoo.com/auction.php?a=asta_{auctionId}";
|
||||
}
|
||||
|
||||
// Verifica duplicati
|
||||
if (_auctionViewModels.Any(a => a.AuctionId == auctionId))
|
||||
{
|
||||
MessageBox.Show("Asta già monitorata!", "Duplicato", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// ? MODIFICATO: Nome senza ID (già nella colonna separata)
|
||||
var displayName = string.IsNullOrEmpty(productName)
|
||||
? $"Asta {auctionId}"
|
||||
: DecodeAllHtmlEntities(productName);
|
||||
|
||||
// CARICA IMPOSTAZIONI PREDEFINITE SALVATE
|
||||
var settings = Utilities.SettingsManager.Load();
|
||||
|
||||
// ? Determina stato iniziale dalla configurazione
|
||||
bool isActive = false;
|
||||
bool isPaused = false;
|
||||
|
||||
switch (settings.DefaultNewAuctionState)
|
||||
{
|
||||
case "Active":
|
||||
isActive = true;
|
||||
isPaused = false;
|
||||
break;
|
||||
case "Paused":
|
||||
isActive = true;
|
||||
isPaused = true;
|
||||
break;
|
||||
case "Stopped":
|
||||
default:
|
||||
isActive = false;
|
||||
isPaused = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Crea model con valori dalle impostazioni salvate e stato configurato
|
||||
var auction = new AuctionInfo
|
||||
{
|
||||
AuctionId = auctionId,
|
||||
Name = DecodeAllHtmlEntities(displayName),
|
||||
OriginalUrl = originalUrl,
|
||||
BidBeforeDeadlineMs = settings.DefaultBidBeforeDeadlineMs,
|
||||
CheckAuctionOpenBeforeBid = settings.DefaultCheckAuctionOpenBeforeBid,
|
||||
IsActive = isActive,
|
||||
IsPaused = isPaused
|
||||
};
|
||||
|
||||
// Aggiungi al monitor
|
||||
_auctionMonitor.AddAuction(auction);
|
||||
|
||||
// Crea ViewModel con valori dalle impostazioni
|
||||
var vm = new AuctionViewModel(auction)
|
||||
{
|
||||
MinPrice = settings.DefaultMinPrice,
|
||||
MaxPrice = settings.DefaultMaxPrice,
|
||||
MaxClicks = settings.DefaultMaxClicks
|
||||
};
|
||||
_auctionViewModels.Add(vm);
|
||||
|
||||
// ? Auto-start del monitoraggio se l'asta è attiva e il monitoraggio è fermo
|
||||
if (isActive && !_isAutomationActive)
|
||||
{
|
||||
_auctionMonitor.Start();
|
||||
_isAutomationActive = true;
|
||||
Log($"[AUTO-START] Monitoraggio avviato automaticamente per nuova asta: {vm.Name}", LogLevel.Info);
|
||||
}
|
||||
|
||||
SaveAuctions();
|
||||
UpdateTotalCount();
|
||||
UpdateGlobalControlButtons();
|
||||
|
||||
var stateText = isActive ? (isPaused ? "Paused" : "Active") : "Stopped";
|
||||
Log($"[ADD] Asta aggiunta con stato={stateText}, Anticipo={settings.DefaultBidBeforeDeadlineMs}ms", Utilities.LogLevel.Info);
|
||||
|
||||
// ? NUOVO: Se il nome non è stato estratto, recuperalo in background DOPO l'aggiunta
|
||||
if (string.IsNullOrEmpty(productName))
|
||||
{
|
||||
_ = FetchAuctionNameInBackgroundAsync(auction, vm);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"Errore aggiunta asta: {ex.Message}");
|
||||
MessageBox.Show($"Errore: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera il nome dell'asta in background e aggiorna l'UI quando completa
|
||||
/// </summary>
|
||||
private async Task FetchAuctionNameInBackgroundAsync(AuctionInfo auction, AuctionViewModel vm)
|
||||
{
|
||||
try
|
||||
{
|
||||
// ? USA IL SERVIZIO CENTRALIZZATO invece di HttpClient diretto
|
||||
var response = await _htmlCacheService.GetHtmlAsync(
|
||||
auction.OriginalUrl,
|
||||
RequestPriority.Normal,
|
||||
bypassCache: false // Usa cache se disponibile
|
||||
);
|
||||
|
||||
if (!response.Success)
|
||||
{
|
||||
Log($"[WARN] Impossibile recuperare nome per asta {auction.AuctionId}: {response.Error}", LogLevel.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// Estrai nome dal <title>
|
||||
var match = System.Text.RegularExpressions.Regex.Match(response.Html, @"<title>([^<]+)</title>");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var productName = match.Groups[1].Value.Trim().Replace(" - Bidoo", "");
|
||||
// ? Decodifica entity HTML (incluse quelle non standard)
|
||||
productName = DecodeAllHtmlEntities(productName);
|
||||
// ? MODIFICATO: Nome senza ID
|
||||
var newName = productName;
|
||||
|
||||
// Aggiorna il nome su thread UI
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
auction.Name = newName;
|
||||
// Forza refresh della griglia per mostrare il nuovo nome
|
||||
var tempSource = MultiAuctionsGrid.ItemsSource;
|
||||
MultiAuctionsGrid.ItemsSource = null;
|
||||
MultiAuctionsGrid.ItemsSource = tempSource;
|
||||
SaveAuctions(); // Salva il nome aggiornato
|
||||
Log($"[NAME] Nome recuperato per asta {auction.AuctionId}: {productName}{(response.FromCache ? " (cached)" : "")}", LogLevel.Info);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"[WARN] Nome non trovato nell'HTML per asta {auction.AuctionId}", LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[WARN] Errore recupero nome per asta {auction.AuctionId}: {ex.Message}", LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decodifica tutte le entity HTML, incluse quelle non standard come +
|
||||
/// </summary>
|
||||
private string DecodeAllHtmlEntities(string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return text;
|
||||
|
||||
// Prima decodifica entity standard
|
||||
var decoded = System.Net.WebUtility.HtmlDecode(text);
|
||||
|
||||
// ? Poi sostituisci entity non standard che WebUtility.HtmlDecode non gestisce
|
||||
decoded = decoded.Replace("+", "+");
|
||||
decoded = decoded.Replace("=", "=");
|
||||
decoded = decoded.Replace("−", "-");
|
||||
decoded = decoded.Replace("×", "×");
|
||||
decoded = decoded.Replace("÷", "÷");
|
||||
decoded = decoded.Replace("%", "%");
|
||||
decoded = decoded.Replace("$", "$");
|
||||
decoded = decoded.Replace("€", "€");
|
||||
decoded = decoded.Replace("£", "£");
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
private async Task AddAuctionFromUrl(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsValidAuctionUrl(url))
|
||||
{
|
||||
MessageBox.Show("URL asta non valido!", "Errore", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var auctionId = ExtractAuctionId(url);
|
||||
if (string.IsNullOrEmpty(auctionId))
|
||||
{
|
||||
MessageBox.Show("Impossibile estrarre ID asta!", "Errore", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// Verifica duplicati
|
||||
if (_auctionViewModels.Any(a => a.AuctionId == auctionId))
|
||||
{
|
||||
MessageBox.Show("Asta già monitorata!", "Duplicato", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch nome (opzionale)
|
||||
var name = $"Asta {auctionId}";
|
||||
try
|
||||
{
|
||||
// ? USA IL SERVIZIO CENTRALIZZATO
|
||||
var response = await _htmlCacheService.GetHtmlAsync(url, RequestPriority.Normal);
|
||||
|
||||
if (response.Success)
|
||||
{
|
||||
var match2 = System.Text.RegularExpressions.Regex.Match(response.Html, @"<title>([^<]+)</title>");
|
||||
if (match2.Success)
|
||||
{
|
||||
name = DecodeAllHtmlEntities(match2.Groups[1].Value.Trim().Replace(" - Bidoo", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
// CARICA IMPOSTAZIONI PREDEFINITE SALVATE
|
||||
var settings = Utilities.SettingsManager.Load();
|
||||
|
||||
// ? Determina stato iniziale dalla configurazione
|
||||
bool isActive = false;
|
||||
bool isPaused = false;
|
||||
|
||||
switch (settings.DefaultNewAuctionState)
|
||||
{
|
||||
case "Active":
|
||||
isActive = true;
|
||||
isPaused = false;
|
||||
break;
|
||||
case "Paused":
|
||||
isActive = true;
|
||||
isPaused = true;
|
||||
break;
|
||||
case "Stopped":
|
||||
default:
|
||||
isActive = false;
|
||||
isPaused = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Crea model con valori dalle impostazioni salvate e stato configurato
|
||||
var auction = new AuctionInfo
|
||||
{
|
||||
AuctionId = auctionId,
|
||||
Name = DecodeAllHtmlEntities(name),
|
||||
OriginalUrl = url,
|
||||
BidBeforeDeadlineMs = settings.DefaultBidBeforeDeadlineMs,
|
||||
CheckAuctionOpenBeforeBid = settings.DefaultCheckAuctionOpenBeforeBid,
|
||||
IsActive = isActive,
|
||||
IsPaused = isPaused
|
||||
};
|
||||
|
||||
// Aggiungi al monitor
|
||||
_auctionMonitor.AddAuction(auction);
|
||||
|
||||
// Crea ViewModel con valori dalle impostazioni
|
||||
var vm = new AuctionViewModel(auction)
|
||||
{
|
||||
MinPrice = settings.DefaultMinPrice,
|
||||
MaxPrice = settings.DefaultMaxPrice,
|
||||
MaxClicks = settings.DefaultMaxClicks
|
||||
};
|
||||
_auctionViewModels.Add(vm);
|
||||
|
||||
// ? Auto-start del monitoraggio se l'asta è attiva e il monitoraggio è fermo
|
||||
if (isActive && !_isAutomationActive)
|
||||
{
|
||||
_auctionMonitor.Start();
|
||||
_isAutomationActive = true;
|
||||
Log($"[AUTO-START] Monitoraggio avviato automaticamente per nuova asta: {vm.Name}", LogLevel.Info);
|
||||
}
|
||||
|
||||
SaveAuctions();
|
||||
UpdateTotalCount();
|
||||
UpdateGlobalControlButtons();
|
||||
|
||||
var stateText = isActive ? (isPaused ? "Paused" : "Active") : "Stopped";
|
||||
Log($"[ADD] Asta aggiunta con stato={stateText}, Anticipo={settings.DefaultBidBeforeDeadlineMs}ms", Utilities.LogLevel.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Errore aggiunta asta: {ex.Message}");
|
||||
MessageBox.Show($"Errore: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna manualmente il nome di un'asta recuperandolo dall'HTML
|
||||
/// </summary>
|
||||
public async Task RefreshAuctionNameAsync(AuctionViewModel vm)
|
||||
{
|
||||
if (vm == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
Log($"[NAME REFRESH] Aggiornamento nome per: {vm.Name}", LogLevel.Info);
|
||||
await FetchAuctionNameInBackgroundAsync(vm.AuctionInfo, vm);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Refresh nome asta: {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controlla se ci sono aste con nomi generici e prova a recuperarli dopo un delay
|
||||
/// </summary>
|
||||
private async Task RetryFailedAuctionNamesAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Aspetta 30 secondi prima di ritentare (dà tempo alle altre richieste di completare)
|
||||
await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(30));
|
||||
|
||||
// Trova aste con nomi generici "Asta XXXX"
|
||||
var auctionsWithGenericNames = _auctionViewModels
|
||||
.Where(vm => vm.Name.StartsWith("Asta ") && !vm.Name.Contains("Shop") && !vm.Name.Contains("€"))
|
||||
.ToList();
|
||||
|
||||
if (auctionsWithGenericNames.Count > 0)
|
||||
{
|
||||
Log($"[NAME RETRY] Trovate {auctionsWithGenericNames.Count} aste con nomi generici. Ritento recupero...", LogLevel.Info);
|
||||
|
||||
// Ritenta il recupero per ognuna (con delay tra una e l'altra per non sovraccaricare)
|
||||
foreach (var vm in auctionsWithGenericNames)
|
||||
{
|
||||
await FetchAuctionNameInBackgroundAsync(vm.AuctionInfo, vm);
|
||||
await System.Threading.Tasks.Task.Delay(2000); // 2 secondi tra una richiesta e l'altra
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[WARN] Errore retry nomi aste: {ex.Message}", LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveAuctions()
|
||||
{
|
||||
try
|
||||
{
|
||||
var auctions = _auctionMonitor.GetAuctions();
|
||||
Utilities.PersistenceManager.SaveAuctions(auctions);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Errore salvataggio: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadSavedAuctions()
|
||||
{
|
||||
try
|
||||
{
|
||||
// ? Carica impostazioni
|
||||
var settings = Utilities.SettingsManager.Load();
|
||||
|
||||
// Ottieni username corrente dalla sessione per ripristinare IsMyBid
|
||||
var session = _auctionMonitor.GetSession();
|
||||
var currentUsername = session?.Username ?? string.Empty;
|
||||
|
||||
var auctions = Utilities.PersistenceManager.LoadAuctions();
|
||||
foreach (var auction in auctions)
|
||||
{
|
||||
// Protezione: rimuovi eventuali BidHistory null
|
||||
auction.BidHistory = auction.BidHistory?.Where(b => b != null).ToList() ?? new System.Collections.Generic.List<BidHistory>();
|
||||
|
||||
// ? Decode HTML entities (incluse quelle non standard)
|
||||
try { auction.Name = DecodeAllHtmlEntities(auction.Name ?? string.Empty); } catch { }
|
||||
|
||||
// ? Ripristina IsMyBid per tutte le puntate in RecentBids
|
||||
if (auction.RecentBids != null && auction.RecentBids.Count > 0 && !string.IsNullOrEmpty(currentUsername))
|
||||
{
|
||||
foreach (var bid in auction.RecentBids)
|
||||
{
|
||||
bid.IsMyBid = bid.Username.Equals(currentUsername, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ? NUOVO: Gestione stato in base a RememberAuctionStates
|
||||
if (settings.RememberAuctionStates)
|
||||
{
|
||||
// MODO 1: Ripristina lo stato salvato di ogni asta (IsActive e IsPaused vengono dal file salvato)
|
||||
// Non serve fare nulla, lo stato è già quello salvato nel file
|
||||
}
|
||||
else
|
||||
{
|
||||
// MODO 2: Applica DefaultStartAuctionsOnLoad a tutte le aste
|
||||
var loadState = settings.DefaultStartAuctionsOnLoad;
|
||||
switch (loadState)
|
||||
{
|
||||
case "Active":
|
||||
auction.IsActive = true;
|
||||
auction.IsPaused = false;
|
||||
break;
|
||||
case "Paused":
|
||||
auction.IsActive = true;
|
||||
auction.IsPaused = true;
|
||||
break;
|
||||
case "Stopped":
|
||||
default:
|
||||
auction.IsActive = false;
|
||||
auction.IsPaused = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_auctionMonitor.AddAuction(auction);
|
||||
var vm = new AuctionViewModel(auction);
|
||||
_auctionViewModels.Add(vm);
|
||||
}
|
||||
|
||||
// ? Avvia monitoraggio se ci sono aste in stato Active O Paused
|
||||
bool hasActiveOrPausedAuctions = auctions.Any(a => a.IsActive);
|
||||
|
||||
if (hasActiveOrPausedAuctions && auctions.Count > 0)
|
||||
{
|
||||
_auctionMonitor.Start();
|
||||
_isAutomationActive = true;
|
||||
|
||||
if (settings.RememberAuctionStates)
|
||||
{
|
||||
var activeCount = auctions.Count(a => a.IsActive && !a.IsPaused);
|
||||
var pausedCount = auctions.Count(a => a.IsActive && a.IsPaused);
|
||||
Log($"[AUTO-START] Monitoraggio avviato: {activeCount} attive, {pausedCount} in pausa (stati ripristinati)", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
var loadState = settings.DefaultStartAuctionsOnLoad;
|
||||
if (loadState == "Active")
|
||||
{
|
||||
Log($"[AUTO-START] Monitoraggio avviato automaticamente per {auctions.Count} aste caricate in stato attivo", LogLevel.Info);
|
||||
}
|
||||
else if (loadState == "Paused")
|
||||
{
|
||||
Log($"[AUTO-START] Monitoraggio avviato automaticamente per {auctions.Count} aste caricate in pausa", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateTotalCount();
|
||||
UpdateGlobalControlButtons();
|
||||
|
||||
// Log sempre mostrato (anche con 0 aste)
|
||||
if (auctions.Count > 0)
|
||||
{
|
||||
if (settings.RememberAuctionStates)
|
||||
{
|
||||
Log($"[LOAD] {auctions.Count} aste caricate con stati individuali ripristinati", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"[LOAD] {auctions.Count} aste caricate con stato iniziale: {settings.DefaultStartAuctionsOnLoad}", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[LOAD] Nessuna asta salvata", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Caricamento aste: {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna i dettagli dell'asta selezionata nel pannello Info Prodotto
|
||||
/// </summary>
|
||||
private void UpdateSelectedAuctionDetails(AuctionViewModel? vm)
|
||||
{
|
||||
if (vm == null || vm.AuctionInfo == null)
|
||||
{
|
||||
// Resetta campi se nessuna asta selezionata
|
||||
AuctionMonitor.ProductBuyNowPriceText.Text = "-";
|
||||
AuctionMonitor.ProductShippingCostText.Text = "-";
|
||||
AuctionMonitor.ProductWinLimitText.Text = "-";
|
||||
return;
|
||||
}
|
||||
|
||||
var auction = vm.AuctionInfo;
|
||||
|
||||
// CARICA AUTOMATICAMENTE INFO PRODOTTO SE NON PRESENTI
|
||||
if (!auction.BuyNowPrice.HasValue && !auction.ShippingCost.HasValue)
|
||||
{
|
||||
// Carica in background senza bloccare l'UI
|
||||
_ = LoadProductInfoInBackgroundAsync(auction);
|
||||
}
|
||||
|
||||
// Aggiorna i campi delle impostazioni
|
||||
UpdateAuctionSettingsDisplay(vm);
|
||||
|
||||
// Aggiorna Valore (Compra Subito)
|
||||
if (auction.BuyNowPrice.HasValue)
|
||||
{
|
||||
AuctionMonitor.ProductBuyNowPriceText.Text = $"{auction.BuyNowPrice.Value:F2}€";
|
||||
}
|
||||
else
|
||||
{
|
||||
AuctionMonitor.ProductBuyNowPriceText.Text = "-";
|
||||
}
|
||||
|
||||
// Aggiorna Spese di Spedizione
|
||||
if (auction.ShippingCost.HasValue)
|
||||
{
|
||||
AuctionMonitor.ProductShippingCostText.Text = $"{auction.ShippingCost.Value:F2}€";
|
||||
}
|
||||
else
|
||||
{
|
||||
AuctionMonitor.ProductShippingCostText.Text = "-";
|
||||
}
|
||||
|
||||
// Aggiorna Limiti di Vincita
|
||||
if (auction.HasWinLimit && !string.IsNullOrWhiteSpace(auction.WinLimitDescription))
|
||||
{
|
||||
AuctionMonitor.ProductWinLimitText.Text = auction.WinLimitDescription;
|
||||
}
|
||||
else if (!auction.HasWinLimit)
|
||||
{
|
||||
AuctionMonitor.ProductWinLimitText.Text = "Nessun limite";
|
||||
}
|
||||
else
|
||||
{
|
||||
AuctionMonitor.ProductWinLimitText.Text = "-";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carica le informazioni del prodotto (e nome se generico) in background quando selezioni un'asta
|
||||
/// </summary>
|
||||
private async System.Threading.Tasks.Task LoadProductInfoInBackgroundAsync(AuctionInfo auction)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool hasGenericName = auction.Name.StartsWith("Asta ") &&
|
||||
!auction.Name.Contains("Shop") &&
|
||||
!auction.Name.Contains("€") &&
|
||||
!auction.Name.Contains("Buono") &&
|
||||
!auction.Name.Contains("Carburante");
|
||||
|
||||
Log($"[PRODUCT INFO] Caricamento automatico per: {auction.Name}{(hasGenericName ? " (+ nome generico)" : "")}", Utilities.LogLevel.Info);
|
||||
|
||||
// ? USA IL SERVIZIO CENTRALIZZATO
|
||||
var response = await _htmlCacheService.GetHtmlAsync(
|
||||
auction.OriginalUrl,
|
||||
RequestPriority.High, // Priorità alta per info prodotto
|
||||
bypassCache: false
|
||||
);
|
||||
|
||||
if (!response.Success)
|
||||
{
|
||||
Log($"[PRODUCT INFO] Errore caricamento: {response.Error}", Utilities.LogLevel.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
bool updated = false;
|
||||
|
||||
// 1. ? Se nome generico, estrai nome reale dal <title>
|
||||
if (hasGenericName)
|
||||
{
|
||||
var matchTitle = System.Text.RegularExpressions.Regex.Match(response.Html, @"<title>([^<]+)</title>");
|
||||
if (matchTitle.Success)
|
||||
{
|
||||
var productName = matchTitle.Groups[1].Value.Trim().Replace(" - Bidoo", "");
|
||||
productName = DecodeAllHtmlEntities(productName);
|
||||
// ? MODIFICATO: Nome senza ID
|
||||
var newName = productName;
|
||||
|
||||
auction.Name = newName;
|
||||
updated = true;
|
||||
Log($"[NAME] Nome recuperato: {productName}{(response.FromCache ? " (cached)" : "")}", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. ? Estrai informazioni prodotto (prezzo, spedizione, limiti)
|
||||
var extracted = Utilities.ProductValueCalculator.ExtractProductInfo(response.Html, auction);
|
||||
if (extracted)
|
||||
{
|
||||
updated = true;
|
||||
Log($"[PRODUCT INFO] Valore={auction.BuyNowPrice:F2}€, Spedizione={auction.ShippingCost:F2}€{(response.FromCache ? " (cached)" : "")}", Utilities.LogLevel.Success);
|
||||
}
|
||||
|
||||
// 3. ? Salva e aggiorna UI solo se qualcosa è cambiato
|
||||
if (updated)
|
||||
{
|
||||
SaveAuctions();
|
||||
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
// Refresh griglia per mostrare nome aggiornato
|
||||
if (hasGenericName)
|
||||
{
|
||||
var tempSource = MultiAuctionsGrid.ItemsSource;
|
||||
MultiAuctionsGrid.ItemsSource = null;
|
||||
MultiAuctionsGrid.ItemsSource = tempSource;
|
||||
}
|
||||
|
||||
// Refresh dettagli se ancora selezionata
|
||||
if (_selectedAuction != null && _selectedAuction.AuctionId == auction.AuctionId)
|
||||
{
|
||||
UpdateSelectedAuctionDetails(_selectedAuction);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[PRODUCT INFO] Errore caricamento: {ex.Message}", Utilities.LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,642 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using AutoBidder.Dialogs;
|
||||
using AutoBidder.Utilities;
|
||||
using AutoBidder.ViewModels;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Button click event handlers for auction operations
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void StartButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_isAutomationActive)
|
||||
{
|
||||
// Avvia il monitoraggio globale
|
||||
_auctionMonitor.Start();
|
||||
_isAutomationActive = true;
|
||||
Log("[START] Monitoraggio avviato!", LogLevel.Success);
|
||||
}
|
||||
|
||||
// Attiva e riprendi tutte le aste
|
||||
foreach (var vm in _auctionViewModels)
|
||||
{
|
||||
if (!vm.IsActive)
|
||||
{
|
||||
vm.IsActive = true;
|
||||
}
|
||||
vm.IsPaused = false;
|
||||
}
|
||||
|
||||
if (sender != null) // Solo se chiamato dall'utente, non internamente
|
||||
{
|
||||
Log("[START ALL] Tutte le aste avviate/riprese", LogLevel.Info);
|
||||
}
|
||||
|
||||
// ? Salva gli stati aggiornati su disco
|
||||
SaveAuctions();
|
||||
UpdateGlobalControlButtons();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Avvio: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void StopButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Ferma tutte le aste
|
||||
foreach (var vm in _auctionViewModels)
|
||||
{
|
||||
vm.IsActive = false;
|
||||
}
|
||||
|
||||
// Ferma il monitoraggio globale
|
||||
if (_isAutomationActive)
|
||||
{
|
||||
_auctionMonitor.Stop();
|
||||
_isAutomationActive = false;
|
||||
}
|
||||
|
||||
// ? Salva gli stati aggiornati su disco
|
||||
SaveAuctions();
|
||||
UpdateGlobalControlButtons();
|
||||
|
||||
if (sender != null) // Solo se chiamato dall'utente
|
||||
{
|
||||
Log("[STOP ALL] Monitoraggio fermato e tutte le aste arrestate", LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE STOP] {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async void PauseAllButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var vm in _auctionViewModels.Where(a => a.IsActive))
|
||||
{
|
||||
vm.IsPaused = true;
|
||||
}
|
||||
|
||||
// ? Salva gli stati aggiornati su disco
|
||||
SaveAuctions();
|
||||
UpdateGlobalControlButtons();
|
||||
|
||||
if (sender != null) // Solo se chiamato dall'utente
|
||||
{
|
||||
Log("[PAUSE ALL] Tutte le aste in pausa", LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Pausa globale: {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async void AddUrlButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dialog = new AddAuctionSimpleDialog();
|
||||
if (dialog.ShowDialog() == true)
|
||||
{
|
||||
var raw = dialog.AuctionId ?? string.Empty;
|
||||
var parts = Regex.Split(raw, "[\r\n;]+|\\s+")
|
||||
.Select(p => p.Trim())
|
||||
.Where(p => !string.IsNullOrWhiteSpace(p))
|
||||
.ToList();
|
||||
|
||||
if (parts.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Nessun URL/ID valido trovato.", "Errore", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var added = 0;
|
||||
var skipped = new System.Collections.Generic.List<string>();
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
try
|
||||
{
|
||||
var input = part;
|
||||
string? aid = null;
|
||||
if (input.Contains("bidoo.com") || input.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
aid = ExtractAuctionId(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
aid = input;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(aid) && _auctionViewModels.Any(a => a.AuctionId == aid))
|
||||
{
|
||||
skipped.Add(part + " (duplicato)");
|
||||
continue;
|
||||
}
|
||||
|
||||
await AddAuctionById(input);
|
||||
added++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
skipped.Add(part + " (errore: " + ex.Message + ")");
|
||||
}
|
||||
}
|
||||
|
||||
UpdateGlobalControlButtons();
|
||||
|
||||
var summary = $"Aggiunte: {added}. Skipped: {skipped.Count}.";
|
||||
if (skipped.Count > 0)
|
||||
summary += "\nDettagli: " + string.Join("; ", skipped.Take(10));
|
||||
|
||||
MessageBox.Show(summary, "Aggiunta aste", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
|
||||
// ? RIMOSSO: Retry automatico ora avviene alla selezione on-demand
|
||||
// Le aste con nome generico vengono aggiornate automaticamente quando l'utente le seleziona
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveUrlButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var auctionName = _selectedAuction.Name;
|
||||
var auctionId = _selectedAuction.AuctionId;
|
||||
|
||||
// Salva l'indice corrente prima di rimuovere
|
||||
var currentIndex = _auctionViewModels.IndexOf(_selectedAuction);
|
||||
|
||||
// Conferma rimozione
|
||||
var result = MessageBox.Show(
|
||||
$"Rimuovere l'asta dal monitoraggio?\n\n{auctionName}\n(ID: {auctionId})\n\nL'asta verrà eliminata dalla lista e non sarà più monitorata.",
|
||||
"Conferma Rimozione",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (result != MessageBoxResult.Yes)
|
||||
{
|
||||
Log($"[REMOVE] Rimozione annullata: {auctionName}", LogLevel.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Rimuove dal monitor
|
||||
_auctionMonitor.RemoveAuction(auctionId);
|
||||
|
||||
// Rimuove dal ViewModel
|
||||
_auctionViewModels.Remove(_selectedAuction);
|
||||
|
||||
// Salva modifiche
|
||||
SaveAuctions();
|
||||
UpdateTotalCount();
|
||||
UpdateGlobalControlButtons();
|
||||
|
||||
Log($"[REMOVE] Asta rimossa: {auctionName} (ID: {auctionId})", LogLevel.Success);
|
||||
|
||||
// ? NUOVO: Sposta il focus sulla riga successiva
|
||||
if (_auctionViewModels.Count > 0)
|
||||
{
|
||||
// Se c'è ancora almeno un'asta nella lista
|
||||
int newIndex;
|
||||
|
||||
if (currentIndex >= _auctionViewModels.Count)
|
||||
{
|
||||
// L'asta rimossa era l'ultima, seleziona la nuova ultima
|
||||
newIndex = _auctionViewModels.Count - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Seleziona l'asta che ora si trova nella stessa posizione
|
||||
newIndex = currentIndex;
|
||||
}
|
||||
|
||||
// Seleziona l'asta
|
||||
MultiAuctionsGrid.SelectedIndex = newIndex;
|
||||
_selectedAuction = _auctionViewModels[newIndex];
|
||||
|
||||
// ? FIX: Salva il nome della NUOVA asta selezionata per il log
|
||||
var newAuctionName = _selectedAuction?.Name ?? "Sconosciuta";
|
||||
|
||||
// Forza il focus sulla griglia dopo un breve delay per permettere alla UI di aggiornarsi
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MultiAuctionsGrid.Focus();
|
||||
|
||||
// Scroll fino alla riga selezionata per assicurarsi che sia visibile
|
||||
if (MultiAuctionsGrid.SelectedItem != null)
|
||||
{
|
||||
MultiAuctionsGrid.ScrollIntoView(MultiAuctionsGrid.SelectedItem);
|
||||
}
|
||||
|
||||
// ? FIX: Usa la variabile locale invece di _selectedAuction.Name
|
||||
Log($"[FOCUS] Focus spostato su: {newAuctionName}", LogLevel.Info);
|
||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nessuna asta rimasta, reset selezione
|
||||
_selectedAuction = null;
|
||||
Log($"[REMOVE] Nessuna asta rimasta nella lista", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERROR] Errore rimozione asta: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante la rimozione:\n{ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveAllButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_auctionViewModels.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Non ci sono aste da rimuovere", "Lista Vuota", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var count = _auctionViewModels.Count;
|
||||
|
||||
// Conferma rimozione
|
||||
var result = MessageBox.Show(
|
||||
$"Rimuovere TUTTE le aste dal monitoraggio?\n\nSono presenti {count} aste monitorate.\n\nTutte le aste verranno eliminate dalla lista e non saranno più monitorate.",
|
||||
"Conferma Rimozione Totale",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Warning);
|
||||
|
||||
if (result != MessageBoxResult.Yes)
|
||||
{
|
||||
Log($"[REMOVE ALL] Rimozione annullata", LogLevel.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Ferma il monitoraggio se attivo
|
||||
if (_isAutomationActive)
|
||||
{
|
||||
_auctionMonitor.Stop();
|
||||
_isAutomationActive = false;
|
||||
Log("[STOP] Monitoraggio fermato prima della rimozione totale", LogLevel.Info);
|
||||
}
|
||||
|
||||
// Rimuove tutte le aste dal monitor e dal ViewModel
|
||||
var auctionsToRemove = _auctionViewModels.ToList(); // Copia per evitare modifiche durante iterazione
|
||||
|
||||
foreach (var auction in auctionsToRemove)
|
||||
{
|
||||
_auctionMonitor.RemoveAuction(auction.AuctionId);
|
||||
}
|
||||
|
||||
// Pulisci la lista ViewModel
|
||||
_auctionViewModels.Clear();
|
||||
|
||||
// Resetta selezione
|
||||
_selectedAuction = null;
|
||||
|
||||
// Salva modifiche
|
||||
SaveAuctions();
|
||||
UpdateTotalCount();
|
||||
UpdateGlobalControlButtons();
|
||||
|
||||
Log($"[REMOVE ALL] Tutte le aste rimosse: {count} aste eliminate", LogLevel.Success);
|
||||
|
||||
MessageBox.Show($"Tutte le {count} aste sono state rimosse dal monitoraggio.", "Rimozione Completata", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERROR] Errore rimozione totale: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante la rimozione delle aste: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async void CopyAuctionUrlButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Seleziona un'asta dalla griglia prima di copiare l'URL.",
|
||||
"Nessuna Asta Selezionata",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
Log("[INFO] Tentativo di copia URL senza asta selezionata", LogLevel.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
var url = _selectedAuction.AuctionInfo.OriginalUrl;
|
||||
if (string.IsNullOrEmpty(url))
|
||||
url = $"https://it.bidoo.com/auction.php?a=asta_{_selectedAuction.AuctionId}";
|
||||
|
||||
// Tenta di copiare con retry mechanism
|
||||
const int maxAttempts = 3;
|
||||
const int delayMs = 50;
|
||||
|
||||
for (int attempt = 1; attempt <= maxAttempts; attempt++)
|
||||
{
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(url);
|
||||
Log("URL copiato negli appunti", LogLevel.Success);
|
||||
return; // Successo, esci
|
||||
}
|
||||
catch (System.Runtime.InteropServices.COMException ex) when (ex.ErrorCode == unchecked((int)0x800401D0)) // CLIPBRD_E_CANT_OPEN
|
||||
{
|
||||
if (attempt < maxAttempts)
|
||||
{
|
||||
// Clipboard occupato, riprova dopo un breve delay
|
||||
System.Threading.Thread.Sleep(delayMs);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ultimo tentativo fallito
|
||||
Log($"[WARN] Clipboard temporaneamente occupato. Il testo potrebbe essere stato copiato.", LogLevel.Warning);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Altri errori
|
||||
Log($"[ERRORE] Impossibile copiare URL: {ex.Message}", LogLevel.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenAuctionInternalButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var url = _selectedAuction.AuctionInfo.OriginalUrl;
|
||||
if (string.IsNullOrEmpty(url))
|
||||
url = $"https://it.bidoo.com/auction.php?a=asta_{_selectedAuction.AuctionId}";
|
||||
|
||||
// Naviga alla scheda Browser
|
||||
TabBrowser.IsChecked = true;
|
||||
|
||||
// Naviga all'URL
|
||||
if (EmbeddedWebView?.CoreWebView2 != null)
|
||||
{
|
||||
EmbeddedWebView.CoreWebView2.Navigate(url);
|
||||
Log($"[BROWSER] Apertura asta nel browser interno: {_selectedAuction.Name}", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"[WARN] Browser interno non ancora inizializzato", LogLevel.Warning);
|
||||
MessageBox.Show("Il browser interno non è ancora pronto.\nRiprova tra qualche secondo.", "Browser", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Apertura nel browser interno: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante l'apertura: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenAuctionExternalButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var url = _selectedAuction.AuctionInfo.OriginalUrl;
|
||||
if (string.IsNullOrEmpty(url))
|
||||
url = $"https://it.bidoo.com/auction.php?a=asta_{_selectedAuction.AuctionId}";
|
||||
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = url,
|
||||
UseShellExecute = true
|
||||
});
|
||||
|
||||
Log($"[BROWSER] Apertura asta nel browser esterno: {_selectedAuction.Name}", LogLevel.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Apertura nel browser esterno: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante l'apertura: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ExportAuctionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
MessageBox.Show(
|
||||
$"Esportazione singola asta:\n\n{_selectedAuction.Name}\n(ID: {_selectedAuction.AuctionId})\n\nFunzionalità in sviluppo.\nUsa 'Esporta' dalla toolbar per esportare tutte le aste.",
|
||||
"Export Asta",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
|
||||
Log($"[INFO] Richiesto export singolo per asta: {_selectedAuction.Name} (funzionalità in sviluppo)", LogLevel.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Export asta: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async void RefreshProductInfoButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var auction = _selectedAuction.AuctionInfo;
|
||||
|
||||
// Verifica che ci siano le info prodotto caricate
|
||||
if (!auction.BuyNowPrice.HasValue)
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Informazioni prodotto non disponibili.\n\n" +
|
||||
"Il sistema le sta caricando automaticamente.\n" +
|
||||
"Riprova tra qualche secondo.",
|
||||
"Info Prodotto Mancanti",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// Feedback visivo
|
||||
AuctionMonitor.RefreshProductInfoButton.IsEnabled = false;
|
||||
|
||||
// CALCOLA LIMITI SUGGERITI (CONSERVATIVI)
|
||||
double buyNowPrice = auction.BuyNowPrice.Value;
|
||||
double shippingCost = auction.ShippingCost ?? 0;
|
||||
double totalValue = buyNowPrice + shippingCost;
|
||||
|
||||
// Max EUR = 40% del valore TOTALE (più conservativo del 50%)
|
||||
double suggestedMaxPrice = totalValue * 0.40;
|
||||
suggestedMaxPrice = Math.Round(suggestedMaxPrice, 2);
|
||||
|
||||
// CALCOLA MAX CLICKS (numero massimo puntate conservativo)
|
||||
// Formula: (Valore Totale - Max EUR) / 0.20€ per puntata
|
||||
// Poi riduciamo del 20% per maggiore margine di sicurezza
|
||||
int maxClicksTheoretical = (int)Math.Floor((totalValue - suggestedMaxPrice) / 0.20);
|
||||
int suggestedMaxClicks = (int)Math.Floor(maxClicksTheoretical * 0.80); // 80% del teorico
|
||||
|
||||
// Minimo 10 puntate per dare comunque una chance
|
||||
if (suggestedMaxClicks < 10) suggestedMaxClicks = 10;
|
||||
|
||||
Log($"[LIMITI] Valore={buyNowPrice:F2}€ + Extra={shippingCost:F2}€ = Tot={totalValue:F2}€ ? MaxEUR={suggestedMaxPrice:F2}€ (40%), MaxClicks={suggestedMaxClicks}", LogLevel.Info);
|
||||
|
||||
// CHIEDI CONFERMA
|
||||
var result = MessageBox.Show(
|
||||
$"Limiti suggeriti (conservativi):\n\n" +
|
||||
$"Max EUR: {suggestedMaxPrice:F2}€\n" +
|
||||
$"Max Clicks: {suggestedMaxClicks}\n\n" +
|
||||
$"Applicare questi valori?",
|
||||
"Conferma Limiti",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (result != MessageBoxResult.Yes)
|
||||
{
|
||||
Log($"[LIMITI] Annullato dall'utente", LogLevel.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
// APPLICA I LIMITI
|
||||
_selectedAuction.MaxPrice = suggestedMaxPrice;
|
||||
_selectedAuction.MaxClicks = suggestedMaxClicks;
|
||||
|
||||
// AGGIORNA UI
|
||||
UpdateAuctionSettingsDisplay(_selectedAuction);
|
||||
|
||||
// SALVA
|
||||
SaveAuctions();
|
||||
|
||||
Log($"[LIMITI] Applicati: MaxEUR={suggestedMaxPrice:F2}€, MaxClicks={suggestedMaxClicks}", LogLevel.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Calcolo limiti: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante il calcolo dei limiti:\n\n{ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuctionMonitor.RefreshProductInfoButton.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sposta l'asta selezionata verso l'alto nell'elenco
|
||||
/// </summary>
|
||||
private void MoveUpButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var currentIndex = _auctionViewModels.IndexOf(_selectedAuction);
|
||||
|
||||
if (currentIndex <= 0)
|
||||
{
|
||||
// Già in cima o non trovata
|
||||
Log($"[MOVE] L'asta è già in cima alla lista", LogLevel.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
// Sposta l'elemento verso l'alto
|
||||
_auctionViewModels.Move(currentIndex, currentIndex - 1);
|
||||
|
||||
// Mantieni la selezione
|
||||
MultiAuctionsGrid.SelectedItem = _selectedAuction;
|
||||
MultiAuctionsGrid.ScrollIntoView(_selectedAuction);
|
||||
|
||||
// Salva il nuovo ordine
|
||||
SaveAuctions();
|
||||
|
||||
Log($"[MOVE UP] Asta spostata verso l'alto: {_selectedAuction.Name}", LogLevel.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Spostamento asta verso l'alto: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante lo spostamento: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sposta l'asta selezionata verso il basso nell'elenco
|
||||
/// </summary>
|
||||
private void MoveDownButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var currentIndex = _auctionViewModels.IndexOf(_selectedAuction);
|
||||
|
||||
if (currentIndex < 0 || currentIndex >= _auctionViewModels.Count - 1)
|
||||
{
|
||||
// Già in fondo o non trovata
|
||||
Log($"[MOVE] L'asta è già in fondo alla lista", LogLevel.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
// Sposta l'elemento verso il basso
|
||||
_auctionViewModels.Move(currentIndex, currentIndex + 1);
|
||||
|
||||
// Mantieni la selezione
|
||||
MultiAuctionsGrid.SelectedItem = _selectedAuction;
|
||||
MultiAuctionsGrid.ScrollIntoView(_selectedAuction);
|
||||
|
||||
// Salva il nuovo ordine
|
||||
SaveAuctions();
|
||||
|
||||
Log($"[MOVE DOWN] Asta spostata verso il basso: {_selectedAuction.Name}", LogLevel.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Spostamento asta verso il basso: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante lo spostamento: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using AutoBidder.Utilities;
|
||||
using AutoBidder.ViewModels;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Command implementations for MainWindow
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void InitializeCommands()
|
||||
{
|
||||
StartAllCommand = new RelayCommand(_ => ExecuteStartAll());
|
||||
StopAllCommand = new RelayCommand(_ => ExecuteStopAll());
|
||||
PauseAllCommand = new RelayCommand(_ => ExecutePauseAll());
|
||||
|
||||
GridStartCommand = new RelayCommand(param => ExecuteGridStart(param as AuctionViewModel));
|
||||
GridPauseCommand = new RelayCommand(param => ExecuteGridPause(param as AuctionViewModel));
|
||||
GridStopCommand = new RelayCommand(param => ExecuteGridStop(param as AuctionViewModel));
|
||||
GridBidCommand = new RelayCommand(async param => await ExecuteGridBidAsync(param as AuctionViewModel));
|
||||
}
|
||||
|
||||
private void ExecuteStartAll()
|
||||
{
|
||||
StartButton_Click(null, null);
|
||||
}
|
||||
|
||||
private void ExecuteStopAll()
|
||||
{
|
||||
StopButton_Click(null, null);
|
||||
}
|
||||
|
||||
private void ExecutePauseAll()
|
||||
{
|
||||
PauseAllButton_Click(null, null);
|
||||
}
|
||||
|
||||
private void ExecuteGridStart(AuctionViewModel? vm)
|
||||
{
|
||||
if (vm == null) return;
|
||||
|
||||
// Attiva l'asta
|
||||
vm.IsActive = true;
|
||||
vm.IsPaused = false;
|
||||
|
||||
// Se il monitoraggio globale non è attivo, avvialo automaticamente
|
||||
if (!_isAutomationActive)
|
||||
{
|
||||
_auctionMonitor.Start();
|
||||
_isAutomationActive = true;
|
||||
Log($"[AUTO-START] Monitoraggio avviato automaticamente per asta: {vm.Name}", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"[START] Asta avviata: {vm.Name}", LogLevel.Info);
|
||||
}
|
||||
|
||||
// ? Salva gli stati aggiornati su disco
|
||||
SaveAuctions();
|
||||
UpdateGlobalControlButtons();
|
||||
}
|
||||
|
||||
private void ExecuteGridPause(AuctionViewModel? vm)
|
||||
{
|
||||
if (vm == null) return;
|
||||
vm.IsPaused = true;
|
||||
Log($"[PAUSA] Asta in pausa: {vm.Name}", LogLevel.Info);
|
||||
|
||||
// ? Salva gli stati aggiornati su disco
|
||||
SaveAuctions();
|
||||
UpdateGlobalControlButtons();
|
||||
}
|
||||
|
||||
private void ExecuteGridStop(AuctionViewModel? vm)
|
||||
{
|
||||
if (vm == null) return;
|
||||
vm.IsActive = false;
|
||||
|
||||
// Se tutte le aste sono fermate, ferma anche il monitoraggio globale
|
||||
bool hasActiveAuctions = _auctionViewModels.Any(a => a.IsActive);
|
||||
if (!hasActiveAuctions && _isAutomationActive)
|
||||
{
|
||||
_auctionMonitor.Stop();
|
||||
_isAutomationActive = false;
|
||||
Log($"[AUTO-STOP] Monitoraggio fermato: nessuna asta attiva", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"[STOP] Asta fermata: {vm.Name}", LogLevel.Info);
|
||||
}
|
||||
|
||||
// ? Salva gli stati aggiornati su disco
|
||||
SaveAuctions();
|
||||
UpdateGlobalControlButtons();
|
||||
}
|
||||
|
||||
private async Task ExecuteGridBidAsync(AuctionViewModel? vm)
|
||||
{
|
||||
if (vm == null) return;
|
||||
try
|
||||
{
|
||||
Log($"[BID] Puntata manuale richiesta su: {vm.Name}", LogLevel.Info);
|
||||
var result = await _auctionMonitor.PlaceManualBidAsync(vm.AuctionInfo);
|
||||
|
||||
// Aggiorna dati puntate da risposta server per puntata manuale
|
||||
if (result.Success)
|
||||
{
|
||||
if (result.RemainingBids.HasValue)
|
||||
{
|
||||
vm.AuctionInfo.RemainingBids = result.RemainingBids.Value;
|
||||
|
||||
// Aggiorna immediatamente il banner in alto
|
||||
Dispatcher.Invoke(() => UpdateRemainingBidsDisplay());
|
||||
}
|
||||
if (result.BidsUsedOnThisAuction.HasValue)
|
||||
{
|
||||
vm.AuctionInfo.BidsUsedOnThisAuction = result.BidsUsedOnThisAuction.Value;
|
||||
}
|
||||
|
||||
// Notifica aggiornamento contatori per aggiornare la UI - SUL THREAD UI
|
||||
Dispatcher.Invoke(() => vm.RefreshCounters());
|
||||
|
||||
Log($"[OK] Puntata manuale su {vm.Name}: {result.LatencyMs}ms", LogLevel.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"[FAIL] Puntata manuale su {vm.Name}: {result.Error}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Puntata manuale: {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Event handlers per il nuovo sistema di connessione automatica
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Handler per il click sul nome utente nella sidebar
|
||||
/// </summary>
|
||||
private void SidebarUsername_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
// Riusa la stessa logica del pulsante connessione (se fosse ancora presente)
|
||||
ConnectionStatusButton_Click(sender, new RoutedEventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler per il pulsante stato connessione nel banner
|
||||
/// Se non connesso: apre tab Browser per login
|
||||
/// Se connesso: mostra opzioni (disconnetti, riconnetti)
|
||||
/// </summary>
|
||||
private void ConnectionStatusButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = _sessionService?.GetCurrentSession();
|
||||
|
||||
if (session != null && !string.IsNullOrEmpty(session.Username))
|
||||
{
|
||||
// Già connesso - Mostra opzioni
|
||||
var result = MessageBox.Show(
|
||||
this,
|
||||
$"Connesso come: {session.Username}\n" +
|
||||
$"Puntate residue: {session.RemainingBids}\n" +
|
||||
$"Credito Shop: EUR {session.ShopCredit:F2}\n\n" +
|
||||
"Vuoi disconnettere e accedere con un altro account?",
|
||||
"Gestione Connessione",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
// Disconnetti
|
||||
DisconnectSession();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non connesso - Apri browser per login
|
||||
MessageBox.Show(
|
||||
this,
|
||||
"Per accedere:\n\n" +
|
||||
"1. Fai login su Bidoo nella scheda Browser\n" +
|
||||
"2. La connessione sarà automatica\n\n" +
|
||||
"Apertura scheda Browser...",
|
||||
"Accedi a Bidoo",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
|
||||
// Apri tab Browser
|
||||
TabBrowser.IsChecked = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Gestione connessione: {ex.Message}", Utilities.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disconnette la sessione corrente
|
||||
/// </summary>
|
||||
private void DisconnectSession()
|
||||
{
|
||||
try
|
||||
{
|
||||
Log("[SESSION] Disconnessione in corso...", Utilities.LogLevel.Info);
|
||||
|
||||
// Clear session tramite SessionService
|
||||
_sessionService?.ClearSession();
|
||||
|
||||
// Aggiorna UI
|
||||
SetUserBanner(string.Empty, 0);
|
||||
|
||||
// Ferma monitoraggio se attivo
|
||||
if (_isAutomationActive)
|
||||
{
|
||||
_auctionMonitor?.Stop();
|
||||
_isAutomationActive = false;
|
||||
UpdateGlobalControlButtons();
|
||||
}
|
||||
|
||||
Log("[SESSION] Disconnesso con successo", Utilities.LogLevel.Success);
|
||||
|
||||
MessageBox.Show(
|
||||
this,
|
||||
"Disconnesso con successo.\n\n" +
|
||||
"Per riconnetterti, fai login nella scheda Browser.",
|
||||
"Disconnesso",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Disconnessione: {ex.Message}", Utilities.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Event handlers for UserControl events and tab navigation
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
// ===== TAB NAVIGATION =====
|
||||
|
||||
private void TabAsteAttive_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowPanel(AuctionMonitor);
|
||||
}
|
||||
|
||||
private void TabBrowser_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowPanel(Browser);
|
||||
}
|
||||
|
||||
private void TabPuntateGratis_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowPanel(PuntateGratisPanel);
|
||||
}
|
||||
|
||||
private void TabDatiStatistici_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowPanel(StatisticsPanel);
|
||||
}
|
||||
|
||||
private void TabImpostazioni_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Mostra il pannello Impostazioni
|
||||
ShowPanel(Settings);
|
||||
|
||||
// Carica impostazioni quando si apre la tab
|
||||
LoadDefaultSettings();
|
||||
|
||||
// NOTA: Caricamento cookie RIMOSSO - ora automatico tramite browser
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void ShowPanel(System.Windows.UIElement? panelToShow)
|
||||
{
|
||||
// Prevent NullReferenceException during initialization
|
||||
if (AuctionMonitor == null || Browser == null || StatisticsPanel == null || Settings == null || PuntateGratisPanel == null)
|
||||
return;
|
||||
|
||||
// Hide all panels
|
||||
AuctionMonitor.Visibility = Visibility.Collapsed;
|
||||
Browser.Visibility = Visibility.Collapsed;
|
||||
PuntateGratisPanel.Visibility = Visibility.Collapsed;
|
||||
StatisticsPanel.Visibility = Visibility.Collapsed;
|
||||
Settings.Visibility = Visibility.Collapsed;
|
||||
|
||||
// Show selected panel
|
||||
if (panelToShow != null)
|
||||
panelToShow.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
// ===== AUCTION MONITOR CONTROL EVENTS =====
|
||||
|
||||
private void AuctionMonitor_StartClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StartButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_PauseAllClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PauseAllButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_StopClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StopButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_ExportClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Chiama il metodo di export esistente
|
||||
try
|
||||
{
|
||||
// Esporta tutte le aste monitorate
|
||||
var auctions = _auctionMonitor.GetAuctions();
|
||||
if (auctions.Count == 0)
|
||||
{
|
||||
System.Windows.MessageBox.Show("Nessuna asta da esportare", "Export", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Implementare dialog export con scelta formato
|
||||
System.Windows.MessageBox.Show($"Export di {auctions.Count} aste.\n\nFunzionalità in sviluppo.\nUsa le impostazioni nella scheda Impostazioni per configurare l'export.", "Export Aste", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
|
||||
Log($"[INFO] Richiesto export di {auctions.Count} aste (funzionalità in sviluppo)", Utilities.LogLevel.Info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Export: {ex.Message}", Utilities.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void AuctionMonitor_AddUrlClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AddUrlButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_RemoveUrlClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RemoveUrlButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_RemoveAllClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RemoveAllButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_MoveUpClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MoveUpButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_MoveDownClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MoveDownButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_AuctionSelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AuctionMonitor.MultiAuctionsGrid.SelectedItem is ViewModels.AuctionViewModel selected)
|
||||
{
|
||||
_selectedAuction = selected;
|
||||
UpdateSelectedAuctionDetails(selected);
|
||||
|
||||
// ? NUOVO: Rileva nome generico O info prodotto mancanti e recupera automaticamente
|
||||
var auction = selected.AuctionInfo;
|
||||
bool hasGenericName = auction.Name.StartsWith("Asta ") &&
|
||||
!auction.Name.Contains("Shop") &&
|
||||
!auction.Name.Contains("€") &&
|
||||
!auction.Name.Contains("Buono") &&
|
||||
!auction.Name.Contains("Carburante");
|
||||
|
||||
bool needsProductInfo = !auction.BuyNowPrice.HasValue && !auction.ShippingCost.HasValue;
|
||||
|
||||
// Se ha nome generico O mancano info prodotto ? recupera in background
|
||||
if (hasGenericName || needsProductInfo)
|
||||
{
|
||||
Log($"[AUTO-FETCH] Recupero automatico per: {auction.Name} (nome generico={hasGenericName}, info mancanti={needsProductInfo})", Utilities.LogLevel.Info);
|
||||
|
||||
// Avvia fetch in background senza bloccare UI
|
||||
_ = LoadProductInfoInBackgroundAsync(auction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AuctionMonitor_CopyUrlClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CopyAuctionUrlButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_OpenAuctionInternalClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenAuctionInternalButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_OpenAuctionExternalClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenAuctionExternalButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_ExportAuctionClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ExportAuctionButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_ResetSettingsClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ResetSettingsButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_ClearBiddersClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ClearBiddersButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_ClearLogClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ClearLogButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_ClearGlobalLogClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ClearLogButton_Click(sender, e); // Clear Log invece di ClearGlobalLog
|
||||
}
|
||||
|
||||
// ===== AUCTION SETTINGS EVENTS =====
|
||||
|
||||
private void AuctionMonitor_RefreshProductInfoClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RefreshProductInfoButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_ConnectionStatusClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ConnectionStatusButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void AuctionMonitor_BidBeforeDeadlineMsChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Gestito internamente dal binding WPF
|
||||
if (_selectedAuction != null && int.TryParse(AuctionMonitor.SelectedBidBeforeDeadlineMs.Text, out int ms))
|
||||
{
|
||||
_selectedAuction.AuctionInfo.BidBeforeDeadlineMs = ms;
|
||||
SaveAuctions();
|
||||
}
|
||||
}
|
||||
|
||||
private void AuctionMonitor_CheckAuctionOpenChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Gestito internamente dal binding WPF
|
||||
if (_selectedAuction != null)
|
||||
{
|
||||
_selectedAuction.AuctionInfo.CheckAuctionOpenBeforeBid = AuctionMonitor.SelectedCheckAuctionOpen.IsChecked ?? false;
|
||||
SaveAuctions();
|
||||
}
|
||||
}
|
||||
|
||||
private void AuctionMonitor_MinPriceChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Gestito internamente dal binding WPF
|
||||
if (_selectedAuction != null && double.TryParse(AuctionMonitor.SelectedMinPrice.Text, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out double price))
|
||||
{
|
||||
_selectedAuction.MinPrice = price;
|
||||
SaveAuctions();
|
||||
}
|
||||
}
|
||||
|
||||
private void AuctionMonitor_MaxPriceChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Gestito internamente dal binding WPF
|
||||
if (_selectedAuction != null && double.TryParse(AuctionMonitor.SelectedMaxPrice.Text, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out double price))
|
||||
{
|
||||
_selectedAuction.MaxPrice = price;
|
||||
SaveAuctions();
|
||||
}
|
||||
}
|
||||
|
||||
private void AuctionMonitor_MaxClicksChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Gestito internamente dal binding WPF
|
||||
if (_selectedAuction != null && int.TryParse(AuctionMonitor.SelectedMaxClicks.Text, out int clicks))
|
||||
{
|
||||
_selectedAuction.MaxClicks = clicks;
|
||||
SaveAuctions();
|
||||
}
|
||||
}
|
||||
|
||||
// ===== BROWSER CONTROL EVENTS =====
|
||||
|
||||
private void Browser_BrowserBackClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Browser.EmbeddedWebView?.CoreWebView2 != null && Browser.EmbeddedWebView.CoreWebView2.CanGoBack)
|
||||
Browser.EmbeddedWebView.CoreWebView2.GoBack();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void Browser_BrowserForwardClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Browser.EmbeddedWebView?.CoreWebView2 != null && Browser.EmbeddedWebView.CoreWebView2.CanGoForward)
|
||||
Browser.EmbeddedWebView.CoreWebView2.GoForward();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void Browser_BrowserRefreshClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Browser.EmbeddedWebView?.Reload();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void Browser_BrowserHomeClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Browser.EmbeddedWebView?.CoreWebView2?.Navigate("https://it.bidoo.com/");
|
||||
Browser.BrowserAddress.Text = "https://it.bidoo.com/";
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void Browser_BrowserGoClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = Browser.BrowserAddress.Text?.Trim();
|
||||
if (string.IsNullOrEmpty(url)) return;
|
||||
if (!url.StartsWith("http", System.StringComparison.OrdinalIgnoreCase))
|
||||
url = "https://" + url;
|
||||
Browser.EmbeddedWebView?.CoreWebView2?.Navigate(url);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void Browser_BrowserAddAuctionClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = Browser.BrowserAddress.Text?.Trim() ?? Browser.EmbeddedWebView?.Source?.ToString();
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
_ = AddAuctionFromUrl(url);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
// ===== SETTINGS CONTROL EVENTS =====
|
||||
|
||||
private void Settings_SaveDefaultsClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SaveDefaultsButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void Settings_CancelDefaultsClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CancelDefaultsButton_Click(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using AutoBidder.Utilities;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Logging functionality with color-coded severity levels and configurable minimum level filtering
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Scrive un messaggio nel log globale con filtraggio basato sul livello minimo configurato
|
||||
/// </summary>
|
||||
/// <param name="message">Messaggio da loggare</param>
|
||||
/// <param name="level">Livello di severità del messaggio</param>
|
||||
private void Log(string message, LogLevel level = LogLevel.Info)
|
||||
{
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// Carica impostazioni per ottenere livello minimo e limite righe
|
||||
var settings = SettingsManager.Load();
|
||||
|
||||
// Filtra messaggi in base al livello minimo configurato
|
||||
MinimumLogLevel minLevel = MinimumLogLevel.Normal; // Default
|
||||
if (Enum.TryParse<MinimumLogLevel>(settings.MinLogLevel, out var parsedLevel))
|
||||
{
|
||||
minLevel = parsedLevel;
|
||||
}
|
||||
|
||||
// Se il livello del messaggio è maggiore del minimo configurato, ignora
|
||||
if ((int)level > (int)minLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var timestamp = DateTime.Now.ToString("HH:mm:ss");
|
||||
|
||||
// Prefisso in base al livello per chiarezza
|
||||
string prefix = level switch
|
||||
{
|
||||
LogLevel.Error => "[ERROR]",
|
||||
LogLevel.Warning => "[WARN]",
|
||||
LogLevel.Info => "[INFO]",
|
||||
LogLevel.Success => "[OK]",
|
||||
LogLevel.Debug => "[DEBUG]",
|
||||
LogLevel.Trace => "[TRACE]",
|
||||
_ => "[LOG]"
|
||||
};
|
||||
|
||||
var logEntry = $"[{timestamp}] {prefix} {message}";
|
||||
|
||||
// Color coding based on severity for dark theme
|
||||
var color = level switch
|
||||
{
|
||||
LogLevel.Error => new SolidColorBrush(Color.FromRgb(232, 17, 35)), // #E81123 (Red)
|
||||
LogLevel.Warning => new SolidColorBrush(Color.FromRgb(255, 191, 0)), // #FFBF00 (Yellow)
|
||||
LogLevel.Success => new SolidColorBrush(Color.FromRgb(0, 216, 0)), // #00D800 (Green)
|
||||
LogLevel.Info => new SolidColorBrush(Color.FromRgb(100, 180, 255)), // #64B4FF (Light Blue)
|
||||
LogLevel.Debug => new SolidColorBrush(Color.FromRgb(255, 140, 255)), // #FF8CFF (Magenta)
|
||||
LogLevel.Trace => new SolidColorBrush(Color.FromRgb(160, 160, 160)), // #A0A0A0 (Gray)
|
||||
_ => new SolidColorBrush(Color.FromRgb(204, 204, 204)) // #CCCCCC (Light Gray)
|
||||
};
|
||||
|
||||
var p = new System.Windows.Documents.Paragraph { Margin = new Thickness(0, 2, 0, 2) };
|
||||
var r = new System.Windows.Documents.Run(logEntry) { Foreground = color };
|
||||
p.Inlines.Add(r);
|
||||
LogBox.Document.Blocks.Add(p);
|
||||
|
||||
// Mantieni solo gli ultimi N paragrafi (configurabile dalle impostazioni)
|
||||
int maxLogLines = settings.MaxGlobalLogLines;
|
||||
|
||||
if (LogBox.Document.Blocks.Count > maxLogLines)
|
||||
{
|
||||
// Rimuovi i paragrafi più vecchi (primi inseriti)
|
||||
int excessCount = LogBox.Document.Blocks.Count - maxLogLines;
|
||||
for (int i = 0; i < excessCount; i++)
|
||||
{
|
||||
if (LogBox.Document.Blocks.FirstBlock != null)
|
||||
{
|
||||
LogBox.Document.Blocks.Remove(LogBox.Document.Blocks.FirstBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-scroll if near bottom
|
||||
if (LogBox.VerticalOffset >= LogBox.ExtentHeight - LogBox.ViewportHeight - 40)
|
||||
{
|
||||
LogBox.ScrollToEnd();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using AutoBidder.Utilities;
|
||||
using AutoBidder.ViewModels;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// UI update methods and selected auction details
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void UpdateAuctionLog(AuctionViewModel auction)
|
||||
{
|
||||
try
|
||||
{
|
||||
var auctionInfo = auction.AuctionInfo;
|
||||
var logBox = SelectedAuctionLog;
|
||||
var doc = logBox.Document;
|
||||
doc.Blocks.Clear();
|
||||
|
||||
foreach (var entry in auctionInfo.AuctionLog)
|
||||
{
|
||||
var upper = entry.ToUpperInvariant();
|
||||
|
||||
// Color coding based on log content
|
||||
Brush color;
|
||||
if (upper.Contains("[ERRORE]") || upper.Contains("[FAIL]") || upper.Contains("EXCEPTION"))
|
||||
color = new SolidColorBrush(Color.FromRgb(232, 17, 35)); // Red
|
||||
else if (upper.Contains("[WARN]") || upper.Contains("ATTENZIONE"))
|
||||
color = new SolidColorBrush(Color.FromRgb(255, 183, 0)); // Yellow/Orange
|
||||
else if (upper.Contains("[OK]") || upper.Contains("SUCCESS"))
|
||||
color = new SolidColorBrush(Color.FromRgb(0, 216, 0)); // Green
|
||||
else
|
||||
color = new SolidColorBrush(Color.FromRgb(100, 180, 255)); // Light Blue - #64B4FF (più chiaro e leggibile)
|
||||
|
||||
var p = new System.Windows.Documents.Paragraph { Margin = new Thickness(0, 2, 0, 2) };
|
||||
var r = new System.Windows.Documents.Run(entry) { Foreground = color };
|
||||
p.Inlines.Add(r);
|
||||
doc.Blocks.Add(p);
|
||||
}
|
||||
|
||||
// Auto-scroll if near bottom
|
||||
var viewer = logBox;
|
||||
var vpos = viewer.VerticalOffset;
|
||||
var vmax = viewer.ExtentHeight - viewer.ViewportHeight;
|
||||
if (vmax - vpos < 40)
|
||||
{
|
||||
viewer.ScrollToEnd();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void RefreshBiddersGrid(AuctionViewModel auction)
|
||||
{
|
||||
try
|
||||
{
|
||||
var bidders = auction.AuctionInfo.BidderStats.Values
|
||||
.OrderByDescending(b => b.BidCount)
|
||||
.ToList();
|
||||
|
||||
SelectedAuctionBiddersGrid.ItemsSource = null;
|
||||
SelectedAuctionBiddersGrid.ItemsSource = bidders;
|
||||
SelectedAuctionBiddersCount.Text = $"Utenti: {bidders?.Count ?? 0}";
|
||||
|
||||
// ?? NUOVO: Aggiorna il contatore della storia puntate con limite configurato
|
||||
var settings = SettingsManager.Load();
|
||||
var maxEntries = settings?.MaxBidHistoryEntries ?? 20;
|
||||
var historyCount = auction.BidHistoryEntries?.Count ?? 0;
|
||||
|
||||
var bidHistoryCountTextBlock = AuctionMonitor.FindName("BidHistoryCount") as TextBlock;
|
||||
if (bidHistoryCountTextBlock != null)
|
||||
{
|
||||
// Mostra "Ultime 20 puntate" se il limite è attivo
|
||||
if (maxEntries > 0)
|
||||
{
|
||||
bidHistoryCountTextBlock.Text = $"Ultime {maxEntries} puntate";
|
||||
}
|
||||
else
|
||||
{
|
||||
bidHistoryCountTextBlock.Text = $"Ultime puntate: {historyCount}";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void UpdateAuctionSettingsDisplay(AuctionViewModel auction)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Blocca temporaneamente i TextChanged per evitare loop di aggiornamento
|
||||
_isUpdatingSelection = true;
|
||||
|
||||
SelectedAuctionName.Text = auction.Name;
|
||||
SelectedBidBeforeDeadlineMs.Text = auction.AuctionInfo.BidBeforeDeadlineMs.ToString();
|
||||
SelectedCheckAuctionOpen.IsChecked = auction.AuctionInfo.CheckAuctionOpenBeforeBid;
|
||||
SelectedMinPrice.Text = auction.MinPrice.ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
|
||||
SelectedMaxPrice.Text = auction.MaxPrice.ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
|
||||
SelectedMaxClicks.Text = auction.MaxClicks.ToString();
|
||||
|
||||
var url = auction.AuctionInfo.OriginalUrl;
|
||||
if (string.IsNullOrEmpty(url))
|
||||
url = $"https://it.bidoo.com/auction.php?a=asta_{auction.AuctionId}";
|
||||
SelectedAuctionUrl.Text = url;
|
||||
|
||||
ResetSettingsButton.IsEnabled = true;
|
||||
ClearBiddersButton.IsEnabled = true;
|
||||
ClearLogButton.IsEnabled = true;
|
||||
|
||||
UpdateAuctionLog(auction);
|
||||
RefreshBiddersGrid(auction);
|
||||
|
||||
_isUpdatingSelection = false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
_isUpdatingSelection = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateTotalCount()
|
||||
{
|
||||
MonitorateTitle.Text = $"Aste monitorate: {_auctionViewModels.Count}";
|
||||
}
|
||||
|
||||
private void UpdateGlobalControlButtons()
|
||||
{
|
||||
try
|
||||
{
|
||||
var hasAuctions = _auctionViewModels.Count > 0;
|
||||
|
||||
if (!hasAuctions)
|
||||
{
|
||||
// Nessuna asta: tutti disabilitati
|
||||
StartButton.IsEnabled = false;
|
||||
StartButton.Opacity = 0.4;
|
||||
PauseAllButton.IsEnabled = false;
|
||||
PauseAllButton.Opacity = 0.4;
|
||||
StopButton.IsEnabled = false;
|
||||
StopButton.Opacity = 0.4;
|
||||
return;
|
||||
}
|
||||
|
||||
// Conta quante aste possono eseguire ogni azione
|
||||
int canStartCount = _auctionViewModels.Count(a => a.CanStart);
|
||||
int canPauseCount = _auctionViewModels.Count(a => a.CanPause);
|
||||
int canStopCount = _auctionViewModels.Count(a => a.CanStop);
|
||||
|
||||
// AVVIA TUTTI: abilitato se ALMENO UNA asta può essere avviata
|
||||
// Scuro se NESSUNA asta può essere avviata (tutte già avviate)
|
||||
StartButton.IsEnabled = canStartCount > 0;
|
||||
StartButton.Opacity = canStartCount > 0 ? 1.0 : 0.4;
|
||||
|
||||
// PAUSA TUTTI: abilitato se ALMENO UNA asta può essere messa in pausa
|
||||
// Scuro se NESSUNA asta può essere messa in pausa (tutte già in pausa o ferme)
|
||||
PauseAllButton.IsEnabled = canPauseCount > 0;
|
||||
PauseAllButton.Opacity = canPauseCount > 0 ? 1.0 : 0.4;
|
||||
|
||||
// FERMA TUTTI: abilitato se ALMENO UNA asta può essere fermata
|
||||
// Scuro se NESSUNA asta può essere fermata (tutte già ferme)
|
||||
StopButton.IsEnabled = canStopCount > 0;
|
||||
StopButton.Opacity = canStopCount > 0 ? 1.0 : 0.4;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void MultiAuctionsGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (MultiAuctionsGrid.SelectedItem is AuctionViewModel selected)
|
||||
{
|
||||
_selectedAuction = selected;
|
||||
UpdateSelectedAuctionDetails(selected);
|
||||
}
|
||||
}
|
||||
|
||||
private void GridOpenAuction_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sender is FrameworkElement element && element.DataContext is AuctionViewModel vm)
|
||||
{
|
||||
var url = vm.AuctionInfo.OriginalUrl;
|
||||
if (string.IsNullOrEmpty(url))
|
||||
url = $"https://it.bidoo.com/auction.php?a=asta_{vm.AuctionId}";
|
||||
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = url,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Apertura asta: {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ExportSelectedAuction_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sender is FrameworkElement element && element.DataContext is AuctionViewModel vm)
|
||||
{
|
||||
MessageBox.Show(this, $"Esportazione singola asta non ancora implementata.\nUsa 'Esporta Aste' dalla toolbar.", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Esportazione asta: {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resetta le impostazioni dell'asta selezionata ai valori predefiniti
|
||||
/// </summary>
|
||||
private void ResetSettingsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var settings = SettingsManager.Load();
|
||||
|
||||
// Resetta ai valori predefiniti dalle impostazioni
|
||||
_selectedAuction.AuctionInfo.BidBeforeDeadlineMs = settings.DefaultBidBeforeDeadlineMs;
|
||||
_selectedAuction.AuctionInfo.CheckAuctionOpenBeforeBid = settings.DefaultCheckAuctionOpenBeforeBid;
|
||||
_selectedAuction.MinPrice = settings.DefaultMinPrice;
|
||||
_selectedAuction.MaxPrice = settings.DefaultMaxPrice;
|
||||
_selectedAuction.MaxClicks = settings.DefaultMaxClicks;
|
||||
|
||||
// Aggiorna UI
|
||||
UpdateAuctionSettingsDisplay(_selectedAuction);
|
||||
|
||||
// Salva
|
||||
SaveAuctions();
|
||||
|
||||
Log($"[RESET] Impostazioni ripristinate ai valori predefiniti per: {_selectedAuction.Name}", LogLevel.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Reset impostazioni: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante il reset: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pulisce la lista degli utenti che hanno puntato sull'asta selezionata
|
||||
/// </summary>
|
||||
private void ClearBiddersButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = MessageBox.Show(
|
||||
$"Pulire la lista degli utenti per questa asta?\n\n{_selectedAuction.Name}\n\nLa lista degli utenti che hanno puntato verrà svuotata.",
|
||||
"Conferma Pulizia",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (result != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
// Pulisci la lista bidders
|
||||
_selectedAuction.AuctionInfo.BidderStats.Clear();
|
||||
|
||||
// Aggiorna UI
|
||||
RefreshBiddersGrid(_selectedAuction);
|
||||
|
||||
Log($"[CLEAR] Lista utenti pulita per: {_selectedAuction.Name}", LogLevel.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Pulizia lista utenti: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante la pulizia: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pulisce il log dell'asta selezionata
|
||||
/// </summary>
|
||||
private void ClearLogButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_selectedAuction == null)
|
||||
{
|
||||
MessageBox.Show("Seleziona un'asta dalla griglia", "Nessuna Selezione", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// Pulisci il log dell'asta
|
||||
_selectedAuction.AuctionInfo.AuctionLog.Clear();
|
||||
|
||||
// Aggiorna UI
|
||||
UpdateAuctionLog(_selectedAuction);
|
||||
|
||||
Log($"[CLEAR] Log pulito per: {_selectedAuction.Name}", LogLevel.Info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Pulizia log asta: {ex.Message}", LogLevel.Error);
|
||||
MessageBox.Show($"Errore durante la pulizia: {ex.Message}", "Errore", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// URL parsing and validation utilities
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private bool IsValidAuctionUrl(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
var uri = new Uri(url);
|
||||
var host = uri.Host.ToLowerInvariant();
|
||||
|
||||
// Valida dominio Bidoo
|
||||
if (!host.Contains("bidoo.com") && !host.Contains("bidoo.it") &&
|
||||
!host.Contains("bidoo.fr") && !host.Contains("bidoo.es") &&
|
||||
!host.Contains("bidoo.de"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Valida path asta
|
||||
return uri.AbsolutePath.Contains("/asta/") || uri.Query.Contains("a=");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private string? ExtractAuctionId(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
var uri = new Uri(url);
|
||||
|
||||
// Formato nuovo: /asta/nome-prodotto-81204324
|
||||
var match = Regex.Match(uri.AbsolutePath, @"/asta/[^/]*-(\d{8,})");
|
||||
if (match.Success)
|
||||
{
|
||||
return match.Groups[1].Value;
|
||||
}
|
||||
|
||||
// Formato vecchio: /asta/81204324
|
||||
match = Regex.Match(uri.AbsolutePath, @"/asta/(\d{8,})");
|
||||
if (match.Success)
|
||||
{
|
||||
return match.Groups[1].Value;
|
||||
}
|
||||
|
||||
// Formato query: ?a=Galaxy_S25_Ultra_256GB_81204324
|
||||
match = Regex.Match(uri.Query, @"[?&]a=([^&]+)");
|
||||
if (match.Success)
|
||||
{
|
||||
var aValue = match.Groups[1].Value;
|
||||
|
||||
// Estrai ID numerico finale (8+ cifre)
|
||||
var idMatch = Regex.Match(aValue, @"(\d{8,})");
|
||||
if (idMatch.Success)
|
||||
{
|
||||
return idMatch.Groups[1].Value;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private string? ExtractProductName(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
var uri = new Uri(url);
|
||||
|
||||
// Formato query: ?a=Galaxy_S25_Ultra_256GB_81204324
|
||||
var match = Regex.Match(uri.Query, @"[?&]a=([^&]+)");
|
||||
if (match.Success)
|
||||
{
|
||||
var aValue = match.Groups[1].Value;
|
||||
|
||||
// Rimuovi l'ID finale e gli underscore
|
||||
var nameMatch = Regex.Match(aValue, @"^(.+?)_(\d{8,})$");
|
||||
if (nameMatch.Success)
|
||||
{
|
||||
var productName = nameMatch.Groups[1].Value;
|
||||
productName = productName.Replace('_', ' ');
|
||||
return productName;
|
||||
}
|
||||
}
|
||||
|
||||
// Formato path: /asta/galaxy-s25-ultra-256gb-81204324
|
||||
match = Regex.Match(uri.AbsolutePath, @"/asta/(.+?)-(\d{8,})");
|
||||
if (match.Success)
|
||||
{
|
||||
var productName = match.Groups[1].Value;
|
||||
productName = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(
|
||||
productName.Replace('-', ' ')
|
||||
);
|
||||
return productName;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using AutoBidder.Services;
|
||||
using AutoBidder.Utilities;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// User info and banner management - REFACTORED con SessionService
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private System.Windows.Threading.DispatcherTimer _userBannerTimer;
|
||||
private System.Windows.Threading.DispatcherTimer _userHtmlTimer;
|
||||
private SessionService _sessionService; // NUOVO: Servizio centralizzato
|
||||
|
||||
private void InitializeUserInfoTimers()
|
||||
{
|
||||
// Timer per aggiornamento dati utente da HTML ogni 5 minuti (PRINCIPALE)
|
||||
_userHtmlTimer = new System.Windows.Threading.DispatcherTimer();
|
||||
_userHtmlTimer.Interval = TimeSpan.FromMinutes(5);
|
||||
_userHtmlTimer.Tick += UserHtmlTimer_Tick;
|
||||
_userHtmlTimer.Start();
|
||||
|
||||
// Timer per aggiornamento banner API ogni 10 minuti (SECONDARIO - fallback)
|
||||
_userBannerTimer = new System.Windows.Threading.DispatcherTimer();
|
||||
_userBannerTimer.Interval = TimeSpan.FromMinutes(10);
|
||||
_userBannerTimer.Tick += UserBannerTimer_Tick;
|
||||
_userBannerTimer.Start();
|
||||
}
|
||||
|
||||
private void InitializeSessionService()
|
||||
{
|
||||
// NUOVO: Inizializza SessionService
|
||||
_sessionService = new SessionService(_auctionMonitor.GetApiClient());
|
||||
|
||||
// Event handlers
|
||||
_sessionService.OnLog += (msg) => Log(msg, LogLevel.Info);
|
||||
_sessionService.OnSessionChanged += (session) =>
|
||||
{
|
||||
Dispatcher.Invoke(() => SetUserBanner(session.Username, session.RemainingBids));
|
||||
};
|
||||
}
|
||||
|
||||
private void SetUserBanner(string username, int? remainingBids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = _sessionService?.GetCurrentSession();
|
||||
|
||||
if (!string.IsNullOrEmpty(username))
|
||||
{
|
||||
// === CONNESSO ===
|
||||
|
||||
// Header - Puntate + Credito
|
||||
RemainingBidsText.Text = remainingBids?.ToString() ?? "0";
|
||||
|
||||
if (session?.ShopCredit > 0)
|
||||
{
|
||||
AuctionMonitor.ShopCreditText.Text = $"EUR {session.ShopCredit:F2}";
|
||||
}
|
||||
else
|
||||
{
|
||||
AuctionMonitor.ShopCreditText.Text = "EUR 0.00";
|
||||
}
|
||||
|
||||
// Aste vinte
|
||||
BannerAsteDaRiscattare.Text = "0";
|
||||
|
||||
// Indicatore limite puntate
|
||||
var settings = Utilities.SettingsManager.Load();
|
||||
UpdateMinBidsIndicator(settings.MinimumRemainingBids);
|
||||
|
||||
// === SIDEBAR - Mostra dati utente ===
|
||||
SidebarUsernameText.Text = username;
|
||||
SidebarUsernameText.Foreground = new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(0, 216, 0)); // Verde
|
||||
SidebarUsernameText.FontWeight = System.Windows.FontWeights.Bold;
|
||||
SidebarUsernameText.ToolTip = $"Connesso come {username} - Click per disconnettere";
|
||||
|
||||
// Mostra dettagli (ID + Email)
|
||||
if (session?.UserId > 0)
|
||||
{
|
||||
SidebarUserIdText.Text = $"ID: {session.UserId}";
|
||||
SidebarUserIdText.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
SidebarUserIdText.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(session?.Email))
|
||||
{
|
||||
SidebarUserEmailText.Text = session.Email;
|
||||
SidebarUserEmailText.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
SidebarUserEmailText.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
|
||||
SidebarUserDetailsPanel.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
// === NON CONNESSO ===
|
||||
|
||||
// Reset header
|
||||
RemainingBidsText.Text = "0";
|
||||
AuctionMonitor.ShopCreditText.Text = "EUR 0.00";
|
||||
BannerAsteDaRiscattare.Text = "0";
|
||||
|
||||
// Nascondi indicatore limite
|
||||
MinBidsLimitIndicator.Visibility = Visibility.Collapsed;
|
||||
|
||||
// === SIDEBAR - Mostra "Non connesso" ===
|
||||
SidebarUsernameText.Text = "Non connesso";
|
||||
SidebarUsernameText.Foreground = new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(255, 82, 82)); // Rosso chiaro (#FF5252)
|
||||
SidebarUsernameText.FontWeight = System.Windows.FontWeights.Bold;
|
||||
SidebarUsernameText.ToolTip = "Non connesso - Click per accedere tramite browser";
|
||||
|
||||
// Nascondi dettagli (ID + Email)
|
||||
SidebarUserDetailsPanel.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private async void UserBannerTimer_Tick(object? sender, EventArgs e)
|
||||
{
|
||||
// Usa SessionService per refresh
|
||||
if (_sessionService != null)
|
||||
{
|
||||
await _sessionService.RefreshUserInfoAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private async void UserHtmlTimer_Tick(object? sender, EventArgs e)
|
||||
{
|
||||
// Usa SessionService per refresh
|
||||
if (_sessionService != null)
|
||||
{
|
||||
await _sessionService.RefreshUserInfoAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carica sessione salvata
|
||||
/// </summary>
|
||||
private void LoadSavedSession()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = _sessionService?.GetCurrentSession();
|
||||
|
||||
if (session != null && session.IsValid)
|
||||
{
|
||||
StartButton.IsEnabled = true;
|
||||
|
||||
Log($"[SESSION] Ripristino sessione per: {session.Username}", LogLevel.Info);
|
||||
|
||||
// Aggiorna UI con stato connesso (ottimistico)
|
||||
SetUserBanner(session.Username, session.RemainingBids);
|
||||
|
||||
// Verifica validità cookie in background
|
||||
System.Threading.Tasks.Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Log("[SESSION] Verifica validità sessione...", LogLevel.Info);
|
||||
var success = await _auctionMonitor.UpdateUserInfoAsync();
|
||||
var updatedSession = _auctionMonitor.GetSession();
|
||||
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (success && updatedSession != null && !string.IsNullOrEmpty(updatedSession.Username))
|
||||
{
|
||||
SetUserBanner(updatedSession.Username, updatedSession.RemainingBids);
|
||||
Log($"[SESSION] Sessione valida - {updatedSession.Username} ({updatedSession.RemainingBids} puntate)", LogLevel.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetUserBanner(string.Empty, 0);
|
||||
Log("[SESSION] Sessione scaduta", LogLevel.Warning);
|
||||
CheckBrowserCookieAfterWebViewReady();
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
SetUserBanner(string.Empty, 0);
|
||||
Log($"[SESSION] Errore verifica sessione: {ex.Message}", LogLevel.Warning);
|
||||
CheckBrowserCookieAfterWebViewReady();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[SESSION] Nessuna sessione salvata", LogLevel.Info);
|
||||
CheckBrowserCookieAfterWebViewReady();
|
||||
SetUserBanner(string.Empty, 0);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Caricamento sessione: {ex.Message}", LogLevel.Error);
|
||||
CheckBrowserCookieAfterWebViewReady();
|
||||
SetUserBanner(string.Empty, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attende che WebView sia pronta, poi verifica presenza cookie
|
||||
/// </summary>
|
||||
private void CheckBrowserCookieAfterWebViewReady()
|
||||
{
|
||||
System.Threading.Tasks.Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// Aspetta che WebView sia inizializzata (max 60 secondi)
|
||||
var webViewReady = await WaitForWebViewInitAsync(60);
|
||||
|
||||
if (!webViewReady)
|
||||
{
|
||||
await Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
Log("[WARN] WebView non inizializzata dopo 60 secondi", LogLevel.Warning);
|
||||
Log("[INFO] Per accedere:", LogLevel.Info);
|
||||
Log("[INFO] 1. Click su 'Non connesso' nella sidebar", LogLevel.Info);
|
||||
Log("[INFO] 2. Si aprirà la scheda Browser", LogLevel.Info);
|
||||
Log("[INFO] 3. Fai login su Bidoo", LogLevel.Info);
|
||||
Log("[INFO] 4. La connessione sarà automatica", LogLevel.Info);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// WebView pronta - verifica cookie
|
||||
await Dispatcher.InvokeAsync(async () =>
|
||||
{
|
||||
var browserCookie = await GetCookieFromWebView();
|
||||
|
||||
if (string.IsNullOrEmpty(browserCookie))
|
||||
{
|
||||
Log("[INFO] Nessun cookie nel browser", LogLevel.Info);
|
||||
Log("[INFO] Per accedere:", LogLevel.Info);
|
||||
Log("[INFO] 1. Click su 'Non connesso' nella sidebar", LogLevel.Info);
|
||||
Log("[INFO] 2. Si aprirà la scheda Browser", LogLevel.Info);
|
||||
Log("[INFO] 3. Fai login su Bidoo", LogLevel.Info);
|
||||
Log("[INFO] 4. La connessione sarà automatica", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[INFO] Cookie rilevato nel browser - importazione in corso...", LogLevel.Info);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[WARN] Errore verifica cookie: {ex.Message}", LogLevel.Warning);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna immediatamente il banner delle puntate residue (chiamato dopo ogni puntata)
|
||||
/// </summary>
|
||||
public void UpdateRemainingBidsDisplay()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = _sessionService?.GetCurrentSession();
|
||||
if (session != null && session.RemainingBids > 0)
|
||||
{
|
||||
RemainingBidsText.Text = session.RemainingBids.ToString();
|
||||
Log($"[BANNER UPDATE] Puntate residue aggiornate: {session.RemainingBids}", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERROR] Errore aggiornamento banner: {ex.Message}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ? Aggiorna l'indicatore del limite minimo puntate nel banner
|
||||
/// </summary>
|
||||
private void UpdateMinBidsIndicator(int minBidsLimit)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (minBidsLimit > 0)
|
||||
{
|
||||
// Mostra indicatore con solo il numero tra parentesi
|
||||
MinBidsLimitIndicator.Visibility = Visibility.Visible;
|
||||
MinBidsLimitIndicator.Text = $"({minBidsLimit})";
|
||||
MinBidsLimitIndicator.ToolTip = $"Limite minimo puntate attivo: non scendera sotto {minBidsLimit} puntate";
|
||||
|
||||
// Colore basato su puntate residue
|
||||
var session = _sessionService?.GetCurrentSession();
|
||||
if (session != null && session.RemainingBids > 0)
|
||||
{
|
||||
if (session.RemainingBids <= minBidsLimit)
|
||||
{
|
||||
// Al limite - Rosso chiaro (più visibile su sfondo scuro)
|
||||
MinBidsLimitIndicator.Foreground = new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(255, 82, 82)); // #FF5252 - Rosso chiaro
|
||||
}
|
||||
else if (session.RemainingBids <= minBidsLimit + 10)
|
||||
{
|
||||
// Vicino al limite - Giallo
|
||||
MinBidsLimitIndicator.Foreground = new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(255, 193, 7)); // #FFC107 - Giallo
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sopra il limite - Verde
|
||||
MinBidsLimitIndicator.Foreground = new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(0, 216, 0)); // #00D800 - Verde
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nascondi indicatore
|
||||
MinBidsLimitIndicator.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using AutoBidder.Utilities;
|
||||
|
||||
namespace AutoBidder
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione WebView2: pre-caricamento e estrazione cookie
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private bool _isWebViewInitialized = false;
|
||||
private TaskCompletionSource<bool>? _webViewInitCompletionSource;
|
||||
|
||||
/// <summary>
|
||||
/// Inizializza WebView2 in background all'avvio per pre-caricare il browser
|
||||
/// </summary>
|
||||
private async void InitializeWebView2()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (EmbeddedWebView == null)
|
||||
{
|
||||
Log("[WARN] WebView2 non disponibile", LogLevel.Warning);
|
||||
_webViewInitCompletionSource?.TrySetResult(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Log("[BROWSER] Inizializzazione WebView2 in background...", LogLevel.Info);
|
||||
|
||||
// Aspetta un attimo che l'UI sia completamente caricata
|
||||
await System.Threading.Tasks.Task.Delay(500);
|
||||
|
||||
// ? FIX: WebView2 si inizializza SOLO se visibile
|
||||
// Salva tab corrente e switcha temporaneamente a Browser
|
||||
var wasVisible = Browser.Visibility == Visibility.Visible;
|
||||
var currentTab = TabAsteAttive.IsChecked == true ? "AsteAttive" :
|
||||
TabBrowser.IsChecked == true ? "Browser" :
|
||||
TabPuntateGratis.IsChecked == true ? "PuntateGratis" :
|
||||
TabDatiStatistici.IsChecked == true ? "DatiStatistici" :
|
||||
TabImpostazioni.IsChecked == true ? "Impostazioni" : "AsteAttive";
|
||||
|
||||
if (!wasVisible)
|
||||
{
|
||||
await Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
Browser.Visibility = Visibility.Visible;
|
||||
});
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
// Specifica UserDataFolder esplicito
|
||||
var userDataFolder = System.IO.Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"AutoBidder",
|
||||
"WebView2"
|
||||
);
|
||||
|
||||
// Crea directory se non esiste
|
||||
System.IO.Directory.CreateDirectory(userDataFolder);
|
||||
|
||||
// Crea environment con UserDataFolder esplicito
|
||||
var env = await Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateAsync(
|
||||
browserExecutableFolder: null,
|
||||
userDataFolder: userDataFolder
|
||||
);
|
||||
|
||||
// Inizializza WebView con environment
|
||||
await EmbeddedWebView.EnsureCoreWebView2Async(env);
|
||||
|
||||
// Ripristina tab originale se necessario
|
||||
if (!wasVisible)
|
||||
{
|
||||
await Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
Browser.Visibility = Visibility.Collapsed;
|
||||
|
||||
// Ripristina tab originale
|
||||
switch (currentTab)
|
||||
{
|
||||
case "AsteAttive":
|
||||
TabAsteAttive.IsChecked = true;
|
||||
AuctionMonitor.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case "PuntateGratis":
|
||||
TabPuntateGratis.IsChecked = true;
|
||||
PuntateGratisPanel.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case "DatiStatistici":
|
||||
TabDatiStatistici.IsChecked = true;
|
||||
StatisticsPanel.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case "Impostazioni":
|
||||
TabImpostazioni.IsChecked = true;
|
||||
Settings.Visibility = Visibility.Visible;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (EmbeddedWebView.CoreWebView2 != null)
|
||||
{
|
||||
_isWebViewInitialized = true;
|
||||
|
||||
// Pre-carica la pagina di Bidoo in background
|
||||
EmbeddedWebView.CoreWebView2.Navigate("https://it.bidoo.com");
|
||||
|
||||
Log("[BROWSER] WebView2 inizializzato e pre-caricato", LogLevel.Success);
|
||||
|
||||
// Registra evento per rilevare login automatico
|
||||
EmbeddedWebView.CoreWebView2.NavigationCompleted += OnWebViewNavigationCompleted;
|
||||
|
||||
// Notifica che WebView è pronta
|
||||
_webViewInitCompletionSource?.TrySetResult(true);
|
||||
|
||||
// Verifica immediata se c'è già un cookie
|
||||
await CheckAndImportCookieIfAvailable();
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("[ERROR] CoreWebView2 è null dopo init", LogLevel.Error);
|
||||
_webViewInitCompletionSource?.TrySetResult(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERROR] Inizializzazione WebView2 fallita: {ex.Message}", LogLevel.Error);
|
||||
_webViewInitCompletionSource?.TrySetResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica e importa cookie se disponibile
|
||||
/// </summary>
|
||||
private async Task CheckAndImportCookieIfAvailable()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Aspetta che la pagina sia completamente caricata
|
||||
await Task.Delay(1000);
|
||||
|
||||
var cookie = await GetCookieFromWebView();
|
||||
|
||||
if (!string.IsNullOrEmpty(cookie))
|
||||
{
|
||||
var currentSession = _sessionService?.GetCurrentSession();
|
||||
|
||||
// Importa solo se diverso da quello salvato
|
||||
if (currentSession == null ||
|
||||
string.IsNullOrEmpty(currentSession.CookieString) ||
|
||||
!currentSession.CookieString.Contains(cookie))
|
||||
{
|
||||
Log("[BROWSER] Cookie rilevato nel browser - importazione automatica...", LogLevel.Info);
|
||||
await AutoImportCookieFromWebView(cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[WARN] Verifica cookie fallita: {ex.Message}", LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aspetta che WebView sia inizializzata (con timeout)
|
||||
/// </summary>
|
||||
private async Task<bool> WaitForWebViewInitAsync(int timeoutSeconds = 60)
|
||||
{
|
||||
if (_isWebViewInitialized)
|
||||
return true;
|
||||
|
||||
_webViewInitCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
// Timeout
|
||||
var timeoutTask = Task.Delay(TimeSpan.FromSeconds(timeoutSeconds));
|
||||
var completedTask = await Task.WhenAny(_webViewInitCompletionSource.Task, timeoutTask);
|
||||
|
||||
if (completedTask == timeoutTask)
|
||||
{
|
||||
Log("[WARN] Timeout attesa inizializzazione WebView2", LogLevel.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
return await _webViewInitCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evento chiamato quando la navigazione nella WebView è completata
|
||||
/// Rileva automaticamente se l'utente ha effettuato il login
|
||||
/// </summary>
|
||||
private async void OnWebViewNavigationCompleted(object? sender, CoreWebView2NavigationCompletedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!e.IsSuccess || EmbeddedWebView?.CoreWebView2 == null)
|
||||
return;
|
||||
|
||||
var url = EmbeddedWebView.CoreWebView2.Source;
|
||||
|
||||
// Se l'utente è sulla homepage di Bidoo (dopo login), verifica cookie
|
||||
if (url.Contains("bidoo.com") && !url.Contains("login"))
|
||||
{
|
||||
// ? REFACTORED: Delega a CheckAndImportCookieIfAvailable
|
||||
await CheckAndImportCookieIfAvailable();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Importa automaticamente il cookie dalla WebView senza conferma utente
|
||||
/// </summary>
|
||||
private async Task<bool> AutoImportCookieFromWebView(string cookieString)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Valida e attiva il cookie usando SessionService
|
||||
var result = await _sessionService.ValidateAndActivateSessionAsync(cookieString);
|
||||
|
||||
if (result.Success && result.Session != null)
|
||||
{
|
||||
// Salva automaticamente la sessione
|
||||
_sessionService.SaveSession(result.Session);
|
||||
|
||||
// Aggiorna il banner
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
SetUserBanner(result.Session.Username, result.Session.RemainingBids);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Estrae il cookie __stattrb dalla WebView2
|
||||
/// </summary>
|
||||
/// <returns>Cookie completo o null se non trovato</returns>
|
||||
private async Task<string?> GetCookieFromWebView()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (EmbeddedWebView?.CoreWebView2 == null)
|
||||
return null;
|
||||
|
||||
// Ottieni tutti i cookie di bidoo.com
|
||||
var cookies = await EmbeddedWebView.CoreWebView2.CookieManager.GetCookiesAsync("https://it.bidoo.com");
|
||||
|
||||
if (cookies == null || cookies.Count == 0)
|
||||
return null;
|
||||
|
||||
// Cerca il cookie __stattrb (cookie di sessione principale)
|
||||
var stattrb = cookies.FirstOrDefault(c => c.Name == "__stattrb");
|
||||
|
||||
if (stattrb == null)
|
||||
return null;
|
||||
|
||||
// Costruisci la stringa cookie completa con tutti i cookie necessari
|
||||
var cookieStrings = cookies
|
||||
.Where(c => !string.IsNullOrEmpty(c.Value))
|
||||
.Select(c => $"{c.Name}={c.Value}")
|
||||
.ToList();
|
||||
|
||||
return string.Join("; ", cookieStrings);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[WARN] Impossibile estrarre cookie da WebView: {ex.Message}", LogLevel.Warning);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Importa il cookie dalla WebView e lo salva per l'uso nelle API
|
||||
/// </summary>
|
||||
public async Task<bool> ImportCookieFromWebView()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_isWebViewInitialized || EmbeddedWebView?.CoreWebView2 == null)
|
||||
{
|
||||
Log("[WARN] Browser non inizializzato - attendi qualche secondo e riprova", LogLevel.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
Log("[BROWSER] Estrazione cookie dal browser...", LogLevel.Info);
|
||||
|
||||
var cookieString = await GetCookieFromWebView();
|
||||
|
||||
if (string.IsNullOrEmpty(cookieString))
|
||||
{
|
||||
Log("[WARN] Nessun cookie trovato nel browser - assicurati di aver effettuato il login su bidoo.com", LogLevel.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ? NOTA: Non aggiorna più TextBox (rimossa) - direttamente alla validazione
|
||||
|
||||
// Valida e attiva il cookie usando SessionService
|
||||
var result = await _sessionService.ValidateAndActivateSessionAsync(cookieString);
|
||||
|
||||
if (result.Success && result.Session != null)
|
||||
{
|
||||
// Salva automaticamente la sessione
|
||||
_sessionService.SaveSession(result.Session);
|
||||
|
||||
// Aggiorna il banner
|
||||
SetUserBanner(result.Session.Username, result.Session.RemainingBids);
|
||||
|
||||
Log($"[OK] Cookie importato e validato - Utente: {result.Session.Username}, Puntate: {result.Session.RemainingBids}", LogLevel.Success);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"[ERRORE] Cookie importato ma non valido: {result.ErrorMessage}", LogLevel.Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Importazione cookie: {ex.Message}", LogLevel.Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se WebView2 è pronta per l'uso
|
||||
/// </summary>
|
||||
public bool IsWebViewReady()
|
||||
{
|
||||
return _isWebViewInitialized && EmbeddedWebView?.CoreWebView2 != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
# This file ensures the data directory is tracked by git
|
||||
@@ -0,0 +1,27 @@
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AutoBidder.Models;
|
||||
|
||||
namespace AutoBidder.Data;
|
||||
|
||||
/// <summary>
|
||||
/// DbContext per autenticazione Identity
|
||||
/// </summary>
|
||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||
{
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
// Personalizza nomi tabelle Identity (opzionale)
|
||||
builder.Entity<ApplicationUser>(entity =>
|
||||
{
|
||||
entity.ToTable("Users");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AutoBidder.Models;
|
||||
|
||||
namespace AutoBidder.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Context Entity Framework per PostgreSQL - Database Statistiche Aste
|
||||
/// Gestisce aste concluse, metriche strategiche e analisi performance
|
||||
/// </summary>
|
||||
public class PostgresStatsContext : DbContext
|
||||
{
|
||||
public PostgresStatsContext(DbContextOptions<PostgresStatsContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
// Tabelle principali
|
||||
public DbSet<CompletedAuction> CompletedAuctions { get; set; }
|
||||
public DbSet<BidderPerformance> BidderPerformances { get; set; }
|
||||
public DbSet<ProductStatistic> ProductStatistics { get; set; }
|
||||
public DbSet<DailyMetric> DailyMetrics { get; set; }
|
||||
public DbSet<StrategicInsight> StrategicInsights { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
// Configurazione CompletedAuction
|
||||
modelBuilder.Entity<CompletedAuction>(entity =>
|
||||
{
|
||||
entity.ToTable("completed_auctions");
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.AuctionId).HasColumnName("auction_id").IsRequired().HasMaxLength(100);
|
||||
entity.Property(e => e.ProductName).HasColumnName("product_name").IsRequired().HasMaxLength(500);
|
||||
entity.Property(e => e.FinalPrice).HasColumnName("final_price").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.BuyNowPrice).HasColumnName("buy_now_price").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.ShippingCost).HasColumnName("shipping_cost").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.TotalBids).HasColumnName("total_bids");
|
||||
entity.Property(e => e.MyBidsCount).HasColumnName("my_bids_count");
|
||||
entity.Property(e => e.ResetCount).HasColumnName("reset_count");
|
||||
entity.Property(e => e.Won).HasColumnName("won");
|
||||
entity.Property(e => e.WinnerUsername).HasColumnName("winner_username").HasMaxLength(100);
|
||||
entity.Property(e => e.CompletedAt).HasColumnName("completed_at");
|
||||
entity.Property(e => e.DurationSeconds).HasColumnName("duration_seconds");
|
||||
entity.Property(e => e.AverageLatency).HasColumnName("average_latency").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.Savings).HasColumnName("savings").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.TotalCost).HasColumnName("total_cost").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.CreatedAt).HasColumnName("created_at").HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
entity.HasIndex(e => e.AuctionId).HasDatabaseName("idx_auction_id");
|
||||
entity.HasIndex(e => e.ProductName).HasDatabaseName("idx_product_name");
|
||||
entity.HasIndex(e => e.CompletedAt).HasDatabaseName("idx_completed_at");
|
||||
entity.HasIndex(e => e.Won).HasDatabaseName("idx_won");
|
||||
});
|
||||
|
||||
// Configurazione BidderPerformance
|
||||
modelBuilder.Entity<BidderPerformance>(entity =>
|
||||
{
|
||||
entity.ToTable("bidder_performances");
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Username).HasColumnName("username").IsRequired().HasMaxLength(100);
|
||||
entity.Property(e => e.TotalAuctions).HasColumnName("total_auctions");
|
||||
entity.Property(e => e.AuctionsWon).HasColumnName("auctions_won");
|
||||
entity.Property(e => e.AuctionsLost).HasColumnName("auctions_lost");
|
||||
entity.Property(e => e.TotalBidsPlaced).HasColumnName("total_bids_placed");
|
||||
entity.Property(e => e.WinRate).HasColumnName("win_rate").HasColumnType("decimal(5,2)");
|
||||
entity.Property(e => e.AverageBidsPerAuction).HasColumnName("average_bids_per_auction").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.AverageCompetition).HasColumnName("average_competition").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.IsAggressive).HasColumnName("is_aggressive");
|
||||
entity.Property(e => e.LastSeenAt).HasColumnName("last_seen_at");
|
||||
entity.Property(e => e.UpdatedAt).HasColumnName("updated_at").HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
entity.HasIndex(e => e.Username).IsUnique().HasDatabaseName("idx_username");
|
||||
entity.HasIndex(e => e.WinRate).HasDatabaseName("idx_win_rate");
|
||||
});
|
||||
|
||||
// Configurazione ProductStatistic
|
||||
modelBuilder.Entity<ProductStatistic>(entity =>
|
||||
{
|
||||
entity.ToTable("product_statistics");
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.ProductKey).HasColumnName("product_key").IsRequired().HasMaxLength(200);
|
||||
entity.Property(e => e.ProductName).HasColumnName("product_name").IsRequired().HasMaxLength(500);
|
||||
entity.Property(e => e.TotalAuctions).HasColumnName("total_auctions");
|
||||
entity.Property(e => e.AverageWinningBids).HasColumnName("average_winning_bids").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.AverageFinalPrice).HasColumnName("average_final_price").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.AverageResets).HasColumnName("average_resets").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.MinBidsSeen).HasColumnName("min_bids_seen");
|
||||
entity.Property(e => e.MaxBidsSeen).HasColumnName("max_bids_seen");
|
||||
entity.Property(e => e.RecommendedMaxBids).HasColumnName("recommended_max_bids");
|
||||
entity.Property(e => e.RecommendedMaxPrice).HasColumnName("recommended_max_price").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.CompetitionLevel).HasColumnName("competition_level").HasMaxLength(20);
|
||||
entity.Property(e => e.LastUpdated).HasColumnName("last_updated").HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
entity.HasIndex(e => e.ProductKey).IsUnique().HasDatabaseName("idx_product_key");
|
||||
entity.HasIndex(e => e.ProductName).HasDatabaseName("idx_product_name_stats");
|
||||
});
|
||||
|
||||
// Configurazione DailyMetric
|
||||
modelBuilder.Entity<DailyMetric>(entity =>
|
||||
{
|
||||
entity.ToTable("daily_metrics");
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Date).HasColumnName("date").HasColumnType("date");
|
||||
entity.Property(e => e.TotalBidsUsed).HasColumnName("total_bids_used");
|
||||
entity.Property(e => e.MoneySpent).HasColumnName("money_spent").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.AuctionsWon).HasColumnName("auctions_won");
|
||||
entity.Property(e => e.AuctionsLost).HasColumnName("auctions_lost");
|
||||
entity.Property(e => e.TotalSavings).HasColumnName("total_savings").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.AverageLatency).HasColumnName("average_latency").HasColumnType("decimal(10,2)");
|
||||
entity.Property(e => e.WinRate).HasColumnName("win_rate").HasColumnType("decimal(5,2)");
|
||||
entity.Property(e => e.ROI).HasColumnName("roi").HasColumnType("decimal(10,2)");
|
||||
|
||||
entity.HasIndex(e => e.Date).IsUnique().HasDatabaseName("idx_date");
|
||||
});
|
||||
|
||||
// Configurazione StrategicInsight
|
||||
modelBuilder.Entity<StrategicInsight>(entity =>
|
||||
{
|
||||
entity.ToTable("strategic_insights");
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.InsightType).HasColumnName("insight_type").IsRequired().HasMaxLength(50);
|
||||
entity.Property(e => e.ProductKey).HasColumnName("product_key").HasMaxLength(200);
|
||||
entity.Property(e => e.RecommendedAction).HasColumnName("recommended_action").IsRequired();
|
||||
entity.Property(e => e.ConfidenceLevel).HasColumnName("confidence_level").HasColumnType("decimal(5,2)");
|
||||
entity.Property(e => e.DataPoints).HasColumnName("data_points");
|
||||
entity.Property(e => e.Reasoning).HasColumnName("reasoning");
|
||||
entity.Property(e => e.CreatedAt).HasColumnName("created_at").HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
entity.Property(e => e.IsActive).HasColumnName("is_active").HasDefaultValue(true);
|
||||
|
||||
entity.HasIndex(e => e.InsightType).HasDatabaseName("idx_insight_type");
|
||||
entity.HasIndex(e => e.ProductKey).HasDatabaseName("idx_product_key_insight");
|
||||
entity.HasIndex(e => e.CreatedAt).HasDatabaseName("idx_created_at");
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica e crea lo schema del database
|
||||
/// </summary>
|
||||
public async Task<bool> EnsureSchemaAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Verifica connessione
|
||||
if (!await Database.CanConnectAsync())
|
||||
{
|
||||
Console.WriteLine("[PostgreSQL] Cannot connect to database");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Crea schema se non esistono le tabelle (senza migrations)
|
||||
var created = await Database.EnsureCreatedAsync();
|
||||
|
||||
if (created)
|
||||
{
|
||||
Console.WriteLine("[PostgreSQL] Schema created successfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("[PostgreSQL] Schema already exists");
|
||||
}
|
||||
|
||||
// Verifica che tutte le tabelle esistano
|
||||
var hasCompletedAuctions = await CompletedAuctions.AnyAsync();
|
||||
Console.WriteLine($"[PostgreSQL] Database verified - {(hasCompletedAuctions ? "has data" : "empty")}");
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"[PostgreSQL ERROR] Schema creation failed: {ex.Message}");
|
||||
Console.WriteLine($"[PostgreSQL ERROR] Stack trace: {ex.StackTrace}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica che tutte le tabelle richieste esistano
|
||||
/// </summary>
|
||||
public async Task<bool> ValidateSchemaAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Prova a contare le righe di ogni tabella (forza check esistenza)
|
||||
await CompletedAuctions.CountAsync();
|
||||
await BidderPerformances.CountAsync();
|
||||
await ProductStatistics.CountAsync();
|
||||
await DailyMetrics.CountAsync();
|
||||
await StrategicInsights.CountAsync();
|
||||
|
||||
Console.WriteLine("[PostgreSQL] All tables validated successfully");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"[PostgreSQL ERROR] Schema validation failed: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AutoBidder.Models;
|
||||
|
||||
namespace AutoBidder.Data
|
||||
{
|
||||
public class StatisticsContext : DbContext
|
||||
{
|
||||
public DbSet<ProductStat> ProductStats { get; set; }
|
||||
|
||||
public StatisticsContext(DbContextOptions<StatisticsContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<ProductStat>()
|
||||
.HasIndex(p => p.ProductKey)
|
||||
.IsUnique(false);
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window x:Class="AutoBidder.Dialogs.AddAuctionSimpleDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:AutoBidder.Controls"
|
||||
Title="Aggiungi Asta" Height="320" Width="700"
|
||||
Background="#0a0a0a" Foreground="#FFFFFF"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Icon="pack://application:,,,/Icon/favicon.ico"
|
||||
ResizeMode="NoResize">
|
||||
<Border Background="#1a1a1a" CornerRadius="8" Padding="16" Margin="8">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="Inserire URL dell'asta (uno o più)" Foreground="#CCCCCC" FontSize="14" Margin="0,0,0,6" />
|
||||
<TextBlock Grid.Row="1" Text="Puoi aggiungere più link separandoli con 'a capo', 'spazio' o ';'" Foreground="#999999" FontSize="12" Margin="0,0,0,10" />
|
||||
|
||||
<TextBox x:Name="AuctionUrlBox" Grid.Row="2" MinWidth="560" Margin="0,0,0,8"
|
||||
Background="#181818" Foreground="#00CCFF" BorderBrush="#444" BorderThickness="1"
|
||||
Padding="8" FontSize="13" ToolTip="Inserisci uno o più URL/ID dell'asta. Separali con a capo, spazio o ';'"
|
||||
AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Height="160" />
|
||||
|
||||
<controls:SimpleToolbar Grid.Row="3" Margin="0,8,0,0">
|
||||
<controls:SimpleToolbar.RightContent>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="OK" Width="110" Margin="6" Padding="10,8"
|
||||
Style="{StaticResource SmallButtonStyle}" Background="#00CC66" Foreground="White" Click="OkButton_Click" />
|
||||
<Button Content="Annulla" Width="110" Margin="6" Padding="10,8"
|
||||
Style="{StaticResource SmallButtonStyle}" Background="#666" Foreground="White" Click="CancelButton_Click" />
|
||||
</StackPanel>
|
||||
</controls:SimpleToolbar.RightContent>
|
||||
</controls:SimpleToolbar>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace AutoBidder.Dialogs
|
||||
{
|
||||
public partial class AddAuctionSimpleDialog : Window
|
||||
{
|
||||
public string AuctionId { get; private set; } = string.Empty;
|
||||
|
||||
public AddAuctionSimpleDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var text = AuctionUrlBox.Text ?? string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
MessageBox.Show("Inserisci almeno un URL o ID dell'asta.", "Errore", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// Return the raw text (may contain multiple entries); caller will parse it
|
||||
AuctionId = text.Trim();
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<Window x:Class="AutoBidder.Dialogs.ClosedAuctionsWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Aste Chiuse - Estrazione" Height="600" Width="1000"
|
||||
Background="#0a0a0a" Foreground="#FFFFFF" WindowStartupLocation="CenterOwner">
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="8" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border Background="#1a1a1a" Padding="10" CornerRadius="6" Grid.Row="0" BorderBrush="#333333" BorderThickness="1">
|
||||
<DockPanel>
|
||||
<TextBlock Text="Estrazione Aste Chiuse" FontSize="16" FontWeight="Bold" Foreground="#00CC66" VerticalAlignment="Center" DockPanel.Dock="Left" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right">
|
||||
<Button x:Name="StartExtractButton" Content="Avvia Estrazione" Click="StartExtractButton_Click" Width="140" Height="36" Margin="8,0,0,0" Background="#00CC66" Style="{StaticResource SmallButtonStyle}"/>
|
||||
<Button x:Name="ExportStatsButton" Content="Esporta Statistiche" Click="ExportStatsButton_Click" Width="160" Height="36" Margin="8,0,0,0" Background="#8B5CF6" Style="{StaticResource SmallButtonStyle}"/>
|
||||
<Button x:Name="CloseButton" Content="Chiudi" Click="CloseButton_Click" Width="80" Height="36" Margin="8,0,0,0" Background="#666" Style="{StaticResource SmallButtonStyle}"/>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="2" Background="#1a1a1a" Padding="8" CornerRadius="6" BorderBrush="#333333" BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="8" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Products grid: styled like MainWindow -->
|
||||
<DataGrid x:Name="ProductsGrid" AutoGenerateColumns="False" Grid.Column="0" Background="#1a1a1a" Foreground="#FFFFFF" BorderBrush="#333333" BorderThickness="1"
|
||||
RowBackground="#1a1a1a" AlternatingRowBackground="#222222" GridLinesVisibility="Horizontal" HorizontalGridLinesBrush="#333333"
|
||||
IsReadOnly="True" SelectionUnit="CellOrRowHeader" SelectionMode="Extended" ClipboardCopyMode="IncludeHeader" CanUserAddRows="False" CanUserDeleteRows="False">
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#2a2a2a" />
|
||||
<Setter Property="Foreground" Value="#FFFFFF" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Padding" Value="10,8" />
|
||||
<Setter Property="BorderThickness" Value="0,0,0,2" />
|
||||
<Setter Property="BorderBrush" Value="#00CC66" />
|
||||
</Style>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Height" Value="36" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#0099FF" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="10,6" />
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Command="ApplicationCommands.Copy" Header="Copia" />
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Asta URL" Binding="{Binding AuctionUrl}" Width="2*" />
|
||||
<DataGridTextColumn Header="Nome" Binding="{Binding ProductName}" Width="3*"/>
|
||||
<DataGridTextColumn Header="Prezzo" Binding="{Binding FinalPrice}" Width="80"/>
|
||||
<DataGridTextColumn Header="Vincitore" Binding="{Binding Winner}" Width="120"/>
|
||||
<DataGridTextColumn Header="Puntate Usate" Binding="{Binding BidsUsed}" Width="100"/>
|
||||
<DataGridTextColumn Header="Scraped At" Binding="{Binding ScrapedAt}" Width="140"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<GridSplitter Grid.Column="1" Width="8" />
|
||||
|
||||
<!-- Log area styled like main window log -->
|
||||
<Border Grid.Column="2" Background="#0f0f0f" Padding="8" CornerRadius="6" BorderBrush="#333333" BorderThickness="1">
|
||||
<DockPanel>
|
||||
<TextBlock Text="Log Operazioni" FontWeight="Bold" Foreground="#00CC66" DockPanel.Dock="Top" Margin="0,0,0,8" />
|
||||
<RichTextBox x:Name="ExtractLogBox" IsReadOnly="True" VerticalScrollBarVisibility="Auto" FontFamily="Consolas" FontSize="11" Background="#0f0f0f" Foreground="#CCC" BorderBrush="#333333" BorderThickness="1" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using Microsoft.Win32;
|
||||
using AutoBidder.Models;
|
||||
using AutoBidder.Services;
|
||||
using AutoBidder.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AutoBidder.Dialogs
|
||||
{
|
||||
public partial class ClosedAuctionsWindow : Window
|
||||
{
|
||||
private ObservableCollection<ClosedAuctionRecord> _products = new();
|
||||
|
||||
private bool _isRunning = false;
|
||||
|
||||
// StatsService using local DB. Create context with default sqlite file in app folder
|
||||
private readonly StatsService _statsService;
|
||||
|
||||
public ClosedAuctionsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
ProductsGrid.ItemsSource = _products;
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<StatisticsContext>();
|
||||
var dbPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "stats.db");
|
||||
optionsBuilder.UseSqlite($"Data Source={dbPath}");
|
||||
var ctx = new StatisticsContext(optionsBuilder.Options);
|
||||
_statsService = new StatsService(ctx);
|
||||
|
||||
Log("Finestra pronta");
|
||||
}
|
||||
|
||||
private void Log(string message)
|
||||
{
|
||||
try
|
||||
{
|
||||
var para = new Paragraph(new Run($"{DateTime.Now:HH:mm} - {message}"));
|
||||
ExtractLogBox.Document.Blocks.Add(para);
|
||||
// keep size manageable
|
||||
while (ExtractLogBox.Document.Blocks.Count > 500)
|
||||
ExtractLogBox.Document.Blocks.Remove(ExtractLogBox.Document.Blocks.FirstBlock);
|
||||
ExtractLogBox.ScrollToEnd();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private async void StartExtractButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_isRunning)
|
||||
{
|
||||
Log("Estrazione già in corso");
|
||||
return;
|
||||
}
|
||||
|
||||
_isRunning = true;
|
||||
StartExtractButton.IsEnabled = false;
|
||||
Log("Avvio procedura di estrazione da closed_auctions.php...");
|
||||
|
||||
try
|
||||
{
|
||||
var scraper = new ClosedAuctionsScraper(null, _statsService, Log);
|
||||
var closedUrl = "https://it.bidoo.com/closed_auctions.php";
|
||||
|
||||
Log($"Scarico: {closedUrl}");
|
||||
|
||||
int count = 0;
|
||||
await foreach (var rec in scraper.ScrapeYieldAsync(closedUrl))
|
||||
{
|
||||
// Filter out records without bids info (user requested)
|
||||
if (!rec.BidsUsed.HasValue)
|
||||
{
|
||||
Log($"Scartata asta (mancano puntate): {rec.AuctionUrl} - '{rec.ProductName ?? "?"}'");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add and log incrementally so user sees progress
|
||||
_products.Add(rec);
|
||||
count++;
|
||||
Log($"[{count}] {rec.ProductName} | Prezzo: {(rec.FinalPrice.HasValue?rec.FinalPrice.Value.ToString("F2")+"€":"--")} | Vincitore: {rec.Winner ?? "--"} | Puntate: {rec.BidsUsed.Value} | URL: {rec.AuctionUrl}");
|
||||
}
|
||||
|
||||
Log($"Estrazione completata: {count} record aggiunti.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Estrattore: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isRunning = false;
|
||||
StartExtractButton.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private async void ExportStatsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log("Preparazione esportazione statistiche...");
|
||||
var stats = await _statsService.GetAllStatsAsync();
|
||||
if (stats == null || stats.Count == 0)
|
||||
{
|
||||
Log("Nessuna statistica disponibile da esportare.");
|
||||
MessageBox.Show(this, "Nessuna statistica disponibile.", "Esporta Statistiche", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var dlg = new SaveFileDialog() { Filter = "CSV files|*.csv|All files|*.*", FileName = "auction_stats.csv" };
|
||||
if (dlg.ShowDialog(this) != true) return;
|
||||
|
||||
using var sw = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8);
|
||||
sw.WriteLine("ProductKey,ProductName,TotalAuctions,AverageBidsUsed,AverageFinalPrice,LastSeen");
|
||||
foreach (var s in stats)
|
||||
{
|
||||
var line = $"\"{s.ProductKey}\",\"{s.ProductName}\",{s.TotalAuctions},{s.AverageBidsUsed:F2},{s.AverageFinalPrice:F2},{s.LastSeen:O}";
|
||||
sw.WriteLine(line);
|
||||
}
|
||||
|
||||
Log($"Statistiche esportate su: {dlg.FileName}");
|
||||
MessageBox.Show(this, "Statistiche esportate con successo.", "Esporta Statistiche", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"[ERRORE] Esporta: {ex.Message}");
|
||||
MessageBox.Show(this, "Errore durante esportazione: " + ex.Message, "Esporta Statistiche", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<Window x:Class="AutoBidder.Dialogs.SessionDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Configura Sessione" Height="440" Width="700"
|
||||
Background="#0a0a0a" Foreground="#FFFFFF"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Icon="pack://application:,,,/Icon/favicon.ico"
|
||||
ResizeMode="NoResize">
|
||||
<Border Background="#1a1a1a" CornerRadius="8" Padding="16" Margin="8">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Inserisci Cookie di sessione" FontSize="16" FontWeight="SemiBold" Foreground="#00CC66" Margin="0,0,0,12" />
|
||||
<TextBlock Grid.Row="1" Text="Cookie di sessione (copia dal menu delle Impostazioni/Applicazioni di Chrome)" Foreground="#CCCCCC" FontSize="13" />
|
||||
<TextBlock Grid.Row="2" Foreground="#888" FontSize="12" TextWrapping="Wrap" Margin="0,4,0,10">
|
||||
<Run Text="Come trovare i cookie di sessione in Chrome:" />
|
||||
<LineBreak/>
|
||||
<Run Text="1. Apri Chrome e premi F12 (Windows) o Cmd+Option+I (Mac) per aprire gli Strumenti per sviluppatori." />
|
||||
<LineBreak/>
|
||||
<Run Text="2. Vai alla scheda 'Application'." />
|
||||
<LineBreak/>
|
||||
<Run Text="3. Nel pannello a sinistra, espandi 'Storage' e seleziona 'Cookies'." />
|
||||
<LineBreak/>
|
||||
<Run Text="4. Scegli il sito desiderato e copia il valore del cookie di sessione." />
|
||||
</TextBlock>
|
||||
<TextBox x:Name="CookieBox" Grid.Row="3" MinWidth="320" MinHeight="120" MaxHeight="220" VerticalScrollBarVisibility="Auto"
|
||||
Background="#181818" Foreground="#00CCFF" BorderBrush="#444" BorderThickness="1" Padding="8" FontSize="14" AcceptsReturn="True" TextWrapping="Wrap" />
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
|
||||
<Button x:Name="OkButton" Content="OK" Width="110" Margin="6" Padding="10,8"
|
||||
Style="{StaticResource SmallButtonStyle}" Background="#00CC66" Foreground="White" Click="OkButton_Click" />
|
||||
<Button x:Name="CancelButton" Content="Annulla" Width="110" Margin="6" Padding="10,8"
|
||||
Style="{StaticResource SmallButtonStyle}" Background="#666" Foreground="White" Click="CancelButton_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace AutoBidder.Dialogs
|
||||
{
|
||||
public partial class SessionDialog : Window
|
||||
{
|
||||
public string AuthToken { get; private set; } = string.Empty;
|
||||
|
||||
public SessionDialog(string existingToken = "", string existingUsername = "")
|
||||
{
|
||||
InitializeComponent();
|
||||
CookieBox.Text = existingToken ?? string.Empty;
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AuthToken = CookieBox.Text?.Trim() ?? string.Empty;
|
||||
if (string.IsNullOrEmpty(AuthToken))
|
||||
{
|
||||
MessageBox.Show("Cookie obbligatorio", "Errore", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
# ============================================
|
||||
# STAGE 1: Build
|
||||
# ============================================
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
|
||||
# Copy csproj and restore dependencies (cache layer)
|
||||
COPY ["AutoBidder.csproj", "."]
|
||||
RUN dotnet restore "./AutoBidder.csproj"
|
||||
|
||||
# Copy all source files
|
||||
COPY . .
|
||||
|
||||
# Build application
|
||||
WORKDIR "/src/."
|
||||
RUN dotnet build "./AutoBidder.csproj" -c $BUILD_CONFIGURATION -o /app/build --no-restore
|
||||
|
||||
# ============================================
|
||||
# STAGE 2: Publish
|
||||
# ============================================
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
# RIMOSSO --no-build per evitare errore path
|
||||
RUN dotnet publish "./AutoBidder.csproj" \
|
||||
-c $BUILD_CONFIGURATION \
|
||||
-o /app/publish \
|
||||
/p:UseAppHost=false
|
||||
|
||||
# ============================================
|
||||
# STAGE 3: Final Runtime
|
||||
# ============================================
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
|
||||
WORKDIR /app
|
||||
|
||||
# Install curl for healthcheck and sqlite3
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
ca-certificates \
|
||||
sqlite3 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create data directories for persistence
|
||||
RUN mkdir -p /app/Data /app/Data/backups /app/logs && \
|
||||
chmod 777 /app/Data /app/logs
|
||||
|
||||
# Copy published application
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
# Expose port (single HTTP for simplicity)
|
||||
EXPOSE 8080
|
||||
|
||||
# Environment variables (overridable via docker-compose/unraid)
|
||||
ENV ASPNETCORE_URLS=http://+:8080
|
||||
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||
ENV Kestrel__EnableHttps=false
|
||||
|
||||
# Database path - tutti i database SQLite e dati persistenti
|
||||
# Può essere sovrascritto nel docker-compose per mappare un volume persistente
|
||||
ENV DATA_PATH=/app/Data
|
||||
|
||||
# Autenticazione applicazione (OBBLIGATORIO)
|
||||
ENV ADMIN_USERNAME=admin
|
||||
ENV ADMIN_PASSWORD=
|
||||
|
||||
# Health check
|
||||
# Aumentato timeout e start-period per Blazor Server
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=90s --retries=5 \
|
||||
CMD curl -f http://localhost:8080/ || exit 1
|
||||
|
||||
# Labels for metadata
|
||||
LABEL org.opencontainers.image.title="AutoBidder" \
|
||||
org.opencontainers.image.description="Sistema automatizzato gestione aste Bidoo - Blazor .NET 8" \
|
||||
org.opencontainers.image.version="1.2.0" \
|
||||
org.opencontainers.image.vendor="Alby96" \
|
||||
org.opencontainers.image.source="https://gitea.encke-hake.ts.net/Alby96/Mimante"
|
||||
|
||||
# Entry point
|
||||
ENTRYPOINT ["dotnet", "AutoBidder.dll"]
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
______________________________________________________________________________________________________________
|
||||
FUNZIONALITA
|
||||
|
||||
Cambiare la pagina delle statistiche in modo da aggiungere una sezione in più, oltre alle statistiche memorizzate in un automatico, in cui posso associare un range di prezzo e di puntate per ogni articolo, identificato tramite il suo nome
|
||||
|
||||
Aggiungere una scansione periodica e automatica delle aste terminate in modo da aggiornare automaticamente il mio elenco degli articoli delle aste terminate per aggiornare prezzo e numero di puntate usate in automatico. Molto importante: salvare anche l'ora di chiusura dell'asta
|
||||
|
||||
Aggiungere una funzionalità di aggiunta automatica delle aste al monitor appena compaiono nell'elenco delle aste disponibile cercando tramite sezione e nome articolo
|
||||
|
||||
Aggiungi una indicazione visiva nella colonna dello stato che indica quando un'asta pur essendo nello stato attiva il bot non punta perché fuori range oppure per altri motivi
|
||||
|
||||
Fare una tasto nelle statistiche che applichi massivamente i limiti a tutti gli articoli attualmente monitorati che hanno delle informazioni salvate nel database delle aste terminate
|
||||
|
||||
_______________________________________________________________________________________________________________
|
||||
REWORK
|
||||
|
||||
Esegui un rework generico del sistema di log della singola asta e del log globale. Ci sono troppe righe inutili come tante righe simili duplicate nel log della singola asta e informazioni inutili nel log globale come per esempio l'indicazione del focus che si sposta su una certa riga. Valuta i cambiamenti e le ottimizzazioni da fare e applica le modifiche.
|
||||
|
||||
Esegui un rework della grafica in modo da eliminare le animazioni popup che danno fastidio all'usabilità del programma. In particolare intendo che quando il mouse passa su un pulsante o una griglia questa aumenta leggermente di dimensione per evidenziarsi ma questo non mi piace. Elimina questa cosa e sostituiscila piuttosto con una illuminazione o colorazione più chiara o scura per evidenziare il fatto che sto per selezionare quel particolare pulsante
|
||||
|
||||
_______________________________________________________________________________________________________________
|
||||
CORREZIONI
|
||||
|
||||
Aggiungi più stati per indicare la strategia o il fatto che non sta puntando e per quale motivo.
|
||||
In particolare oltre agli stati già presenti indicare anche il motivo per cui non sta puntando come per esempio "fuori range di prezzo", "fuori range di puntate", "asta terminata", "strategia non permette puntata", ecc
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="17px" height="18px" viewBox="0 0 17 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: sketchtool 57.1 (101010) - https://sketch.com -->
|
||||
<title>E3DC3394-397D-4994-B12B-47234FB13863</title>
|
||||
<desc>Created with sketchtool.</desc>
|
||||
<g id="Product-Pages" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Home---Portrait-Version-A-Copy-6" transform="translate(-77.000000, -637.000000)">
|
||||
<g id="Group-20" transform="translate(63.000000, 553.000000)">
|
||||
<g id="Group-17-Copy" transform="translate(14.000000, 84.000000)">
|
||||
<g id="001-settings" transform="translate(0.000000, 0.500000)">
|
||||
<path d="M15.6392002,7.48800011 C14.1532002,7.20200011 13.4720002,5.46640008 14.3672002,4.24600006 L14.9952002,3.38800005 L13.6376002,2.03040003 L12.7936002,2.60200004 C11.5408002,3.45200005 9.83120015,2.70520004 9.60160014,1.21000002 L9.44080014,0.160000002 L7.52040011,0.160000002 L7.27200011,1.45360002 C6.9920001,2.90520004 5.31720008,3.59920005 4.09200006,2.76920004 L3.00320004,2.03040003 L1.64520002,3.38800005 L2.27360003,4.24600006 C3.16880005,5.46640008 2.48600004,7.20200011 1.00160001,7.48800011 L0,7.68040011 L0,9.60080014 L1.05000002,9.76160015 C2.54520004,9.99120015 3.29200005,11.7008002 2.44200004,12.9536002 L1.87040003,13.7976002 L3.22800005,15.1552002 L4.08600006,14.5272002 C5.30640008,13.6320002 7.0420001,14.3132002 7.32800011,15.7992002 L7.52040011,16.8008003 L9.44080014,16.8008003 L9.55320014,16.0616002 C9.78920015,14.5336002 11.5608002,13.7992002 12.8080002,14.7132002 L13.4108002,15.1552002 L14.7688002,13.7976002 L14.1968002,12.9536002 C13.3484002,11.7008002 14.0936002,9.99120015 15.5892002,9.76160015 L16.6408002,9.60080014 L16.6408002,7.68040011 L15.6392002,7.48800011 Z M8.47960013,10.0804002 C7.68440011,10.0804002 7.0408001,9.43520014 7.0408001,8.63960013 C7.0408001,7.84440012 7.68440011,7.20080011 8.47960013,7.20080011 C9.27520014,7.20080011 9.92040015,7.84440012 9.92040015,8.63960013 C9.92040015,9.43520014 9.27520014,10.0804002 8.47960013,10.0804002 Z" id="Fill-1" fill="#C7CAC7"/>
|
||||
<path d="M8.47960013,5.60080008 C6.8016001,5.60080008 5.44080008,6.9616001 5.44080008,8.63960013 C5.44080008,10.3192002 6.8016001,11.6804002 8.47960013,11.6804002 C10.1592002,11.6804002 11.5204002,10.3192002 11.5204002,8.63960013 C11.5204002,6.9616001 10.1592002,5.60080008 8.47960013,5.60080008 Z M8.47960013,10.0804002 C7.68440011,10.0804002 7.0408001,9.43520014 7.0408001,8.63960013 C7.0408001,7.84440012 7.68440011,7.20080011 8.47960013,7.20080011 C9.27520014,7.20080011 9.92040015,7.84440012 9.92040015,8.63960013 C9.92040015,9.43520014 9.27520014,10.0804002 8.47960013,10.0804002 Z" id="Fill-2" fill="#556080"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18.96 32.35"><defs><style>.cls-1{fill:#38454f;}.cls-2{fill:#1caee4;}.cls-3{fill:#1081e0;}.cls-4{fill:#cbd4d8;}.cls-5{fill:#546a79;}</style></defs><title>Asset 10002-app</title><g id="Layer_2" data-name="Layer 2"><g id="Livello_1" data-name="Livello 1"><path class="cls-1" d="M15.76,32.35H3.2A3.21,3.21,0,0,1,0,29.14V3.2A3.2,3.2,0,0,1,3.2,0H15.76A3.2,3.2,0,0,1,19,3.2V29.14A3.21,3.21,0,0,1,15.76,32.35Z"/><rect class="cls-2" x="1.67" y="3.35" width="15.61" height="23.98"/><path class="cls-3" d="M3.35,7.81a.56.56,0,0,0,.39-.17L6,5.41a.56.56,0,0,0,0-.79.57.57,0,0,0-.79,0L3,6.86a.54.54,0,0,0,0,.78A.56.56,0,0,0,3.35,7.81Z"/><path class="cls-3" d="M3.35,10.6a.56.56,0,0,0,.39-.17L4.86,9.32a.57.57,0,0,0,0-.79.56.56,0,0,0-.79,0L3,9.64a.57.57,0,0,0,.4,1Z"/><path class="cls-3" d="M5.18,7.41a.59.59,0,0,0-.16.4.57.57,0,0,0,.16.39.6.6,0,0,0,.4.17A.58.58,0,0,0,6,8.2a.57.57,0,0,0,.16-.39.56.56,0,0,0-1-.4Z"/><path class="cls-3" d="M6.3,7.09a.54.54,0,0,0,.39.16.57.57,0,0,0,.4-.16L8.76,5.41a.56.56,0,0,0,0-.79.57.57,0,0,0-.79,0L6.3,6.3A.56.56,0,0,0,6.3,7.09Z"/><path class="cls-3" d="M8,7.41l-5,5a.56.56,0,0,0,.4,1,.54.54,0,0,0,.39-.16l5-5a.56.56,0,0,0,0-.79A.57.57,0,0,0,8,7.41Z"/><path class="cls-3" d="M9.08,6.3a.57.57,0,0,0-.16.39.59.59,0,0,0,.16.4.61.61,0,0,0,.4.16A.55.55,0,0,0,10,6.69a.57.57,0,0,0-.16-.39A.59.59,0,0,0,9.08,6.3Z"/><path class="cls-3" d="M11.55,4.62a.57.57,0,0,0-.79,0l-.56.56a.56.56,0,0,0,.4,1A.54.54,0,0,0,11,6l.56-.56A.56.56,0,0,0,11.55,4.62Z"/><path class="cls-4" d="M11.15,2.23H7.81a.56.56,0,0,1-.56-.56.55.55,0,0,1,.56-.55h3.34a.55.55,0,0,1,.56.55A.56.56,0,0,1,11.15,2.23Z"/><path class="cls-5" d="M16.17,2.23h-.56a.56.56,0,0,1-.55-.56.55.55,0,0,1,.55-.55h.56a.55.55,0,0,1,.56.55A.56.56,0,0,1,16.17,2.23Z"/><path class="cls-5" d="M13.94,2.23h-.56a.56.56,0,0,1-.55-.56.55.55,0,0,1,.55-.55h.56a.55.55,0,0,1,.56.55A.56.56,0,0,1,13.94,2.23Z"/><path class="cls-4" d="M10.87,30.67H8.09a.84.84,0,0,1-.84-.83h0A.85.85,0,0,1,8.09,29h2.78a.85.85,0,0,1,.84.84h0A.84.84,0,0,1,10.87,30.67Z"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.83 32.52"><defs><style>.cls-1{fill:#ffd039;}.cls-2{fill:#f4b70c;}.cls-3{fill:#ffbb64;}.cls-4{fill:#ffae47;}.cls-5{fill:#ffdf65;}.cls-6{fill:#ffcd2c;}.cls-7{fill:#ffa035;}.cls-8{fill:#f78819;}</style></defs><title>Asset 9002-cup</title><g id="Layer_2" data-name="Layer 2"><g id="Livello_1" data-name="Livello 1"><path class="cls-1" d="M31.05,5.85h0a3.61,3.61,0,0,0-2.83-1.36H24.84a.47.47,0,0,0-.47.48V7.05a.47.47,0,0,0,.47.48h3.38a.56.56,0,0,1,.45.22.58.58,0,0,1,.11.46,9,9,0,0,1-1.93,4,5.79,5.79,0,0,1-2.37,1.58.46.46,0,0,0-.31.34,8.32,8.32,0,0,1-.84,2.26.46.46,0,0,0,0,.5.46.46,0,0,0,.39.2h.08a9,9,0,0,0,5.27-2.83,11.8,11.8,0,0,0,2.64-5.33A3.61,3.61,0,0,0,31.05,5.85Z"/><path class="cls-2" d="M27,12.28V12l-.15.16a5.79,5.79,0,0,1-2.37,1.58.46.46,0,0,0-.31.34,8.32,8.32,0,0,1-.84,2.26.46.46,0,0,0,0,.5.46.46,0,0,0,.39.2h.08a10,10,0,0,0,2.22-.65A9.45,9.45,0,0,0,27,12.28Z"/><path class="cls-2" d="M24.37,5V7.05a.47.47,0,0,0,.47.48H27v-3H24.84A.47.47,0,0,0,24.37,5Z"/><path class="cls-3" d="M19.5,28.05c-.14-.11-1.42-1.18-1.58-7a.49.49,0,0,0-.17-.36.54.54,0,0,0-.39-.1,8.66,8.66,0,0,1-1.44.13h0a8.69,8.69,0,0,1-1.45-.13.54.54,0,0,0-.39.1.49.49,0,0,0-.17.36c-.16,5.8-1.44,6.87-1.58,7a.44.44,0,0,0-.32.5.51.51,0,0,0,.5.42h6.81a.51.51,0,0,0,.5-.42A.44.44,0,0,0,19.5,28.05Z"/><path class="cls-4" d="M19.5,28.05c-.14-.11-1.42-1.18-1.58-7a.49.49,0,0,0-.17-.36.54.54,0,0,0-.39-.1,8.66,8.66,0,0,1-1.44.13h0l-.46,0a.48.48,0,0,1,.16.35c.16,5.8,1.43,6.87,1.58,7a.44.44,0,0,1,.32.5A.51.51,0,0,1,17,29h2.31a.51.51,0,0,0,.5-.42A.44.44,0,0,0,19.5,28.05Z"/><path class="cls-1" d="M.79,5.85h0A3.58,3.58,0,0,1,3.61,4.49H7A.47.47,0,0,1,7.46,5V7.05A.47.47,0,0,1,7,7.53H3.61a.56.56,0,0,0-.45.22.58.58,0,0,0-.11.46,9,9,0,0,0,1.93,4,5.79,5.79,0,0,0,2.37,1.58.46.46,0,0,1,.31.34,8.32,8.32,0,0,0,.84,2.26.46.46,0,0,1,0,.5.46.46,0,0,1-.39.2H8a9,9,0,0,1-5.27-2.83A11.8,11.8,0,0,1,.09,8.89,3.58,3.58,0,0,1,.79,5.85Z"/><path class="cls-2" d="M4.83,12.28V12l.15.16a5.79,5.79,0,0,0,2.37,1.58.46.46,0,0,1,.31.34,8.32,8.32,0,0,0,.84,2.26.46.46,0,0,1,0,.5.46.46,0,0,1-.39.2H8a10.16,10.16,0,0,1-2.22-.65A9.45,9.45,0,0,1,4.83,12.28Z"/><path class="cls-2" d="M7.46,5V7.05A.47.47,0,0,1,7,7.53H4.83v-3H7A.47.47,0,0,1,7.46,5Z"/><path class="cls-5" d="M24.84,2.76H7a.47.47,0,0,0-.48.48v9a9.41,9.41,0,1,0,18.81,0v-9A.47.47,0,0,0,24.84,2.76Z"/><path class="cls-6" d="M24.84,2.76H22.62a.47.47,0,0,1,.47.48v9a9.41,9.41,0,0,1-8.29,9.34,8.32,8.32,0,0,0,1.12.07,9.42,9.42,0,0,0,9.4-9.41v-9A.47.47,0,0,0,24.84,2.76Z"/><path class="cls-7" d="M20.06,11.17a1.05,1.05,0,0,0,.27-1.08,1,1,0,0,0-.85-.71l-1.76-.26a.08.08,0,0,1-.07,0l-.79-1.6a1,1,0,0,0-.94-.58h0a1,1,0,0,0-.95.58l-.79,1.6a.08.08,0,0,1-.07,0l-1.76.26a1,1,0,0,0-.85.71,1.05,1.05,0,0,0,.27,1.08L13,12.41a.1.1,0,0,1,0,.09l-.3,1.75a1.05,1.05,0,0,0,1.53,1.11l1.57-.83H16l1.57.83a1.11,1.11,0,0,0,.49.12,1.07,1.07,0,0,0,.62-.2,1,1,0,0,0,.42-1l-.3-1.75a.14.14,0,0,1,0-.09Z"/><path class="cls-8" d="M19.48,9.38,19,9.31,16.74,11.5a.57.57,0,0,0-.17.51l.52,3.11.44.24a1.11,1.11,0,0,0,.49.12,1.07,1.07,0,0,0,.62-.2,1,1,0,0,0,.42-1l-.3-1.75a.14.14,0,0,1,0-.09l1.27-1.24a1.05,1.05,0,0,0,.27-1.08A1,1,0,0,0,19.48,9.38Z"/><path class="cls-5" d="M25.12,31.89A5.14,5.14,0,0,0,20.43,28h-9a5.14,5.14,0,0,0-4.69,3.88.47.47,0,0,0,.07.43.49.49,0,0,0,.39.2h17.5a.48.48,0,0,0,.38-.2A.47.47,0,0,0,25.12,31.89Z"/><path class="cls-6" d="M25.12,31.89A5.14,5.14,0,0,0,20.43,28H16.77a5.14,5.14,0,0,1,4.69,3.88.5.5,0,0,1-.07.43.49.49,0,0,1-.39.2h3.67a.48.48,0,0,0,.38-.2A.47.47,0,0,0,25.12,31.89Z"/><path class="cls-1" d="M25.62,0H6.21a1.86,1.86,0,0,0,0,3.71H25.62a1.86,1.86,0,0,0,0-3.71Z"/><path class="cls-2" d="M25.62,0H23.46a1.86,1.86,0,1,1,0,3.71h2.16a1.86,1.86,0,0,0,0-3.71Z"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,215 @@
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
* copy, modify, and distribute this software in source code or binary form for use
|
||||
* in connection with the web services and APIs provided by Facebook.
|
||||
*
|
||||
* As with any software that integrates with the Facebook platform, your use of
|
||||
* this software is subject to the Facebook Platform Policy
|
||||
* [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
* included in all copies or substantial portions of the software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},i(e)}function l(e,t,n){return t=d(t),s(e,c()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function s(e,t){if(t&&(i(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function u(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function m(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,k(r.key),r)}}function g(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){return S(e)||v(e,t)||C(e,t)||y()}function y(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(e,t){if(e){if(typeof e=="string")return b(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function b(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(n!=null){var r,o,a,i,l=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}function S(e){if(Array.isArray(e))return e}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?R(Object(n),!0).forEach(function(t){E(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function E(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){var t=I(e,"string");return i(t)=="symbol"?t:t+""}function I(e,t){if(i(e)!="object"||!e)return e;var n=e[typeof Symbol=="function"?Symbol.toPrimitive:"@@toPrimitive"];if(n!==void 0){var r=n.call(e,t||"default");if(i(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsCollapseUserData",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},a=o.exports;return(function(){"use strict";function e(e,t){if(e==null)return null;var n=Object.keys(e).some(function(n){return Object.prototype.hasOwnProperty.call(t,n)&&e[n]!==t[n]});return n?null:L(L({},e),t)}o.exports=e})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsExtractEventPayload",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsEvents"),n=e.getIWLParameters,r=a.getFbeventsModules("signalsFBEventsExtractFromInputs"),i=a.getFbeventsModules("signalsFBEventsExtractPageFeatures");function l(e){var o=e.button,a=e.buttonFeatures,l=e.buttonText,s=e.form,u=e.pixel,c=e.shouldExtractUserData,d=c&&s==null,m=r({button:o,containerElement:d?t:s,shouldExtractUserData:c}),p=i(),_=m.formFieldFeatures,f=m.userData,g=m.alternateUserData,h=m.rawCensoredUserData,y={buttonFeatures:a,buttonText:l,formFeatures:d?[]:_,pageFeatures:p,parameters:n.trigger({pixel:u,target:o})[0]};return[y,f,g,h]}o.exports=l})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsExtractFormFieldFeatures",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsPixelPIIUtils"),t=e.extractPIIFields;function n(e,n){var r={id:e.id,name:e.name,tag:e.tagName.toLowerCase()},o={},a={},i={};if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.placeholder!==""&&(r.placeholder=e.placeholder),r.tag==="input"&&(r.inputType=e.getAttribute("type"),n&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))){var l=t(r,e);l!=null&&(o=l.normalized,a=l.rawCensored,i=l.alternateNormalized)}return!(e instanceof HTMLButtonElement)&&e.value===""&&(r.valueMeaning="empty"),[r,o,i,a]}o.exports=n})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsExtractFromInputs",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsFeatureCounter"),t=a.getFbeventsModules("signalsFBEventsCollapseUserData"),n=a.getFbeventsModules("signalsFBEventsExtractFormFieldFeatures"),r=15,i="input,textarea,select,button";function l(o){var a=o.button,l=o.containerElement,s=o.shouldExtractUserData,u=new e,c=[],d={},m={},p={};if(l==null)return{formFieldFeatures:c,userData:d,alternateUserData:m,rawCensoredUserData:p};for(var _=l.querySelectorAll(i),f=0;f<_.length;f++){var g=_[f];if(g instanceof HTMLInputElement||g instanceof HTMLTextAreaElement||g instanceof HTMLSelectElement||g instanceof HTMLButtonElement){var y="".concat(g.tagName).concat(g.type===void 0?"":g.type),C=u.incrementAndGet(y);if(C>r||g===a)continue;var b=n(g,s&&d!=null),v=h(b,4),S=v[0],R=v[1],L=v[2],E=v[3];S!=null&&c.push(S),d=t(d,R),p=t(p,E),m=t(m,L)}}return{formFieldFeatures:c,userData:d,alternateUserData:m,rawCensoredUserData:p}}o.exports=l})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsExtractPageFeatures",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsShared"),n=e.unicodeSafeTruncate,r=500;function i(){var e=t.querySelector("title"),o=n(e&&e.text,r);return{title:o}}o.exports=i})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsFeatureCounter",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},a=o.exports;return(function(){"use strict";var e=(function(){function e(){_(this,e),E(this,"_features",{})}return g(e,[{key:"incrementAndGet",value:function(t){return this._features[t]==null&&(this._features[t]=0),this._features[t]++,this._features[t]}}])})();o.exports=e})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsMakeSafeString",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsUtils"),t=e.each,n=/[^\s\"]/,r=/[^\s:+\"]/;function i(e,t,o){return o==null?n.test(t)?t==="@"?null:{start:e,userOrDomain:"user"}:null:t==="@"?o.userOrDomain==="domain"?null:L(L({},o),{},{userOrDomain:"domain"}):t==="."?o.userOrDomain==="domain"&&o.lastDotIndex===e-1?null:L(L({},o),{},{lastDotIndex:e}):o.userOrDomain==="domain"&&r.test(t)===!1||o.userOrDomain==="user"&&n.test(t)===!1?o.lastDotIndex===e-1?null:L(L({},o),{},{end:e-1}):o}function l(e,t){return e.userOrDomain==="domain"&&e.lastDotIndex!=null&&e.lastDotIndex!==t-1&&e.start!=null&&e.end!=null&&e.end!==e.lastDotIndex}function s(e){for(var n=null,r=e,o=[],a=0;a<r.length;a++)n=i(a,r[a],n),n!=null&&(l(n,r.length)?o.push(n):a===r.length-1&&(n.end=a,l(n,r.length)&&o.push(n)),n.end!=null&&(n=null));return t(o.reverse(),function(e){var t=e.start,n=e.end;n!=null&&(r=r.slice(0,t)+"@"+r.slice(n+1))}),r}var u=/[\d]+(\.[\d]+)?/g;function c(e){for(var t=e;/\d\.\d/.test(t);)t=t.replace(u,"0");return t=t.replace(u,"0"),t}function d(e){return{safe:c(s(e))}}o.exports=d})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsThrottler",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},a=o.exports;return(function(){"use strict";var e=1e3,t=(function(){function t(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e;_(this,t),E(this,"_lastArgs",null),E(this,"_lastTime",0),this._rateMS=n}return g(t,[{key:"_passesThrottleImpl",value:function(){var e=this._lastArgs;if(e==null)return!0;var t=Date.now(),n=t-this._lastTime;if(n>=this._rateMS||e.length!==arguments.length)return!0;for(var r=0;r<arguments.length;r++)if((r<0||arguments.length<=r?void 0:arguments[r])!==e[r])return!0;return!1}},{key:"passesThrottle",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=this._passesThrottleImpl.apply(this,t);return this._lastTime=Date.now(),this._lastArgs=t,r}}])})();o.exports=t})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.inferredevents",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var n=a.getFbeventsModules("SignalsFBEventsGuardrail"),r=a.getFbeventsModules("SignalsFBEventsConfigStore"),i=a.getFbeventsModules("SignalsFBEventsQEV2"),s=a.getFbeventsModules("SignalsFBEventsExperimentNames"),u=s.BUTTON_CLICK_OPTIMIZE_EXPERIMENT_V2,c=a.getFbeventsModules("SignalsFBEventsEvents"),d=c.fired,p=c.piiConflicting,f=c.extractPii,y=a.getFbeventsModules("SignalsFBEventsShared"),C=y.signalsConvertNodeToHTMLElement,b=y.signalsExtractForm,v=y.signalsIsIWLElement,S=y.signalsExtractButtonFeatures,R=y.signalsGetTruncatedButtonText,k=y.signalsGetWrappingButton,I=a.getFbeventsModules("SignalsFBEventsPlugin"),T=a.getFbeventsModules("SignalsFBEventsThrottler"),D=a.getFbeventsModules("SignalsFBEventsUtils"),x=a.getFbeventsModules("signalsFBEventsExtractEventPayload"),$=a.getFbeventsModules("signalsFBEventsMakeSafe"),P=a.getFbeventsModules("signalsFBEventsMakeSafeString"),N=D.each,M=D.keys,w=a.getFbeventsModules("signalsFBEventsExtractFromInputs"),A=new T,F=a.getFbeventsModules("signalsFBEventsDoAutomaticMatching"),O=100;function B(e,t){return t!=null&&t.buttonSelector==="extended"}function W(e){return function(n){if(!e.disableAutoConfig){var t=n.target instanceof Node?C(n.target):null;if(t!=null){if(v(t)||!A.passesThrottle(t))return;var o=null,a=null,l=e.getOptedInPixels("InferredEvents");N(l,function(n){var o=r.get(n.id,"inferredEvents"),a=!1;o!=null&&o.disableRestrictedData!=null&&(a=o.disableRestrictedData);var l=B(n.id,o),s;s=k(t,l,!1);var c={},d=Date.now().toString();if(s==null&&(s=k(t,l,!0),s!=null&&(c=L(L({},c),{},{"ie[e]":"1"}),i.isInTest(u,d))),s!=null){var m=e.optIns.isOptedIn(n.id,"AutomaticMatching"),_=e.optIns.isOptedIn(n.id,"OpenBridge"),f=b(s),g=S(s,f),y=g?g.innerText:null,C=P(y!=null?y:R(s)).safe;if(!(C!=null&&C.length>O)){var v,E,I,T,D=m||_,$=x({button:s,buttonFeatures:g,buttonText:C,form:f,pixel:n,shouldExtractUserData:D}),N=h($,4);v=N[0],E=N[1],I=N[2],T=N[3],a&&(v={}),E==null&&p.trigger(n),m&&E!=null&&F(e,n,E,I,T||{}),_&&E!=null&&q(n,E),!(a&&(n.userDataFormFields==null||M(n.userDataFormFields).length===0)&&(n.sgwUserDataFormFields==null||M(n.sgwUserDataFormFields).length===0))&&e.trackSingleSystem("automatic",n,"SubscribedButtonClick",v,{},c,d)}}})}}}}function q(e,t){if(e.sgwUserDataFormFields==null)e.sgwUserDataFormFields=t;else for(var n in t){var r=t[n];r!=null&&typeof r=="string"&&r.trim().length>0&&e.sgwUserDataFormFields&&(e.sgwUserDataFormFields[n]=r)}}function U(e,n,r,o,a){if(!e.disableAutoConfig){var i=e.optIns.isOptedIn(n.id,"InferredEvents");if(i){var l=e.optIns.isOptedIn(n.id,"AutomaticMatching");if(l){var s=r==null,u=w({button:o,containerElement:s?t:r,shouldExtractUserData:!0}),c=u.userData,d=u.alternateUserData,m=u.rawCensoredUserData;c==null?p.trigger(n):F(e,n,c,d,m||{},a)}}}}var V=(function(e){function t(){var e;_(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=l(this,t,[].concat(r)),E(e,"extractPII",U),e}return m(t,e),g(t)})(I);o.exports=new V(function(n,r){d.listenOnce(function(){var n=$(W(r));t.addEventListener?t.addEventListener("click",n,{capture:!0,once:!1,passive:!0}):e.attachEvent("onclick",n)}),f.listen(function(e,t,n){return U(r,e,t,n)})})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.inferredevents"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.inferredevents",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.inferredevents",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},i(e)}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function s(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e){var t=c(e,"string");return i(t)=="symbol"?t:t+""}function c(e,t){if(i(e)!="object"||!e)return e;var n=e[typeof Symbol=="function"?Symbol.toPrimitive:"@@toPrimitive"];if(n!==void 0){var r=n.call(e,t||"default");if(i(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t,n){return t=g(t),p(e,f()?Reflect.construct(t,n||[],g(e).constructor):t.apply(e,n))}function p(e,t){if(t&&(i(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function _(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function h(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function C(e,t){return L(e)||R(e,t)||v(e,t)||b()}function b(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(e,t){if(e){if(typeof e=="string")return S(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function S(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function R(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(n!=null){var r,o,a,i,l=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}function L(e){if(Array.isArray(e))return e}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("fbevents.plugins.identity",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("fbevents.plugins.iwlbootstrapper",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function l(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t,n){return t=p(t),c(e,m()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function c(e,t){if(t&&(b(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function d(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function _(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function g(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){var t=y(e,"string");return b(t)=="symbol"?t:t+""}function y(e,t){if(b(e)!="object"||!e)return e;var n=e[typeof Symbol=="function"?Symbol.toPrimitive:"@@toPrimitive"];if(n!==void 0){var r=n.call(e,t||"default");if(b(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function C(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=R(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){l=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(l)throw a}}}}function b(e){"@babel/helpers - typeof";return b=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},b(e)}function v(e){return E(e)||L(e)||R(e)||S()}function S(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function R(e,t){if(e){if(typeof e=="string")return k(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function L(e){if(typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]!=null||e["@@iterator"]!=null)return Array.from(e)}function E(e){if(Array.isArray(e))return k(e)}function k(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsFbcCombiner",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsURLUtil"),t=e.getURLParameterWithValidationCheck,n="clickID",r="fbclid";function i(e,t){var n=new Map(e.map(function(e){return[e.paramConfig.query,e]}));return t.forEach(function(e){n.has(e.paramConfig.query)||n.set(e.paramConfig.query,e)}),Array.from(n.values())}function l(e){var t="";return e.forEach(function(e){var n=e.paramValue;if(n!=null&&n!==""){var r=e.paramConfig.prefix!==""?"_".concat(e.paramConfig.prefix,"_").concat(n):"_".concat(n),o=Array.from(t.matchAll(/_([a-zA-Z_]+)_/g)).map(function(e){return e[1]}),a=o.filter(function(t){return t!==e.paramConfig.prefix}).map(function(e){return"_".concat(e,"_")}).join("|"),i=a?new RegExp("_".concat(e.paramConfig.prefix,"_.*?(?=").concat(a,"|$)")):new RegExp("_".concat(e.paramConfig.prefix,"_.*?$"));t.match(i)?t=t.replace(i,r):t===""?t=e.paramConfig.prefix!==""?"".concat(e.paramConfig.prefix,"_").concat(n):n:t+=r}}),t===""?null:t}function s(e,t){var n=i(e,t),o="",a=!1,s=v(n).sort(function(e,t){return e.paramConfig.query===r?-1:t.paramConfig.query===r?1:e.paramConfig.query.localeCompare(t.paramConfig.query)}),u=l(s);return u}function u(e,n){var o=n.params;if(o==null||o.length===0)return null;var a=new Map;if(o.forEach(function(n){var r=t(e,n.query);r!=null&&r!==""&&a.set(n.query,r)}),a.size===0)return null;var i=v(o).filter(function(e){return a.has(e.query)}).filter(function(e){return e.query===r||e.prefix!==""}).map(function(e){return{paramConfig:e,paramValue:a.get(e.query)||""}}).sort(function(e,t){return e.paramConfig.query===r?-1:t.paramConfig.query===r?1:e.paramConfig.query.localeCompare(t.paramConfig.query)}),s=l(i);return s}o.exports={combineFbcParamsFromUrlAndEBP:s,combineFbcParamsFromUrl:u,getUniqueFbcParamConfigAndValue:i,constructFbcFromSortedParamValues:l}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsGetIsSafariOrMobileSafari",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},a=o.exports;return(function(){"use strict";function t(){var t=e.navigator;return t.userAgent.indexOf("Safari")!==-1&&t.userAgent.indexOf("Chrome")===-1}function n(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e.navigator.userAgent)}function r(){var t=e.navigator.userAgent.match(/OS (\d+)_(\d+)_?(\d+)?/);if(t==null||t.length<2)return!1;var n=[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3]||0,10)];return!(n[0]<14||n[0]===14&&n[1]<5)}function a(){return t()&&n()&&r()}o.exports={getIsMobileSafari:a,getIsSafari:t}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsIsHostFacebook",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},a=o.exports;return(function(){"use strict";o.exports=function(t){if(typeof t!="string")return!1;var e=t.match(/^(.*\.)*(facebook\.com|internalfb\.com|workplace\.com|instagram\.com|oculus\.com|novi\.com)\.?$/i);return e!==null}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsLocalStorageTypedef",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsTyped"),t=e.Typed,n=t.objectWithFields({setItem:t.func(),getItem:t.func()});o.exports=n})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsLocalStorageUtils",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var t=a.getFbeventsModules("SignalsFBEventsLocalStorageTypedef"),n=a.getFbeventsModules("SignalsFBEventsTyped"),r=n.coerce;function i(t,n){e.localStorage.setItem(t,n)}function l(t){return e.localStorage.getItem(t)}function s(t){e.localStorage.removeItem(t)}function u(){var n=null;try{n=r(e.localStorage,t)}catch(e){return!1}return n!=null}function c(e){var t=e.trim().toLowerCase();if(t.length===0)return!1;var n=["true","false","null","undefined","0","1"];return!n.includes(t)}function d(e){if(e==null)return null;var t=String(e);if(t.length===0||!c(t))return null;try{var n=JSON.parse(t);if(Array.isArray(n)&&n.length>0){var r=n.filter(function(e){return typeof e=="string"&&c(e)}).join(",");return r.length>0?r:null}else if(b(n)==="object"&&n!==null){var o=Object.values(n).filter(function(e){return typeof e=="string"&&c(e)}).join(",");return o.length>0?o:null}}catch(e){return t}return t}function m(e){for(var t=[/event/i,/click/i,/sent/i,/tracking/i,/analytics/i,/log/i,/flag/i,/toggle/i,/enabled/i,/disabled/i],n=0,r=t;n<r.length;n++){var o=r[n];if(o.test(e))return!0}return!1}function p(){if(!u())return null;try{for(var t=[/(last|recent).*search/i,/search.*(history|keyword)/i,/^search$/i],n=e.localStorage,r=[],o=0;o<n.length;o++){var a=n.key(o);if(a!=null&&!m(a)){var i=C(t),s;try{for(i.s();!(s=i.n()).done;){var c=s.value;if(c.test(a)){r.push(a);break}}}catch(e){i.e(e)}finally{i.f()}}}for(var p=0,_=r;p<_.length;p++){var f=_[p],g=l(f),h=d(g);if(h!=null)return h}}catch(e){return null}}o.exports={setLocalStorageItem:i,getLocalStorageItem:l,removeLocalStorageItem:s,isLocalStorageSupported:u,getSearchHistoryKeywords:p}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsShouldNotDropCookie",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var t=a.getFbeventsModules("signalsFBEventsIsHostFacebook"),n="FirstPartyCookies";o.exports=function(o,a){return e.location.protocol.substring(0,4)!=="http"||t(e.location.hostname)||a.disableFirstPartyCookies||a.getOptedInPixels(n).indexOf(o)===-1}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsURLUtil",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var n=a.getFbeventsModules("SignalsFBEventsGuardrail"),r=a.getFbeventsModules("SignalsFBEventsLogging"),i=r.logWarning,l=["javascript"];function s(e,t){var r=new RegExp("[?#&]"+t.replace(/[\[\]]/g,"\\$&")+"(=([^&#]*)|&|#|$)"),o=r.exec(e);if(!o)return null;if(!o[2])return"";var a=n.eval("fix_fbevent_uri_error");if(a)try{return decodeURIComponent(o[2].replace(/\+/g," "))}catch(e){return i(e,"pixel","URLUtil"),o[2].replace(/\+/g," ")}else return decodeURIComponent(o[2].replace(/\+/g," "))}function u(e,t){var n=s(e,t);if(n!=null){var r=!0,o=n.toLowerCase();return l.forEach(function(e){o.includes(e)&&(r=!1)}),r?n:null}}function c(n){var r=null;return r=s(e.location.href,n),r!=null||(r=s(t.referrer,n)),r}o.exports={getURLParameter:s,getURLParameterWithValidationCheck:u,maybeGetParamFromUrlForEbp:c}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.cookie",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var n=a.getFbeventsModules("SignalsFBEventsEvents"),r=n.configLoaded,i=a.getFbeventsModules("SignalsFBEventsEvents"),c=i.getCustomParameters,d=i.getClickIDFromBrowserProperties,m=i.setEventId,p=a.getFbeventsModules("SignalsFBEventsPixelCookie"),f=a.getFbeventsModules("SignalsFBEventsPlugin"),h=a.getFbeventsModules("SignalsFBEventsURLUtil"),y=h.getURLParameterWithValidationCheck,C=a.getFbeventsModules("SignalsFBEventsFbcCombiner"),b=C.combineFbcParamsFromUrl,S=a.getFbeventsModules("signalsFBEventsShouldNotDropCookie"),R=a.getFbeventsModules("SignalsPixelCookieUtils"),L=R.readPackedCookie,E=R.writeNewCookie,k=R.writeExistingCookie,I=R.CLICK_ID_PARAMETER,T=R.CLICKTHROUGH_COOKIE_NAME,D=R.CLICKTHROUGH_COOKIE_PARAM,x=R.DOMAIN_SCOPED_BROWSER_ID_COOKIE_NAME,$=R.DOMAIN_SCOPED_BROWSER_ID_COOKIE_PARAM,P=R.DEFAULT_FBC_PARAM_CONFIG,N=R.DEFAULT_ENABLE_FBC_PARAM_SPLIT,M=R.MULTI_CLICKTHROUGH_COOKIE_PARAM,w=R.NINETY_DAYS_IN_MS,A=a.getFbeventsModules("SignalsFBEventsLocalStorageUtils"),F=A.getLocalStorageItem,O=A.setLocalStorageItem,B=A.isLocalStorageSupported,W=a.getFbeventsModules("signalsFBEventsGetIsSafariOrMobileSafari"),q=W.getIsSafari,U=a.getFbeventsModules("SignalsFBEventsLogging"),V=U.logWarning,H=a.getFbeventsModules("signalsFBEventsFeatureGate"),G="_fbleid",z="fbleid",j=a.getFbeventsModules("SignalsParamList"),K=10080*60*1e3,Q=999999999,X="multiFbc",Y=",",J=["javascript"];function Z(){var e=Math.floor(Math.random()*Q),t=Math.floor(Math.random()*Q);return e.toString()+t.toString()}function ee(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e.location.href,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,o=y(n,I);if((o==null||o.trim()=="")&&(o=y(t.referrer,I)),(o==null||o.trim()=="")&&(o=r),o!=null&&o.length>500)return null;var a=L(T);return o!=null&&o.trim()!=""?a?(a.maybeUpdatePayload(o),k(T,a)):E(T,o):a?k(T,a):null}function te(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e.location.href,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,o=arguments.length>2?arguments[2]:void 0,a=r;if((a==null||a.trim()=="")&&(a=b(n,o),(a==null||a.trim()=="")&&(a=b(t.referrer,o))),a!=null&&a.length>500)return null;var i=L(T);return a!=null&&a.trim()!=""?i?(i.maybeUpdatePayload(a),k(T,i)):E(T,a):i?k(T,i):null}function ne(e,t){try{if(!B())return;var n=F(X);if(n==null?n="":n=String(n),n.includes(e))return n;var r=Date.now();r=typeof r=="number"?r:new Date().getTime();var o=n.split(",").slice(0,t-1).map(function(e){return p.unpack(e)}).filter(function(e){return e!=null&&e.creationTime!=null&&r-e.creationTime<w}).map(function(e){return e&&e.pack()}).filter(function(e){return e!=null&&e!==""}),a=[e].concat(v(o)).join(",");return O(X,a),a}catch(e){var i=e instanceof Error?e.message:String(e),l=new Error("[Multi Fbc Error] Error in adding multi fbc: "+i);e instanceof Error&&e.stack!=null&&(l.stack=e.stack),V(l,"pixel","cookie")}}function re(){var e=L(x);if(e)return k(x,e),e;var t=Z();return E(x,t)}var oe=(function(e){function t(){var e;s(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=u(this,t,[].concat(r)),g(e,"dropOrRefreshClickIDCookie",ee),g(e,"dropOrRefreshDomainScopedBrowserIDCookie",re),g(e,"dropOrRefreshFbcCookie",te),g(e,"addToMultiFbcQueue",ne),e}return _(t,e),l(t)})(f);o.exports=new oe(function(t,n){var o=null;d.listen(function(e){o=e});var a=P,i=N,l=N,s=N,u=0,m=!1;r.listen(function(t){var r=n.getPixel(t);if(r!=null){var c=n.pluginConfig.get(r.id,"cookie");if(c!=null&&c.fbcParamsConfig!=null&&(a=c.fbcParamsConfig),l=c!=null&&c.enableFbcParamSplitAll!=null?c.enableFbcParamSplitAll:N,s=c!=null&&c.enableFbcParamSplitSafariOnly!=null?c.enableFbcParamSplitSafariOnly:N,i=q()?s:l,c!=null&&c.maxMultiFbcQueueSize!=null&&(u=c.maxMultiFbcQueueSize,m=u>0),!S(r,n)){var d=ee(e.location.href,o);d!=null&&m&&ne(d.pack(),u)}}});function p(){c.listen(function(t,r,l,s,c){if(S(t,n))return{};var d={},p=ee(e.location.href,o),_=te(e.location.href,o,a);if(i&&_){var f=_.pack();if(d[D]=f,m){var g=ne(_.pack(),u)||f;d[M]=g}}else if(p){var h=p.pack();if(d[D]=p.pack(),m){var y=ne(p.pack(),u)||h;d[M]=y}}var C=re();if(C){var b=C.pack();d[$]=b}if(H("offsite_clo_beta_event_id_coverage",t.id)&&r!=="Lead"){var v=L(G);v!=null&&v.payload!=null&&(d.oed={event_id:v.payload})}return d})}p()})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.cookie"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.cookie",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.cookie",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},i(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){var t=d(e,"string");return i(t)=="symbol"?t:t+""}function d(e,t){if(i(e)!="object"||!e)return e;var n=e[typeof Symbol=="function"?Symbol.toPrimitive:"@@toPrimitive"];if(n!==void 0){var r=n.call(e,t||"default");if(i(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBevents.plugins.automaticmatchingforpartnerintegrations",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var t=a.getFbeventsModules("SignalsFBEventsConfigStore"),n=a.getFbeventsModules("SignalsFBEventsEvents"),r=n.configLoaded,i=n.piiAutomatched,l=a.getFbeventsModules("SignalsFBEventsPlugin"),u=a.getFbeventsModules("SignalsFBEventsUtils"),c=u.idx,d=u.isEmptyObject,m=u.keys,p=u.reduce,_=a.getFbeventsModules("SignalsPixelPIIUtils"),f=_.getNormalizedPIIValue;function g(){return c(e,function(e){return e.Shopify.checkout})!=null}var h={ct:function(){return c(e,function(e){return e.Shopify.checkout.billing_address.city})},em:function(){return c(e,function(e){return e.Shopify.checkout.email})},fn:function(){return c(e,function(e){return e.Shopify.checkout.billing_address.first_name})},ln:function(){return c(e,function(e){return e.Shopify.checkout.billing_address.last_name})},ph:function(){return c(e,function(e){return e.Shopify.checkout.billing_address.phone})},st:function(){return c(e,function(e){return e.Shopify.checkout.billing_address.province_code})},zp:function(){return c(e,function(e){return e.Shopify.checkout.billing_address.zip})}};function y(e){return g()?p(e,function(e,t){var n=h[t],r=n!=null?n():null,o=r!=null&&r!==""?f(t,r):null;return o!=null&&(e[t]=o),e},{}):null}o.exports=new l(function(e,n){r.listen(function(e){if(e!=null){var r=n.optIns.isOptedIn(e,"AutomaticMatching"),o=n.optIns.isOptedIn(e,"AutomaticMatchingForPartnerIntegrations"),a=r&&o;if(a){var l=n.getPixel(e);if(l!=null){var u=t.get(l.id,"automaticMatching");if(u!=null){var c=y(u.selectedMatchKeys);c==null||d(c)||(l.userDataFormFields=s(s({},l.userDataFormFields),c),i.trigger(l))}}}}})})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBevents.plugins.automaticmatchingforpartnerintegrations"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.automaticmatchingforpartnerintegrations",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.automaticmatchingforpartnerintegrations",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.prohibitedsources",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var t=a.getFbeventsModules("SignalsFBEventsConfigStore"),n=a.getFbeventsModules("SignalsFBEventsEvents"),r=n.configLoaded,i=a.getFbeventsModules("SignalsFBEventsLogging"),l=a.getFbeventsModules("SignalsFBEventsPlugin"),s=a.getFbeventsModules("SignalsFBEventsUtils"),u=s.filter,c=a.getFbeventsModules("sha256_with_dependencies_new");o.exports=new l(function(n,o){r.listen(function(n){var r=o.optIns.isOptedIn(n,"ProhibitedSources");if(r){var a=o.getPixel(n);if(a!=null){var l=t.get(a.id,"prohibitedSources");if(l!=null){var s=u(l.prohibitedSources,function(t){return t.domain!=null&&t.domain===c(e.location.hostname)}).length>0;s&&(o.locks.lock("prohibited_sources_".concat(n)),i.consoleWarn("[fbpixel] "+a.id+" is unavailable. Go to Events Manager to learn more"))}}}})})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.prohibitedsources"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.prohibitedsources",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.prohibitedsources",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("fbevents.plugins.unwanteddata",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=l(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){s=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if(typeof e=="string")return s(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},u(e)}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.iabpcmaebridge",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var n=a.getFbeventsModules("SignalsFBEventsEvents"),r=n.fired,i=n.setEventId,l=n.getCustomParameters,s=a.getFbeventsModules("SignalsFBEventsPlugin"),u=a.getFbeventsModules("SignalsParamList"),c=a.getFbeventsModules("signalsFBEventsGetIsIosInAppBrowser"),d=a.getFbeventsModules("signalsFBEventsGetIsAndroidIAW"),m=a.getFbeventsModules("SignalsFBEventsConfigStore"),p=a.getFbeventsModules("SignalsFBEventsGuardrail"),_=a.getFbeventsModules("sha256_with_dependencies_new"),f=a.getFbeventsModules("SignalsFBEventsLocalStorageUtils"),g=f.getSearchHistoryKeywords;function h(e){return(typeof e=="string"||e instanceof String)&&e.toUpperCase()==="LDU"}function y(e){try{if(e==null||typeof e!="string")return null;var t=JSON.parse(e);return t.conversionBit!=null&&typeof t.conversionBit=="number"&&t.priority!=null&&typeof t.priority=="number"&&t.etldOne!=null&&typeof t.etldOne=="string"?e:JSON.stringify({conversionBit:-1,priority:-1,etldOne:""})}catch(e){return null}}function C(e){if(e==null)return!1;var t=m.get(e,"IABPCMAEBridge");return!(t==null||t.enableAutoEventId==null||!t.enableAutoEventId)}o.exports=new s(function(n,o){!c()&&!d(null,null)||(l.listen(function(e,t){return C(e.id)?{iab:1}:{}}),i.listen(function(t,n){if(C(t)){var r="".concat(e.location.origin,"_").concat(Date.now(),"_").concat(Math.random()),o=_(r),a=n.get("eid");if(p.eval("multi_eid_fix",t)&&(a==null||a==="")&&(a=n.getEventId()),!(a!=null&&a!==""||o==null)){n.append("apcm_eid","1");var i="pcm_plugin-set_".concat(o);n.append("eid",i)}}}),r.listen(function(n,r){if(c()){var o=r.get("id"),a=r.get("ev"),i={},l=r.get("dpo"),s=r.get("dpoco"),u=r.get("dpost"),d=r.get("coo"),m=r.get("es"),_=r.getEventId(),f=r.get("apcm_eid"),C=r.get("iab"),b=y(r.get("aem")),v=p.eval("get_keywords_from_local_storage",o);if(v){var S=g();S!=null&&S.length>0&&r.append("lspk",S)}var R=!1;if((d==="false"||d==="true")&&(i.coo=d),m!==null&&(i.es=m),t!==null&&t.referrer!==null&&(i.referrer_link=t.referrer),h(l)){if(s==="1"&&u==="1000")return;s==="0"&&u==="0"&&(R=!0)}var L={id:o,ev:a,dpo:R,aem:b!=null?b:""},E=["eid","apcm_eid","iab","lspk"],k={};r.each(function(e,t){if(e){var n=e.match(/^cd\[(.+)\]$/);n?i[n[1]]=t:E.includes(e)&&(k[e]=t)}}),i.cd_extra=JSON.stringify(k),L.cd=JSON.stringify(i);var I={pcmPixelPostMessageEvent:L};e.postMessage(I,"*")}}))})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.iabpcmaebridge"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.iabpcmaebridge",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.iabpcmaebridge",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=R(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){l=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(l)throw a}}}}function l(e){"@babel/helpers - typeof";return l=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},l(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,C(r.key),r)}}function u(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t,n){return t=f(t),m(e,_()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function m(e,t){if(t&&(l(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function p(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function g(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function y(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C(e){var t=b(e,"string");return l(t)=="symbol"?t:t+""}function b(e,t){if(l(e)!="object"||!e)return e;var n=e[typeof Symbol=="function"?Symbol.toPrimitive:"@@toPrimitive"];if(n!==void 0){var r=n.call(e,t||"default");if(l(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function v(e){return E(e)||L(e)||R(e)||S()}function S(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function R(e,t){if(e){if(typeof e=="string")return k(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function L(e){if(typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]!=null||e["@@iterator"]!=null)return Array.from(e)}function E(e){if(Array.isArray(e))return k(e)}function k(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsBrowserPropertiesTypedef",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsTyped"),t=e.coerce,n=e.Typed,r=n.objectWithFields({open:n.func()});o.exports={XMLHttpRequestPrototypeTypedef:r}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.browserproperties",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var t=a.getFbeventsModules("SignalsFBEventsEvents"),n=t.configLoaded,r=a.getFbeventsModules("SignalsFBEventsEvents"),i=r.getClickIDFromBrowserProperties,l=a.getFbeventsModules("signalsFBEventsGetIsAndroidIAW"),s=a.getFbeventsModules("SignalsFBEventsLogging"),u=s.logWarning,c=a.getFbeventsModules("SignalsFBEventsPlugin"),d=a.getFbeventsModules("signalsFBEventsShouldNotDropCookie"),m=a.getFbeventsModules("SignalsFBEventsURLUtil"),p=m.maybeGetParamFromUrlForEbp,_=a.getFbeventsModules("SignalsParamList"),f=a.getFbeventsModules("SignalsFBEventsBrowserPropertiesTypedef"),g=f.XMLHttpRequestPrototypeTypedef,h=a.getFbeventsModules("SignalsFBEventsTyped"),y=h.coerce,C=a.getFbeventsModules("SignalsFBEventsFbcCombiner"),b=C.combineFbcParamsFromUrlAndEBP,v=a.getFbeventsModules("SignalsPixelCookieUtils"),S=v.CLICK_ID_PARAMETER,R=v.CLICKTHROUGH_COOKIE_PARAM,L=a.getFbeventsModules("SignalsFBEvents.plugins.cookie"),E=L.dropOrRefreshClickIDCookie,k=L.dropOrRefreshFbcCookie,I=[{prefix:"",query:"fbclid",ebp_path:"clickID"}],T={params:I},D=!1,x=T,$=D,P=D,N="browserProperties",M="pixel",w="browserProperties";function A(t,n,r){if(!(t==null||t==="")){var o=String(t);i.trigger(o);var a=n.id;if(!(a==null||o==null)){var l=r.getPixel(a.toString());if(l!=null){var s=d(l,r);if(!s){var u=n.customParams||new _,c=u.get(R);if(!(c!=null&&c!=="")){var m=E(e.location.href,o);m!=null&&(u.append(R,m.pack()),n.customParams=u)}}}}}}function F(t,n,r){if(!(t==null||t==="")){var o=String(t);i.trigger(o);var a=n.id;if(!(a==null||o==null)){var l=r.getPixel(a.toString());if(l!=null){var s=d(l,r);if(!s){var u=n.customParams||new _,c=u.get(R),m=k(e.location.href,o,x);m!=null&&(c==null||c===""?u.append(R,m.pack()):u.replaceEntry(R,m.pack()),n.customParams=u)}}}}}function O(t){var n=new Promise(function(n,r){var o=new e.XMLHttpRequest;o.onloadend=function(){if(o.readyState===o.DONE&&o.status>=200&&o.status<300){var e=t.asyncParamFetchers.get(N);e!=null&&e.result==null&&(e.result=o.responseText,t.asyncParamFetchers.set(N,e)),n(o.responseText)}else{var a=new Error("[EBP Error] Android, status="+o.status+", responseText="+o.responseText);u(a,M,w),r(a)}};try{var a=y(XMLHttpRequest.prototype,g);if(a!=null&&!a.open.toString().includes("native code")){var i=new Error("[EBP Error] XMLHttpRequest.prototype.open is overridden ");u(i,M,w),r(i)}o.open("GET","properties://browser/clickID"),o.send()}catch(e){var l=new Error("[EBP Error] XMLHttpRequest.prototype.open call failed");u(l,M,w),r(l)}});t.asyncParamFetchers.set(N,{request:n,callback:A}),t.asyncParamPromisesAllSettled=!1}function B(t,n,r){var o=new Promise(function(t,o){var a=[],i=[];n.forEach(function(t){var n=t.ebp_path;if(n!==""){var r=new Promise(function(r,o){var i=new e.XMLHttpRequest;i.onloadend=function(){if(i.readyState===i.DONE&&i.status>=200&&i.status<300)a.push({paramConfig:t,paramValue:i.responseText}),r(i.responseText);else{var e=new Error("[EBP Error], status="+i.status+", responseText="+i.responseText);u(e,M,w),o(e)}};try{var l=y(XMLHttpRequest.prototype,g);if(l!=null&&!l.open.toString().includes("native code")){var s=new Error("[EBP Error] XMLHttpRequest.prototype.open is overridden ");u(s,M,w),o(s)}}catch(e){u(e,M,w),o(e)}i.open("GET","properties://browser/"+n),i.send()});i.push(r)}}),Promise.allSettled(i).then(function(){var e=b(r,a);t(e)})});t.asyncParamFetchers.set(N,{request:o,callback:F}),t.asyncParamPromisesAllSettled=!1}function W(t){var n=e.webkit.messageHandlers.browserProperties.postMessage("clickID");n.then(function(e){var n=t.asyncParamFetchers.get(N);return n!=null&&n.result==null&&(n.result=e,t.asyncParamFetchers.set(N,n)),e}).catch(function(e){e.message="[EBP Error] Fetch error"+e.message,u(e,M,w)}),t.asyncParamFetchers.set(N,{request:n,callback:A}),t.asyncParamPromisesAllSettled=!1}function q(t,n,r){var o=[],a=[],i=new Promise(function(i,l){n.forEach(function(t){var n=t.ebp_path;if(n!==""){var r=e.webkit.messageHandlers.browserProperties.postMessage(n);r.then(function(e){return o.push({paramConfig:t,paramValue:e}),e}).catch(function(e){e.message="[EBP Error]"+e.message,u(e,M,w),l(e)}),a.push(r)}}),Promise.allSettled(a).then(function(e){var n=b(r,o),a=t.asyncParamFetchers.get(N);a!=null&&a.result==null&&(a.result=n,t.asyncParamFetchers.set(N,a)),i(n)})});t.asyncParamFetchers.set(N,{request:i,callback:F}),t.asyncParamPromisesAllSettled=!1}function U(){var e=[],t=[];return x.params!=null&&x.params.forEach(function(n){var r=p(n.query);r!=null?t.push({paramConfig:n,paramValue:r}):e.push(n)}),{urlMissingParams:e,urlExistingParams:t}}o.exports=new c(function(t,r){if(!(typeof Promise=="undefined"||Promise.toString().indexOf("[native code]")===-1)){var o=e.webkit!=null&&e.webkit.messageHandlers!=null&&e.webkit.messageHandlers.browserProperties!=null,a=l(397,264)&&typeof e.XMLHttpRequest!="undefined";if(!(!o&&!a)){var i=200,s=null,u=null,c=[],d=[];n.listen(function(e){var t=r.getPixel(e);if(t!=null){vaLine truncated
|
||||
,a.ensureModuleRegistered("fbevents.plugins.browserproperties",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("fbevents.plugins.eventvalidation",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=l(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){s=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if(typeof e=="string")return s(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("fbevents.plugins.clienthint",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=l(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){s=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if(typeof e=="string")return s(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},u(e)}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.lastexternalreferrer",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var n=a.getFbeventsModules("SignalsFBEventsGetValidUrl"),r=a.getFbeventsModules("SignalsFBEventsEvents"),i=r.getCustomParameters,l=a.getFbeventsModules("SignalsFBEventsPlugin"),s=a.getFbeventsModules("signalsFBEventsGetIsAndroidIAW"),u=a.getFbeventsModules("signalsFBEventsGetIsIosInAppBrowser"),c=a.getFbeventsModules("SignalsFBEventsLogging"),d=c.logWarning,m=a.getFbeventsModules("SignalsFBEventsLocalStorageUtils"),p=m.getLocalStorageItem,_=m.removeLocalStorageItem,f=m.setLocalStorageItem,g=m.isLocalStorageSupported;o.exports=new l(function(r,o){var a=s()&&typeof e.XMLHttpRequest!="undefined",l=u();if(a||l||!g())return;var c="facebook.com",m="instagram.com",h="lastExternalReferrer",y="lastExternalReferrerTime";function C(e,t){return e==t||e.endsWith(".".concat(t))}try{var b=p(y);b!=null&&(new Date().getTime()-Number(b))/(1e3*60*60*24)>90&&(_(y),_(h));var v=!1,S="",R=n(t.referrer);if(R!=null&&(S=R.hostname),S=="")f(h,"empty"),v=!0;else{var L=String(e.location.hostname);S!==L&&(C(S,c)?f(h,"fb"):C(S,m)?f(h,"ig"):f(h,"other"),v=!0)}v&&f(y,new Date().getTime());var E=p(h);E!=null&&E!="empty"&&E!="fb"&&E!="ig"&&(E="other"),i.listen(function(e){return{ler:E}})}catch(e){var k=e instanceof Error?e.message:String(e),I=new Error("[LastExternalReferrer Error] "+k);e instanceof Error&&e.stack!=null&&(I.stack=e.stack),d(I,"pixel","lastexternalreferrer")}})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.lastexternalreferrer"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.lastexternalreferrer",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.lastexternalreferrer",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.cookiedeprecationlabel",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var t=a.getFbeventsModules("SignalsFBEventsEvents"),n=t.getCustomParameters,r=a.getFbeventsModules("SignalsFBEventsPlugin"),i=a.getFbeventsModules("SignalsParamList"),l=a.getFbeventsModules("SignalsFBEventsLogging"),s=l.logError,u=a.getFbeventsModules("signalsFBEventsGetIsChrome"),c="cdl",d="cookieDeprecationLabel",m="";function p(e,t,n){var r=t.customParams||new i;r.get(c)==null&&e!=null&&r.append(c,String(e)),t.customParams=r}o.exports=new r(function(t,r){if(u()){var o=e.navigator.cookieDeprecationLabel;if(o==null){n.listen(function(e){return{cdl:"API_unavailable"}});return}var a=o.getValue().then(function(e){if(e==null)return null;m=String(e);var t=r.asyncParamFetchers.get(d);return t!=null&&t.result==null&&(t.result=m,r.asyncParamFetchers.set(d,t)),m}).catch(function(e){e.message="[CookieDeprecationLabel Error] Fetch error"+String(e.message),s(e,"pixel","cookiedeprecationlabel")});r.asyncParamFetchers.set(d,{request:a,callback:p}),r.asyncParamPromisesAllSettled=!1}})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.cookiedeprecationlabel"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.cookiedeprecationlabel",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.cookiedeprecationlabel",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("fbevents.plugins.unwantedparams",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("fbevents.plugins.standardparamchecks",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=l(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){s=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(s)throw a}}}}function l(e,t){if(e){if(typeof e=="string")return s(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},u(e)}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.topicsapi",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var n=a.getFbeventsModules("SignalsFBEventsNetworkConfig"),r=a.getFbeventsModules("SignalsFBEventsFiredEvent"),i=a.getFbeventsModules("SignalsParamList"),l=a.getFbeventsModules("SignalsFBEventsLocalStorageUtils"),s=l.getLocalStorageItem,u=l.setLocalStorageItem,c=l.isLocalStorageSupported,d=a.getFbeventsModules("SignalsFBEventsLogging"),m=d.logError,p=d.logWarning,_=d.logInfoString,f=a.getFbeventsModules("signalsFBEventsGetIsChrome"),g=a.getFbeventsModules("signalsFBEventsGetIsAndroidIAW"),h=a.getFbeventsModules("SignalsFBEventsPlugin"),y="topicsLastReferenceTime",C=1440*60*1e3,b=1,v="pixel",S="topicsapi";function R(e,t){Math.random()>.001||_(e,v,t)}var L=function(t){return"[Topics API][Pixel Plugin] ".concat(t)},E=function(t){var e=Number(Date.now()),n=Number(t);return e-n>=b*C},k=function(){if(!c())return!1;var e=!1;try{var t=s(y);if(t==null)return!0;e=E(t)}catch(e){var n="preObservationAction action:"+(e==null?"Unknown":e.message);return p(new Error(L(n)),v,S),!1}return e},I=function(){if(c())try{u(y,Date.now())}catch(t){var e="postObservationAction action:"+(t==null?"Unknown":t.message);p(new Error(L(e)),v,S)}},T=function(r){var t=n.TOPICS_API_ENDPOINT,o="".concat(t,"?id=").concat(r),a=e.fetch(o,{browsingTopics:!0,skipObservation:!0}).then(function(e){return R(L("observation action successful for pixel ".concat(r)),S),e}).catch(function(e){var t="observation action:"+(e==null?"Unknown":e.message);p(new Error(L(t)),v,S)})},D=new h(function(e,n){(f()||g())&&(t.featurePolicy==null||!t.featurePolicy.allowsFeature("browsing-topics")||r.listen(function(e,t){try{var n=k();if(n){var r=t.get("id");if(r==null){m(new Error(L("no pixel id found")),v,S);return}T(r)}I()}catch(e){var o="generic client-side:"+(e==null?"Unknown":e.message);p(new Error(L(o)),v,S)}}))});o.exports=D})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.topicsapi"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.topicsapi",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.topicsapi",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("fbevents.plugins.gating",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=L(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){l=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(l)throw a}}}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,g(r.key),r)}}function u(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t){d(e,t),t.add(e)}function d(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function m(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){var t=h(e,"string");return T(t)=="symbol"?t:t+""}function h(e,t){if(T(e)!="object"||!e)return e;var n=e[typeof Symbol=="function"?Symbol.toPrimitive:"@@toPrimitive"];if(n!==void 0){var r=n.call(e,t||"default");if(T(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function y(e,t){return v(e)||b(e,t)||L(e,t)||C()}function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function b(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(n!=null){var r,o,a,i,l=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}function v(e){if(Array.isArray(e))return e}function S(e){return k(e)||E(e)||L(e)||R()}function R(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e,t){if(e){if(typeof e=="string")return I(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}function E(e){if(typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]!=null||e["@@iterator"]!=null)return Array.from(e)}function k(e){if(Array.isArray(e))return I(e)}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e){"@babel/helpers - typeof";return T=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},T(e)}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsExtractMicrodataFromJsonLdV2",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsMicrodata"),n=e.Product,r=e.Offer,i=e.PriceSpecification,l=e.Microdata,s=e.AggregateRating,u=a.getFbeventsModules("SignalsFBEventsUtils"),c=u.each,d=a.getFbeventsModules("SignalsFBEventsExtractMicrodataUtils"),m=d.JSON_LD_TOTAL_LENGTH_LIMIT,p=d.SCHEMA_ORG_PRODUCT_TYPES,_=d.SCHEMA_ORG_OFFER_TYPES,f=d.SCHEMA_ORG_AGGREGATE_OFFER_TYPES,g=d.MPN_KEYS,h=d.AVAILABILITY_KEYS,y=d.PRICE_KEYS,C=d.LOW_PRICE_KEYS,b=d.CURRENCY_KEYS,v=d.ID_KEYS,S=d.OFFER_KEYS,R=d.PRICE_SPECIFICATION_KEYS,L=d.URL_KEYS,E=d.MAIN_ENTITY_KEYS,k=d.GRAPH_KEYS,I=d.HAS_VARIANT_KEYS,D=d.SKU_KEYS,x=d.PRODUCT_ID_KEYS,$=d.GTIN_KEYS,P=d.GTIN8_KEYS,N=d.GTIN12_KEYS,M=d.GTIN13_KEYS,w=d.GTIN14_KEYS,A=d.ISBN_KEYS,F=d.MIN_PRICE_KEYS,O=d.MAX_PRICE_KEYS,B=d.NAME_KEYS,W=d.DESCRIPTION_KEYS,q=d.SCHEMA_ORG_AGGREGATE_RATING_TYPES,U=d.AGGREGATE_RATING_KEYS,V=d.RATING_VALUE_KEYS,H=d.RATING_COUNT_KEYS,G=d.REVIEW_COUNT_KEYS,z=d.BEST_RATING_KEYS,j=d.WORST_RATING_KEYS,K=d.getFieldFromJsonRaw,Q=d.getFieldFromJsonAsString,X=d.addToList,Y=d.parseJsonLdText,J=d.getJsonLdType;function Z(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{handleInvalidJson:!1},n=new l,r=t.querySelectorAll('script[type="application/ld+json"]'),o=0,a=0;a<r.length;a++){var i=r[a].innerText;if(!(i==null||i===""))try{if(o+=i.length,o>m)return n;for(var s=Y(i,e.handleInvalidJson),u=0;u<s.length;u++){var c=s[u];X(s,K(c,E)),X(s,K(c,k)),X(s,K(c,I));var d=ee(c);d!=null&&n.addProduct(d)}}catch(e){n.addError(i)}}return n}function ee(e){var t=J(e),r=p.includes(t);if(!r)return null;var o=new n;return ae(e,o),oe(e,o),te(e,o),o.name=Q(e,B),o.description=Q(e,W),o}function te(e,t){var n=K(e,S);if(n==null)return t;var r=Array.isArray(n)?n:[n];c(r,function(e){var n=J(e),r=_.includes(n)||f.includes(n);if(r){var o=ne(e,t);o!=null&&t.addOffer(o)}})}function ne(e,t){var n=new r;ae(e,n),ie(e,n),n.availability=Q(e,h);var o=K(e,R);return o!=null&&(n.priceSpecification=re(o)),n}function re(e){if(e==null)return null;var t=Array.isArray(e)?e:[e],n=[];return c(t,function(e){if(!(e==null||T(e)!=="object")){var t=new i;ie(e,t),n.push(t)}}),n.length>0?n:null}function oe(e,t){var n=K(e,U);if(n!=null){var r=new s;r.ratingValue=Q(n,V),r.ratingCount=Q(n,H),r.reviewCount=Q(n,G),r.bestRating=Q(n,z),r.worstRating=Q(n,j),t.aggregateRating=r}}function ae(e,t){t.id=Q(e,v),t.sku=Q(e,D),t.productId=Q(e,x),t.gtin=Q(e,$),t.gtin8=Q(e,P),t.gtin12=Q(e,N),t.gtin13=Q(e,M),t.gtin14=Q(e,w),t.isbn=Q(e,A),t.mpn=Q(e,g),t.url=Q(e,L)}function ie(e,t){t.priceCurrency=Q(e,b),t.lowPrice=Q(e,C),t.price=Q(e,y),t.minPrice=Q(e,F),t.maxPrice=Q(e,O)}o.exports={buildMicrodataFromJsonLd:Z}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsExtractMicrodataFromOpenGraphV2",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsMicrodata"),n=e.Product,r=e.Offer,i=e.PriceSpecification,l=e.Microdata,s=e.AggregateRating,u=a.getFbeventsModules("SignalsFBEventsUtils"),c=u.FBSet,d=a.getFbeventsModules("SignalsFBEventsShared"),m=d.unicodeSafeTruncate,p=500,_=["gtin","gtin8","gtin12","gtin13","gtin14","isbn"];function f(){for(var e=new l,o=new n,a=new r,i=new c(["og","product","music","video","article","book","profile","website","twitter"]),s=!1,u=t.querySelectorAll("meta[property]"),d=0;d<u.length;d++){var _=u[d],f=_.getAttribute("property"),y=_.getAttribute("content");if(!(f==null||y==null)&&!(f.indexOf(":")===-1||!i.has(f.split(":")[0]))){var C=m(y,p);(f==="product:retailer_item_id"||f==="product:sku"||f==="og:type"&&C.toLowerCase().includes("product"))&&(s=!0),C!==""&&(h(a,f,C),g(o,f,C))}}return s||(o.name=null,o.description=null),o.addOffer(a),e.addProduct(o),e}function g(e,t,n){e.name==null&&(t==="product:name"||t==="og:title")&&(e.name=n),e.description==null&&(t==="product:description"||t==="og:description")&&(e.description=n),(t==="product:retailer_item_id"||t==="product:sku")&&e.addId(n)}function h(e,t,n){e.priceCurrency==null&&(t==="product:price:currency"||t==="og:price:currency")&&(e.priceCurrency=n),e.id==null&&(t==="product:retailer_item_id"||t==="product:sku")&&(e.id=n),e.mpn==null&&t==="product:mfr_part_no"&&(e.mpn=n),e.gtin==null&&_.map(function(e){return"product:".concat(e)}).includes(t)&&(e.gtin=n),e.price==null&&(t==="product:price:amount"||t==="og:price:amount")&&(e.price=n),e.availability==null&&(t==="product:availability"||t==="og:availability")&&(e.availability=n)}o.exports={buildMicrodataFromOpenGraph:f}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsExtractMicrodataFromSchemaOrgV2",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsMicrodata"),n=e.Product,r=e.Offer,i=e.PriceSpecification,l=e.Microdata,s=e.AggregateRating,u=a.getFbeventsModules("SignalsFBEventsUtils"),c=u.FBSet,d=u.filter,m=a.getFbeventsModules("SignalsFBEventsShared"),p=m.signalsGetValueFromHTMLElement,_=a.getFbeventsModules("SignalsFBEventsExtractMicrodataUtils"),f=_.SCHEMA_ORG_PRODUCT_TYPES,g=_.SCHEMA_ORG_OFFER_TYPES,h=_.MPN_KEYS,C=_.AVAILABILITY_KEYS,b=_.PRICE_KEYS,v=_.CURRENCY_KEYS,R=_.ID_KEYS,L=_.OFFER_KEYS,E=_.SKU_KEYS,k=_.PRODUCT_ID_KEYS,I=_.GTIN_KEYS,T=_.GTIN8_KEYS,D=_.GTIN12_KEYS,x=_.GTIN13_KEYS,$=_.GTIN14_KEYS,P=_.ISBN_KEYS,N=_.SCHEMA_ORG_AGGREGATE_RATING_TYPES;function M(){var e=new l,t=A(),n=w();return e.merge(n),e.merge(t),e}function w(){for(var e=new l,n=t.querySelectorAll("[itemscope]"),r=0;r<n.length;r++){var o=n[r],a=q(o,"itemtype");f.includes(a.toLowerCase())&&e.addProduct(B(o))}return e}function A(){for(var e=new l,o=new n,a=new r,i=new s,u=t.querySelectorAll("[itemscope]"),c=U(u),d=u.length-1;d>=0;d--){var m=u[d],_=q(m,"itemtype");if(!(typeof _!="string"||_===""))for(var f=m.querySelectorAll("[itemprop]"),g=0;g<f.length;g++){var h=f[g];if(!c.has(h)){c.add(h);var y=h.getAttribute("itemprop");if(!(typeof y!="string"||y==="")){var C=p(h);C==null||C===""||(F(a,y,C),O(o,i,y,C,_))}}}}return o.addOffer(a),o.aggregateRating=i,e.addProduct(o),e}function F(e,t,n){e.priceCurrency==null&&t==="priceCurrency"&&(e.priceCurrency=n),e.id==null&&(t==="productID"||t==="sku")&&(e.id=n),e.mpn==null&&t==="mpn"&&(e.mpn=n);var r=[].concat(S(I),S(T),S(D),S(x),S($),S(P));e.gtin==null&&r.includes(t.toLowerCase())&&(e.gtin=n),e.price==null&&t==="price"&&(e.price=n),e.availability==null&&t==="availability"&&(e.availability=n)}function O(e,t,n,r,o){(n==="productID"||n==="sku")&&e.addId(r),f.includes(o.toLowerCase())&&(n==="name"&&(e.name=r),n==="description"&&(e.description=r)),N.includes(o.toLowerCase())&&(n==="ratingValue"?t.ratingValue=r:n==="ratingCount"?t.ratingCount=r:n==="reviewCount"?t.reviewCount=r:n==="bestRating"?t.bestRating=r:n==="worstRating"&&(t.worstRating=r))}function B(e){for(var t=V(e),n=y(t,2),r=n[0],o=n[1],a=e.querySelectorAll("[itemscope]"),i=0;i<a.length;i++){var l=a[i],s=q(l,"itemtype");if(g.includes(s.toLowerCase())){var u=W(l);u.priceCurrency=o,r.addOffer(u)}}return r}function W(e){for(var t=new r,n=e.querySelectorAll("[itemprop]"),o=[{itempropsLowerCase:b,get:function(){return t.price},set:function(n){t.price=n}},{itempropsLowerCase:C,get:function(){return t.availability},set:function(n){t.availability=n}},{itempropsLowerCase:h,get:function(){return t.mpn},set:function(n){t.mpn=n}},{itempropsLowerCase:[].concat(S(I),S(T),S(D),S(x),S($),S(P)),get:function(){return t.gtin},set:function(n){t.gtin=n}},{itempropsLowerCase:[].concat(S(k),S(E),S(R)),get:function(){return t.id},set:function(n){t.id=n}}],a=0;a<n.length;a++){var i=n[a],l=q(i,"itemprop"),s=p(i);if(!(l===""||s==null||s===""))for(var u=0;u<o.length;u++){var c=o[u],d=c.set,m=c.itempropsLowerCase,_=c.get;_()==null&&m.includes(l.toLowerCase())&&d(s)}}return t}function q(e,t){var n=e.getAttribute(t);return n==null||typeof n!="string"?"":n}function U(e){for(var t=new c,n=0;n<e.length;n++)t.add(e[n]);return t}function V(e){for(var t=new n,r=null,o=[{itempropsLowerCase:h,get:function(){return t.mpn},set:function(n){t.mpn=n}},{itempropsLowerCase:[].concat(S(I),S(T),S(D),S(x),S($),S(P)),get:function(){return t.gtin},set:function(n){t.gtin=n}},{itempropsLowerCase:[].concat(S(k),S(E),S(R)),get:function(){return t.id},set:function(n){t.id=n}},{itempropsLowerCase:v,get:function(){return r},set:function(t){r=t}}],a=e.querySelectorAll("[itemprop]"),i=0;i<a.length;i++){var l=a[i],s=q(l,"itemprop"),u=p(l);if(!(s===""||u==null||u===""))for(var c=0;c<o.length;c++){var d=o[c],m=d.set,_=d.itempropsLowerCase,f=d.get;f()==null&&_.includes(s.toLowerCase())&&m(u)}}return[t,r]}o.exports={buildMicrodataFromSchemaOrg:M,buildMicrodataFromSchemaOrgOld:A}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("signalsFBEventsExtractMicrodataSchemas",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var t=a.getFbeventsModules("SignalsFBEventsExtractMicrodataFromJsonLdV2"),n=t.buildMicrodataFromJsonLd,r=a.getFbeventsModules("SignalsFBEventsGuardrail"),i=a.getFbeventsModules("SignalsFBEventsShared"),l=i.MicrodataExtractionMethods,s=l.extractJsonLd,u=l.extractMetaTagData,c=l.extractOpenGraph,d=l.extractSchemaOrg,m=l.mergeProductMetadata,p=a.getFbeventsModules("SignalsFBEventsQE"),f=a.getFbeventsModules("SignalsFBEventsUtils"),g=f.keys,h=a.getFbeventsModules("SignalsFBEventsLogging"),y=h.logError,C=h.logUserError,b=h.logInfoString,v=a.getFbeventsModules("sha256_with_dependencies_new"),S="pixel",R="extractMicrodataSchemas",L=a.getFbeventsModules("SignalsFBEventsQE"),E=a.getFbeventsModules("SignalsFBEventsQEV2"),k=a.getFbeventsModules("SignalsFBEventsExperimentNames"),I=k.AUTOMATIC_PARAMETERS_JSON_AUTO_FIX;function T(e,t){!r.eval("enable_automatic_parameter_logging")||Math.random()>.02||b(e,"automatic_parameters",t)}function D(e){var t="product_url_presend_but_no_content_id_sizing";T("total",t);var n=e.productUrl!=null&&e.productUrl!="";n&&T("with_product_url",t);var r=e.automaticParameters;if(r!=null){T("with_automatic_parameters",t),n&&T("with_product_url_and_automatic_parameters",t);var o=r.contents;if(!(o==null||!Array.isArray(o))){n&&T("with_product_url_and_contents",t);var a=o.map(function(e){return e.id});a=a.filter(function(e){return e!=null&&e!=""}),a.length!==0&&(n&&T("with_product_url_and_contentid",t),T("with_valid_contentid",t))}}}function x(e,t){return n().getProductUrls()}function $(t){for(var n=t.id,r=t.includeJsonLd,o=r===void 0?!1:r,a=t.instance,i=t.onlyHash,l=i===void 0?!1:i,s=t.includeAutomaticParameters,u=s===void 0?!1:s,c=t.includeProductContent,d=c===void 0?!1:c,f=t.includeProductUrls,g=f===void 0?!1:f,h=E.isInTestPageLoadLevelExperiment(I),y={automaticParameters:{},productID:null,productUrl:null,productContents:[],productUrls:[]},b=P(u,!1,y,d),v=b.extractedProperties,S=N(o,u,h,y,d),R=S.extractedProperties,L=0;L<S.invalidInnerTexts.length;L++)C({jsonLd:S.invalidInnerTexts[L],type:"INVALID_JSON_LD"});var k=F(),T=M(u,!1,y,d),x=T.extractedProperties;y=m([b.productMetadata,S.productMetadata,T.productMetadata]),D(y);var $=p.get("logDataLayer"),O=$&&$.isInExperimentGroup,B=O===!0?e.dataLayer||[]:[];if(A(x,R,v,k,B)){var W={DataLayer:B,MetaTag:k,OpenGraph:v,"Schema.org":x};return o&&(W=_(_({},W),{},{"JSON-LD":R})),w(W,y,l,u,d,g)}}function P(e,t,n,r){var o={extractedProperties:{},productMetadata:n};try{o=c(e,t,r)}catch(e){var a="[Microdata OpenGraph]";e!=null&&e.message!=null&&(a+=": ".concat(e.message)),y(new Error(a),S,R)}return o}function N(e,t,n,r,o){var a={extractedProperties:[],invalidInnerTexts:[],productMetadata:r};try{a=e?s(t,n,T,o):{extractedProperties:[],invalidInnerTexts:[],productMetadata:r}}catch(e){var i="[Microdata JSON LD]";e!=null&&e.message!=null&&(i+=": ".concat(e.message)),y(new Error(i),S,R)}return a}function M(e,t,n,r){var o={extractedProperties:[],productMetadata:n};try{o=d(e,t,r)}catch(e){var a="[Microdata Schema]";e!=null&&e.message!=null&&(a+=": ".concat(e.message)),y(new Error(a),S,R)}return o}function w(e,t,n,r,o,a){var i=v(JSON.stringify(e));return i!=null&&(i=i.substring(0,24)),n?{hmd:i,pid:t.productID,pl:t.productUrl}:o?t.productContents.length===0?null:{contents:t.productContents}:r?{ap:t.automaticParameters}:a?{productUrls:t.productUrls}:e}function A(e,t,n,r,o){return e.length>0||t.length>0||g(n).length>0||g(r).length>1||r.title!==""||o.length&&o.length>0}function F(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t={title:""};try{t=u(e)}catch(e){var n="[Microdata Metadata]";e!=null&&e.message!=null&&(n+=": ".concat(e.message)),y(new Error(n),S,R)}return t}o.exports={extractAllSchemas:$,extractMetaTagDataWithErrorLogging:F,extractProductURLs:x}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsExtractMicrodataUtils",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsUtils"),t=e.each,n=a.getFbeventsModules("SignalsFBEventsShared"),r=n.MicrodataExtractionMethods,i=r.jsonRepair,l=12e4,s=["product","https://schema.org/product","http://schema.org/product"],u=["offer","https://schema.org/offer","http://schema.org/offer"],c=["aggregateoffer","https://schema.org/aggregateoffer","http://schema.org/aggregateoffer"],d=["aggregaterating","https://schema.org/aggregaterating","http://schema.org/aggregaterating"],m=["aggregaterating"],p=["offers","offer"],_=["pricespecification"],f=["mainentity"],g=["@graph"],h=["hasvariant"],y=["@id"],C=["sku"],b=["productid","product_id"],v=["gtin"],S=["gtin8"],R=["gtin12"],L=["gtin13"],E=["gtin14"],k=["isbn"],I=["mpn"],D=["url"],x=["availability"],$=["pricecurrency"],P=["lowprice"],N=["price"],M=["minprice"],w=["maxprice"],A=["name"],F=["description"],O=["ratingvalue"],B=["ratingcount"],W=["reviewcount"],q=["bestrating"],U=["worstrating"];function V(e,n){if(e==null||T(e)!=="object")return null;var r=Object.keys(e),o={};t(r,function(t){n.includes(t.toLowerCase())&&(o[t.toLowerCase()]=e[t])});var a=n.find(function(e){return o[e]});return a!=null?o[a]:null}function H(e,t){var n=V(e,t);return n==null?null:typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):null}function G(e,n){n!=null&&(Array.isArray(n)?t(n,function(t){t!=null&&T(t)==="object"&&e.push(t)}):T(n)==="object"&&e.push(n))}function z(e,t){var n=K(e);if(n==null)return[];try{n=JSON.parse(n.replace(/[\n\r\t]+/g," "))}catch(e){if(t){if(n=i(n),n==null)return[];n=JSON.parse(n.replace(/[\n\r\t]+/g," "))}else throw e}return Array.isArray(n)?n:[n]}function j(e){return e==null||T(e)!=="object"?"":typeof e["@type"]=="string"&&e["@type"]!=null?e["@type"].toLowerCase():""}function K(e){return e==null?null:e.replace(/\\"|\"(?:\\"|[^\"])*\"|(\/\/.*|\/\*[\s\S]*?\*\/)/g,function(e,t){return t?"":e})}function Q(e){if(e==null)return null;try{return i(e)}catch(t){return e}}o.exports={JSON_LD_TOTAL_LENGTH_LIMIT:l,SCHEMA_ORG_PRODUCT_TYPES:s,SCHEMA_ORG_OFFER_TYPES:u,SCHEMA_ORG_AGGREGATE_OFFER_TYPES:c,MPN_KEYS:I,AVAILABILITY_KEYS:x,PRICE_KEYS:N,LOW_PRICE_KEYS:P,CURRENCY_KEYS:$,ID_KEYS:y,OFFER_KEYS:p,PRICE_SPECIFICATION_KEYS:_,URL_KEYS:D,MAIN_ENTITY_KEYS:f,GRAPH_KEYS:g,HAS_VARIANT_KEYS:h,SKU_KEYS:C,PRODUCT_ID_KEYS:b,GTIN_KEYS:v,GTIN8_KEYS:S,GTIN12_KEYS:R,GTIN13_KEYS:L,GTIN14_KEYS:E,ISBN_KEYS:k,MIN_PRICE_KEYS:M,MAX_PRICE_KEYS:w,NAME_KEYS:A,DESCRIPTION_KEYS:F,SCHEMA_ORG_AGGREGATE_RATING_TYPES:d,AGGREGATE_RATING_KEYS:m,RATING_VALUE_KEYS:O,RATING_COUNT_KEYS:B,REVIEW_COUNT_KEYS:W,BEST_RATING_KEYS:q,WORST_RATING_KEYS:U,getFieldFromJsonRaw:V,getFieldFromJsonAsString:H,addToList:G,parseJsonLdText:z,getJsonLdType:j}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsMicrodata",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},a=o.exports;return(function(){"use strict";var e=new WeakSet,t=(function(){function t(){l(this,t),c(this,e),this.products=[],this.errors=[]}return u(t,[{key:"addError",value:function(t){this.errors.push(t)}},{key:"addProduct",value:function(t){this.products.push(t)}},{key:"merge",value:function(t){var e=i(t.products),n;try{for(e.s();!(n=e.n()).done;){var r=n.value;this.addProduct(r)}}catch(t){e.e(t)}finally{e.f()}var o=i(t.errors),a;try{for(o.s();!(a=o.n()).done;){var l=a.value;this.addError(l)}}catch(e){o.e(e)}finally{o.f()}}},{key:"getProductUrls",value:function(){var e=[],t=i(this.products),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;if(r.url!=null&&e.push(r.url),r.offers!=null){var o=i(r.offers),a;try{for(o.s();!(a=o.n()).done;){var l=a.value;l.url!=null&&e.push(l.url)}}catch(e){o.e(e)}finally{o.f()}}}}catch(e){t.e(e)}finally{t.f()}return e}},{key:"getAutomaticParameters",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{includeAllContentIds:!0},o=m(e,this,n).call(this),a=[],l=i(this.products),s;try{for(l.s();!(s=l.n()).done;){var u=s.value,c=m(e,this,r).call(this,u,t);if(c!=null){var d=i(c),p;try{for(d.s();!(p=d.n()).done;){var _=p.value;_!=null&&a.push(_)}}catch(e){d.e(e)}finally{d.f()}}}}catch(e){l.e(e)}finally{l.f()}var f={};return a.length>0&&(f.contents=a),o!=null&&(f.currency=o),Object.keys(f).length===0?null:f}},{key:"getProductContents",value:function(){var e=[],t=i(this.products),n;try{for(t.s();!(n=t.n()).done;){var r=n.value,o={},a=r.name,l=r.description,s=r.getAggregateRating(),u=r.getAllProductIds();b(o,"name",a),b(o,"description",l),b(o,"aggregate_rating",s),b(o,"ids",u),S(o)||e.push(o)}}catch(e){t.e(e)}finally{t.f()}return e.length>0?e:null}}])})();function n(){var e=i(this.products),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;if(n.offers!=null){var r=i(n.offers),o;try{for(r.s();!(o=r.n()).done;){var a=o.value;if(a.priceCurrency!=null)return a.priceCurrency;if(a.priceSpecification!=null){var l=i(a.priceSpecification),s;try{for(l.s();!(s=l.n()).done;){var u=s.value;if(u.priceCurrency!=null)return u.priceCurrency}}catch(e){l.e(e)}finally{l.f()}}}}catch(e){r.e(e)}finally{r.f()}}}}catch(t){e.e(t)}finally{e.f()}return null}function r(e,t){var n=e.offers;if(n==null)return null;var r=h(e),o=g(e),a=e.getMPN(),l=[],s=i(n),u;try{for(s.s();!(u=s.n()).done;){var c=u.value,d={},m=g(c),p=c.getMPN(),_=c.getAvailability(),f=c.getPrice(),C=h(c),R=m!=null?m:o,L=p!=null?p:a,E=C!=null?C:r;if(b(d,"gtin",R),b(d,"mpn",L),b(d,"availability",_),b(d,"item_price",f),t.includeAllContentIds){var k=y(c);k.length===0&&r!=null&&(k=[r]),v(d,k).forEach(function(e){S(e)||l.push(e)})}else b(d,"id",E),S(d)||l.push(d)}}catch(e){s.e(e)}finally{s.f()}return l.length>0?l:null}var a=(function(){function e(){l(this,e)}return u(e,[{key:"addId",value:function(t){this.ids==null&&(this.ids=[]),this.ids.push(t)}},{key:"addOffer",value:function(t){this.offers==null&&(this.offers=[]),this.offers.push(t)}},{key:"getMPN",value:function(){return this.mpn}},{key:"getAggregateRating",value:function(){var e=this.aggregateRating;if(e==null)return null;var t={};return b(t,"ratingValue",e.ratingValue),b(t,"ratingCount",e.ratingCount),b(t,"reviewCount",e.reviewCount),b(t,"bestRating",e.bestRating),b(t,"worstRating",e.worstRating),S(t)?null:t}},{key:"getAllProductIds",value:function(){var e=this.ids==null?[]:this.ids,t=h(this);if(t!=null&&e.push(t),this.offers==null)return e;var n=i(this.offers),r;try{for(n.s();!(r=n.n()).done;){var o=r.value,a=h(o);a!=null&&e.push(a)}}catch(e){n.e(e)}finally{n.f()}var l=[],s=i(e),u;try{for(s.s();!(u=s.n()).done;){var c=u.value;l.includes(c)||l.push(c)}}catch(e){s.e(e)}finally{s.f()}return l.length>0?l:null}}])})(),s=u(function e(){l(this,e)}),d=new WeakSet,p=(function(){function e(){l(this,e),c(this,d)}return u(e,[{key:"getMPN",value:function(){return this.mpn}},{key:"getAvailability",value:function(){return C(this.availability)}},{key:"getPrice",value:function(){var e=R(this.price);return e!=null||(e=R(this.lowPrice),e!=null)?e:m(d,this,f).call(this)}}])})();function f(){if(this.priceSpecification==null)return null;var e=null,t=i(this.priceSpecification),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;e=L(e,R(r.price)),e=L(e,R(r.lowPrice)),e=L(e,R(r.maxPrice)),e=L(e,R(r.minPrice))}}catch(e){t.e(e)}finally{t.f()}return e}function g(e){return e.gtin!=null?e.gtin:e.gtin8!=null?e.gtin8:e.gtin12!=null?e.gtin12:e.gtin13!=null?e.gtin13:e.gtin14!=null?e.gtin14:e.isbn!=null?e.isbn:null}function h(e){return e.sku!=null?e.sku:e.productId!=null?e.productId:e.id!=null?e.id:null}function y(e){if(e==null)return[];var t=[];return e.id!=null&&t.push(e.id),e.sku!=null&&t.push(e.sku),e.productId!=null&&t.push(e.productId),t}function C(e){if(e==null||typeof e!="string"&&!(e instanceof String))return null;var t=e.split("/");return t.length>0?t[t.length-1]:""}function b(e,t,n){n!=null&&(e[t]=n)}function v(e,t){var n=[];return t.forEach(function(t){if(t!Line truncated
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.automaticparameters",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsPlugin"),t=a.getFbeventsModules("SignalsFBEventsEvents"),n=t.getAutomaticParameters,r=a.getFbeventsModules("SignalsFBEventsUtils"),i=r.some,l=a.getFbeventsModules("signalsFBEventsExtractMicrodataSchemas"),s=l.extractAllSchemas,u=a.getFbeventsModules("SignalsFBEventsUtils"),c=u.FBSet,d=a.getFbeventsModules("SignalsFBEventsQE"),m=a.getFbeventsModules("SignalsFBEventsQEV2"),p=a.getFbeventsModules("SignalsFBEventsExperimentNames"),_=p.PROCESS_AUTOMATIC_PARAMETERS,f=p.AUTOMATIC_PARAMETERS_JSON_AUTO_FIX,g=p.MICRODATA_REFACTOR_MIGRATION,h=a.getFbeventsModules("SignalsFBEventsExtractMicrodataFromJsonLdV2"),y=h.buildMicrodataFromJsonLd,C=a.getFbeventsModules("SignalsFBEventsExtractMicrodataFromOpenGraphV2"),b=C.buildMicrodataFromOpenGraph,v=a.getFbeventsModules("SignalsFBEventsExtractMicrodataFromSchemaOrgV2"),S=v.buildMicrodataFromSchemaOrg,R=a.getFbeventsModules("SignalsFBEventsMicrodata"),L=R.Microdata;o.exports=new e(function(e,t){n.listen(function(e,n){if(!I(e,n,t))return{};var r=m.isInTestPageLoadLevelExperiment(g);if(r){var o=E();return o!=null?o:{}}var a=s({id:e,includeJsonLd:!0,instance:t,onlyHash:!1,includeAutomaticParameters:!0});return a!=null?a:{}})});function E(){var e=k().getAutomaticParameters();return e==null?null:{ap:e}}function k(){var e=new L,t=m.isInTestPageLoadLevelExperiment(f);return e.merge(b()),e.merge(y({handleInvalidJson:t})),e.merge(S()),e}function I(e,t,n){return d.isInTest(_),n.disableAutoConfig?!1:i(n.getOptedInPixels("AutomaticParameters"),function(t){return t.id===e})}})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.automaticparameters"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.automaticparameters",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.automaticparameters",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},i(e)}function l(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=s(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){l=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(l)throw a}}}}function s(e,t){if(e){if(typeof e=="string")return u(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,g(r.key),r)}}function _(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){var t=h(e,"string");return i(t)=="symbol"?t:t+""}function h(e,t){if(i(e)!="object"||!e)return e;var n=e[typeof Symbol=="function"?Symbol.toPrimitive:"@@toPrimitive"];if(n!==void 0){var r=n.call(e,t||"default");if(i(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsBlockFlags",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},a=o.exports;return(function(){"use strict";function e(e){var t={};return e.forEach(function(e){t[e]=1}),{bfs:t}}o.exports={createBlockFlags:e}})(),o.exports})(e,t,n,r)})
|
||||
,a.ensureModuleRegistered("SignalsFBEventsBotDetectionEngine",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsUtils"),t=e.stringStartsWith,n=a.getFbeventsModules("SignalsFBEventsGuardrail"),r=a.getFbeventsModules("SignalsFBEventsLogging"),i=r.logWarning,s=Object.freeze({NOT_SPIDER_AND_NOT_BOT:0,SPIDER_OR_BOT:1,NOT_SPIDER_OR_BOT_EXCEPTION:2,SPIDER_OR_BOT_WHITELIST_FAILED:3}),u=Object.freeze({EXPERIMENT:"Experiment",STABLE:"Stable"}),c=Object.freeze({STARTS_WITH:"StartsWith",CONTAINS:"Contains"}),p=Object.freeze({BROAD_BLOCK:"BroadBlock",NARROW_ALLOW:"NarrowAllow"}),g=(function(){function e(){m(this,e),f(this,"_isInitialized",!1),f(this,"_rulesData",null),f(this,"_spiderPatterns",[]),f(this,"_browserPatterns",[]),f(this,"_userAgentCache",new Map),f(this,"_cacheMaxSize",1e3),this._initializeEngine()}return _(e,[{key:"_initializeEngine",value:function(){this._isInitialized=!0}},{key:"loadRulesFromConfig",value:function(t){try{if(this._rulesData=t,!t.spider_bot_rules||!t.browser_patterns){i("Invalid server rules format, missing required fields");return}this._spiderPatterns=this._parseRuleString(t.spider_bot_rules),this._browserPatterns=this._parseRuleString(t.browser_patterns)}catch(e){i("Failed to load rules from config:",e),this._rulesData=null,this._spiderPatterns=[],this._browserPatterns=[]}}},{key:"_parseRuleString",value:function(t){return!t||t.trim()===""?[]:t.split("\n").filter(function(e){return e.length>1}).map(function(e){var t=e.charAt(0),n=e.substring(1).split("~");return{pattern:n[0].toLowerCase(),startOfString:t==="1",exceptions:n.slice(1).map(function(e){return e.toLowerCase()})}})}},{key:"_isMetabot",value:function(t,n){if(n===s.SPIDER_OR_BOT_WHITELIST_FAILED){var e="facebookexternalhit";return t.toLowerCase().includes(e)}return!1}},{key:"detectBot",value:function(t){if(!this._isInitialized)return this._createErrorResult("Engine not initialized",t);var e=this._getCacheKey(t);if(this._userAgentCache.has(e)){var n=this._userAgentCache.get(e);if(n)return d(d({},n),{},{cached:!0})}try{var r=this._performBotDetection(t);return this._cacheResult(e,r),r}catch(e){return i("Error during bot detection:",e),this._createErrorResult(e.message,t)}}},{key:"shouldBlockUserAgent",value:function(t){var e=this.detectBot(t);return e.ruleType===s.SPIDER_OR_BOT||e.ruleType===s.SPIDER_OR_BOT_WHITELIST_FAILED&&e.isMetabot===!0}},{key:"_checkMobileAppBypass",value:function(t){for(var e=t.toLowerCase(),n=["fban/","fbav/","fbandroidsdk","fbiossdk","fbandroidsdk.","fbiossdk.","fb-zerobalance","fb_iab","fbios","fbandroid"],r=0,o=n;r<o.length;r++){var a=o[r];if(e.includes(a))return!0}var i=["mobile","iphone","android","blackberry","windows phone"],s=e.includes("facebook")||e.includes("fb");if(s){var u=l(i),c;try{for(u.s();!(c=u.n()).done;){var d=c.value;if(e.includes(d))return!0}}catch(e){u.e(e)}finally{u.f()}}return!1}},{key:"_performBotDetection",value:function(r){var e=r.toLowerCase(),o=this._checkMobileAppBypass(r),a=o||this._checkBrowserPatterns(e);if(!a){var i=this._isMetabot(r,s.SPIDER_OR_BOT_WHITELIST_FAILED);return{isBot:!0,ruleType:s.SPIDER_OR_BOT_WHITELIST_FAILED,isMetabot:i}}var u=this._checkSpiderPatterns(e),c=n.eval("use_string_prefix_match_from_util");if(u.matched&&u.exceptions&&u.exceptions.length>0){var d=l(u.exceptions),m;try{for(d.s();!(m=d.n()).done;){var p=m.value,_=c?t(e,p):e.startsWith(p),f=u.startOfString?_:e.includes(p);if(f)return{isBot:!1,ruleType:s.NOT_SPIDER_OR_BOT_EXCEPTION}}}catch(e){d.e(e)}finally{d.f()}}return u.matched?{isBot:!0,ruleType:s.SPIDER_OR_BOT}:{isBot:!1,ruleType:s.NOT_SPIDER_AND_NOT_BOT}}},{key:"_checkBrowserPatterns",value:function(r){if(this._browserPatterns.length===0)return!0;var e=n.eval("use_string_prefix_match_from_util"),o=l(this._browserPatterns),a;try{for(o.s();!(a=o.n()).done;){var i=a.value,s=e?t(r,i.pattern):r.startsWith(i.pattern),u=i.startOfString?s:r.includes(i.pattern);if(u)return!0}}catch(e){o.e(e)}finally{o.f()}return!1}},{key:"_checkSpiderPatterns",value:function(r){var e=n.eval("use_string_prefix_match_from_util"),o=l(this._spiderPatterns),a;try{for(o.s();!(a=o.n()).done;){var i=a.value,s=e?t(r,i.pattern):r.startsWith(i.pattern),u=i.startOfString?s:r.includes(i.pattern);if(u)return{matched:!0,pattern:i.pattern,exceptions:i.exceptions||[],startOfString:i.startOfString}}}catch(e){o.e(e)}finally{o.f()}return{matched:!1}}},{key:"_getCacheKey",value:function(t){return t.length>100?t.substring(0,100)+"_"+t.length:t}},{key:"_cacheResult",value:function(t,n){if(this._userAgentCache.size>=this._cacheMaxSize){var e=this._userAgentCache.keys().next().value;e&&this._userAgentCache.delete(e)}this._userAgentCache.set(t,n)}},{key:"_createErrorResult",value:function(t,n){return{isBot:!1,ruleType:"ERROR"}}},{key:"getStatus",value:function(){return{initialized:this._isInitialized,rules_loaded:this._rulesData!=null,cache_size:this._userAgentCache.size,cache_max_size:this._cacheMaxSize,spider_patterns_count:this._spiderPatterns.length,browser_patterns_count:tLine truncated
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.botblocking",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsConfigStore"),t=a.getFbeventsModules("SignalsFBEventsBlockFlags"),n=t.createBlockFlags,r=a.getFbeventsModules("SignalsFBEventsBotDetectionEngine"),i=a.getFbeventsModules("SignalsFBEventsGuardrail"),l={NOT_SPIDER_AND_NOT_BOT:0,SPIDER_OR_BOT:1,NOT_SPIDER_OR_BOT_EXCEPTION:2,SPIDER_OR_BOT_WHITELIST_FAILED:3},s="pixel",u="botblocking",c=a.getFbeventsModules("SignalsFBEventsLogging"),d=c.logWarning,m=c.logInfoString,p=a.getFbeventsModules("SignalsFBEventsEvents"),_=p.configLoaded,f=p.getCustomParameters,g=a.getFbeventsModules("SignalsFBEventsSendEventEvent"),h=a.getFbeventsModules("SignalsFBEventsTyped"),y=h.coerce,C=h.Typed,b=a.getFbeventsModules("SignalsFBEventsPlugin");o.exports=new b(function(t,o){var a=null,l=!1,c=null;_.listen(function(t){if(t!=null){var n=o.optIns.isOptedIn(t,"BotBlocking");if(n){var i=o.getPixel(t);if(i!=null&&(c=e.get(t,"botblocking"),c!=null))try{if(a=new r,c.rules){a.loadRulesFromConfig(c.rules),m("Bot detection rules loaded from server config - pixel_id: ".concat(t));var p=navigator.userAgent||"";l=a.shouldBlockUserAgent(p)}}catch(e){d(new Error("[BotBlocking] Failed to initialize bot blocking plugin - pixel_id: ".concat(t,", error: ").concat(e.message)),s,u)}}}}),f.listen(function(e,t,r){var i=o.optIns.isOptedIn(e.id,"BotBlocking");if(!i)return{};if(c==null)return{};if(!a)return{};try{return l?n(["b"]):{}}catch(n){return d(new Error("[BotBlocking] Error during bot blocking in getCustomParameters - pixel_id: ".concat(e.id,", event_name: ").concat(t,", error: ").concat(n.message)),s,u),{}}}),g.listen(function(e){var t=e.id;if(t==null)return!1;var n=y(t,C.fbid());if(n==null)return!1;var r=o.optIns.isOptedIn(n,"BotBlocking");if(!r)return!1;var c=o.getPixel(n);if(c==null||!a)return!1;var p=i.eval("bot_blocking_client_side_block_enabled",n);if(!p)return!1;try{return l?(m("[Meta pixel] Bot traffic detected and blocked - pixel_id: ".concat(n)),!0):!1}catch(e){return d(new Error("[BotBlocking] Error during bot blocking in SendEventEvent - pixel_id: ".concat(n,", error: ").concat(e.message)),s,u),!1}})})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.botblocking"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.botblocking",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.botblocking",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;if(a.execStart=e.performance&&e.performance.now&&e.performance.now(),!(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})())return;function i(e,t){var n=typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=L(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(t){l=!0,a=t},f:function(){try{i||n.return==null||n.return()}finally{if(l)throw a}}}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,g(r.key),r)}}function u(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t){d(e,t),t.add(e)}function d(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function m(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){var t=h(e,"string");return T(t)=="symbol"?t:t+""}function h(e,t){if(T(e)!="object"||!e)return e;var n=e[typeof Symbol=="function"?Symbol.toPrimitive:"@@toPrimitive"];if(n!==void 0){var r=n.call(e,t||"default");if(T(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function y(e,t){return v(e)||b(e,t)||L(e,t)||C()}function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function b(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]||e["@@iterator"];if(n!=null){var r,o,a,i,l=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}function v(e){if(Array.isArray(e))return e}function S(e){return k(e)||E(e)||L(e)||R()}function R(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e,t){if(e){if(typeof e=="string")return I(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}function E(e){if(typeof Symbol!="undefined"&&e[typeof Symbol=="function"?Symbol.iterator:"@@iterator"]!=null||e["@@iterator"]!=null)return Array.from(e)}function k(e){if(Array.isArray(e))return I(e)}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e){"@babel/helpers - typeof";return T=typeof Symbol=="function"&&typeof(typeof Symbol=="function"?Symbol.iterator:"@@iterator")=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==(typeof Symbol=="function"?Symbol.prototype:"@@prototype")?"symbol":typeof e},T(e)}a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.pagemetadata",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var e=a.getFbeventsModules("SignalsFBEventsPlugin"),t=a.getFbeventsModules("SignalsFBEventsUtils"),n=t.some,r=a.getFbeventsModules("SignalsFBEventsEvents"),i=r.getCustomParameters,l=a.getFbeventsModules("signalsFBEventsExtractMicrodataSchemas"),s=l.extractAllSchemas,u=l.extractMetaTagDataWithErrorLogging,c=a.getFbeventsModules("SignalsFBEventsQEV2"),d=a.getFbeventsModules("SignalsFBEventsExperimentNames"),m=d.AUTOMATIC_PARAMETERS_JSON_AUTO_FIX,p=d.MICRODATA_REFACTOR_MIGRATION,_=a.getFbeventsModules("SignalsFBEventsExtractMicrodataFromJsonLdV2"),f=_.buildMicrodataFromJsonLd,g=a.getFbeventsModules("SignalsFBEventsExtractMicrodataFromOpenGraphV2"),h=g.buildMicrodataFromOpenGraph,y=a.getFbeventsModules("SignalsFBEventsExtractMicrodataFromSchemaOrgV2"),C=y.buildMicrodataFromSchemaOrgOld,b=a.getFbeventsModules("SignalsFBEventsMicrodata"),v=b.Microdata;o.exports=new e(function(e,t){i.listen(function(e,r){if(t.disableAutoConfig)return{};var o=n(t.getOptedInPixels("PageMetadata"),function(t){return t.id===e.id});if(!o)return{};var a=u();r!=="PageView"&&a&&T(a)==="object"&&Object.prototype.hasOwnProperty.call(a,"title")&&delete a.title;var i=c.isInTestPageLoadLevelExperiment(p),l=null;if(i?l=S():l=s({id:e.id,includeJsonLd:!0,instance:t,onlyHash:!1,includeAutomaticParameters:!1,includeProductContent:!0}),l==null||l.contents==null)return{pmd:a};var d=l.contents;return a&&T(a)==="object"?(a.contents=d,{pmd:a}):{pmd:{contents:d}}})});function S(){var e=R().getProductContents();return e==null?null:{contents:e}}function R(){var e=new v,t=c.isInTestPageLoadLevelExperiment(m);return e.merge(h()),e.merge(f({handleInvalidJson:t})),e.merge(C()),e}})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.pagemetadata"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.pagemetadata",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.pagemetadata",function(){
|
||||
return o.exports})})()})(window,document,location,history);
|
||||
(function(e,t,n,r){var o={exports:{}},a=o.exports;(function(){var a=e.fbq;a.execStart=e.performance&&e.performance.now&&e.performance.now(),(function(){var t=e.postMessage||function(){};return a?!0:(t({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*"),"error"in console,!1)})()&&(a.__fbeventsModules||(a.__fbeventsModules={},a.__fbeventsResolvedModules={},a.getFbeventsModules=function(e){return a.__fbeventsResolvedModules[e]||(a.__fbeventsResolvedModules[e]=a.__fbeventsModules[e]()),a.__fbeventsResolvedModules[e]},a.fbIsModuleLoaded=function(e){return!!a.__fbeventsModules[e]},a.ensureModuleRegistered=function(e,t){a.fbIsModuleLoaded(e)||(a.__fbeventsModules[e]=t)})
|
||||
,a.ensureModuleRegistered("SignalsFBEvents.plugins.websiteperformance",function(){
|
||||
return(function(e,t,n,r){var o={exports:{}},i=o.exports;return(function(){"use strict";var t=a.getFbeventsModules("SignalsFBEventsEvents"),n=t.getCustomParameters,r=a.getFbeventsModules("SignalsFBEventsPlugin"),i=a.getFbeventsModules("SignalsFBEventsLogging"),l=i.logInfo,s=i.logError,u=a.getFbeventsModules("SignalsParamList"),c="pixel",d="WebsitePerformance";o.exports=new r(function(t,r){try{var o=function(){var t=typeof e.performance.getEntriesByType=="function"?e.performance.getEntriesByType("navigation")[0]:null;if(t==null)return null;var n=t.domContentLoadedEventEnd,r=t.startTime,o=n-r;return o>0?o:null},a=function(){if(e.performance==null||e.performance.timing==null)return null;var t=e.performance.timing,n=t.domContentLoadedEventEnd,r=t.navigationStart,o=n-r;return o>0?o:null},i=!1;(e.performance==null||typeof e.performance.getEntriesByType!="function")&&(l(new Error("Modern Performance not supported"),c,d),e.performance!=null&&e.performance.timing!=null&&(i=!0));var u=null;i?u=a():u=o(),n.listen(function(e,t,n){try{var l=r.optIns.isOptedIn(e.id,"WebsitePerformance");return l?(u==null&&(i?u=a():u=o()),u==null?{}:{plt:u}):{}}catch(e){return s(e,c,d),{}}})}catch(e){s(e,c,d);return}})})(),o.exports})(e,t,n,r)}),o.exports=a.getFbeventsModules("SignalsFBEvents.plugins.websiteperformance"),a.registerPlugin&&a.registerPlugin("fbevents.plugins.websiteperformance",o.exports)
|
||||
,a.ensureModuleRegistered("fbevents.plugins.websiteperformance",function(){
|
||||
return o.exports}))})()})(window,document,location,history);
|
||||
fbq.registerPlugin("1468546770034581", {__fbEventsPlugin: 1, plugin: function(fbq, instance, config) { config.set("1468546770034581", "inferredEvents", {"buttonSelector":null,"disableRestrictedData":false});
|
||||
fbq.loadPlugin("inferredevents");
|
||||
fbq.loadPlugin("identity");
|
||||
instance.optIn("1468546770034581", "InferredEvents", true);
|
||||
config.set("1468546770034581", "automaticMatching", {"selectedMatchKeys":["em","fn","ln","ph","ge","zp","ct","st","country","db","external_id"]});
|
||||
fbq.loadPlugin("inferredevents");
|
||||
fbq.loadPlugin("identity");
|
||||
instance.optIn("1468546770034581", "AutomaticMatching", true);
|
||||
fbq.loadPlugin("iwlbootstrapper");
|
||||
instance.optIn("1468546770034581", "IWLBootstrapper", true);
|
||||
config.set("1468546770034581", "cookie", {"fbcParamsConfig":{"params":[{"prefix":"","query":"fbclid","ebp_path":"clickID"},{"prefix":"aem","query":"brid","ebp_path":"aem"},{"prefix":"waaem","query":"waaem","ebp_path":""}]},"enableFbcParamSplitAll":false,"maxMultiFbcQueueSize":5,"enableFbcParamSplitSafariOnly":true});
|
||||
fbq.loadPlugin("cookie");
|
||||
instance.optIn("1468546770034581", "FirstPartyCookies", true);
|
||||
fbq.loadPlugin("inferredevents");
|
||||
instance.optIn("1468546770034581", "InferredEvents", true);
|
||||
fbq.loadPlugin("automaticmatchingforpartnerintegrations");
|
||||
instance.optIn("1468546770034581", "AutomaticMatchingForPartnerIntegrations", true);
|
||||
config.set(null, "batching", {"batchWaitTimeMs":10,"maxBatchSize":10});
|
||||
config.set(null, "microdata", {"waitTimeMs":500});
|
||||
config.set("1468546770034581", "prohibitedSources", {"prohibitedSources":[]});
|
||||
fbq.loadPlugin("prohibitedsources");
|
||||
instance.optIn("1468546770034581", "ProhibitedSources", true);
|
||||
config.set("1468546770034581", "unwantedData", {"blacklisted_keys":{"Purchase":{"cd":["token","id_transazione","id_ordine","holder_name","card_number"],"url":[]},"PageView":{"cd":["ttclid","c","token","PayerID","id_order","card_number"],"url":["changepassword"]},"CompleteRegistration":{"cd":["ttclid"],"url":[]}},"sensitive_keys":{}});
|
||||
fbq.loadPlugin("unwanteddata");
|
||||
instance.optIn("1468546770034581", "UnwantedData", true);
|
||||
config.set("1468546770034581", "IABPCMAEBridge", {"enableAutoEventId":true});
|
||||
fbq.loadPlugin("iabpcmaebridge");
|
||||
instance.optIn("1468546770034581", "IABPCMAEBridge", true);
|
||||
config.set("1468546770034581", "browserProperties", {"delayInMs":200,"enableEventSuppression":true,"enableBackupTimeout":true,"fbcParamsConfig":{"params":[{"prefix":"","query":"fbclid","ebp_path":"clickID"},{"prefix":"aem","query":"brid","ebp_path":"aem"},{"prefix":"waaem","query":"waaem","ebp_path":""}]},"enableFbcParamSplitIOS":false,"enableFbcParamSplitAndroid":false});
|
||||
fbq.loadPlugin("browserproperties");
|
||||
instance.optIn("1468546770034581", "BrowserProperties", true);
|
||||
config.set("1468546770034581", "eventValidation", {"unverifiedEventNames":[],"restrictedEventNames":[]});
|
||||
fbq.loadPlugin("eventvalidation");
|
||||
instance.optIn("1468546770034581", "EventValidation", true);
|
||||
config.set("1468546770034581", "clientHint", {"delayInMs":200,"disableBackupTimeout":false});
|
||||
fbq.loadPlugin("clienthint");
|
||||
instance.optIn("1468546770034581", "ClientHint", true);
|
||||
fbq.loadPlugin("lastexternalreferrer");
|
||||
instance.optIn("1468546770034581", "LastExternalReferrer", true);
|
||||
fbq.loadPlugin("cookiedeprecationlabel");
|
||||
instance.optIn("1468546770034581", "CookieDeprecationLabel", true);
|
||||
fbq.loadPlugin("unwantedparams");
|
||||
instance.optIn("1468546770034581", "UnwantedParams", true);
|
||||
fbq.loadPlugin("standardparamchecks");
|
||||
instance.optIn("1468546770034581", "StandardParamChecks", true);
|
||||
fbq.loadPlugin("topicsapi");
|
||||
instance.optIn("1468546770034581", "TopicsAPI", true);
|
||||
config.set("1468546770034581", "gating", {"gatings":[{"name":"content_type_opt","passed":true},{"name":"experiment_xhr_vs_fetch","passed":true},{"name":"read_nested_event_id","passed":true},{"name":"offsite_clo_beta_event_id_coverage","passed":false},{"name":"enable_product_variant_id","passed":true},{"name":"enable_shopify_additional_events","passed":false},{"name":"enable_shopify_search_contents","passed":false},{"name":"enable_shopify_payment_fields","passed":false},{"name":"enable_shopify_external_id","passed":false},{"name":"dpo_country_state_validation","passed":false}]});
|
||||
fbq.loadPlugin("gating");
|
||||
instance.optIn("1468546770034581", "Gating", true);
|
||||
fbq.loadPlugin("automaticparameters");
|
||||
instance.optIn("1468546770034581", "AutomaticParameters", true);
|
||||
config.set("1468546770034581", "botblocking", {"rules":{"spider_bot_rules":"01job\n0abot\n0agentname\n0apachebench\n0applesyndication\n0ask jeeves\n0ask+jeeves\n0atomz\n0avantgo\n0baiduspider\n0blitzbot\n0bloglines\n0bordermanager\n0changedetection\n0check_http\n0checkurl\n0chkd\n0contype\n0Download Ninja\n0Download+Ninja\n0dts agent\n0dts+agent\n0favorg\n0getright\n0golem\n0gomezagent\n0googlebot\n0grabber\n0ia_archive\n0ichiro\n0IEAutoDiscovery\n0indy library\n0indy+library\n0infolink\n0internet ninja\n0internet+ninja\n0internetseer\n0isilo\n0jakarta\n0jobo\n0justview\n0keynote\n0larbin\n0libwww-perl\n0linkbot\n0linkchecker\n0linklint\n0linkscan\n0linkwalker\n1lwp\n0lydia\n0magus bot\n0magus+bot\n0mediapartners-google\n0mfc_tear_sample\n0microsoft scheduled cache content download service\n0microsoft url control\n0microsoft+scheduled+cache+content+download+service\n0microsoft+url+control\n0miva\n0mj12bot\n0monitor\n0mozilla\/5.0 (compatible; msie 5.0)\n0mozilla\/5.0+(compatible;+msie+5.0)\n0ms frontpage\n0MS Search\n0ms+frontpage\n0MS+Search\n0MSNPTC\n0nbot\n1ng\/2.0\n0nutch\n0nutscrape\n0ocelli\n0patric\n0pluck\n0plumtree\n0powermarks\n0psbot\n0rpt-http\n0rssreader\n0scooter\n0seekbot\n0sherlock\n0shopwiki\n0slurp\n0sucker\n0templeton\n0\/teoma\n0thunderstone\n0t-h-u-n-d-e-r-s-t-o-n-e\n0topix\n0ukonline\n0ultraseek\n0urchin\n0vagabondo\n0web downloader\n0web+downloader\n0webauto\n0webcapture\n0webcheck\n0WebCopier\n0webtool\n0wget\n0xenu\n0yacy\n0zealbot\n0zeusbot\n0ez publish link validator\n0ez+publish+link+validator\n0Goldfire\n0SiteVigil\n0iOpus\n0Microsoft BITS\n0Microsoft+BITS\n0heritrix\n0yahoofeedseeker\n0internal zero-knowledge agent\n0internal+zero-knowledge+agent\n0SurveyBot\/\n0Liferea\n0YahooSeeker\n0FindLinks\n0oodlebot\n0AdsBot-Google\n0KHTE\n0KTXN\n0Advanced Email Extractor\n0Advanced+Email+Extractor\n0webbot\n0panscient.com\n0Snoopy\n0bot\/1.0\n0UniversalSearch\n0Maxamine\n0Argus\n0Google Wireless Transcoder\n0Google+Wireless+Transcoder\n0ClickAJob\n0JobRapido\n0Python-urllib\n0http:\/\/bot.ims.ca\n0System Center Operations Manager\n0System+Center+Operations+Manager\n0JoeDog\n0websitepulse\n0BitvoUserAgent\n0Mozilla\/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813)\n0Mozilla\/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;1813)\n0Paros\n0Watchmouse\n0proximic\n0Scoutjet\n0Twiceler\n0Pingdom\n0Europarchive\n0Webmetrics\n0holmes\n0AlertSite\n0Yahoo Pipes\n0Yahoo+Pipes\n0SimplePie\n0Drupal\n0HTMLParser\n0SnapPreviewBot\n1FDM 3.x\n1FDM+3.x\n0Trovit\n0RiverglassScanner\n0Wepbot\n0Siteimprove\n0archive.org\n0VocusBot\n0BLP_bbot\n0W3C_Validator\n0Dotbot\n0(simulated_by_Webserver_Stress_Tool)\n0Linguee Bot\n0Linguee+Bot\n0WAPT\n0updatepatrol\n0SiteCon\n0twitterbot\n0richmetrics.com\/bot\n0bingbot\n0WWW-Mechanize\n0Google Web Preview\n0Google+Web+Preview\n0ADGBOT\n0httpunit\n0HttpComponents\n0Twisted PageGetter\n0Twisted+PageGetter\n0AppEngine-Google\n0YioopBot\n0Flamingo_SearchEngine\n0Atomic_Email_Hunter\n0FeedBurner\n0talktalk.co\n0facebookexternalhit\n0adbeat\n1SJN\n0outbrain\n0TweetmemeBot\n0WASALive\n0wikiwix-bot\n0Ezooms\n0HiScan\n0d24y-aegis\n0Google-HotelAdsVerifier\n0FupBot\n0moatbot\n0VMCbot\n0companydatatree\n0CookieReports\n0BingPreview\n1Scan\n0flamingosearch\n0Reconnoiter\n0Funnelback\n0Feed43\n0auditbot\n0Genieo\n0NerdByNature\n0Python-httplib\n0Cutbot\n0Server Density External Llama\n0Server+Density+External+Llama\n0MNA Digital Circonus Check\n0MNA+Digital+Circonus+Check\n0scanalert\n0catchpoint\n0discoverybot\n0Jooblebot\n0bitlybot\n0ADR)\n0YottaaMonitor\n0AdometryBot\n0TSMbot\n0PhantomJS\n0tagscanner\n0LoadImpactPageAnalyzer\n0CFSCHEDULE\n0searchme.com\/support\/\n0MetaURI\n0cXensebot\n0linkdex\n0SearchBot\n0ColdFusion\n0Open Web Analytics Bot\n0Open+Web+Analytics+Bot\n0YahooExternalCache\n0HP SiteScope\n0HP+SiteScope\n0Nielsen\n0Feedzilla\n0Superfeedr\n1Java\/\n0MixrankBot\n0Squider\n0topsy.com\/butterfly\/\n0Neustar\n1InAGist URL Resolver\n1InAGist+URL+Resolver\n1Crowsnest\/\n1kraken\/\n1JS-Kit URL Resolver\n1JS-Kit+URL+Resolver\n1python-requests\/\n1Scrapy\/\n0imgsizer\n0PTST\n0WeSEE:Search\n0ContextAd Bot\n0ContextAd+Bot\n0ADmantX\n0Google-HTTP-Java-Client\n0YahooCacheSystem\n0Typhoeus\n0Twikle\n0EbuzzingFeedBot\n0Cliqzbot\n0CrystalSemanticsBot\n0Livelapbot\n0evidon\n0automationtest\n0WeSEE:Ads\/\n0riddler.io\n0LongURL API\n0LongURL+API\n0LOCKSS cache\n0LOCKSS+cache\n0Go 1.1 package http\n0Go+1.1+package+http\n0google_partner_monitoring\n0SiteExplorer\n0A6-Indexer\n0VigLink\n0HTTP_Request2\n0binlar\n0BUbiNG\n0spbot\n0LinkTiger\n0newspaper\/0.0.\n0twibble.io\n0GoogleSecurityScanner\n0RKG Url Verifier\n0RKG+Url+Verifier\n0MaxPoint Bot\n0MaxPoint+Bot\n1Worldwatch\/\n1WebNotifier\/\n0oia.OWA\n0Google Page Speed Insights\n0Google+Page+Speed+Insights\n0Site24x7\n0RediffNewsBot\n0WinHttpRequest\n0aiHitBot\n0help.coccoc.com\n0Adsense-Snapshot-Google\n0prerender\n0COMODO SSL Checker\n0COMODO+SSL+Checker\n0RuxitSynthetic\n0EngageBDR\n0intergator\n0Yahoo Ad Monitoring\n0Yahoo+Ad+Monitoring\Line truncated
|
||||
fbq.loadPlugin("botblocking");
|
||||
instance.optIn("1468546770034581", "BotBlocking", true);
|
||||
fbq.loadPlugin("pagemetadata");
|
||||
instance.optIn("1468546770034581", "PageMetadata", true);
|
||||
fbq.loadPlugin("websiteperformance");
|
||||
instance.optIn("1468546770034581", "WebsitePerformance", true);instance.configLoaded("1468546770034581"); }});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
+1
@@ -0,0 +1 @@
|
||||
var configuration_map = {"notificationRuleList":[],"config":{"enableNotification":true},"passKey":"{}"};
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
!function(){"use strict";function t(t){return t&&t.t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,i;function n(){if(i)return e;i=1,e=function(e,i,s){"function"==typeof i&&(s=i,i={}),i||(i={});var o,a,r=i.prefix||"__jp",c=i.name||r+t++,l=i.param||"callback",u=null!=i.timeout?i.timeout:6e4,h=encodeURIComponent,d=document.getElementsByTagName("script")[0]||document.head;function g(){o.parentNode&&o.parentNode.removeChild(o),window[c]=n,a&&clearTimeout(a)}return u&&(a=setTimeout(function(){g(),s&&s(new Error("Timeout"))},u)),window[c]=function(t){g(),s&&s(null,t)},e=(e+=(~e.indexOf("?")?"&":"?")+l+"="+h(c)).replace("?&","?"),(o=document.createElement("script")).src=e,d.parentNode.insertBefore(o,d),function(){window[c]&&g()}};var t=0;function n(){}return e}const s=t(n()),o="Email",a="Push",r="ChromePush",c="Email",l="SMS",u="SafariPush",h="SafariLegacyPush",d="FirefoxPush",g="chrome",p="edge",w="safari",f="firefox",b=[{i:"Opera",o:/(?:opera|opr|opios)/i,l:/(?:opera|opr|opios)[ /](\d+(?:\.\d+)?)/i},{i:"Facebook",o:/FBAN\//i,l:/FBAV\/(\d+(?:\.\d+)?)/i},{i:"Samsung Browser",o:/samsungbrowser/i,l:/samsungbrowser[ /](\d+(?:\.\d+)?)/i},{i:"Yandex Browser",o:/yabrowser/i,l:/yabrowser[ /](\d+(?:\.\d+)?)/i},{i:"Vivaldi",o:/vivaldi/i,l:/vivaldi[ /](\d+(?:\.\d+)?)/i},{i:"UC Browser",o:/ucbrowser/i,l:/ucbrowser[ /](\d+(?:\.\d+)?)/i},{i:"Microsoft Edge",o:/edg/i,l:/edg[ /](\d+(?:\.\d+)?)/i},{i:"Firefox",o:/firefox|iceweasel|fxios/i,l:/(?:firefox|iceweasel|fxios)[ /](\d+(?:\.\d+)?)/i},{i:"Chromium",o:/chromium/i,l:/chromium[ /](\d+(?:\.\d+)?)/i},{i:"Chrome",o:/chrome|crios|crmo/i,l:/(?:chrome|crios|crmo)[ /](\d+(?:\.\d+)?)/i},{i:"Safari",o:/safari|applewebkit/i,l:/version[ /](\d+(?:\.\d+)?)/i}];function m(t){for(const e of b)if(e.o.test(t)){const i=t.match(e.l)?.[1]??"";return{name:e.i,version:i}}return{name:"Unknown",version:""}}const y=t=>!/like android/i.test(t)&&/android/i.test(t),S=t=>t.match(/(iphone|ipod|ipad)/i)?.[1]?.toLowerCase()||"";function v(t=navigator.userAgent){const e=S(t);return/tablet/i.test(t)&&!/tablet pc/i.test(t)||"ipad"===e||y(t)&&!/[^-]mobi/i.test(t)||!/nexus\s*[0-6]\s*/i.test(t)&&/nexus\s*\d+/i.test(t)}function O(t=navigator.userAgent){if(v(t))return!1;const e=S(t);return/[^-]mobi/i.test(t)||"iphone"===e||"ipod"===e||y(t)}const k={Chrome:g,Chromium:g,Firefox:f,"Microsoft Edge":p,Safari:w};function I(){return k[m(navigator.userAgent).name]||"other"}const x=()=>{const t=m(navigator.userAgent).version;if(!t)return-1;const[e,i="0"]=t.split(".");return+`${e}.${i}`};function C(){const t=I(),e=x();return t===f&&e>=72||t===w&&e>=12.1}const _="160510",E=()=>"undefined"!=typeof window,$=()=>E()&&void 0!==window.safari,P=()=>"undefined"!=typeof navigator&&"serviceWorker"in navigator,T="Browser",N=()=>E()&&null!=window.safari?.pushNotification,M="undefined"!=typeof PushSubscriptionOptions&&PushSubscriptionOptions.prototype.hasOwnProperty("applicationServerKey"),A=({action:t,legacy:e=!1}={})=>new URL(e?"https://onesignal.com/api/v1/":"https://api.onesignal.com/"),D=()=>I()===f?d:I()===w&&M&&!N()?u:N()?h:r;function U(){return String(x())}function B(){return navigator.platform}const L="set-alias",R="delete-alias",W="set-property",F="refresh-user",j="login-user",K="create-subscription",z="update-subscription",V="delete-subscription",H="transfer-subscription",q="custom-event",G="external_id",J="onesignal_id";class Y extends Error{status;statusText;constructor(t,e){super("Registration of a Service Worker failed."),this.status=t,this.statusText=e}}class Q extends Error{reason;constructor(t){let e;switch(t){case 1:e="Invalid email";break;case 0:e="Invalid sms";break;case 2:e="Invalid email & sms"}super(e),this.reason=t}}const Z=new Error("Missing app ID"),X=new Error("Retry limit reached"),tt=new Error("Permission blocked"),et=new Error("AppID doesn't match existing apps"),it=new Error("Safari web platform must be enabled"),nt=t=>new Error(`Channel '${t}' already exists`),st=t=>new Error(`"${t}" is empty`),ot=t=>new Error(`"${t}" is malformed`),at=t=>new Error(`"${t}" is the wrong type`);function rt(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ct(t,e){if(e&&e.allowNull&&null===t)return!0;if(e&&e.allowEmpty&&null==t)return!0;try{const i=new URL(t);return!e||!e.requireHttps||"https:"===i.protocol}catch(i){return!1}}function lt(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)}function ut(t){return new Promise(e=>setTimeout(e,t))}function ht(){return Promise.resolve()}function dt(t,e){return null!=t?t:e}function gt(){return location.origin}class pt{static u(){try{const t=window.localStorage.getItem("loglevel");return"trace"===t?.toLowerCase()}catch(t){return!1}}static h(t){try{window.localStorage.setItem("loglevel",t)}catch(e){console.error(e)}}static p(t){return(...e)=>{(this.u()||"error"===t)&&console[t](...e)}}static m=pt.p("debug");static S=pt.p("info");static v=pt.p("warn");static O=pt.p("error")}function wt(t,e,i){return mt("POSTLine truncated
|
||||
//# sourceMappingURL=OneSignalSDK.page.es6.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
!function(){"use strict";"undefined"!=typeof PushSubscriptionOptions&&PushSubscriptionOptions.prototype.hasOwnProperty("applicationServerKey")||void 0!==window.safari&&void 0!==window.safari.pushNotification?function(){const n=document.createElement("script");n.src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.es6.js?v=160510",n.defer=!0,document.head.appendChild(n)}():function(){let n="Incompatible browser.";"Apple Computer, Inc."===navigator.vendor&&navigator.maxTouchPoints>0&&(n+=" Try these steps: https://tinyurl.com/bdh2j9f7"),console.info(n)}()}();
|
||||
//# sourceMappingURL=OneSignalSDK.page.js.map
|
||||
@@ -0,0 +1 @@
|
||||
window.google_ad_status = 1;
|
||||
@@ -0,0 +1,220 @@
|
||||
|
||||
var mult_send = 0;
|
||||
|
||||
function Contest_Send(){
|
||||
|
||||
mult_send = mult_send + 1;
|
||||
PreparaContestSend('senduscontestform',false);
|
||||
|
||||
if (mult_send == 1)
|
||||
{
|
||||
AJAXReqContestSend("POST","send_us_contest.php",true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function PreparaContestSend(nome,ele){
|
||||
stringa = "";
|
||||
var form = document.forms[nome];
|
||||
|
||||
var numeroElementi = form.elements.length;
|
||||
|
||||
for(var i = 0; i < numeroElementi; i++){
|
||||
|
||||
nmfrm = form.elements[i].name;
|
||||
|
||||
if(i < numeroElementi-1)
|
||||
{
|
||||
stringa += form.elements[i].name+"="+encodeURIComponent(form.elements[i].value)+"&";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
stringa += form.elements[i].name+"="+encodeURIComponent(form.elements[i].value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function AJAXReqContestSend(method,url,bool){
|
||||
if(window.XMLHttpRequest){
|
||||
myReq = new XMLHttpRequest();
|
||||
} else
|
||||
|
||||
if(window.ActiveXObject){
|
||||
myReq = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
|
||||
if(!myReq){
|
||||
myReq = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
}
|
||||
}
|
||||
|
||||
if(myReq){
|
||||
|
||||
myReq.onreadystatechange = state_ContestSend;
|
||||
|
||||
myReq.open(method,url,bool);
|
||||
|
||||
|
||||
myReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
|
||||
myReq.send(stringa);
|
||||
|
||||
}else{
|
||||
alert("Impossibilitati ad usare AJAX");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function state_ContestSend(bReload){
|
||||
|
||||
if (myReq.readyState==4){
|
||||
|
||||
mult_send = 0;
|
||||
|
||||
if (myReq.status==200){
|
||||
|
||||
ResponseContestSend(myReq.responseText);
|
||||
}
|
||||
else {
|
||||
if (bDebug) {alert("Problem retrieving XML data");}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function ResponseContestSend(sResponse){
|
||||
|
||||
|
||||
var vetResp = sResponse.split('|');
|
||||
|
||||
if (vetResp[0].toUpperCase() == 'OK')
|
||||
{
|
||||
if (MM_findObj("contest_name_msg"))
|
||||
{
|
||||
DisplayHTMLData(MM_findObj('contest_name_msg'), ' ');
|
||||
}
|
||||
if (MM_findObj("contest_video_msg"))
|
||||
{
|
||||
DisplayHTMLData(MM_findObj('contest_video_msg'), ' ');
|
||||
}
|
||||
if (MM_findObj("send_box_contest"))
|
||||
{
|
||||
MM_findObj("send_box_contest").style.display='none';
|
||||
}
|
||||
if (MM_findObj("send_box_contest_response"))
|
||||
{
|
||||
MM_findObj("send_box_contest_response").style.display='block';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (MM_findObj("contest_name_msg"))
|
||||
{
|
||||
DisplayHTMLData(MM_findObj('contest_name_msg'), ' ');
|
||||
}
|
||||
if (MM_findObj("contest_video_msg"))
|
||||
{
|
||||
DisplayHTMLData(MM_findObj('contest_video_msg'), ' ');
|
||||
}
|
||||
for (b=1; b<vetResp.length; b++)
|
||||
{
|
||||
var f = vetResp[b].split(';');
|
||||
var fldcont = f[0];
|
||||
var msgcont = f[1];
|
||||
|
||||
if (fldcont == 'contest_name')
|
||||
{
|
||||
DisplayHTMLData(MM_findObj(fldcont + '_msg'), msgcont);
|
||||
}
|
||||
|
||||
if (fldcont == 'contest_video')
|
||||
{
|
||||
DisplayHTMLData(MM_findObj(fldcont + '_msg'), msgcont);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var HTTP_FIRSTAUCT_URL = new String ('first_auct.php');
|
||||
var xmlhttpFirstAuct = null;
|
||||
|
||||
function FirstAuct() {
|
||||
|
||||
var sUrlFirstAuct = HTTP_FIRSTAUCT_URL + "?chk=" + new Date().valueOf();
|
||||
|
||||
if (xmlhttpFirstAuct) {
|
||||
|
||||
if ((xmlhttpFirstAuct.readyState != 4) && (xmlhttpFirstAuct.readyState != 0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (window.XMLHttpRequest){
|
||||
|
||||
xmlhttpFirstAuct = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject){
|
||||
|
||||
xmlhttpFirstAuct = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
if (xmlhttpFirstAuct != null){
|
||||
xmlhttpFirstAuct.onreadystatechange = state_FirstAuct;
|
||||
xmlhttpFirstAuct.open("GET",sUrlFirstAuct,true);
|
||||
xmlhttpFirstAuct.send(null);
|
||||
return true;
|
||||
} else {
|
||||
if (bDebug)
|
||||
{
|
||||
alert("Your browser does not support XMLHTTP.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
xmlhttpFirstAuct = null;
|
||||
if (bDebug) alert('Errore in loadXMLDocElenco');
|
||||
}
|
||||
finally {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function state_FirstAuct(){
|
||||
|
||||
if (xmlhttpFirstAuct.readyState==4){
|
||||
|
||||
if (xmlhttpFirstAuct.status!=200){
|
||||
|
||||
if (bDebug) {
|
||||
alert("Problem retrieving XML data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- saved from url=(0231)https://www.google.com/recaptcha/enterprise/anchor?ar=1&k=6LcjhUMpAAAAADxcuxrNs1Ou0iKbz2h3dn58Egnw&co=aHR0cHM6Ly9pdC5iaWRvby5jb206NDQz&hl=it&v=TkacYOdEJbdB_JjX802TMer9&size=invisible&anchor-ms=20000&execute-ms=15000&cb=bqz19uym1h4r -->
|
||||
<html dir="ltr" lang="it"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>reCAPTCHA</title>
|
||||
<style type="text/css">
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu72xKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu5mxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7mxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fABc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fCBc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fBxc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fCxc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fBBc4.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmYUtfCRc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmYUtfABc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmYUtfCBc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmYUtfBxc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmYUtfCxc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmYUtfChc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmYUtfBBc4.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="./styles__ltr.css">
|
||||
<script nonce="" type="text/javascript">window['__recaptcha_api'] = 'https://www.google.com/recaptcha/enterprise/';</script>
|
||||
<script type="text/javascript" src="./recaptcha__it.js.download" nonce="">
|
||||
|
||||
</script></head>
|
||||
<body><div id="rc-anchor-alert" class="rc-anchor-alert"></div>
|
||||
<input type="hidden" id="recaptcha-token" value="03AFcWeA74YX2ICyXDmtirwAgwZMe2CBuvalEtEc8ZP99Hgn2dD-a44Cv9zLjZAI1QSKv0uhvGMo5V65zzXHY_cBgGO7s5ocei3p4fusBZBLQBNFpHQvEd2nZHWuk9Ir-Z0sb1etdd9i0UZvB1q07iw8XNpPQgnd3nJeEMqA7rvUU-dTEa8ytjX3twuzxPg-dIB3ZtjTooJnvBTSXruPpGPfA0yXYzdCBuD71lyYS0U27FHeGN6vjS39Psh4W9u6HINDaBix3O-eUq4y2q06euZczUgCdddkxyLiFkFGark_xOklhTifM3qPtiF3ZN-F5SXy3jYc-RbWKEGvojFYSsw7sdh78tPYGwVdZmDa1Vh78Bx9QE7A_hReH7ktYvecRVlTGhtP6ZbVa3axHlUitTamVbQ85uuhUAjAvCmSq-Ezz7P2If1OL55Q4Rd7X8uOJ7fbuuRxveKgaolmowrFgw1EPyO1oMqPucBucl6jlOrNnneP1UfqaqxDAybOFWXQXG0dzSWlH-OXQ86SwzSfqVzgZGCR1RBse_33emGDOf_sRTAAMgdToNu1GIOQKvmqpBFDjJLZQM0CN7kvj35qTJog6kz-p62VVH1qtG0-V0hP807xJqjNBL7EHgLD11M1z8trqqpkrn26KqTS2Mhpt8H86GuL_ma12sGljO2zH1CabLIrEiclLNx1l8ej0OqpBt-6mRD2dqLdHpEFpzwRwF2CMSVes-3mKo28udelI_pvUn1z6DjkSRsvfk_U9DAp88ioELVk1fvKpHYKmWQzDlQx-3lzCKyziVhnAa5tk1twAzQDUTWtsIsqBZC55k48gLVtS9ZWMH63AkEKGRDzBn9Jgycg9ioLTY4DrrMX7c_e_df5E9NEyBThM8ySI2RBOshZ-3VTu2pKiZVg2bi-qqREiC1nGgAgGWinLUiQeSVqjQ_i2CeIsQyH9il1MTvDs2lSApyMf-mWFIprX_Skw_j5sWdBunswrZhR3mke3ixU-Xe9on0VtarzQGkDFWkk9yDddV23_MdZVmmx8McIQ-eOjUFzdTk4ggEpgb7qUyccqzs0GDR2ZfA0ARs4eKOv4W0pI4uV3_qMvIQzbPozyPb41He7MpOaMkVRJlYBp_y14PAMCK0o9XK-VSUcHLQoO7dSPfrCpGAC7vi7lBVS04m8WenocAKSMEi8EOEIRBReqQmjdZr-Wlt1iU01uZrZSAWMblFC8UkqqrGRUPvIc8kCxouXKEwczI-XYVAnPf3r3VdZzvKAnn8gTRjtD9xizrJvS2RNH3cj3sArBElsUwyMrdpgN2erv3W6n2vzTl4M_ERDRtp52SKpfxOLlVSJqS4kHK9bzqmfMNpnmBqpJcZXJpCvgVh9J7e4iIbeZyQrvVoya3IUg8-P78JBfAE4-tCaQWCi69KV7BNmWiELGzqAqO8dQerTnKI-7PF8yyMnMifi1AENrHu4r3vIdQFLuS5CfSsQ1KLL-RGqjfMxrqFvfDfYAIag-80Q">
|
||||
<script type="text/javascript" nonce="">
|
||||
recaptcha.anchor.Main.init("[\x22ainput\x22,[\x22bgdata\x22,\x22\x22,\x22LyogQW50aS1zcGFtLiBXYW50IHRvIHNheSBoZWxsbz8gQ29udGFjdCAoYmFzZTY0KSBZbTkwWjNWaGNtUXRZMjl1ZEdGamRFQm5iMjluYkdVdVkyOXQgKi8gKGZ1bmN0aW9uKCl7dmFyIFA9ZnVuY3Rpb24oZSxIKXtpZihIPShlPW51bGwsaCkudHJ1c3RlZFR5cGVzLCFIfHwhSC5jcmVhdGVQb2xpY3kpcmV0dXJuIGU7dHJ5e2U9SC5jcmVhdGVQb2xpY3koImJnIix7Y3JlYXRlSFRNTDpGLGNyZWF0ZVNjcmlwdDpGLGNyZWF0ZVNjcmlwdFVSTDpGfSl9Y2F0Y2goWil7aC5jb25zb2xlJiZoLmNvbnNvbGUuZXJyb3IoWi5tZXNzYWdlKX1yZXR1cm4gZX0sRj1mdW5jdGlvbihlKXtyZXR1cm4gZX0saD10aGlzfHxzZWxmOygwLGV2YWwpKGZ1bmN0aW9uKGUsSCl7cmV0dXJuKEg9UCgpKSYmZS5ldmFsKEguY3JlYXRlU2NyaXB0KCIxIikpPT09MT9mdW5jdGlvbihaKXtyZXR1cm4gSC5jcmVhdGVTY3JpcHQoWil9OmZ1bmN0aW9uKFope3JldHVybiIiK1p9fShoKShBcnJheShNYXRoLnJhbmRvbSgpKjc4MjR8MCkuam9pbigiXG4iKStbJyhmdW5jdGlvbigpey8qJywKJycsCicgQ29weXJpZ2h0IEdvb2dsZSBMTEMnLAonIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wJywKJyovJywKJ3ZhciBlbD1mdW5jdGlvbihlLEgpe3JldHVybihIPUQoZSksSCYxMjgpJiYoSD1IJjEyN3xEKGUpPDw3KSxIfSxTPWZ1bmN0aW9uKGUsSCxGLGgpe2ZvcihoPShGPShlfDApLTEsW10pO0Y+PTA7Ri0tKWhbKGV8MCktMS0oRnwwKV09SD4+Rio4JjI1NTtyZXR1cm4gaH0scT10aGlzfHxzZWxmLFp4PWZ1bmN0aW9uKGUsSCxGLGgpe3JldHVybiBUKEYsKEhMKEYsKChoPVQoRiwzNyksRi5JJiZoPEYuTik/KG0oMzcsRixGLk4pLGkxKGUsRikpOm0oMzcsRixlKSxIKSksbSgzNyxGLGgpLDE1OSkpfSxoSz1mdW5jdGlvbihlLEgsRil7cmV0dXJuIGUuS1MoZnVuY3Rpb24oaCl7Rj1ofSxmYWxzZSxIKSxGfSxnPWZ1bmN0aW9uKGUsSCxGLGgsSyxQLEEsdyl7dz10aGlzO3RyeXtGMihGLFAsaCxILGUsdGhpcyxBLEspfWNhdGNoKFcpe2YodGhpcyxXKSxoKGZ1bmN0aW9uKHope3oody5LKX0pfX0sVSxQTD1mdW5jdGlvbihlLEgsRixoLEspe2ZvcihGPShoPUZbMl18KEs9MCwwKSxGWzNdfDApO0s8MTQ7SysrKWU9ZT4+Pjh8ZTw8MjQsZSs9SHwwLGVePWgrMzAyNyxIPUg8PDN8SD4+PjI5LEhePWUsRj1GPj4+OHxGPDwyNCxGKz1ofDAsaD1oPDwzfGg+Pj4yOSxGXj1LKzMwMjcsaF49RjtyZXR1cm5bSD4+PjI0JjI1NSxIPj4+MTYmMjU1LEg+Pj44JjI1NSxIPj4+MCYyNTUsZT4+PjI0JjI1NSxlPj4+MTYmMjU1LGU+Pj44JjI1NSxlPj4+MCYyNTVdfSxPcD1mdW5jdGlvbihlLEgsRixoKXtmb3IoO0guaC5sZW5ndGg7KXtoPShILkE9bnVsbCxIKS5oLnBvcCgpO3RyeXtGPUtXKEgsaCl9Y2F0Y2goSyl7ZihILEspfWlmKGUmJkguQSl7KGU9SC5BLGUpKGZ1bmN0aW9uKCl7RSh0cnVlLEgsdHJ1ZSl9KTticmVha319cmV0dXJuIEZ9LGwxPWZ1bmN0aW9uKGUsSCxGLGgpe3koZSxTKEgsKGg9KEY9dihlKSx2KGUpKSxUKShlLEYpKSxoKX0sZDE9ZnVuY3Rpb24oZSxIKXtyZXR1cm4gSD0wLGZ1bmN0aW9uKCl7cmV0dXJuIEg8ZS5sZW5ndGg/e2RvbmU6ZmFsc2UsdmFsdWU6ZVtIKytdfTp7ZG9uZTp0cnVlfX19LGkxPWZ1bmN0aW9uKGUsSCl7SC5ILmxlbmd0aD4xMDQ/WShILDAsW2EsMzZdKTooSC5ILnB1c2goSC5SLnNsaWNlKCkpLEguUlszN109dm9pZCAwLG0oMzcsSCxlKSl9LER4PWZ1bmN0aW9uKGUsSCxGLGgpe3RyeXtoPWVbKChIfDApKzIpJTNdLGVbSF09KGVbSF18MCktKGVbKChIfDApKzEpJTNdfDApLShofDApXihIPT0xP2g8PEY6aD4+PkYpfWNhdGNoKEspe3Rocm93IEs7fX0sJHM9ZnVuY3Rpb24oZSxILEYsaCxLLFApe2ZvcihQPXYoKEs9KCgoRj0oSD1lW0FLXXx8e30sdikoZSksSCkueXg9dihlKSxIKS5VPVtdLGUuVj09ZSk/KEQoZSl8MCktMToxLGUpKSxoPTA7aDxLO2grKylILlUucHVzaCh2KGUpKTtmb3IoSC5ONT1UKGUsRiksSC5qSj1UKGUsUCk7Sy0tOylILlVbS109VChlLEguVVtLXSk7cmV0dXJuIEh9LGpsPWZ1bmN0aW9uKGUsSCxGKXtpZihlLmxlbmd0aD09Myl7Zm9yKEY9MDtGPDM7RisrKUhbRl0rPWVbRl07Zm9yKEY9WzEzLDgsMTMsMTIsMTYsNSwoZT0wLDMpLDEwLDE1XTtlPDk7ZSsrKUhbM10oSCxlJTMsRltlXSl9fSxuPWZ1bmN0aW9uKGUsSCxGKXttKGUsRixIKSxIW0xXXT0yNzk2fSxYLEYyPWZ1bmN0aW9uKGUsSCxGLGgsSyxQLEEsdyxXLHope2ZvcihXPSh6PShQLlpNPShQLnhjPVdMKFAuZyx7Z2V0OihQLnVBPVBbR10sUC50WD13MSxQLnpSPVNsLGZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuY29uY2F0KCl9KX0pLE0pW1AuZ10oUC54Yyx7dmFsdWU6e3ZhbHVlOnt9fX0pLFtdKSwwKTtXPDM2MjtXKyspeltXXT1TdHJpbmcuZnJvbUNoYXJDb2RlKFcpO2lmKChQLkdSPSgoUC5uUz0oUC5OPTAsZmFsc2UpLChQLmw9dm9pZCAwLFApLlI9KFAuVz0wLFAuWj0wLFAuSD1bXSxbXSksUC5HPSgoUC5SbD1ILFAudT0wLFAuRj0oUC5ZPTEsZmFsc2UpLFAuSlg9dm9pZCAwLFApLlg9dm9pZCAwLFAuTD1bXSxQLks9KFAuY0g9W10sdm9pZCAwKSwwKSwoVz13aW5kb3cucGVyZm9ybWFuY2V8fHt9LFAuRmo9MCwoUC5EPTAsUCkuaD0oUC5BPW51bGwsUC5wUz1bXSxQLkVtPTEwMDAxLFtdKSwoUC5pQT1bXSxQKS5mUz0oKFAubz1mYWxzZSxQKS5CSD1mYWxzZSxLKSxQLlhqPWZhbHNlLFAuZzM9dm9pZCAwLFAuQz12b2lkIDAsUC5sQT0yNSxQLlY9UCxQLkk9W10sUC5PPXZvaWQgMCxQKS5QPXZvaWQgMCwoUC5WeD0wLFApLmFyPShQLnY9MCwwKSxQKS5pPShQLlBIPWZ1bmN0aW9uKFope3RoaXMuVj1afSxQLmhYPVtdLGZhbHNlKSxXLnRpbWVPcmlnaW58fChXLnRpbWluZ3x8e30pLm5hdmlnYXRpb25TdGFydHx8MCksaCkmJmgubGVuZ3RoPT0yJiYoUC5pQT1oWzFdLFAuY0g9aFswXSksdyl0cnl7UC5KWD1KU09OLnBhcnNlKHcpfWNhdGNoKFope1AuSlg9e319KHgoKChuKDI1MixmdW5jdGlvbihaLE8sbCxkLEwpe2ZvcihMPShsPShkPShPPXYoWiksZWwoWikpLDApLFtdKTtsPGQ7bCsrKUwucHVzaChEKFopKTttKE8sWixMKX0sKG4oODEsZnVuY3Rpb24oWixPLGwsZCxMKXsobD1UKChMPShPPVQoWiwoZD0oTz0oTD0oZD0obD12KFopLHYoWikpLHYoWikpLHYoWikpLFQoWixkKSksTykpLFQoWixMKSksWikuVixsKSxsIT09MCkmJihMPW1nKDEsWixMLE8sbCxkKSxsLmFkZEV2ZW50TGlzdGVuZXIoZCxMLGZXKSxtKDQ2NixaLFtsLGQsTF0pKX0sKG0oODcsKG4oMjM0LChuKDEzMCxmdW5jdGlvbihaKXtwVyhaLDMpfSwobSgyNCwobSgxODAsUCwoUC5ReD0obig0MTgsZnVuY3Rpb24oWixPLGwsZCl7aWYoTz1aLkgucG9wKCkpe2ZvcihsPUQoWik7bD4wO2wtLSlkPXYoWiksT1tkXT1aLlJbZF07Wi5SPSgoT1szNjVdPVouUlszNjVdLE8pWzMzOV09Wi5SWzMzOV0sTyl9ZWxzZSBtKDM3LFosWi5OKX0sKG4oMzk4LGZ1bmN0aW9uKFosTyxsLGQpeyhPPXYoKGw9dihaKSxaKSksZD12KFopLFopLlY9PVomJihPPVQoWixPKSxkPVQoWixkKSxUKFosbClbT109ZCxsPT0yMzEmJihaLkM9dm9pZCAwLE89PTImJihaLlg9UVUoZmFsc2UsMzIsWiksWi5DPXZvaWQgMCkpKX0sKG4oNDM5LChuKDE2NywobigobigxMDksZnVuY3Rpb24oWixPLGwsZCxMLHQscCxWLGMsUixiLE4pe2Z1bmN0aW9uIEMoUSxJKXtmb3IoO2Q8Line truncated
|
||||
</script><div class="rc-anchor rc-anchor-invisible rc-anchor-light rc-anchor-invisible-hover"><div id="recaptcha-accessible-status" class="rc-anchor-aria-status" aria-hidden="true">Recaptcha richiede la verifica. </div><div class="rc-anchor-error-msg-container" style="display:none"><span class="rc-anchor-error-msg" aria-hidden="true"></span></div><div class="rc-anchor-normal-footer"><div class="rc-anchor-logo-large" role="presentation"><div class="rc-anchor-logo-img rc-anchor-logo-img-large"></div></div><div class="rc-anchor-pt"><a href="https://www.google.com/intl/it/policies/privacy/" target="_blank">Privacy</a><span aria-hidden="true" role="presentation"> - </span><a href="https://www.google.com/intl/it/policies/terms/" target="_blank">Termini</a></div></div><div class="rc-anchor-invisible-text"><span>protetto da <strong>reCAPTCHA</strong></span><div class="rc-anchor-pt"><a href="https://www.google.com/intl/it/policies/privacy/" target="_blank" style="">Privacy</a><span aria-hidden="true" role="presentation"> - </span><a href="https://www.google.com/intl/it/policies/terms/" target="_blank" style="">Termini</a></div></div></div><iframe style="display: none;" src="./saved_resource.html"></iframe></body></html>
|
||||
@@ -0,0 +1,129 @@
|
||||
btn-promo {
|
||||
border-radius: 3px;
|
||||
background: linear-gradient(rgb(82, 157, 253), rgb(46, 114, 202));
|
||||
background: -moz-linear-gradient(rgb(82, 157, 253), rgb(46, 114, 202));
|
||||
background: -webkit-linear-gradient(rgb(82, 157, 253), rgb(46, 114, 202));
|
||||
background: -o-linear-gradient(rgb(82, 157, 253), rgb(46, 114, 202));
|
||||
background: -ms-linear-gradient(rgb(82, 157, 253), rgb(46, 114, 202));
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn.btn-promo:hover {
|
||||
background: linear-gradient(rgb(117, 175, 250), rgb(53, 124, 216));
|
||||
background: -moz-linear-gradient(rgb(117, 175, 250), rgb(53, 124, 216));
|
||||
background: -webkit-linear-gradient(rgb(117, 175, 250), rgb(53, 124, 216));
|
||||
background: -o-linear-gradient(rgb(117, 175, 250), rgb(53, 124, 216));
|
||||
background: -ms-linear-gradient(rgb(117, 175, 250), rgb(53, 124, 216));
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.mCSB_inside > .mCSB_container {
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
.mCSB_scrollTools .mCSB_draggerRail {
|
||||
width: 6px;
|
||||
background-color: #e2e2e2;
|
||||
}
|
||||
|
||||
.mCSB_scrollTools .mCSB_draggerContainer {
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {
|
||||
background-color: #20cb9a !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.loader {
|
||||
margin: 10px auto;
|
||||
border: 5px solid #f3f3f3;
|
||||
/* Light grey */
|
||||
border-top: 5px solid #20cb9a;
|
||||
/* Blue */
|
||||
border-radius: 50%;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
-webkit-animation: spin 2s linear infinite;
|
||||
animation: spin 2s linear infinite;
|
||||
}
|
||||
|
||||
.stopScroll{
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 384px) {
|
||||
#prod_win_cont_modal h3 {
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 320px) {
|
||||
.prod_won__2 {
|
||||
margin-left: 1px !important;
|
||||
margin-right: 1px !important;
|
||||
}
|
||||
#prod_win_cont_modal .col-xs-6{
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
#modal iframe {
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
#myModal3 .modal-dialog, #myModal2 .modal-dialog {
|
||||
margin: 30px auto;
|
||||
}
|
||||
|
||||
.settingBox form div {
|
||||
border-bottom: 1px solid #efefef;
|
||||
padding: 15px;
|
||||
font-weight: 500;
|
||||
font-size: 12px;
|
||||
color: #818181;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 991px) {
|
||||
#menuModal .show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#menuModal .modal-header {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#menuModal .height {
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
.parentOverflowY {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
#notifBoxContainer .mCSB_container {
|
||||
top: 0px;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,206 @@
|
||||
const AuctionsBidManage = (function() {
|
||||
|
||||
const _defaultPart = "divAsta";
|
||||
let _nAstePerBonus = 10;
|
||||
let _limiteAsteVinte = 10;
|
||||
let _nAstePuntataVinte = 0;
|
||||
let _percentualeBonus = 0;
|
||||
let _nPuntateVinteOggi = 0;
|
||||
let _nAsteConfermate = 0;
|
||||
let _nPuntateRiscattate = 0;
|
||||
let _nPuntateDaRiscattare = 0;
|
||||
let _initialized = false;
|
||||
let _defaultValidUntil = null;
|
||||
let _viewSlot = false;
|
||||
|
||||
function _defaultObj() {
|
||||
return {
|
||||
auctions: {},
|
||||
nAsteConfermate: 0,
|
||||
percentualeBonus: 0,
|
||||
limiteAsteVinte: 10,
|
||||
nAstePerBonus: 10,
|
||||
validUntil: getDefaultValidUntil()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggiunge una nuova asta all'oggetto delle aste di puntata vinte in un giorno
|
||||
* @param idAuction {int}
|
||||
*/
|
||||
function add(idAuction){
|
||||
|
||||
let result = get();
|
||||
let retrievedObject = JSON.parse(result);
|
||||
let auctionBidWin = retrievedObject === null ? _defaultObj() : retrievedObject ;
|
||||
let auctionElement = document.getElementById(_defaultPart + idAuction);
|
||||
let creditValue = parseInt(auctionElement.getAttribute('data-credit-value')) > 0 ? parseInt(auctionElement.getAttribute('data-credit-value')) : 0;
|
||||
|
||||
|
||||
|
||||
if(creditValue > 0 && Object.keys(auctionBidWin.auctions).length <= auctionBidWin.limiteAsteVinte){
|
||||
|
||||
// let obj =
|
||||
// {
|
||||
// idAuction: idAuction,
|
||||
// value: creditValue
|
||||
// }
|
||||
// ;
|
||||
//
|
||||
// if(!auctionBidWin.auctions.hasOwnProperty(idAuction)){
|
||||
// auctionBidWin.auctions[idAuction] = obj;
|
||||
// }
|
||||
// let newObj = JSON.stringify(auctionBidWin);
|
||||
//
|
||||
// localStorage.setItem("auctionBidWin", newObj);
|
||||
getRemoteData();
|
||||
}
|
||||
return;
|
||||
}
|
||||
function getDefaultValidUntil(){
|
||||
|
||||
return _defaultValidUntil;
|
||||
|
||||
}
|
||||
|
||||
function setDefaultValidUntil(untilTimestamp){
|
||||
_defaultValidUntil = untilTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ritornano le informazioni salvate nel localStorage
|
||||
* @returns {string}
|
||||
*/
|
||||
function get(){
|
||||
return localStorage.getItem('auctionBidWin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Rimuove dal localStorage
|
||||
*/
|
||||
function remove(){
|
||||
localStorage.removeItem('auctionBidWin');
|
||||
}
|
||||
|
||||
|
||||
function getRemoteData(callback = null){
|
||||
|
||||
fetch('./ajax/get_auction_bids_info_banner.php',{
|
||||
method: "GET"
|
||||
})
|
||||
// gestisci il successo
|
||||
.then(response => response.json()) // converti a json
|
||||
.then(function (data) {
|
||||
let obj = {
|
||||
auctions: data.auctions,
|
||||
nAsteConfermate: data.nAsteConfermate,
|
||||
nAsteVinte: data.nAsteVinte,
|
||||
nPuntateRiscattate: data.nPuntateRiscattate,
|
||||
nPuntateDaRiscattare: data.nPuntateDaRiscattare,
|
||||
limiteAsteVinte: data.limiteAsteVinte,
|
||||
nAstePerBonus: data.nAstePerBonus,
|
||||
percentualeBonus: data.percentualeBonus,
|
||||
validUntil: data.validUntil,
|
||||
viewSlot: data.viewSlot,
|
||||
extraSlots: data.extraSlots, //un elenco degli slots non scaduti e non aperti
|
||||
nPuntateBonus: data.nPuntateBonus
|
||||
};
|
||||
let newObj = JSON.stringify(obj);
|
||||
|
||||
localStorage.setItem("auctionBidWin", newObj);
|
||||
if(callback !== null){
|
||||
callback();
|
||||
}
|
||||
|
||||
})
|
||||
.catch(err => console.log('Request Failed', err)); // gestisci gli errori
|
||||
}
|
||||
|
||||
function retriveInfoComponent(){
|
||||
let result = JSON.parse(get());
|
||||
|
||||
if(result) {
|
||||
|
||||
_nAstePuntataVinte = result.nAsteVinte;
|
||||
_limiteAsteVinte = result.limiteAsteVinte;
|
||||
_nAsteConfermate = result.nAsteConfermate;
|
||||
_nPuntateDaRiscattare = result.nPuntateDaRiscattare;
|
||||
_nPuntateRiscattate = result.nPuntateRiscattate;
|
||||
_nAstePerBonus = result.nAstePerBonus;
|
||||
_percentualeBonus = result.percentualeBonus;
|
||||
_viewSlot = result.viewSlot;
|
||||
_nPuntateVinteOggi = result.nPuntateDaRiscattare + result.nPuntateRiscattate;
|
||||
|
||||
|
||||
|
||||
/*if (_percentualeBonus > 0) {
|
||||
let valorePercentualeBonus = ((_nPuntateVinteOggi * _percentualeBonus) / 100);
|
||||
_nPuntateVinteOggi = _nPuntateVinteOggi + valorePercentualeBonus;
|
||||
}*/
|
||||
|
||||
|
||||
let asteRimanentiPerBonus = _nAstePerBonus - _nAstePuntataVinte;
|
||||
|
||||
return {
|
||||
auctions: result.auctions,
|
||||
asteRimanentiPerBonus: asteRimanentiPerBonus,
|
||||
nAstePerBonus: _nAstePerBonus,
|
||||
nAstePuntataVinte: _nAstePuntataVinte,
|
||||
percentualeBonus: _percentualeBonus,
|
||||
nPuntateVinteOggi: parseInt(_nPuntateVinteOggi),
|
||||
limiteAsteVinte: _limiteAsteVinte,
|
||||
nAsteConfermate: _nAsteConfermate,
|
||||
nPuntateDaRiscattare: _nPuntateDaRiscattare,
|
||||
nPuntateRiscattate: _nPuntateRiscattate,
|
||||
|
||||
viewSlot: _viewSlot,
|
||||
extraSlots: result.extraSlots,
|
||||
nPuntateBonus: result.nPuntateBonus
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param auctionId
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function searchByAuctionId(auctionId){
|
||||
let data = retriveInfoComponent();
|
||||
let controllo = false;
|
||||
if(data == undefined || data == null ){ return; }
|
||||
|
||||
let keys = Object.keys(data.auctions);
|
||||
|
||||
for(let i= 0; i <= keys.length; i++){
|
||||
if(keys[i] === auctionId){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function initRemoteData(){
|
||||
if(!_initialized){
|
||||
getRemoteData();
|
||||
setInterval(function (){
|
||||
getRemoteData();
|
||||
}, 1000 * 60);
|
||||
}
|
||||
_initialized = true;
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
add,
|
||||
get,
|
||||
remove,
|
||||
getRemoteData,
|
||||
retriveInfoComponent,
|
||||
initRemoteData,
|
||||
setDefaultValidUntil,
|
||||
searchByAuctionId
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
@@ -0,0 +1,927 @@
|
||||
#wrapBonusSection{
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
margin-bottom: 20px;
|
||||
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.2);
|
||||
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.2);
|
||||
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.2);
|
||||
border-top: 1px solid #d0d0d0;
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
#wrapBonusSection.visible{
|
||||
display: block;
|
||||
}
|
||||
#BonusSection{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 65%;
|
||||
min-height: 40px;
|
||||
margin: 0 auto;
|
||||
align-items: center;
|
||||
margin-bottom: -25px;
|
||||
}
|
||||
@media (max-width: 576px) {
|
||||
#BonusSection{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#BonusSection .wrap-msg-bonus, #BonusSection .pt-2 .wrap-progress, #BonusSection .pt-1 .wrap-progress, #BonusSection .pt-3 .wrap-progress, #BonusSection .pt-3 .wrap-bids, #auctionBidsModal .wrap-msg-bonus, #auctionBidsModal .wrap-msg-bonus .wrap-progress, #bidsBonusSection #section2 .wrap-progress, #bidsBonusSection #section3 .wrap-progress{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
#bidsBonusSection #section2 .wrap-progress{
|
||||
font-size: 14px;
|
||||
}
|
||||
#auctionBidsModal #countdownAddSlot{
|
||||
font-weight: bold;
|
||||
color: #55bc62;
|
||||
}
|
||||
#auctionBidsModal .wrap-msg-bonus{
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
#BonusSection .pt-2 .item, #BonusSection .pt-3 .item{
|
||||
margin: 2px;
|
||||
}
|
||||
#BonusSection .pt-2, #BonusSection .pt-1, #BonusSection .pt-3, #auctionBidsModal .wrap-pt2{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
#auctionBidsModal .wrap-pt2 .bonus-obtained{
|
||||
font-size: 12px;
|
||||
color: #6F6F6F;
|
||||
font-weight: bold;
|
||||
margin-top: 3px;
|
||||
display: none;
|
||||
}
|
||||
#auctionBidsModal .wrap-pt2{
|
||||
justify-content: space-around;
|
||||
align-items: flex-start;
|
||||
margin-top: 20px;
|
||||
border-top: 1px solid #DBDBDB;
|
||||
padding-top: 20px;
|
||||
font-size: 13px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@media (max-width: 340px) {
|
||||
#auctionBidsModal .wrap-pt2{
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
#auctionToBonusModal{
|
||||
font-size: 15px;
|
||||
color: #333;
|
||||
}
|
||||
#BonusSection .text{
|
||||
color: #6D6D6D;
|
||||
font-size: 15px;
|
||||
margin: auto 4px;
|
||||
}
|
||||
#BonusSection .pt-2 img{
|
||||
height: 29px;
|
||||
}
|
||||
#BonusSection .pt-2 .img-emoji img, #auctionBidsModal .img-emoji img {
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
margin-left: -10px;
|
||||
margin-top: -3px;
|
||||
}
|
||||
#auctionBidsModal .img-emoji img{
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
#auctionBidsModal .img-emoji{
|
||||
z-index: 9;
|
||||
margin-left: -3px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
#BonusSection .pt-dx img, #auctionBidsModal .pt-dx img, #auctionBidsModal .pt-center img{
|
||||
width: 16px;
|
||||
}
|
||||
#BonusSection .pt-2 .wrap-progress .progress{
|
||||
margin-left: 5px;
|
||||
background-color: #D1D1D1;
|
||||
}
|
||||
#auctionBidsModal .progress{
|
||||
width: 56px;
|
||||
height: 24px;
|
||||
margin: 0 6px;
|
||||
position: relative;
|
||||
background-color: #D1D1D1;
|
||||
border-radius: 20px;
|
||||
}
|
||||
#auctionBidsModal .progress{
|
||||
width: 110px;
|
||||
height: 22px;
|
||||
}
|
||||
#auctionBidsModal .pt-1 .progress{
|
||||
height: 11px;
|
||||
}
|
||||
#BonusSection .progress, #auctionBidsModal .progress{
|
||||
width: 60px;
|
||||
height: 13px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
#auctionBidsModal .progress{
|
||||
width: 90px;
|
||||
}
|
||||
#BonusSection #countdown-bonus{
|
||||
width: 60px;
|
||||
color: #fff;
|
||||
background-color: #FF0658;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
padding: 0px 4px;
|
||||
height: 16px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
#BonusSection #bonus-earned, #BonusSection #bonus-active-all{
|
||||
display: none;
|
||||
font-weight: bold;
|
||||
margin-right: 15px;
|
||||
}
|
||||
@media (max-width: 576px) {
|
||||
#BonusSection #bonus-earned, #BonusSection #bonus-active-all{
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
#BonusSection #bonus-active-all{
|
||||
color: #55bc62;
|
||||
}
|
||||
|
||||
|
||||
#BonusSection .progress .progress-bar, #auctionBidsModal .pt-1 .progress .progress-bar, #auctionBidsModal #bidsBonusSection #section2 .progress .progress-bar, #auctionBidsModal .progress .progress-bar{
|
||||
background: rgb(4,170,176);
|
||||
background: linear-gradient(90deg, rgba(4,170,176,1) 0%, rgba(7,206,173,1) 100%);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#BonusSection .progress .progressbar-text{
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
height: 22px;
|
||||
color: #000;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#auctionBidsModal .progress .progressbar-text{
|
||||
font-size: 15px;
|
||||
top: 0;
|
||||
}
|
||||
#todayBids, #auctionBidsModal{
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
}
|
||||
#auctionBidsModal{
|
||||
font-weight: normal;
|
||||
}
|
||||
#auctionToBonus.active{
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
}
|
||||
#confirmedAuctionWithBonus{
|
||||
display: none;
|
||||
margin-left: 5px;
|
||||
}
|
||||
#confirmedAuctionWithBonus .value{
|
||||
font-weight: bold;
|
||||
}
|
||||
.wrap-bonus-mobile{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.wrap-bonus-mobile .wrap-bonus-value{
|
||||
font-size: 14px;
|
||||
color: #504E4E;
|
||||
margin-left: 5px;
|
||||
}
|
||||
#auctionBidsModal .wrap-bonus-value{
|
||||
margin-right: 2px;
|
||||
}
|
||||
#BonusSection .pt-3 img{
|
||||
width: 15px;
|
||||
}
|
||||
#BonusSection .wrap-title-bonus{
|
||||
display: flex;
|
||||
}
|
||||
#BonusSection .wrap-title-bonus .icon-check{
|
||||
width: 15px;
|
||||
display: none;
|
||||
margin-right: 4px;
|
||||
}
|
||||
#BonusSection .pt-2 #countdown-bonus{
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 1040px) {
|
||||
#BonusSection{
|
||||
width: 100%;
|
||||
justify-content: space-around;
|
||||
min-height: 50px;
|
||||
}
|
||||
#BonusSection .pt-1, #BonusSection .pt-2, #BonusSection .pt-3{
|
||||
flex-direction: column;
|
||||
}
|
||||
#BonusSection .pt-3 .wrap-bids{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
#BonusSection .text {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#BonusSection .pt-2 img{
|
||||
margin-right: 5px;
|
||||
height: 18px;
|
||||
width: 10px;
|
||||
}
|
||||
#BonusSection .pt-1 .progress {
|
||||
width: 90px;
|
||||
height: 10px;
|
||||
}
|
||||
#todayBids{
|
||||
font-size: 14px;
|
||||
}
|
||||
#BonusSection .pt-3 .item{
|
||||
margin: 0;
|
||||
}
|
||||
#BonusSection .pt-3 img{
|
||||
width: 13px;
|
||||
margin-top: -1px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
#BonusSection .wrap-msg-bonus{
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.wrap-bonus-mobile{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
}
|
||||
@media (max-width: 576px) {
|
||||
#BonusSection {
|
||||
min-height: 45px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 360px) {
|
||||
#BonusSection .text {
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#auctionBidsModal .pt-left .wrap-progress, #auctionBidsModal .pt-dx .wrap-bids, #auctionBidsModal .pt-center .wrap-bids{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#auctionBidsModal .pt-center .item, #auctionBidsModal .pt-dx .item{
|
||||
margin-left: 1px;
|
||||
margin-right: 1px;
|
||||
}
|
||||
#auctionBidsModal .pt-center .item img, #auctionBidsModal .pt-dx .item img{
|
||||
margin-left: 2px;
|
||||
margin-right: 2px;
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
#auctionToGoModal{
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
@media (max-width: 340px) {
|
||||
#auctionBidsModal .wrap-pt2{
|
||||
font-size: 12px;
|
||||
}
|
||||
#auctionToGoModal, #todayBidsModal, #todayBidsPayedModal{
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
#todayBidsModal, #todayBidsPayedModal{
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#loaderAuctionBids{
|
||||
min-height: 40px;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
font-size: 20px;
|
||||
}
|
||||
#auctionToGo{
|
||||
color: #000;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.loader-data{
|
||||
display: block;
|
||||
position: relative;
|
||||
margin-right: 0px !important;
|
||||
margin-left: 0px !important;
|
||||
}
|
||||
.loader-data::before{
|
||||
content: "";
|
||||
background-color: #eaeaea;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 22px;
|
||||
position: absolute;
|
||||
}
|
||||
@media (max-width: 576px) {
|
||||
.loader-data{
|
||||
margin-top: 2px !important;
|
||||
margin-bottom: 2px !important;
|
||||
}
|
||||
.loader-data::before{
|
||||
height: 16px;
|
||||
min-width: 20px;
|
||||
}
|
||||
}
|
||||
#BonusSection .pt-1, #BonusSection .pt-2, #BonusSection .pt-3{
|
||||
position: relative;
|
||||
}
|
||||
.loader-data img{
|
||||
display: none !important;
|
||||
}
|
||||
.wrap-countdown-auctionBidsModal{
|
||||
color: #55BC62;
|
||||
font-weight: bold;
|
||||
}
|
||||
#auctionBidsModal .wrapTitle{
|
||||
margin: 20px auto 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
#auctionBidsModal .modal-body{
|
||||
padding: 0;
|
||||
}
|
||||
#auctionBidsModal .contentModal #bidsBonusSection .content, #auctionBidsModal .contentModal #rankingBonusSection{
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
padding: 15px;
|
||||
}
|
||||
#auctionBidsModal .contentModal #bidsBonusSection .content{
|
||||
margin-top: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#auctionBidsModal .contentModal #bidsBonusSection .content.parent-content-div {
|
||||
padding: 0 0 5px 0;
|
||||
}
|
||||
|
||||
#tabsSection{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
#tabsSection{
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
#tabsSection .pt-1{
|
||||
width: 55%;
|
||||
}
|
||||
#tabsSection .pt-2{
|
||||
width: 40%;
|
||||
}
|
||||
#tabsSection .pt-1, #tabsSection .pt-2{
|
||||
|
||||
padding: 8px 18px;
|
||||
border-bottom: 1px solid #BCBCBC;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
#tabsSection .pt-1 .fa, #tabsSection .pt-2 .fa{
|
||||
margin-right: 5px;
|
||||
}
|
||||
#tabsSection .pt-3{
|
||||
width: 10%;
|
||||
padding: 5px 10px;
|
||||
border-bottom: 1px solid #BCBCBC;
|
||||
}
|
||||
button[aria-label='Close'] span{
|
||||
font-size: 26px;
|
||||
}
|
||||
@media (max-width: 576px) {
|
||||
#tabsSection .pt-3{
|
||||
padding: 4px 10px;
|
||||
}
|
||||
#tabsSection .pt-1, #tabsSection .pt-2{
|
||||
font-size: 12px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
button[aria-label='Close'] span{
|
||||
font-size: 25px;
|
||||
}
|
||||
}
|
||||
|
||||
#tabsSection .pt-1.active, #tabsSection .pt-2.active, #tabsSection .pt-3.active{
|
||||
border-color: #2F80ED;
|
||||
}
|
||||
#tabsSection .pt-1.active a, #tabsSection .pt-2.active a, #tabsSection .pt-3.active a, #tabsSection .pt-1.active a:hover, #tabsSection .pt-2.active a:hover{
|
||||
color: #2F80ED;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
#tabsSection .pt-1 a, #tabsSection .pt-2 a{
|
||||
color: #7d7d7d;
|
||||
}
|
||||
|
||||
|
||||
#tabsSection .pt-1 a:hover, #tabsSection .pt-2 a:hover{
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
color: #2F80ED;
|
||||
}
|
||||
#rankingBonusSection{
|
||||
display: none;
|
||||
}
|
||||
#bidsBonusSection #section2 .box-congrats,
|
||||
#bidsBonusSection #section3 .box-congrats{
|
||||
margin-top: 12px;
|
||||
}
|
||||
#bidsBonusSection #section2, #bidsBonusSection #section3{
|
||||
display: none;
|
||||
}
|
||||
#bidsBonusSection #section2 .titleModal{
|
||||
font-size: 20px;
|
||||
}
|
||||
#auctionBidsModal .wrap-credit-bonus{
|
||||
display: inline-block;
|
||||
}
|
||||
#auctionBidsModal #bidsBonusSection .wrap-content{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
#bidsBonusSection #section2 .summary-body #countdown-bonus{
|
||||
font-size: 14px;
|
||||
}
|
||||
#bidsBonusSection #section2 .summary-body .countdown{
|
||||
color: #FF0658;
|
||||
}
|
||||
#bidsBonusSection #section2 .summary-body #countdownForBonus{
|
||||
font-weight: bold;
|
||||
}
|
||||
#bidsBonusSection #section2 .summary{
|
||||
margin-top: 30px;
|
||||
}
|
||||
#bidsBonusSection #section2 .summary-body{
|
||||
width: 250px;
|
||||
margin: -18px auto 25px;
|
||||
border: 1px solid #000;
|
||||
border-radius: 5px;
|
||||
padding: 20px 15px;
|
||||
box-shadow: 2px 2px 3px 1px rgba(208, 209, 213, 0.2), 0 2px 2px 1px rgba(220, 221, 224, 0.2);
|
||||
-webkit-box-shadow: 2px 2px 3px 1px rgba(208, 209, 213, 0.2), 0 2px 2px 1px rgba(220, 221, 224, 0.2);
|
||||
-moz-box-shadow: 2px 2px 3px 1px rgba(208, 209, 213, 0.2), 0 2px 2px 1px rgba(220, 221, 224, 0.2);
|
||||
}
|
||||
#bidsBonusSection #section3 .summaryTitle{
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 40px;
|
||||
|
||||
}
|
||||
#bidsBonusSection #section3 .summaryList img{
|
||||
width: 18px;
|
||||
}
|
||||
#bidsBonusSection #section3 .summaryList ul{
|
||||
text-align: left;
|
||||
width: 300px;
|
||||
margin: 5px auto 20px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.bottom-area{
|
||||
font-size: 16px;
|
||||
}
|
||||
.bottom-area.highlight{
|
||||
color: #FF0658;
|
||||
font-weight: bold;
|
||||
margin-top: 15px;
|
||||
margin-bottom: -10px;
|
||||
}
|
||||
#auctionBidsModal #bidsBonusSection #bonusSection img{
|
||||
width: 20px;
|
||||
margin-top: -2px;
|
||||
}
|
||||
#auctionBidsModal #bidsBonusSection #bonusSection .bottomSection img{
|
||||
width: 16px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
#auctionBidsModal #bidsBonusSection #bonusSection .bottomSection{
|
||||
font-size: 16px;
|
||||
margin-bottom: 15px;
|
||||
color: #5F5F5F;
|
||||
}
|
||||
|
||||
#bonusSection .btnConfirm{
|
||||
font-size: 18px;
|
||||
display: inline-block;
|
||||
color: #333;
|
||||
background-color: #fcc62d;
|
||||
padding: 5px;
|
||||
line-height: 25px;
|
||||
border-radius: 5px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
width: 95%;
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
@media (max-width: 576px) {
|
||||
#auctionBidsModal #bidsBonusSection #bonusSection .bottomSection {
|
||||
font-size: 15px;
|
||||
}
|
||||
#bonusSection .btnConfirm{
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
#rankingBonusSection .title{
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
#rankingBonusSection .subtitle{
|
||||
font-size: 14px;
|
||||
}
|
||||
#rankingBonusSection #ranking{
|
||||
padding: 0 10px;
|
||||
}
|
||||
#rankingBonusSection #ranking table{
|
||||
margin-top:30px;
|
||||
width: 100%;
|
||||
}
|
||||
#rankingBonusSection #ranking table td{
|
||||
text-align: left;
|
||||
}
|
||||
#rankingBonusSection #ranking table .td1{
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
#rankingBonusSection #ranking table .td1 img{
|
||||
width: 38px;
|
||||
}
|
||||
#rankingBonusSection #ranking table td.td2{
|
||||
font-size: 16px;
|
||||
width: 70%;
|
||||
padding: 8px 10px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
#rankingBonusSection #ranking table td.td3{
|
||||
width: 25%;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
#rankingBonusSection #ranking table td.td3 img{
|
||||
width: 17px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
#auctionBidsModal #section1, #auctionBidsModal #section4{
|
||||
display: none;
|
||||
}
|
||||
#auctionBidsModal #section1{
|
||||
padding: 0px 20px;
|
||||
}
|
||||
#auctionBidsModal #section4 .sad{
|
||||
width: 25px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#BonusSection .img-lock, #BonusSection .img-lock-open{
|
||||
display: none;
|
||||
}
|
||||
#BonusSection .img-lock img, #BonusSection .img-lock-open img{
|
||||
width: 12px;
|
||||
margin-left: 5px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
#BonusSection .pay-bids-counter{
|
||||
margin-left: 5px;
|
||||
color: #fff;
|
||||
background-color: #FF0658;
|
||||
border-radius: 40px;
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
padding: 2px;
|
||||
display: none;
|
||||
}
|
||||
#auctionBidsModal .wrap-new-daily-challenge.wrap2{
|
||||
margin-top: 5px;
|
||||
}
|
||||
#auctionBidsModal .wrap-new-daily-challenge{
|
||||
color: #2F80ED;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin: 20px 60px 0px;
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 576px) {
|
||||
#auctionBidsModal .wrap-new-daily-challenge {
|
||||
margin: 20px 40px 0;
|
||||
}
|
||||
}
|
||||
#BonusSection .img-plus-not-active, #BonusSection .img-plus-active{
|
||||
display: none;
|
||||
}
|
||||
#auctionBidsModal .extraSlots .slot-title .open-lock{
|
||||
margin-top: -5px;
|
||||
width: 15px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
#auctionBidsModal .extraSlots .slot-title span .fa{
|
||||
font-size: 20px;
|
||||
position: absolute;
|
||||
margin-left: 5px;
|
||||
}
|
||||
#auctionBidsModal .extraSlots .wrap-content-slot{
|
||||
padding: 10px 0 15px;
|
||||
}
|
||||
#auctionBidsModal .bonus-obtained{
|
||||
display: none;
|
||||
}
|
||||
#auctionBidsModal .extraSlots{
|
||||
border: none;
|
||||
margin: -5px auto 0;
|
||||
padding: 10px 15px;
|
||||
text-align: center;
|
||||
background-color: #f3f6f9;
|
||||
border-radius: 0;
|
||||
border-bottom-left-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
}
|
||||
#auctionBidsModal .extraSlots.avaible{
|
||||
border-color: #55BC62;
|
||||
}
|
||||
#extraSlotTemplate{
|
||||
display: none;
|
||||
}
|
||||
#wrapSlots{
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
#wrapSlots .box-extra-slot{
|
||||
border: 1px solid #6F6F6F;
|
||||
background-color: #f3f6f9;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
width: 100px;
|
||||
margin-top: 15px;
|
||||
display: none;
|
||||
}
|
||||
.wrap-num-other-slot{
|
||||
position: relative;
|
||||
display: none;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.wrap-num-other-slot .reduce{
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 20px;
|
||||
color: #333;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.wrap-num-other-slot .open{
|
||||
color: #55BC62;
|
||||
text-decoration: underline;
|
||||
display: none;
|
||||
}
|
||||
#wrapSlots .box-extra-slot .expire{
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
color: #6A6B6C;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
#wrapSlots .box-extra-slot .expire img{
|
||||
margin-left: 2px;
|
||||
}
|
||||
#wrapSlots .box-extra-slot .content{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
#wrapSlots .box-extra-slot .content .slot-value{
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
#wrapSlots .box-extra-slot .wrap-cta .cta{
|
||||
background-color: #B4B4B4;
|
||||
color: #fff;
|
||||
padding: 0px 10px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
max-height: 23px;
|
||||
|
||||
}
|
||||
#wrapSlots .box-extra-slot .wrap-cta .cta img{
|
||||
margin-top: -2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.extraSlots .wrap-content-slot{
|
||||
display: none;
|
||||
}
|
||||
.extraSlots .slot-title a{
|
||||
width: 100%;
|
||||
display: block;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
.extraSlots .slot-title{
|
||||
color: #000;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.extraSlots .slot-content{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.extraSlots .slot-content .beforeConfirmed, .extraSlots .slot-content .afterConfirmed{
|
||||
display: none;
|
||||
}
|
||||
.wrap-extra-slots .box-noSlot .titleNoSlot{
|
||||
color: #FE4E4E;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.wrap-extra-slots .box-noSlot .contentNoSlot{
|
||||
font-size: 12px;
|
||||
}
|
||||
.wrap-extra-slots .box-noSlot .contentNoSlot img{
|
||||
width: 17px;
|
||||
margin-top: -3px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
.wrap-extra-slots .box-noSlot{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.wrap-extra-slots .box-noSlot{
|
||||
display: none;
|
||||
}
|
||||
.wrap-extra-slots .box-noSlot .box-noextra-slot .no-extra-slot-content .slot-img img{
|
||||
width: 20px;
|
||||
opacity: 0.6;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.wrap-extra-slots .box-noSlot .box-noextra-slot .no-extra-slot-content{
|
||||
font-size: 10px;
|
||||
color: #333;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
.wrap-extra-slots .box-noSlot .box-noextra-slot{
|
||||
width: 92px;
|
||||
margin: 20px auto;
|
||||
height: 81px;
|
||||
border: 1px solid #55BC62;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#wrapSlots.avaible .box-extra-slot{
|
||||
border-color: #55BC62;
|
||||
background-color: #EDF8EF;
|
||||
}
|
||||
#wrapSlots.avaible .box-extra-slot .wrap-cta .cta{
|
||||
background-color: #55BC62;
|
||||
}
|
||||
.wrap-extra-slots{
|
||||
display: none;
|
||||
}
|
||||
.wrap-extra-slots .title-extraSlot-blocked{
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
margin: 0 0 10px;
|
||||
display: none;
|
||||
text-align: center;
|
||||
}
|
||||
.wrap-extra-slots .title-extraSlot-blocked img{
|
||||
width: 18px;
|
||||
margin-top: -5px;
|
||||
}
|
||||
#auctionBidsModal #bidsBonusSection .img-lock, #auctionBidsModal #bidsBonusSection .img-lock-open{
|
||||
display: none;
|
||||
|
||||
}
|
||||
#auctionBidsModal #bidsBonusSection .img-lock img, #auctionBidsModal #bidsBonusSection .img-lock-open img{
|
||||
margin-left: 5px;
|
||||
width: 14px;
|
||||
margin-top: -5px;
|
||||
}
|
||||
#auctionBidsModal #differenzaAsteDaConfermare{
|
||||
color: #fff;
|
||||
background-color: #FF0658;
|
||||
border-radius: 40px;
|
||||
width: 23px;
|
||||
height: 23px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
padding: 1px 2px;
|
||||
display: inline-block;
|
||||
font-size: 15px;
|
||||
}
|
||||
#auctionBidsModal #bonusEarned img{
|
||||
width: 15px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
#auctionBidsModal .wrap-already-taken, #auctionBidsModal .bonus-yet-to-be-obtained{
|
||||
display: none;
|
||||
}
|
||||
#auctionBidsModal .wrap-already-taken .txt-already-taken{
|
||||
color: #797979;
|
||||
}
|
||||
#auctionBidsModal .bonus-yet-to-be-obtained{
|
||||
color: #FF0658;
|
||||
}
|
||||
#auctionBidsModal #bonusEarned .wrap-details-bonus{
|
||||
text-align: center;
|
||||
margin: 7px 0;
|
||||
}
|
||||
#auctionBidsModal #modalConfirmSlotStopGame{
|
||||
z-index: 11;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
height: 130px;
|
||||
background-color: #fff;
|
||||
width: 270px;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
display: none;
|
||||
}
|
||||
#auctionBidsModal #modalConfirmSlotStopGame .contentButton .btn{
|
||||
padding: 2px 13px;
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
margin: 3px;
|
||||
}
|
||||
#auctionBidsModal #modalConfirmSlotStopGame .contentButton .btn-confirm{
|
||||
background-color: #55BC62
|
||||
}
|
||||
#auctionBidsModal #modalConfirmSlotStopGame .contentButton .btn-cancel{
|
||||
background-color: #BFBFBF;
|
||||
}
|
||||
#auctionBidsModal #modalConfirmSlotStopGame .contentButton{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
#auctionBidsModal #modalConfirmSlotStopGame .content{
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
#auctionBidsModal #modalConfirmSlotStopGame .title{
|
||||
color: #FF0202;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
#auctionBidsModal .overlayModalConfirmSlotStopGame{
|
||||
background: rgba(0,0,0,0.2);
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: none;
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
$(document).ready(function () {
|
||||
window.myAuctionsControlDetail = new Array(); // array di oggetti deputato a contenere l'asta dove si sta autopuntando
|
||||
window.myAuctionsControlDetail_lock = false; // flag to lock SetInterval execution
|
||||
|
||||
/*
|
||||
*
|
||||
* @returns {undefined}
|
||||
* questa funzione si occupa di controllare ogni 2 secondi se l'asta (dettaglio) su cui c'è un'autopuntata sia realmente attive o c'è stato un blocco lato UI
|
||||
*
|
||||
*/
|
||||
|
||||
setInterval(
|
||||
function () {
|
||||
|
||||
if (window.myAuctionsControlDetail_lock == false) {
|
||||
|
||||
window.myAuctionsControlDetail_lock = true; // lock setinterval execution
|
||||
|
||||
//console.log("--- Checking autobids..."); // FOR DEBUG
|
||||
let isAuctionStarted_element = $(".auction-action-timer.auction-header-item-size.closed-timer"); // element not present if auction started
|
||||
|
||||
let callingAjax = false;
|
||||
if (isAuctionStarted_element.length == 0) { // check element not present if auction started
|
||||
|
||||
let element_value = $('.auction-autobid-current-value'); // recupero il valore delle puntate rimanenti nell'asta
|
||||
|
||||
if (element_value.length > 0) {
|
||||
let value = $(element_value[0]).text(); // recupero il valore delle puntate rimanenti nell'asta
|
||||
//console.log("Puntate autobid = "+value); // FOR DEBUG
|
||||
|
||||
if (value > 0) {
|
||||
let idasta = $('input.js-switch.autobid-switch').data("id"); // recupero l'id dell'asta
|
||||
//console.log("Checking Asta: " + idasta); // FOR DEBUG
|
||||
let timestamp = Date.now();
|
||||
|
||||
let myAuctions = {
|
||||
idasta: idasta,
|
||||
value: value,
|
||||
timestamp: timestamp,
|
||||
element_value: element_value
|
||||
}
|
||||
|
||||
if (window.myAuctionsControlDetail.length == 0) { // controllo che questa asta non sia già nell'array
|
||||
//console.log("Adding Asta in array."); // FOR DEBUG
|
||||
window.myAuctionsControlDetail = myAuctions;
|
||||
} else {
|
||||
if (window.myAuctionsControlDetail.value != value) { // controllo che il valore sia cambiato per in modo da aggiornare le informazioni
|
||||
//console.log("Value changed."); // FOR DEBUG
|
||||
window.myAuctionsControlDetail = myAuctions;
|
||||
} else {
|
||||
//console.log("Checking time..."); // FOR DEBUG
|
||||
// in questa condizione il valore non è cambiato dunque controllerò da quanto tempo non cambia
|
||||
var diffMs = (Date.now() - window.myAuctionsControlDetail.timestamp);
|
||||
//console.log("diffMs = "+diffMs); // FOR DEBUG
|
||||
//var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes
|
||||
var diffSecs = Math.round(((diffMs % 86400000) % 3600000) / 1000); // minutes
|
||||
//console.log("diffSecs = "+diffSecs); // FOR DEBUG
|
||||
|
||||
// nel caso in cui la differenza è maggiore o uguale a 2 minuti invoco la funzione che si occuperà di spedire le informazioni lato backend
|
||||
if (diffSecs >= 70) { // default 70 secs
|
||||
callingAjax = true;
|
||||
sentToVerification(myAuctions);
|
||||
window.myAuctionsControlDetail = new Array(); // elimino l'asta dall'array
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
window.myAuctionsControlDetail = new Array(); // elimino l'asta dall'array
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (callingAjax === false) {
|
||||
window.myAuctionsControlDetail_lock = false; // unlock setinterval execution
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
2000);
|
||||
|
||||
|
||||
function sentToVerification(myAuctions) {
|
||||
|
||||
// funzione che serve ad inviare al backend l'asta attiva ma con valori di autopuntata fermi da 2 min
|
||||
//console.log(myAuctions); // FOR DEBUG
|
||||
|
||||
$.ajax({
|
||||
url: "check_autobid.php",
|
||||
//dataType: json,
|
||||
method: 'POST',
|
||||
timeout: 10000, // default 10000
|
||||
data : {
|
||||
idasta: myAuctions.idasta,
|
||||
value: myAuctions.value,
|
||||
timestamp: myAuctions.timestamp
|
||||
},
|
||||
}).done(function (response) {
|
||||
window.myAuctionsControlDetail_lock = false; // unlock setinterval execution
|
||||
//console.log("response = " + response); // FOR DEBUG
|
||||
$(myAuctions.element_value).text(response);
|
||||
}).fail(function(jqXHR, textStatus){
|
||||
if(textStatus === 'timeout') {
|
||||
//console.log("Ajax timeout. Recall ajax."); // FOR DEBUG
|
||||
sentToVerification(myAuctions);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,322 @@
|
||||
function getTexts() {
|
||||
"use strict"
|
||||
return {
|
||||
dialog_confirm: "Sei sicuro di voler rimuovere l\'AutoPuntata?",
|
||||
autobid_active: "Hai attivato la funzione utilizzando le puntate prenotate",
|
||||
autobid_not_active: "Attiva la funzione utilizzando le puntate prenotate",
|
||||
autobid_add: "AGGIUNGI",
|
||||
autobid_insert: "INSERISCI"
|
||||
};
|
||||
}
|
||||
|
||||
function enableAutobid() {
|
||||
"use strict";
|
||||
|
||||
$(".auction-action-autobid-trigger")
|
||||
.toggleClass("button-fucsia-flat", true)
|
||||
.toggleClass("button-gray-flat", false)
|
||||
.off('click')
|
||||
.on('click', setAutobid);
|
||||
|
||||
$(".auction-action-autobid-input")
|
||||
.attr('disabled', false)
|
||||
.off("keyup").keyup(function (e) {
|
||||
if (13 == e.which)
|
||||
$(".auction-action-autobid-trigger").click();
|
||||
$(".auction-action-autobid-mobile .auction-action-autobid-trigger").toggleClass("disable", $(this).val().length == 0);
|
||||
});
|
||||
}
|
||||
|
||||
function disableAutobid(reason) {
|
||||
"use strict";
|
||||
|
||||
$(".auction-action-autobid-trigger")
|
||||
.off('click')
|
||||
.on('click', function () {
|
||||
if (!reason)
|
||||
return;
|
||||
showErrorTooltip('.auction-action-autobid-trigger:eq(' + getAuctionSelector() + ')', {
|
||||
title: reason,
|
||||
html: true,
|
||||
container: "body",
|
||||
trigger: "manual",
|
||||
placement: "top",
|
||||
template: getTemplateTooltip("error")
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
|
||||
function unsetAutobid(evt) {
|
||||
"use strict";
|
||||
if ('undefined' == typeof window['autobid_switchery']) {
|
||||
return;
|
||||
}
|
||||
if (!isSwitchEnabled()) {
|
||||
if (evt) {
|
||||
window._autoController.setAutobid('delete', null, cleanUpAutobidSwitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cleanUpAutobidSwitch() {
|
||||
"use strict"
|
||||
$(".auction-autobid-button")
|
||||
.toggleClass("active", false)
|
||||
.find(".bi-autobid")
|
||||
.toggleClass("bi-dark", true)
|
||||
.toggleClass("bi-green", false);
|
||||
$(".auction-action-bid-mobile .auction-autobid-current-value").empty();
|
||||
setTimeout(function () {
|
||||
if (!isSmartphoneDevice())
|
||||
$('.auction-action-autobid-trigger').text(getTexts().autobid_insert);
|
||||
}, 400);
|
||||
updateAutobid(0);
|
||||
$('.auction-action-autobid:not(.auction-seat-autobid) .autobid-switch-container, .auction-action-autobid-mobile .autobid-switch-container').hide();
|
||||
}
|
||||
|
||||
function isSwitchEnabled() {
|
||||
return 'undefined' != typeof window['autobid_switchery'] && window.autobid_switchery[isSmartphoneDevice() ? 1 : 0].isChecked();
|
||||
}
|
||||
|
||||
function hideAutobid() {
|
||||
"use strict";
|
||||
$(".auction-action-autobid:visible").hide();
|
||||
}
|
||||
|
||||
function showLoginAutobid() {
|
||||
"use strict";
|
||||
$(".auction-action-autobid-trigger")
|
||||
.off('click')
|
||||
.on('click', window.parent.showLogin);
|
||||
|
||||
$(".auction-action-autobid-input").attr('disabled', true);
|
||||
}
|
||||
|
||||
function bindAutobidTrigger() {
|
||||
"use strict";
|
||||
var sNickLoggato = $("#NickLoggato").length > 0 ? $("#NickLoggato").val() : "";
|
||||
|
||||
if (sNickLoggato.length <= 0) {
|
||||
return showLoginAutobid();
|
||||
}
|
||||
$('.auction-action-autobid-trigger').off('click').on('click', function (evt) {
|
||||
var triggerElement = $(this);
|
||||
rippleButton(triggerElement, evt);
|
||||
|
||||
var autobidInputElement = $(".auction-action-autobid-input").eq(isSmartphoneDevice() ? 1 : 0);
|
||||
|
||||
var inputAmount = parseInt(autobidInputElement.val(), 10);
|
||||
var dataInputAmount = parseInt(autobidInputElement.data("amount"), 10);
|
||||
var autobidAmount = !isNaN(dataInputAmount) ? dataInputAmount : inputAmount;
|
||||
autobidInputElement.removeData("amount");
|
||||
|
||||
var autobidLoader = $(".auction-autobid-loader-container");
|
||||
var switchContainer = $('.autobid-switch-container');
|
||||
|
||||
triggerElement.removeAttr("data-autobid-button");
|
||||
|
||||
var isNotValidAmount = isNaN(inputAmount) && isNaN(dataInputAmount);
|
||||
if (isNotValidAmount) {
|
||||
if (isSmartphoneDevice() && !$("[data-stage='2']").is(":visible"))
|
||||
return $(".auction-action-autobid-mobile .auction-action-autobid-input").trigger("focus");
|
||||
} else {
|
||||
autobidLoader.removeClass("hidden");
|
||||
switchContainer.hide();
|
||||
}
|
||||
|
||||
cleanAutobidRequest();
|
||||
window._autoController.setAutobid('create', autobidAmount, function () {
|
||||
switchContainer.show();
|
||||
if (true == isSwitchEnabled())
|
||||
return;
|
||||
$(".autobid-switch.js-switch:hidden")
|
||||
.eq(isSmartphoneDevice() ? 1 : 0)
|
||||
.data("autobid-enabled", "true")
|
||||
.trigger('click');
|
||||
$(".auction-autobid-button")
|
||||
.toggleClass("active", true)
|
||||
.find(".bi-autobid")
|
||||
.toggleClass("bi-dark", false)
|
||||
.toggleClass("bi-green", true);
|
||||
|
||||
var id_product = getUrlParam("a").split("_").reverse()[0];
|
||||
$("#DA"+id_product).find('.favorite').attr('title', "Non puoi rimuoverla dai preferiti se è attiva l\'autopuntata");
|
||||
$("#DA"+id_product).find('.favorite').attr('data-original-title', "Non puoi rimuoverla dai preferiti se è attiva l\'autopuntata");
|
||||
$("#DA"+id_product).find('.favorite').attr('disabled', 'disabled');
|
||||
$("#DA"+id_product).find('.favorite').addClass('active');
|
||||
if (isDeepModal()) {
|
||||
window.parent.BidooCnf.instances.auction.features.startAutobidAuctionUpdate();
|
||||
}
|
||||
|
||||
if (isSmartphoneDevice())
|
||||
return;
|
||||
|
||||
setTimeout(function () {
|
||||
$('.auction-action-autobid-trigger').text(getTexts().autobid_add);
|
||||
}, 400);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setAutobid() {
|
||||
"use strict";
|
||||
if ('undefined' == typeof window['autobid_switchery']) {
|
||||
return;
|
||||
}
|
||||
bindAutobidTrigger();
|
||||
$('.auction-action-autobid-trigger').not("[data-autobid-button]").trigger('click');
|
||||
}
|
||||
|
||||
function updateAutobid(value) {
|
||||
"use strict";
|
||||
var element = $(".auction-autobid-current-value");
|
||||
var oldValue = parseInt(element.eq(0).text(), 10);
|
||||
|
||||
if (value != oldValue) {
|
||||
element.toggle(value > 0);
|
||||
element.text(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function cleanAutobidRequest() {
|
||||
"use strict";
|
||||
$(".auction-action-autobid-input").val('');
|
||||
window._autoController.stopTicker();
|
||||
}
|
||||
|
||||
function updateAutobidStatus(status, value) {
|
||||
"use strict";
|
||||
switch (status) {
|
||||
case 'set':
|
||||
case 'create':
|
||||
{
|
||||
if (0 == value) {
|
||||
closeSwitch();
|
||||
} else {
|
||||
updateAutobid(value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'unset':
|
||||
{
|
||||
closeSwitch();
|
||||
unsetAutobid(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function closeSwitch() {
|
||||
$('.js-switch.autobid-switch')
|
||||
.eq(isSmartphoneDevice() ? 1 : 0)
|
||||
.data("autobid-enabled", "false")
|
||||
.trigger("click");
|
||||
}
|
||||
function setAutobidUI(isAutobid) {
|
||||
"use strict"
|
||||
$(".auction-action-autobid-mobile .autobid-switch-container").toggle(isAutobid);
|
||||
$(".auction-action-bid-mobile .auction-autobid-button")
|
||||
.toggleClass("active", isAutobid)
|
||||
.find(".bi-autobid")
|
||||
.toggleClass("bi-dark", !isAutobid)
|
||||
.toggleClass("bi-green", isAutobid);
|
||||
$(".js-switch.autobid-switch")
|
||||
.data("autobid-enabled", "false")
|
||||
.trigger('click');
|
||||
}
|
||||
|
||||
function setCorrectPlaceholder(isFocused) {
|
||||
"use strict"
|
||||
this.attr("placeholder", isFocused ? "" : $(this).data("placeholder"));
|
||||
$(".auction-action-autobid-mobile .auction-action-autobid-trigger").toggleClass("disable", this.val().length == 0);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
"use strict";
|
||||
window.autobid_switchery = [];
|
||||
window.autobid_seat_switchery = [];
|
||||
$(".js-switch.autobid-switch").each(function (k, item) {
|
||||
window.autobid_switchery.push(new Switchery(item, {size: 'small'}));
|
||||
});
|
||||
|
||||
$(".js-switch.autobid-seat-switch").each(function (k, item) {
|
||||
window.autobid_seat_switchery.push(new Switchery(item, {size: 'small'}));
|
||||
});
|
||||
|
||||
$('.js-switch.autobid-seat-switch').off('change').on('change', function () {
|
||||
var self = this;
|
||||
var isEnabled = $(this).is(':checked');
|
||||
if (isEnabled) {
|
||||
window.stage.getUpdate(function (update) {
|
||||
window._autoController.setAutobid('create', update.me.budget.total, function () {
|
||||
$(".autobid-seat-status").text(getTexts().autobid_active);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
window._autoController.setAutobid('delete', null, function () {
|
||||
updateAutobid(0);
|
||||
$(".autobid-seat-status").text(getTexts().autobid_not_active);
|
||||
});
|
||||
}
|
||||
if (isSmartphoneDevice())
|
||||
setAutobidUI(isEnabled);
|
||||
return true;
|
||||
});
|
||||
|
||||
function confirmAutobidUnset() {
|
||||
|
||||
if(confirm(getTexts().dialog_confirm)){
|
||||
|
||||
return true;
|
||||
}else{
|
||||
if (isSmartphoneDevice()){
|
||||
$('.switchery-small small').css('left', '30px');
|
||||
}else{
|
||||
$('#boxcontent .autobid-switch').click();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$('.js-switch.autobid-switch').off('change').on('change', function () {
|
||||
var switchAutobid = $(this);
|
||||
if (isSmartphoneDevice() && $("[data-stage='2']").is(":visible"))
|
||||
return true;
|
||||
var id_product = getUrlParam("a").split("_").reverse()[0];
|
||||
if (!switchAutobid.is(':checked') && ("false" == switchAutobid.data("autobid-enabled") || confirmAutobidUnset())) {
|
||||
unsetAutobid({});
|
||||
|
||||
|
||||
$("#DA"+id_product).find('.favorite').removeAttr('disabled');
|
||||
$("#DA"+id_product).find('.favorite').attr('title', "Rimuovi quest\'asta dalle tue preferite");
|
||||
if (isDeepModal()) {
|
||||
$("#DA"+id_product).find('.favorite').removeAttr('data-original-title');
|
||||
window.parent.BidooCnf.instances.auction.features.stopAutobidAuctionUpdate();
|
||||
setTimeout(function () {
|
||||
$("#divAsta"+id_product, parent.document).find('.favorite').removeAttr('data-original-title');
|
||||
$("#divAsta"+id_product, parent.document).find('.favorite').removeAttr('disabled');
|
||||
$("#divAsta"+id_product, parent.document).find('.favorite').attr('title', "Rimuovi quest\'asta dalle tue preferite");
|
||||
}, 500);
|
||||
} else {
|
||||
$("#DA"+id_product).find('.favorite').attr("data-original-title", "Rimuovi quest\'asta dalle tue preferite");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
$(".autobid-speed-dial > div > a").on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var self = $(this);
|
||||
var amount = parseInt(self.attr("data-amount"));
|
||||
$(".auction-action-autobid-input").data("amount", amount);
|
||||
$('.auction-action-autobid-trigger').attr("data-autobid-button", true).trigger('click');
|
||||
});
|
||||
|
||||
var scopeElement = $(".auction-action-autobid-input[data-placeholder]");
|
||||
scopeElement
|
||||
.focus(setCorrectPlaceholder.bind(scopeElement, true))
|
||||
.blur(setCorrectPlaceholder.bind(scopeElement, false));
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Loaded 100 of 809 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user