diff --git a/apps/frontend/src/middleware/server-instance-ready.ts b/apps/frontend/src/middleware/server-instance-ready.ts index c094d752bd..de7af67fcd 100644 --- a/apps/frontend/src/middleware/server-instance-ready.ts +++ b/apps/frontend/src/middleware/server-instance-ready.ts @@ -41,8 +41,8 @@ export default defineNuxtRouteMiddleware(async (to) => { if (tab === 'files') { const path = typeof to.query.path === 'string' ? to.query.path : '/' await queryClient.ensureQueryData({ - queryKey: ['files', serverId, path], - queryFn: () => client.kyros.files_v0.listDirectory(path, 1, 2000), + queryKey: ['files', 'v1', worldId, path], + queryFn: () => client.kyros.files_v1.listDescendants(worldId, path, 1, 200), staleTime: 30_000, }) return diff --git a/apps/frontend/src/pages/hosting/manage/[id]/instances/[instance_id]/files.vue b/apps/frontend/src/pages/hosting/manage/[id]/instances/[instance_id]/files.vue index 3e0afc4cdd..d0ce353236 100644 --- a/apps/frontend/src/pages/hosting/manage/[id]/instances/[instance_id]/files.vue +++ b/apps/frontend/src/pages/hosting/manage/[id]/instances/[instance_id]/files.vue @@ -7,18 +7,20 @@ import { import { useQueryClient } from '@tanstack/vue-query' const client = injectModrinthClient() -const { server, serverId } = injectModrinthServerContext() +const { server, worldId } = injectModrinthServerContext() const queryClient = useQueryClient() const flags = useFeatureFlags() const route = useNativeRoute() const initialPath = typeof route.query.path === 'string' ? route.query.path : '/' try { - await queryClient.ensureQueryData({ - queryKey: ['files', serverId, initialPath], - queryFn: () => client.kyros.files_v0.listDirectory(initialPath, 1, 2000), - staleTime: 30_000, - }) + if (worldId.value) { + await queryClient.ensureQueryData({ + queryKey: ['files', 'v1', worldId.value, initialPath], + queryFn: () => client.kyros.files_v1.listDescendants(worldId.value!, initialPath, 1, 200), + staleTime: 30_000, + }) + } } catch { // Let mounted layouts' useQuery surface errors; do not fail route setup. } diff --git a/packages/api-client/src/modules/kyros/files/v0.ts b/packages/api-client/src/modules/kyros/files/v0.ts index b027294e33..3fa383917a 100644 --- a/packages/api-client/src/modules/kyros/files/v0.ts +++ b/packages/api-client/src/modules/kyros/files/v0.ts @@ -166,49 +166,6 @@ export class KyrosFilesV0Module extends AbstractModule { }) } - /** - * Move a file or folder to a new location - * - * @param sourcePath - Current path - * @param destPath - New path - */ - public async moveFileOrFolder(sourcePath: string, destPath: string): Promise { - return this.client.request('/fs/move', { - api: '', - version: 'modrinth/v0', - method: 'POST', - body: { source: sourcePath, destination: destPath }, - useNodeAuth: true, - }) - } - - /** - * Rename a file or folder (convenience wrapper around move) - * - * @param path - Current file/folder path - * @param newName - New name (not full path) - */ - public async renameFileOrFolder(path: string, newName: string): Promise { - const newPath = path.split('/').slice(0, -1).join('/') + '/' + newName - return this.moveFileOrFolder(path, newPath) - } - - /** - * Delete a file or folder - * - * @param path - Path to delete - * @param recursive - If true, delete directory contents recursively - */ - public async deleteFileOrFolder(path: string, recursive: boolean): Promise { - return this.client.request('/fs/delete', { - api: '', - version: 'modrinth/v0', - method: 'DELETE', - params: { path, recursive }, - useNodeAuth: true, - }) - } - /** * Delete a file or folder using explicit filesystem auth credentials. *