diff --git a/frontend/src/components/FileExplorer.tsx b/frontend/src/components/FileExplorer.tsx
index 22ed920..47151ed 100644
--- a/frontend/src/components/FileExplorer.tsx
+++ b/frontend/src/components/FileExplorer.tsx
@@ -777,6 +777,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
setRenaming(null);
setNewName('');
loadFiles(undefined, true);
+ setPinnedRefreshCounter(c => c + 1);
showToast(`Renamed to ${finalName}`);
}
@@ -1958,6 +1959,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
loadFiles();
}}
onPinChange={() => setPinnedRefreshCounter(c => c + 1)}
+ onRename={() => setPinnedRefreshCounter(c => c + 1)}
/>
) : (
diff --git a/frontend/src/components/OfficeHome.tsx b/frontend/src/components/OfficeHome.tsx
index 1152c3c..e100293 100644
--- a/frontend/src/components/OfficeHome.tsx
+++ b/frontend/src/components/OfficeHome.tsx
@@ -11,6 +11,7 @@ interface OfficeHomeProps {
onFileSelect: (file: FileItem) => void;
onCreateBlank: (file: FileItem) => void;
onPinChange?: () => void;
+ onRename?: () => void;
}
// Custom Word icon (blue)
@@ -44,7 +45,7 @@ interface ContextMenuState {
file: FileItem;
}
-export default function OfficeHome({ type, onFileSelect, onCreateBlank, onPinChange }: OfficeHomeProps) {
+export default function OfficeHome({ type, onFileSelect, onCreateBlank, onPinChange, onRename }: OfficeHomeProps) {
const [recentFiles, setRecentFiles] = useState([]);
const [pinnedFiles, setPinnedFiles] = useState([]);
const [allFiles, setAllFiles] = useState([]);
@@ -200,6 +201,7 @@ export default function OfficeHome({ type, onFileSelect, onCreateBlank, onPinCha
await api.rename(renaming, trimmed);
setRenaming(null);
fetchFiles(); // Refresh
+ if (onRename) onRename();
} catch (err: any) {
console.error("Failed to rename", err);
setToast({ message: err.message || "Failed to rename file", type: "error" });
diff --git a/frontend/src/components/OnlyOfficeEditor.tsx b/frontend/src/components/OnlyOfficeEditor.tsx
index bc6b21b..6300cbc 100644
--- a/frontend/src/components/OnlyOfficeEditor.tsx
+++ b/frontend/src/components/OnlyOfficeEditor.tsx
@@ -60,8 +60,8 @@ export default function OnlyOfficeEditor({ file, type, onClose, onRename, theme,
};
useEffect(() => {
- // We need a short-lived download token to pass to the Document Server
- api.createDownloadToken()
+ // We need a long-lived edit token to pass to the Document Server
+ api.createEditToken()
.then((token: string) => setDownloadToken(token))
.catch(err => {
setLoadError("Failed to get download token");
@@ -80,8 +80,8 @@ export default function OnlyOfficeEditor({ file, type, onClose, onRename, theme,
// the auth middleware which fails when requests come through the Next.js proxy.
const INTERNAL_URL = process.env.NEXT_PUBLIC_API_URL || 'http://192.168.50.81:5827/api';
- const fileUrl = `${INTERNAL_URL}/public/onlyoffice/download?path=${encodeURIComponent(file.path)}&token=${editToken}`;
- const callbackUrl = `${INTERNAL_URL}/public/onlyoffice/callback?path=${encodeURIComponent(file.path)}&token=${editToken}`;
+ const fileUrl = `${INTERNAL_URL}/public/onlyoffice/download?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
+ const callbackUrl = `${INTERNAL_URL}/public/onlyoffice/callback?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
const baseConfig: any = {
document: {