revert: store listing repassé par le backend (/api/registry/modules)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
enzo 2026-03-22 17:17:14 +01:00
parent 4b083f6fa5
commit c97a524195

View file

@ -1087,8 +1087,7 @@ document.addEventListener('alpine:init', () => {
_pollTimer: null,
async init() {
await this.load() // modules installés d'abord (loadStore en a besoin)
await this.loadStore()
await Promise.all([this.load(), this.loadStore()])
},
destroy() {
@ -1108,27 +1107,16 @@ document.addEventListener('alpine:init', () => {
async loadStore() {
this.storeLoading = true
this.storeError = ''
// Fetch directement depuis le navigateur (le backend n'a pas forcément accès internet)
const FORGEJO_URL = 'https://git.geronzi.fr'
const FORGEJO_ORG = 'proxmoxPanel'
try {
const res = await fetch(`${FORGEJO_URL}/api/v1/orgs/${FORGEJO_ORG}/repos?limit=50`)
if (!res.ok) {
this.storeError = `Erreur Forgejo (HTTP ${res.status})`
const res = await apiFetch('/api/registry/modules')
if (res.ok) {
const data = await res.json()
this.storeModules = data.modules || []
if (data.error) this.storeError = data.error
} else {
this.storeError = `Erreur serveur (HTTP ${res.status})`
this.storeModules = []
return
}
const repos = await res.json()
const exclude = new Set(['core'])
const installedIDs = new Set(this.modules.map(m => m.id))
this.storeModules = repos
.filter(r => !exclude.has(r.name))
.map(r => ({
id: r.name,
description: r.description || '',
repo_url: r.html_url,
installed: installedIDs.has(r.name),
}))
} catch(e) {
this.storeError = 'Impossible de joindre le store : ' + e.message
this.storeModules = []