Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Remove old cdn

Smaug6739b156f3369940
diff --git a/cdn/go.mod b/cdn/go.mod
deleted file mode 100644
index 38ff0ccf..00000000
--- a/cdn/go.mod
+++ /dev/null
@@ -1,9 +0,0 @@
-module github.com/alexandrie
-
-go 1.22
-
-require (
- github.com/felixge/httpsnoop v1.0.3 // indirect
- github.com/gorilla/handlers v1.5.2 // indirect
- github.com/gorilla/mux v1.8.1 // indirect
-)
diff --git a/cdn/go.sum b/cdn/go.sum
deleted file mode 100644
index a9361ce5..00000000
--- a/cdn/go.sum
+++ /dev/null
@@ -1,6 +0,0 @@
-github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
-github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
-github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE=
-github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
-github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
-github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
diff --git a/cdn/main.go b/cdn/main.go
deleted file mode 100644
index fe977599..00000000
--- a/cdn/main.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package main
-
-import (
- "fmt"
- "log"
- "net/http"
- "os"
- "path"
- "strings"
-
- "github.com/gorilla/handlers"
- "github.com/gorilla/mux"
-)
-
-func main() {
- port := os.Getenv("PORT")
- if port == "" {
- port = "3002"
- }
- r := mux.NewRouter()
-
- fileHandler := http.FileServer(http.Dir("../uploads"))
- r.PathPrefix("/").Handler(http.StripPrefix("/", secureFileServer(fileHandler)))
-
- // Middlewares pour la sécurité
- r.Use(handlers.CompressHandler)
- r.Use(handlers.CORS(handlers.AllowedOrigins([]string{os.Getenv("DOMAIN_CLIENT")}))) // Restriction de CORS
- r.Use(securityHeadersMiddleware)
-
- fmt.Println("Server is running on port", port)
- log.Fatal(http.ListenAndServe(":"+port, r))
-}
-
-func securityHeadersMiddleware(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Security-Policy", "default-src 'self'; script-src 'none'; style-src 'none'")
- w.Header().Set("X-Content-Type-Options", "nosniff")
- w.Header().Set("X-Frame-Options", "DENY")
- w.Header().Set("X-XSS-Protection", "1; mode=block")
- w.Header().Set("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
-
- if strings.HasPrefix(r.URL.Path, "/other") || strings.HasPrefix(r.URL.Path, "/backups") {
- w.Header().Set("Content-Disposition", "attachment; filename")
- }
- next.ServeHTTP(w, r)
- })
-}
-
-func secureFileServer(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- r.URL.Path = path.Clean(r.URL.Path)
- next.ServeHTTP(w, r)
- })
-}