Build failure fixes
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m21s

This commit is contained in:
Elijah 2026-05-24 10:51:19 -07:00
parent d80e31e7f5
commit 6a754808b5
3 changed files with 16 additions and 6 deletions

View file

@ -26,8 +26,9 @@ export default function OfficeHome({ type, onFileSelect, onCreateBlank }: Office
useEffect(() => { useEffect(() => {
// Fetch all files from root directory (as a simple way to find recent files of this type) // Fetch all files from root directory (as a simple way to find recent files of this type)
// Or we could use a search endpoint. For now we will fetch the root directory and filter. // Or we could use a search endpoint. For now we will fetch the root directory and filter.
api.listFiles('.') api.listDirectory('.')
.then(files => { .then(data => {
const files: FileItem[] = data.files || [];
const ext = type === 'docs' ? '.docx' : '.pptx'; const ext = type === 'docs' ? '.docx' : '.pptx';
const filtered = files const filtered = files
.filter(f => !f.is_dir && f.name.endsWith(ext) && !f.is_trashed) .filter(f => !f.is_dir && f.name.endsWith(ext) && !f.is_trashed)
@ -44,8 +45,8 @@ export default function OfficeHome({ type, onFileSelect, onCreateBlank }: Office
const handleCreateBlank = async () => { const handleCreateBlank = async () => {
try { try {
const res = await api.client.post('/onlyoffice/create', { type: type === 'docs' ? 'word' : 'slide' }); const res = await api.createOnlyOfficeFile(type === 'docs' ? 'word' : 'slide');
const { path, name } = res.data; const { path, name } = res;
const newFile: FileItem = { const newFile: FileItem = {
name, name,

View file

@ -24,8 +24,8 @@ export default function OnlyOfficeEditor({ file, type, onClose }: OnlyOfficeEdit
useEffect(() => { useEffect(() => {
// We need a short-lived download token to pass to the Document Server // We need a short-lived download token to pass to the Document Server
api.client.get('/auth/download-token') api.createDownloadToken()
.then(res => setDownloadToken(res.data.token)) .then((token: string) => setDownloadToken(token))
.catch(console.error); .catch(console.error);
}, [file.path]); }, [file.path]);

View file

@ -468,6 +468,15 @@ class ApiClient {
} }
return url; return url;
} }
// --- OnlyOffice ---
async createOnlyOfficeFile(type: 'word' | 'slide') {
const res = await this.request('/api/onlyoffice/create', {
method: 'POST',
body: { type },
});
return res.json();
}
} }
export const api = new ApiClient(); export const api = new ApiClient();