Refine CORS settings in file download handlers and update viewer behavior for mobile and authenticated web
This commit is contained in:
@@ -140,10 +140,17 @@ class FileViewerDispatch {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container(
|
Widget viewerChild = child;
|
||||||
color: AppTheme.primaryBackground,
|
if (!(kIsWeb && token == null)) {
|
||||||
child: InteractiveViewer(minScale: 0.5, maxScale: 4.0, child: child),
|
// Use InteractiveViewer for mobile or authenticated web
|
||||||
|
viewerChild = InteractiveViewer(
|
||||||
|
minScale: 0.5,
|
||||||
|
maxScale: 4.0,
|
||||||
|
child: child,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(color: AppTheme.primaryBackground, child: viewerChild);
|
||||||
} else {
|
} else {
|
||||||
return Container(
|
return Container(
|
||||||
color: AppTheme.primaryBackground,
|
color: AppTheme.primaryBackground,
|
||||||
|
|||||||
BIN
go_cloud/bin/api
BIN
go_cloud/bin/api
Binary file not shown.
@@ -2417,7 +2417,9 @@ func downloadOrgFileHandler(w http.ResponseWriter, r *http.Request, db *database
|
|||||||
// which supports all common video/audio/image formats
|
// which supports all common video/audio/image formats
|
||||||
contentType := getMimeType(fileName)
|
contentType := getMimeType(fileName)
|
||||||
|
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
w.Header().Set("Access-Control-Allow-Origin", "https://www.b0esche.cloud")
|
||||||
|
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
||||||
|
w.Header().Set("Access-Control-Allow-Headers", "Authorization, Range")
|
||||||
w.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", fileName))
|
w.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", fileName))
|
||||||
w.Header().Set("Content-Type", contentType)
|
w.Header().Set("Content-Type", contentType)
|
||||||
w.Header().Set("Accept-Ranges", "bytes")
|
w.Header().Set("Accept-Ranges", "bytes")
|
||||||
@@ -2565,7 +2567,9 @@ func downloadUserFileHandler(w http.ResponseWriter, r *http.Request, db *databas
|
|||||||
// which supports all common video/audio/image formats
|
// which supports all common video/audio/image formats
|
||||||
contentType := getMimeType(fileName)
|
contentType := getMimeType(fileName)
|
||||||
|
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
w.Header().Set("Access-Control-Allow-Origin", "https://www.b0esche.cloud")
|
||||||
|
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
||||||
|
w.Header().Set("Access-Control-Allow-Headers", "Authorization, Range")
|
||||||
w.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", fileName))
|
w.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", fileName))
|
||||||
w.Header().Set("Content-Type", contentType)
|
w.Header().Set("Content-Type", contentType)
|
||||||
w.Header().Set("Accept-Ranges", "bytes")
|
w.Header().Set("Accept-Ranges", "bytes")
|
||||||
|
|||||||
Reference in New Issue
Block a user