🎉 Initial Commit for the Sphere webpage

This commit is contained in:
2025-08-03 20:11:30 +08:00
parent adf62fb42b
commit 7d3236550c
31 changed files with 886 additions and 9 deletions

View File

@@ -0,0 +1,27 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useServicesStore = defineStore('services', () => {
const services = ref<Record<string, string>>({})
async function fetchServices() {
try {
const response = await fetch('/cgi/.well-known/services')
if (!response.ok) {
throw new Error('Network response was not ok')
}
const data = await response.json()
services.value = data
} catch (error) {
console.error('Failed to fetch services:', error)
services.value = {}
}
}
function getSerivceUrl(serviceName: string, ...parts: string[]): string | null {
const baseUrl = services.value[serviceName] || null
return baseUrl ? `${baseUrl}/${parts.join('/')}` : null
}
return { services, fetchServices, getSerivceUrl }
})