From b73d6895a2adc489989ec03c044c0d1e601c5056 Mon Sep 17 00:00:00 2001 From: JuLi0n21 Date: Sun, 27 Jul 2025 14:28:46 +0200 Subject: [PATCH] update setup interaction --- grpc-backend/database.go | 4 ++-- grpc-backend/main.go | 27 +++++++++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/grpc-backend/database.go b/grpc-backend/database.go index f1c0412..51df8fe 100644 --- a/grpc-backend/database.go +++ b/grpc-backend/database.go @@ -200,7 +200,7 @@ func rebuildBeatmapDb(db *sql.DB, osuDb *parser.OsuDB) error { stmt = tx.Stmt(stmt) - for i, beatmap := range osuDb.Beatmaps { + for _, beatmap := range osuDb.Beatmaps { //fmt.Println(i, beatmap.Artist, beatmap.SongTitle, beatmap.MD5Hash) _, err := stmt.Exec( beatmap.DifficultyID, beatmap.Artist, beatmap.ArtistUnicode, @@ -211,7 +211,7 @@ func rebuildBeatmapDb(db *sql.DB, osuDb *parser.OsuDB) error { beatmap.SongSource, beatmap.SongTags, beatmap.LastPlayed, beatmap.FolderName, ) if err != nil { - fmt.Println(i, "hash: ", beatmap.MD5Hash, "artist:", beatmap.Artist, "title:", beatmap.SongTitle, err) + //fmt.Println(i, "hash: ", beatmap.MD5Hash, "artist:", beatmap.Artist, "title:", beatmap.SongTitle, err) } } diff --git a/grpc-backend/main.go b/grpc-backend/main.go index 9b1f1ea..9363df3 100644 --- a/grpc-backend/main.go +++ b/grpc-backend/main.go @@ -33,8 +33,9 @@ func main() { } if envMap["OSU_PATH"] == "" { - fmt.Println("Osu Path not found! Please paste the full path to your osu! folder.") - fmt.Println("Osu Path not found pls paste the full Path to ur osu! folder \n it should start with 'C://' and can be opened from the Settings menu!)\n path: ") + fmt.Println("Osu! not found! Please paste the full path to your osu! folder.") + fmt.Println("It should start with 'C://' and can be opened from the Options menu (Open osu! folder)") + fmt.Print("Path: ") fmt.Scanln(&osuRoot) osuRoot = strings.TrimSpace(osuRoot) @@ -43,8 +44,20 @@ func main() { godotenv.Write(envMap, ".env") } - osuRoot := envMap["OSU_PATH"] cookie := envMap["COOKIE"] + + if cookie == "" { + fmt.Println("No Authentication found please follow the link to log in!\nhttps://proxy.illegalesachen.download/login") + fmt.Println("After login paste the cookie from the browser") + fmt.Print("Cookie: ") + fmt.Scanln(&cookie) + cookie = strings.TrimSpace(cookie) + + envMap["COOKIE"] = cookie + godotenv.Write(envMap, ".env") + } + + osuRoot := envMap["OSU_PATH"] port := GetEnv(envMap["PORT"], ":8080") filename := path.Join(osuRoot, "osu!.db") @@ -53,10 +66,6 @@ func main() { log.Fatal(err) } - if cookie == "" { - fmt.Println("No Authentication found please follow the link to log in!\n http://proxy.illegalesachen.download/login") - } - url, err := StartCloudflared(port) if err != nil { log.Fatalf("Cloudflared service couldnt be started: %v", err) @@ -79,6 +88,7 @@ func main() { Sqlc: sqlc, } + fmt.Println("Enjoy ur music at: https://music.illegalesachen.download (click refresh if the link hasnt updated yet)") if err := runGrpcAndGateway(s, port); err != nil { log.Fatalf("Failed to run servers: %v", err) } @@ -93,6 +103,7 @@ func GetEnv(key, fallback string) string { } func StartCloudflared(port string) (string, error) { + fmt.Println("Starting Cloudflared tunnel...") cmd := exec.Command("cloudflared", "tunnel", "--url", fmt.Sprintf("http://localhost%s", port)) stderr, err := cmd.StderrPipe() @@ -206,7 +217,7 @@ func runGrpcAndGateway(s *Server, port string) error { } mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - log.Printf("HTTP %s %s", r.Method, r.URL.Path) + //log.Printf("HTTP %s %s", r.Method, r.URL.Path) gwMux.ServeHTTP(w, r) }))