From 6e4037952c1296b0c9b827e9053e9266950f3530 Mon Sep 17 00:00:00 2001 From: Suvodip Ghosh Date: Mon, 23 Jun 2025 17:37:02 +0530 Subject: [PATCH 1/3] remove env file --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7087f7f..52eb2ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -image_asset \ No newline at end of file +image_asset +.env \ No newline at end of file -- 2.43.0 From 5298b822776aa5d0a6c478258089dc7ca08d6b57 Mon Sep 17 00:00:00 2001 From: Suvodip Ghosh Date: Mon, 23 Jun 2025 20:33:17 +0530 Subject: [PATCH 2/3] remove cors --- main.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/main.go b/main.go index 2f13ab2..375fff7 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,6 @@ import ( "github.com/joho/godotenv" _ "github.com/mattn/go-sqlite3" "github.com/google/uuid" - "github.com/rs/cors" ) type Config struct { @@ -111,29 +110,13 @@ func saveImageNames() { } func serveAPI() { - // Create a new CORS handler - c := cors.New(cors.Options{ - AllowedOrigins: []string{ - "http://localhost:4321", - "https://siliconpin.cs1.hz.siliconpin.com", - "https://siliconpin.com", - }, - AllowedMethods: []string{"GET", "POST", "OPTIONS"}, - AllowedHeaders: []string{"Content-Type"}, - AllowCredentials: true, - // Debug: true, // Remove in production - }) - // Create a new mux router router := http.NewServeMux() router.HandleFunc("/get-image", getImageHandler) router.HandleFunc("/save-score", saveScoreHandler) - // Wrap your router with the CORS handler - handler := c.Handler(router) - log.Printf("Server starting on port %s", config.Port) - log.Fatal(http.ListenAndServe("0.0.0.0:"+config.Port, handler)) + log.Fatal(http.ListenAndServe(":"+config.Port, router)) } func getImageHandler(w http.ResponseWriter, r *http.Request) { -- 2.43.0 From cd3de824912ca43f8e26635b7ee74c3252665f5b Mon Sep 17 00:00:00 2001 From: Suvodip Ghosh Date: Mon, 23 Jun 2025 20:35:47 +0530 Subject: [PATCH 3/3] Stop tracking .env file --- .env | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index e5adaa1..0000000 --- a/.env +++ /dev/null @@ -1,5 +0,0 @@ -PORT=4008 -# URL_PREFIX=http://0.0.0.0:8000/image_asset -URL_PREFIX = https://minio-api.3027622.siliconpin.com/image-asset/image_asset/ - -# https://minio-api.3027622.siliconpin.com/image-asset/image_asset/20220818222344367.jpg \ No newline at end of file -- 2.43.0