Skip to content

Commit 3324ee4

Browse files
Update static.yml
1 parent 40b809b commit 3324ee4

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

.github/workflows/static.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,33 @@
107107
fetch(`https://api.github.com/repos/${owner}/${repo}/releases/latest`)
108108
.then(res => res.json())
109109
.then(data => {
110-
// Cherche le fichier MagicaSetup.exe
111-
const exeAsset = data.assets.find(a => a.name === "MagicaSetup.exe");
112-
if (exeAsset) {
113-
btn.textContent = "Télécharger la dernière version 📦";
114-
btn.onclick = () => window.location.href = exeAsset.browser_download_url;
110+
console.log("Tous les fichiers disponibles:", data.assets);
111+
112+
// Cherche uniquement les fichiers .exe et exclut les .zip
113+
const exeAssets = data.assets.filter(a =>
114+
a.name.toLowerCase().endsWith('.exe') &&
115+
!a.name.toLowerCase().endsWith('.zip')
116+
);
117+
118+
console.log("Fichiers .exe trouvés:", exeAssets);
119+
120+
if (exeAssets.length > 0) {
121+
// Prend le premier fichier .exe trouvé
122+
const exeAsset = exeAssets[0];
123+
btn.textContent = `Télécharger ${exeAsset.name} 📦`;
124+
btn.onclick = () => {
125+
console.log("Téléchargement:", exeAsset.browser_download_url);
126+
window.location.href = exeAsset.browser_download_url;
127+
};
115128
} else {
116-
btn.textContent = "Pas de MagicaSetup.exe trouvé dans la dernière version";
129+
btn.textContent = "Aucun fichier .exe trouvé dans la dernière version";
117130
btn.disabled = true;
131+
console.log("Aucun .exe trouvé, voici les assets:", data.assets.map(a => a.name));
118132
}
119133
})
120134
.catch(err => {
121-
console.error(err);
122-
btn.textContent = "Erreur API GitHub";
135+
console.error("Erreur API GitHub:", err);
136+
btn.textContent = "Erreur de connexion à GitHub";
123137
btn.disabled = true;
124138
});
125139
</script>

0 commit comments

Comments
 (0)