Integrate graphics, RAW, audio and CAD Craft tools with protected saves

This commit is contained in:
SantaSpeen committed 2026-10-22 19:48:16 +03:00
1 parent 6e36b6c4b7
commit 852140c3a7
24 files changed
+600 -74

No files matched your search

+7 -1
View File
@@ -83,6 +83,9 @@ func addonStaticHandler(manager *addons.Manager) handleFunc {
extension := strings.ToLower(path.Ext(name))
types := map[string]string{".html": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8", ".wasm": "application/wasm", ".css": "text/css", ".ico": "image/x-icon", ".png": "image/png", ".svg": "image/svg+xml", ".webp": "image/webp", ".jpg": "image/jpeg", ".woff": "font/woff", ".woff2": "font/woff2", ".ttf": "font/ttf", ".otf": "font/otf", ".json": "application/json", ".map": "application/json", ".txt": "text/plain"}
contentType, ok := types[extension]
if len(extension) == 8 && strings.HasPrefix(extension, ".part-") && extension[6] >= 'a' && extension[6] <= 'z' && extension[7] >= 'a' && extension[7] <= 'z' {
contentType, ok = "application/octet-stream", true
}
if !ok {
return http.StatusNotFound, nil
}
@@ -117,7 +120,10 @@ func addonStaticHandler(manager *addons.Manager) handleFunc {
w.Header().Set("Content-Security-Policy", `default-src 'self'; script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self'; worker-src 'self' blob:; media-src 'self' blob:; frame-src 'none'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'`)
if bridge {
w.Header().Set("Cache-Control", "no-store")
http.ServeContent(w, r, name, info.ModTime(), bytes.NewReader(officeBridge))
tool, _ := addons.Find(id)
config, _ := json.Marshal(tool)
response := append([]byte("window.__filebrowserCraft="+string(config)+";\n"), officeBridge...)
http.ServeContent(w, r, name, info.ModTime(), bytes.NewReader(response))
return 0, nil
}
if adaptIndex {