mirror of
https://github.com/ZxwyWebSite/lx-source.git
synced 2025-05-23 21:37:42 +08:00
2024-01-01 v1.0.2-b0.8
This commit is contained in:
parent
0b7e1a9425
commit
b500fca79a
@ -23,9 +23,32 @@ var (
|
|||||||
tstQuality = []string{`128k`}
|
tstQuality = []string{`128k`}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 自动生成支持的音质表
|
||||||
|
func loadQMap() [][]string {
|
||||||
|
m := make([][]string, 6)
|
||||||
|
// 0.wy
|
||||||
|
m[0] = defQuality
|
||||||
|
// 1.mg
|
||||||
|
m[1] = defQuality
|
||||||
|
// 2.kw
|
||||||
|
m[2] = []string{`128k`, `320k`, `flac`}
|
||||||
|
// 3.kg
|
||||||
|
m[3] = tstQuality
|
||||||
|
// 4.tx
|
||||||
|
if env.Config.Custom.Tx_Enable {
|
||||||
|
m[4] = defQuality
|
||||||
|
} else {
|
||||||
|
m[4] = tstQuality
|
||||||
|
}
|
||||||
|
// 5.lx
|
||||||
|
// m[sources.S_lx] = defQuality
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
// 载入路由
|
// 载入路由
|
||||||
func InitRouter() *gin.Engine {
|
func InitRouter() *gin.Engine {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
|
qmap := loadQMap()
|
||||||
// Gzip压缩
|
// Gzip压缩
|
||||||
if env.Config.Main.Gzip {
|
if env.Config.Main.Gzip {
|
||||||
r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{"/file/"})))
|
r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{"/file/"})))
|
||||||
@ -41,14 +64,15 @@ func InitRouter() *gin.Engine {
|
|||||||
`github`: `https://github.com/ZxwyWebSite/lx-source`,
|
`github`: `https://github.com/ZxwyWebSite/lx-source`,
|
||||||
// 可用平台
|
// 可用平台
|
||||||
`source`: gin.H{
|
`source`: gin.H{
|
||||||
`mg`: defQuality, //true,
|
`wy`: qmap[0], //true,
|
||||||
`wy`: defQuality, //true,
|
`mg`: qmap[1], //true,
|
||||||
`kg`: tstQuality, //[]string{`128k`, `320k`}, // 测试结构2, 启用时返回音质列表, 禁用为false
|
`kw`: qmap[2], //true,
|
||||||
`tx`: tstQuality, //gin.H{ // "测试结构 不代表最终方式"
|
`kg`: qmap[3], //[]string{`128k`, `320k`}, // 测试结构2, 启用时返回音质列表, 禁用为false
|
||||||
|
`tx`: qmap[4], //gin.H{ // "测试结构 不代表最终方式"
|
||||||
// `enable`: false,
|
// `enable`: false,
|
||||||
// `qualitys`: []string{`128k`, `320k`, `flac`, `flac24bit`},
|
// `qualitys`: []string{`128k`, `320k`, `flac`, `flac24bit`},
|
||||||
// },
|
// },
|
||||||
`kw`: []string{`128k`, `320k`, `flac`}, //true,
|
sources.S_lx: qmap[5],
|
||||||
},
|
},
|
||||||
// 自定义源脚本更新
|
// 自定义源脚本更新
|
||||||
`script`: env.Config.Script,
|
`script`: env.Config.Script,
|
||||||
@ -68,6 +92,11 @@ func InitRouter() *gin.Engine {
|
|||||||
// if env.Config.Cache.Mode == `local` {
|
// if env.Config.Cache.Mode == `local` {
|
||||||
// r.Static(`/file`, env.Config.Cache.Local_Path)
|
// r.Static(`/file`, env.Config.Cache.Local_Path)
|
||||||
// }
|
// }
|
||||||
|
// 软件接口
|
||||||
|
// api := r.Group(`/api`)
|
||||||
|
// {
|
||||||
|
// api.GET(`/lx`, lxHandler) // 洛雪音乐
|
||||||
|
// }
|
||||||
// 数据接口
|
// 数据接口
|
||||||
// r.GET(`/file/:t/:hq/:n`, func(c *gin.Context) {
|
// r.GET(`/file/:t/:hq/:n`, func(c *gin.Context) {
|
||||||
// c.String(http.StatusOK, time.Now().Format(`20060102150405`))
|
// c.String(http.StatusOK, time.Now().Format(`20060102150405`))
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
## Lx-Source/更新日志
|
## Lx-Source/更新日志
|
||||||
|
|
||||||
#### 2023-12-31 v1.0.2-b0.8.2 (dev)
|
#### \# 2024-01-01 v1.0.2-b0.8 (beta)
|
||||||
|
+ 注:新年第一次更新,祝大家听歌愉快
|
||||||
|
- 根据源启用状态生成支持音质表
|
||||||
|
|
||||||
|
#### \# 2023-12-31 v1.0.2-b0.8.2 (dev)
|
||||||
- 注:本次还是累积更新,不单独发布Release
|
- 注:本次还是累积更新,不单独发布Release
|
||||||
+ 从Python版移植部分代码
|
+ 从Python版移植部分代码
|
||||||
+ (兼容tx源一分钟试听链接获取)
|
+ (兼容tx源一分钟试听链接获取)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user