feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
import { ref, computed } from 'vue'
|
|
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
|
import { fileBrowserClient, type FileBrowserItem } from '@/api/filebrowser-client'
|
|
|
|
|
|
|
|
|
|
export const useCloudStore = defineStore('cloud', () => {
|
|
|
|
|
const currentPath = ref('/')
|
|
|
|
|
const items = ref<FileBrowserItem[]>([])
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const error = ref<string | null>(null)
|
|
|
|
|
const authenticated = ref(false)
|
2026-07-27 22:49:30 -04:00
|
|
|
// Per-path listing cache: re-entering a folder paints the last listing
|
|
|
|
|
// immediately (no spinner) while the fresh listing loads behind it.
|
|
|
|
|
const pathCache = new Map<string, FileBrowserItem[]>()
|
|
|
|
|
// Last-wins guard for overlapping navigations (fast folder hopping).
|
|
|
|
|
let navSeq = 0
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
|
|
|
|
|
const breadcrumbs = computed(() => {
|
|
|
|
|
const parts = currentPath.value.split('/').filter(Boolean)
|
|
|
|
|
const crumbs = [{ name: 'Home', path: '/' }]
|
|
|
|
|
let path = ''
|
|
|
|
|
for (const part of parts) {
|
|
|
|
|
path += `/${part}`
|
|
|
|
|
crumbs.push({ name: part, path })
|
|
|
|
|
}
|
|
|
|
|
return crumbs
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const sortedItems = computed(() => {
|
|
|
|
|
const dirs = items.value.filter((i) => i.isDir)
|
|
|
|
|
const files = items.value.filter((i) => !i.isDir)
|
|
|
|
|
dirs.sort((a, b) => a.name.localeCompare(b.name))
|
|
|
|
|
files.sort((a, b) => a.name.localeCompare(b.name))
|
|
|
|
|
return [...dirs, ...files]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
async function init(): Promise<boolean> {
|
|
|
|
|
if (authenticated.value) return true
|
|
|
|
|
const ok = await fileBrowserClient.login()
|
|
|
|
|
authenticated.value = ok
|
|
|
|
|
return ok
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function navigate(path: string): Promise<void> {
|
2026-07-27 22:49:30 -04:00
|
|
|
const seq = ++navSeq
|
|
|
|
|
const apply = (p: string, result: FileBrowserItem[]) => {
|
|
|
|
|
pathCache.set(p, result)
|
|
|
|
|
if (seq !== navSeq) return // a newer navigation superseded this one
|
|
|
|
|
items.value = result
|
|
|
|
|
currentPath.value = p
|
|
|
|
|
}
|
|
|
|
|
// Stale-while-revalidate: show the cached listing for this path
|
|
|
|
|
// immediately (no spinner), then refresh it underneath.
|
|
|
|
|
const cached = pathCache.get(path)
|
|
|
|
|
if (cached) {
|
|
|
|
|
items.value = cached
|
|
|
|
|
currentPath.value = path
|
|
|
|
|
} else {
|
|
|
|
|
loading.value = true
|
|
|
|
|
}
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
error.value = null
|
|
|
|
|
try {
|
|
|
|
|
if (!authenticated.value) {
|
|
|
|
|
const ok = await init()
|
|
|
|
|
if (!ok) {
|
|
|
|
|
error.value = 'Failed to authenticate with File Browser'
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
try {
|
2026-07-27 22:49:30 -04:00
|
|
|
apply(path, await fileBrowserClient.listDirectory(path))
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
} catch {
|
|
|
|
|
// Directory may not exist — try to create it, then retry
|
|
|
|
|
if (path !== '/') {
|
|
|
|
|
try {
|
|
|
|
|
const parentPath = path.substring(0, path.lastIndexOf('/')) || '/'
|
|
|
|
|
const dirName = path.substring(path.lastIndexOf('/') + 1)
|
|
|
|
|
await fileBrowserClient.createFolder(parentPath, dirName)
|
2026-07-27 22:49:30 -04:00
|
|
|
apply(path, await fileBrowserClient.listDirectory(path))
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
} catch {
|
|
|
|
|
// Fall back to root
|
2026-07-27 22:49:30 -04:00
|
|
|
apply('/', await fileBrowserClient.listDirectory('/'))
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error('Failed to list root directory')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
2026-07-27 22:49:30 -04:00
|
|
|
// Keep showing the cached listing on a failed revalidate.
|
|
|
|
|
if (!cached) error.value = e instanceof Error ? e.message : 'Failed to load files'
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
} finally {
|
2026-07-27 22:49:30 -04:00
|
|
|
if (seq === navSeq) loading.value = false
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function refresh(): Promise<void> {
|
|
|
|
|
await navigate(currentPath.value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function uploadFile(file: File): Promise<void> {
|
|
|
|
|
await fileBrowserClient.upload(currentPath.value, file)
|
|
|
|
|
await refresh()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function deleteItem(path: string): Promise<void> {
|
|
|
|
|
await fileBrowserClient.deleteItem(path)
|
|
|
|
|
await refresh()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function downloadUrl(path: string): string {
|
|
|
|
|
return fileBrowserClient.downloadUrl(path)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 00:19:30 +00:00
|
|
|
async function fetchBlobUrl(path: string): Promise<string> {
|
|
|
|
|
return fileBrowserClient.fetchBlobUrl(path)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-12 00:45:42 -04:00
|
|
|
async function streamUrl(path: string): Promise<string> {
|
|
|
|
|
return fileBrowserClient.streamUrl(path)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 00:19:30 +00:00
|
|
|
async function downloadFile(path: string): Promise<void> {
|
|
|
|
|
return fileBrowserClient.downloadFile(path)
|
|
|
|
|
}
|
|
|
|
|
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
function reset(): void {
|
|
|
|
|
currentPath.value = '/'
|
|
|
|
|
items.value = []
|
|
|
|
|
loading.value = false
|
|
|
|
|
error.value = null
|
2026-07-27 22:49:30 -04:00
|
|
|
pathCache.clear()
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
currentPath,
|
|
|
|
|
items,
|
|
|
|
|
loading,
|
|
|
|
|
error,
|
|
|
|
|
authenticated,
|
|
|
|
|
breadcrumbs,
|
|
|
|
|
sortedItems,
|
|
|
|
|
init,
|
|
|
|
|
navigate,
|
|
|
|
|
refresh,
|
|
|
|
|
uploadFile,
|
|
|
|
|
deleteItem,
|
|
|
|
|
downloadUrl,
|
2026-03-12 00:19:30 +00:00
|
|
|
fetchBlobUrl,
|
2026-04-12 00:45:42 -04:00
|
|
|
streamUrl,
|
2026-03-12 00:19:30 +00:00
|
|
|
downloadFile,
|
feat: cloud native file browser, settings Claude auth, deploy hardening
- Add native Cloud file browser with FileBrowser API integration
- Add cloud store, filebrowser-client, useAudioPlayer, useFileType composables
- Add Cloud components: FileGrid, FileCard, FileCardGrid, CloudToolbar
- Add Claude authentication section to Settings with OAuth status check
- Harden deploy script to preserve /aiui/ and claude-login.html
- Add nginx proxies for btcpay, homeassistant, filebrowser (HTTPS block)
- Add app configs for filebrowser, searxng, penpot in package.rs
- Update goal progress tracking with app aliases
- Improve mobile back button composable with ResizeObserver
- Update various views with cloud integration and UI refinements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:05:01 +00:00
|
|
|
reset,
|
|
|
|
|
}
|
|
|
|
|
})
|