diff --git a/gen_web.go b/gen_web.go index 0338b07..125b7ab 100644 --- a/gen_web.go +++ b/gen_web.go @@ -40,6 +40,7 @@ func main() { } return nil }) + sort.Strings(files) fmap := writeEmbed(srcGo+"template/html.go", files) writeRoute(srcGo+"template/route.go", fmap) } @@ -97,6 +98,12 @@ func RouteWebPages(route *gin.RouterGroup) { sort.Strings(keys) for _, link := range keys { fmime := mime.TypeByExtension(filepath.Ext(link)) + if fmime == "application/xml" || fmime == "application/javascript" { + fmime = fmime + "; charset=utf-8" + } + if fmime == "image/x-icon" { + fmime = "image/vnd.microsoft.icon" + } embedStr += ` route.GET("` + link + `", func(c *gin.Context) { c.Data(200, "` + fmime + `", ` + fmap[link] + `) diff --git a/server/torr/dbwrapper.go b/server/torr/dbwrapper.go index 6ae17f6..1b6533b 100644 --- a/server/torr/dbwrapper.go +++ b/server/torr/dbwrapper.go @@ -1,6 +1,7 @@ package torr import ( + "encoding/json" "time" "server/settings" @@ -9,11 +10,25 @@ import ( "github.com/anacrolix/torrent/metainfo" ) +type tsFiles struct { + TorrServer struct { + Files []*state.TorrentFileStat `json:"Files"` + } `json:"TorrServer"` +} + func AddTorrentDB(torr *Torrent) { t := new(settings.TorrentDB) t.TorrentSpec = torr.TorrentSpec t.Title = torr.Title - t.Data = torr.Data + if torr.Data == "" { + files := new(tsFiles) + files.TorrServer.Files = torr.Status().FileStats + buf, _ := json.Marshal(files) + t.Data = string(buf) + torr.Data = t.Data + } else { + t.Data = torr.Data + } t.Poster = torr.Poster t.Size = torr.Size if t.Size == 0 && torr.Torrent != nil { diff --git a/server/web/msx/route.go b/server/web/msx/route.go index 651a0c9..7414da6 100644 --- a/server/web/msx/route.go +++ b/server/web/msx/route.go @@ -7,7 +7,7 @@ func SetupRoute(route *gin.RouterGroup) { route.GET("/msx/torrents", msxTorrents) route.GET("/msx/playlist", msxPlaylist) route.GET("/msx/playlist/*fname", msxPlaylist) - + route.GET("/msx/tizen.html", func(c *gin.Context) { c.Data(200, "text/html; charset=utf-8", Msxtizenhtml) }) diff --git a/web/src/components/Donate/DonateDialog.jsx b/web/src/components/Donate/DonateDialog.jsx index 78b2c05..452dc65 100644 --- a/web/src/components/Donate/DonateDialog.jsx +++ b/web/src/components/Donate/DonateDialog.jsx @@ -23,6 +23,7 @@ export default function DonateDialog({ onClose }) { + @@ -31,7 +32,6 @@ export default function DonateDialog({ onClose }) { -