Fixed incorrect onlyoffice IP
All checks were successful
Automated Container Build / build-and-push (push) Successful in 40s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 40s
This commit is contained in:
parent
6a754808b5
commit
61eafc5fac
1 changed files with 9 additions and 3 deletions
|
|
@ -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
|
// 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
|
// Callback URL that OnlyOffice will post to when saving
|
||||||
const callbackUrl = `${API_BASE}/api/public/onlyoffice/callback?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
|
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">
|
<div className="flex-1 relative">
|
||||||
<DocumentEditor
|
<DocumentEditor
|
||||||
id="docxEditor"
|
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}
|
config={config as any}
|
||||||
events_onDocumentReady={onDocumentReady}
|
events_onDocumentReady={onDocumentReady}
|
||||||
onLoadComponentError={onLoadComponentError}
|
onLoadComponentError={onLoadComponentError}
|
||||||
|
|
|
||||||
Reference in a new issue