feat: wire context broker files category to FileBrowser, fix media state check
- sanitizeFiles() now fetches real data from FileBrowser (usage, folders, recent files) - Fixed media state check to include 'running' and 'stopped' states, not just 'installed' - Removed unused bottomPosition variable in CloudFolder.vue Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a49dd83c5c
commit
36627ae1ac
@@ -10,6 +10,7 @@ import { useAIPermissionsStore } from '@/stores/aiPermissions'
|
||||
import { useAppStore } from '@/stores/app'
|
||||
import { useContainerStore, BUNDLED_APPS } from '@/stores/container'
|
||||
import { rpcClient } from '@/api/rpc-client'
|
||||
import { fileBrowserClient } from '@/api/filebrowser-client'
|
||||
|
||||
/**
|
||||
* Context Broker — mediates all communication between AIUI (iframe) and Archy.
|
||||
@@ -365,11 +366,11 @@ export class ContextBroker {
|
||||
|
||||
for (const id of mediaAppIds) {
|
||||
const pkg = packages[id]
|
||||
if (pkg && pkg.state === 'installed') {
|
||||
if (pkg && (pkg.state === 'installed' || pkg.state === 'running' || pkg.state === 'stopped')) {
|
||||
libraries.push({
|
||||
source: id,
|
||||
name: pkg.manifest?.title || id,
|
||||
status: pkg.installed?.status || 'unknown',
|
||||
status: pkg.state,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -384,13 +385,31 @@ export class ContextBroker {
|
||||
return { available: true, libraries }
|
||||
}
|
||||
|
||||
// T9: Files from cloud/nextcloud
|
||||
private sanitizeFiles(): unknown {
|
||||
return {
|
||||
available: false,
|
||||
folders: [],
|
||||
recentFiles: [],
|
||||
message: 'File browser not yet available',
|
||||
// T9: Files from FileBrowser
|
||||
private async sanitizeFiles(): Promise<unknown> {
|
||||
try {
|
||||
if (!fileBrowserClient.isAuthenticated) {
|
||||
const ok = await fileBrowserClient.login()
|
||||
if (!ok) return { available: false, message: 'File browser authentication failed' }
|
||||
}
|
||||
const usage = await fileBrowserClient.getUsage()
|
||||
const items = await fileBrowserClient.listDirectory('/')
|
||||
const folders = items.filter(i => i.isDir).map(i => ({ name: i.name, path: i.path }))
|
||||
const recentFiles = items
|
||||
.filter(i => !i.isDir)
|
||||
.sort((a, b) => new Date(b.modified).getTime() - new Date(a.modified).getTime())
|
||||
.slice(0, 10)
|
||||
.map(i => ({ name: i.name, path: i.path, size: i.size, modified: i.modified }))
|
||||
return {
|
||||
available: true,
|
||||
totalSize: usage.totalSize,
|
||||
folderCount: usage.folderCount,
|
||||
fileCount: usage.fileCount,
|
||||
folders,
|
||||
recentFiles,
|
||||
}
|
||||
} catch {
|
||||
return { available: false, message: 'File browser not reachable' }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user