mirror of
https://github.com/JuLi0n21/pwa-player.git
synced 2026-04-19 23:40:05 +00:00
update setup interaction
This commit is contained in:
@@ -200,7 +200,7 @@ func rebuildBeatmapDb(db *sql.DB, osuDb *parser.OsuDB) error {
|
|||||||
|
|
||||||
stmt = tx.Stmt(stmt)
|
stmt = tx.Stmt(stmt)
|
||||||
|
|
||||||
for i, beatmap := range osuDb.Beatmaps {
|
for _, beatmap := range osuDb.Beatmaps {
|
||||||
//fmt.Println(i, beatmap.Artist, beatmap.SongTitle, beatmap.MD5Hash)
|
//fmt.Println(i, beatmap.Artist, beatmap.SongTitle, beatmap.MD5Hash)
|
||||||
_, err := stmt.Exec(
|
_, err := stmt.Exec(
|
||||||
beatmap.DifficultyID, beatmap.Artist, beatmap.ArtistUnicode,
|
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,
|
beatmap.SongSource, beatmap.SongTags, beatmap.LastPlayed, beatmap.FolderName,
|
||||||
)
|
)
|
||||||
if err != nil {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if envMap["OSU_PATH"] == "" {
|
if envMap["OSU_PATH"] == "" {
|
||||||
fmt.Println("Osu Path not found! Please paste the full path to your osu! folder.")
|
fmt.Println("Osu! 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("It should start with 'C://' and can be opened from the Options menu (Open osu! folder)")
|
||||||
|
fmt.Print("Path: ")
|
||||||
|
|
||||||
fmt.Scanln(&osuRoot)
|
fmt.Scanln(&osuRoot)
|
||||||
osuRoot = strings.TrimSpace(osuRoot)
|
osuRoot = strings.TrimSpace(osuRoot)
|
||||||
@@ -43,8 +44,20 @@ func main() {
|
|||||||
godotenv.Write(envMap, ".env")
|
godotenv.Write(envMap, ".env")
|
||||||
}
|
}
|
||||||
|
|
||||||
osuRoot := envMap["OSU_PATH"]
|
|
||||||
cookie := envMap["COOKIE"]
|
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")
|
port := GetEnv(envMap["PORT"], ":8080")
|
||||||
filename := path.Join(osuRoot, "osu!.db")
|
filename := path.Join(osuRoot, "osu!.db")
|
||||||
|
|
||||||
@@ -53,10 +66,6 @@ func main() {
|
|||||||
log.Fatal(err)
|
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)
|
url, err := StartCloudflared(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Cloudflared service couldnt be started: %v", err)
|
log.Fatalf("Cloudflared service couldnt be started: %v", err)
|
||||||
@@ -79,6 +88,7 @@ func main() {
|
|||||||
Sqlc: sqlc,
|
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 {
|
if err := runGrpcAndGateway(s, port); err != nil {
|
||||||
log.Fatalf("Failed to run servers: %v", err)
|
log.Fatalf("Failed to run servers: %v", err)
|
||||||
}
|
}
|
||||||
@@ -93,6 +103,7 @@ func GetEnv(key, fallback string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func StartCloudflared(port string) (string, error) {
|
func StartCloudflared(port string) (string, error) {
|
||||||
|
fmt.Println("Starting Cloudflared tunnel...")
|
||||||
cmd := exec.Command("cloudflared", "tunnel", "--url", fmt.Sprintf("http://localhost%s", port))
|
cmd := exec.Command("cloudflared", "tunnel", "--url", fmt.Sprintf("http://localhost%s", port))
|
||||||
|
|
||||||
stderr, err := cmd.StderrPipe()
|
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) {
|
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)
|
gwMux.ServeHTTP(w, r)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user