Fixed incorrect onlyoffice IP
All checks were successful
Automated Container Build / build-and-push (push) Successful in 40s

This commit is contained in:
Elijah 2026-05-24 10:58:05 -07:00
parent 6a754808b5
commit 61eafc5fac

View file

@ -37,10 +37,16 @@ export default function OnlyOfficeEditor({ file, type, onClose }: OnlyOfficeEdit
);
}
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080';
const getApiBase = () => {
if (process.env.NEXT_PUBLIC_API_URL) return process.env.NEXT_PUBLIC_API_URL;
if (typeof window !== 'undefined') return window.location.origin;
return 'http://localhost:8080';
};
const API_BASE = getApiBase();
// URL that OnlyOffice will use to download the file
const fileUrl = `${API_BASE}/api/files/download/${encodeURIComponent(file.path)}?token=${downloadToken}`;
const fileUrl = `${API_BASE}/api/files/download/?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
// Callback URL that OnlyOffice will post to when saving
const callbackUrl = `${API_BASE}/api/public/onlyoffice/callback?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
@ -97,7 +103,7 @@ export default function OnlyOfficeEditor({ file, type, onClose }: OnlyOfficeEdit
<div className="flex-1 relative">
<DocumentEditor
id="docxEditor"
documentServerUrl="http://192.168.50.81:8084/"
documentServerUrl={typeof window !== 'undefined' ? (window.location.protocol === 'https:' ? `https://${window.location.hostname}:4430/` : `http://${window.location.hostname}:8084/`) : "http://192.168.50.81:8084/"}
config={config as any}
events_onDocumentReady={onDocumentReady}
onLoadComponentError={onLoadComponentError}