Integrate Docker support into Archipelago and Neode UI

- Added StateManager and data_model modules to manage application state.
- Updated ApiHandler to utilize StateManager for WebSocket connections.
- Enhanced Server initialization to include StateManager.
- Implemented Docker container querying in Neode UI to populate app data dynamically.
- Removed temporary dummy app configurations in favor of real Docker-based applications.
- Improved WebSocket reconnection logic and error handling in the UI.
- Updated package.json and package-lock.json to include dockerode dependency.
This commit is contained in:
Dorian
2026-01-27 23:06:18 +00:00
parent 7afefafec1
commit 3b3f70276f
15 changed files with 1318 additions and 329 deletions
+4 -110
View File
@@ -144,35 +144,19 @@
</template>
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { computed, ref } from 'vue'
import { useRouter, RouterLink } from 'vue-router'
import { useAppStore } from '../stores/app'
import { PackageState } from '../types/api'
import { dummyApps } from '../utils/dummyApps'
import { fetchMultipleAppInfo } from '../utils/githubAppInfo'
const router = useRouter()
const store = useAppStore()
// TEMPORARY: Always show dummy apps for now (until real apps are ready)
// TODO: Remove this and use real packages when they're available
// Use real packages from store - no more dummy apps
const packages = computed(() => {
const realPackages = store.packages
const packageKeys = realPackages ? Object.keys(realPackages) : []
console.log('[Apps] Real packages from store:', packageKeys.length, 'apps:', packageKeys)
console.log('[Apps] Dummy apps available:', Object.keys(dummyApps).length, 'apps:', Object.keys(dummyApps))
// FOR NOW: Always return dummy apps regardless of what's in store
// This ensures all dummy apps show up for development
console.log('[Apps] Returning dummy apps')
return dummyApps
// TODO: Uncomment this when ready to use real packages
// if (packageKeys.length === 0) {
// return dummyApps
// }
// return realPackages
console.log('[Apps] Real packages from store:', Object.keys(realPackages || {}).length, 'apps')
return realPackages || {}
})
// Sorted by manifest title, case-insensitive; order stable regardless of running/stopped
@@ -319,96 +303,6 @@ function handleImageError(e: Event) {
}
}
// Fetch GitHub app info for dummy apps on mount
const appInfoCache = ref<Record<string, any>>({})
// In development, skip external API calls to avoid rate limiting and noise
// App icons and descriptions are already defined in dummyApps.ts
const isDev = import.meta.env.DEV
// Watch for packages and fetch app info when showing dummy apps (DISABLED IN DEV)
watch(() => Object.keys(store.packages).length, async (packageCount) => {
// Skip external API calls in development to avoid 403/404 errors
if (isDev) {
console.log('[Apps] Using local app data (dev mode, external API calls disabled)')
return
}
// Only fetch if we're showing dummy apps (no real packages)
if (packageCount === 0) {
try {
// First try Start9 registry for icons
console.log('[Apps] Fetching app info from Start9 registry...')
try {
const registryResponse = await fetch('https://registry.start9.com/api/v1/packages')
if (registryResponse.ok) {
const registryData = await registryResponse.json()
// Update dummy apps with registry data
Object.entries(registryData).forEach(([id, pkg]: [string, any]) => {
if (dummyApps[id]) {
const latestVersion = pkg.versions ? Object.keys(pkg.versions).sort().reverse()[0] : null
const versionData = latestVersion ? pkg.versions[latestVersion] : {}
// Update icon from registry
if (versionData.icon) {
dummyApps[id]['static-files'].icon = versionData.icon
} else if (pkg.icon) {
dummyApps[id]['static-files'].icon = pkg.icon
}
// Update description
if (versionData.description) {
const desc = typeof versionData.description === 'string'
? versionData.description
: versionData.description.short || versionData.description.long || ''
if (desc) {
dummyApps[id].manifest.description.short = desc.substring(0, 100)
if (!dummyApps[id].manifest.description.long) {
dummyApps[id].manifest.description.long = desc
}
}
}
}
})
console.log('[Apps] Updated apps from Start9 registry')
return
}
} catch (registryErr) {
// Silently fail in production
console.debug('[Apps] Registry unavailable')
}
// Fallback to GitHub fetching
const appsToFetch = Object.entries(dummyApps).map(([id, pkg]) => ({
id,
'wrapper-repo': pkg.manifest['wrapper-repo']
}))
console.log('[Apps] Fetching GitHub info for dummy apps...')
const githubInfo = await fetchMultipleAppInfo(appsToFetch)
appInfoCache.value = githubInfo
// Update dummy apps with fetched info
Object.entries(githubInfo).forEach(([id, info]) => {
if (dummyApps[id] && info.icon) {
dummyApps[id]['static-files'].icon = info.icon
}
if (dummyApps[id] && info.description) {
dummyApps[id].manifest.description.short = info.description.substring(0, 100)
if (!dummyApps[id].manifest.description.long) {
dummyApps[id].manifest.description.long = info.description
}
}
})
console.log('[Apps] GitHub info fetched:', Object.keys(githubInfo).length, 'apps')
} catch (err) {
console.debug('[Apps] External API fetch skipped or failed')
}
}
}, { immediate: true })
</script>
<style scoped>