Add .gitignore for docker-compose-server.yml and update WOPISrc URL handling in collaboraProxyHandler

This commit is contained in:
Leon Bösche
2026-01-13 14:01:02 +01:00
parent 8baaad2c08
commit 0aa281ac09
3 changed files with 6 additions and 4 deletions

Binary file not shown.

View File

@@ -662,8 +662,8 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database.
return
}
// Build WOPISrc URL
wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s?access_token=%s", fileID, accessToken)
// Build WOPISrc URL (without access_token - that goes in a separate form field)
wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s", fileID)
// Return HTML page with auto-submitting form
// The form POSTs to Collabora from within an iframe to work around CSP frame-ancestors restrictions
@@ -686,19 +686,20 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database.
</div>
<form method="POST" action="%s/browser/dist/cool.html" target="_self" id="collaboraForm" style="display: none;">
<input type="hidden" name="WOPISrc" value="%s">
<input type="hidden" name="access_token" value="%s">
</form>
<script>
// Auto-submit the form to Collabora
var form = document.getElementById('collaboraForm');
if (form) {
console.log('[COLLABORA] Submitting form to /browser/dist/cool.html with WOPISrc');
console.log('[COLLABORA] Submitting form to /browser/dist/cool.html');
form.submit();
} else {
console.error('[COLLABORA] Form not found');
}
</script>
</body>
</html>`, collaboraURL, wopiSrc)
</html>`, collaboraURL, wopiSrc, accessToken)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
// Don't set X-Frame-Options - this endpoint is meant to be loaded in an iframe