Refactor WOPI handlers to remove debug logging and streamline access token usage
This commit is contained in:
BIN
go_cloud/api
BIN
go_cloud/api
Binary file not shown.
@@ -340,7 +340,6 @@ func wopiGetFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
|
|||||||
|
|
||||||
// Get access token from query parameter
|
// Get access token from query parameter
|
||||||
accessToken := r.URL.Query().Get("access_token")
|
accessToken := r.URL.Query().Get("access_token")
|
||||||
fmt.Printf("[WOPI-GetFile] Access token from query: '%s'\n", accessToken)
|
|
||||||
if accessToken == "" {
|
if accessToken == "" {
|
||||||
errors.WriteError(w, errors.CodeUnauthenticated, "Missing access_token", http.StatusUnauthorized)
|
errors.WriteError(w, errors.CodeUnauthenticated, "Missing access_token", http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
@@ -534,11 +533,9 @@ func wopiPutFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
fmt.Printf("[WOPI-STORAGE] Read content: %d bytes\n", len(content))
|
|
||||||
// Check for suggested target (used for export operations like Save as PDF)
|
// Check for suggested target (used for export operations like Save as PDF)
|
||||||
suggestedTarget := r.Header.Get("X-WOPI-SuggestedTarget")
|
suggestedTarget := r.Header.Get("X-WOPI-SuggestedTarget")
|
||||||
isExport := suggestedTarget != ""
|
isExport := suggestedTarget != ""
|
||||||
fmt.Printf("[WOPI-PutFile] Suggested target: '%s', isExport: %v\n", suggestedTarget, isExport)
|
|
||||||
|
|
||||||
var targetFile *database.File
|
var targetFile *database.File
|
||||||
var targetRemotePath string
|
var targetRemotePath string
|
||||||
@@ -848,10 +845,8 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("[COLLABORA-PROXY] Generated access token: %s\n", accessToken)
|
|
||||||
|
|
||||||
// Build WOPISrc URL (with access_token as query parameter)
|
// Build WOPISrc URL (with access_token as query parameter)
|
||||||
wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s?access_token=%s", fileID, url.QueryEscape(accessToken))
|
wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s?access_token=%s", fileID, accessToken)
|
||||||
|
|
||||||
// Get the correct Collabora editor URL from discovery (includes version hash)
|
// Get the correct Collabora editor URL from discovery (includes version hash)
|
||||||
editorURL := getCollaboraEditorURL(collaboraURL)
|
editorURL := getCollaboraEditorURL(collaboraURL)
|
||||||
@@ -902,6 +897,4 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database.
|
|||||||
// 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
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(htmlContent))
|
w.Write([]byte(htmlContent))
|
||||||
|
|
||||||
fmt.Printf("[COLLABORA-PROXY] Served HTML form: file=%s user=%s wopi_src=%s editor_url=%s\n", fileID, userID.String(), wopiSrc, collaboraFullURL)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user