mirror of
https://github.com/JuLi0n21/pwa-player.git
synced 2026-04-19 15:30:05 +00:00
fix url api image/audio
This commit is contained in:
@@ -330,7 +330,7 @@ func getBeatmapCount(db *sql.DB) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getRecent(db *sql.DB, limit, offset int) ([]Song, error) {
|
func getRecent(db *sql.DB, limit, offset int) ([]Song, error) {
|
||||||
rows, err := db.Query("SELECT BeatmapId, MD5Hash, Title, Artist, Creator, Folder, File, Audio, TotalTime FROM Beatmap ORDER BY LastModifiedTime DESC LIMIT ? OFFSET ?", limit, offset)
|
rows, err := db.Query("SELECT BeatmapId, MD5Hash, Title, Artist, Creator, Folder, File, Audio, TotalTime FROM Beatmap GROUP BY Folder ORDER BY LastModifiedTime DESC LIMIT ? OFFSET ?", limit, offset)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []Song{}, err
|
return []Song{}, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,8 +193,8 @@ func runGrpcAndGateway(s *Server, port string) error {
|
|||||||
mux := &http.ServeMux{}
|
mux := &http.ServeMux{}
|
||||||
|
|
||||||
mux.HandleFunc("/callback/", s.callback)
|
mux.HandleFunc("/callback/", s.callback)
|
||||||
mux.HandleFunc("api/v1/audio/{filepath}", s.songFile)
|
mux.HandleFunc("/api/v1/audio/{filepath}", s.songFile)
|
||||||
mux.HandleFunc("api/v1/image/{filepath}", s.imageFile)
|
mux.HandleFunc("/api/v1/image/{filepath}", s.imageFile)
|
||||||
|
|
||||||
fileServer := http.FileServer(http.Dir("gen/swagger"))
|
fileServer := http.FileServer(http.Dir("gen/swagger"))
|
||||||
mux.Handle("/swagger/", http.StripPrefix("/swagger/", fileServer))
|
mux.Handle("/swagger/", http.StripPrefix("/swagger/", fileServer))
|
||||||
|
|||||||
Reference in New Issue
Block a user