Add .gitignore for docker-compose-server.yml and update WOPISrc URL handling in collaboraProxyHandler
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
docker-compose-server.yml
|
||||||
BIN
go_cloud/bin/api
BIN
go_cloud/bin/api
Binary file not shown.
@@ -662,8 +662,8 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build WOPISrc URL
|
// Build WOPISrc URL (without access_token - that goes in a separate form field)
|
||||||
wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s?access_token=%s", fileID, accessToken)
|
wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s", fileID)
|
||||||
|
|
||||||
// Return HTML page with auto-submitting form
|
// Return HTML page with auto-submitting form
|
||||||
// The form POSTs to Collabora from within an iframe to work around CSP frame-ancestors restrictions
|
// 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>
|
</div>
|
||||||
<form method="POST" action="%s/browser/dist/cool.html" target="_self" id="collaboraForm" style="display: none;">
|
<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="WOPISrc" value="%s">
|
||||||
|
<input type="hidden" name="access_token" value="%s">
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
// Auto-submit the form to Collabora
|
// Auto-submit the form to Collabora
|
||||||
var form = document.getElementById('collaboraForm');
|
var form = document.getElementById('collaboraForm');
|
||||||
if (form) {
|
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();
|
form.submit();
|
||||||
} else {
|
} else {
|
||||||
console.error('[COLLABORA] Form not found');
|
console.error('[COLLABORA] Form not found');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>`, collaboraURL, wopiSrc)
|
</html>`, collaboraURL, wopiSrc, accessToken)
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
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
|
// Don't set X-Frame-Options - this endpoint is meant to be loaded in an iframe
|
||||||
|
|||||||
Reference in New Issue
Block a user