mirror of
https://github.com/ZxwyWebSite/lx-source.git
synced 2025-05-23 21:37:42 +08:00
2024-06-22 v1.0.3.0622
This commit is contained in:
parent
3437281f73
commit
9155f34105
56
.github/workflows/action.yml
vendored
56
.github/workflows/action.yml
vendored
@ -49,3 +49,59 @@ jobs:
|
||||
with:
|
||||
name: lx-source-bin_${{ env.SHA }}
|
||||
path: ./dist
|
||||
|
||||
- name: Generate Changelog
|
||||
run: cd repo && echo PACKAGE_VERSION=`go run release.go` >> $GITHUB_ENV && mv changelog.md ../
|
||||
|
||||
- name: Create git tag
|
||||
uses: pkgdeps/git-tag-action@v3
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
github_repo: ${{ github.repository }}
|
||||
version: ${{ env.PACKAGE_VERSION }}
|
||||
git_commit_sha: ${{ github.sha }}
|
||||
git_tag_prefix: "v"
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
body_path: ./changelog.md
|
||||
prerelease: false
|
||||
draft: false
|
||||
tag_name: v${{ env.PACKAGE_VERSION }}
|
||||
files: |
|
||||
./dist/lx-source-android-386.zip
|
||||
./dist/lx-source-android-amd64.zip
|
||||
./dist/lx-source-android-arm.zip
|
||||
./dist/lx-source-android-arm64.zip
|
||||
./dist/lx-source-darwin-amd64v2-go1.20.14.zip
|
||||
./dist/lx-source-darwin-amd64v3-go1.20.14.zip
|
||||
./dist/lx-source-darwin-arm64-go1.20.14.zip
|
||||
./dist/lx-source-linux-amd64v1.zip
|
||||
./dist/lx-source-linux-amd64v2.zip
|
||||
./dist/lx-source-linux-amd64v3.zip
|
||||
./dist/lx-source-linux-amd64v4.zip
|
||||
./dist/lx-source-linux-arm5.zip
|
||||
./dist/lx-source-linux-arm5-go1.20.14.zip
|
||||
./dist/lx-source-linux-arm6.zip
|
||||
./dist/lx-source-linux-arm6-go1.20.14.zip
|
||||
./dist/lx-source-linux-arm64.zip
|
||||
./dist/lx-source-linux-arm64-go1.20.14.zip
|
||||
./dist/lx-source-linux-arm7.zip
|
||||
./dist/lx-source-linux-arm7-go1.20.14.zip
|
||||
./dist/lx-source-linux-mips64hardfloat-go1.20.14.zip
|
||||
./dist/lx-source-linux-mips64lehardfloat-go1.20.14.zip
|
||||
./dist/lx-source-linux-mips64lesoftfloat-go1.20.14.zip
|
||||
./dist/lx-source-linux-mips64softfloat-go1.20.14.zip
|
||||
./dist/lx-source-linux-mipshardfloat-go1.20.14.zip
|
||||
./dist/lx-source-linux-mipslehardfloat-go1.20.14.zip
|
||||
./dist/lx-source-linux-mipslesoftfloat-go1.20.14.zip
|
||||
./dist/lx-source-linux-mipssoftfloat-go1.20.14.zip
|
||||
./dist/lx-source-windows-amd64v1-go1.20.14.zip
|
||||
./dist/lx-source-windows-amd64v2-go1.20.14.zip
|
||||
./dist/lx-source-windows-amd64v2.zip
|
||||
./dist/lx-source-windows-amd64v3-go1.20.14.zip
|
||||
./dist/lx-source-windows-amd64v3.zip
|
||||
./dist/lx-source-windows-amd64v4.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
32
action.go
32
action.go
@ -242,7 +242,7 @@ func main() {
|
||||
home(`go/bin/go1.20.14`): {
|
||||
Args: []string{
|
||||
`-trimpath`, `-buildvcs=false`,
|
||||
`-ldflags`, `-s -w`,
|
||||
`-ldflags`, `-s -w -extldflags '-v -static'`,
|
||||
},
|
||||
GoOS: list_goos{
|
||||
`windows`: {
|
||||
@ -269,6 +269,36 @@ func main() {
|
||||
},
|
||||
`linux`: {
|
||||
Arch: list_arch{
|
||||
`arm`: {
|
||||
Cgos: &list_cgos{
|
||||
AR: `arm-linux-gnueabihf-gcc-ar`,
|
||||
CC: `arm-linux-gnueabihf-gcc`,
|
||||
CXX: `arm-linux-gnueabihf-cpp`,
|
||||
},
|
||||
Vers: list_vers{
|
||||
`5`: {
|
||||
Tags: `go_json`,
|
||||
},
|
||||
`6`: {
|
||||
Tags: `go_json`,
|
||||
},
|
||||
`7`: {
|
||||
Tags: `go_json`,
|
||||
},
|
||||
},
|
||||
},
|
||||
`arm64`: {
|
||||
Cgos: &list_cgos{
|
||||
AR: `aarch64-linux-gnu-gcc-ar`,
|
||||
CC: `aarch64-linux-gnu-gcc`,
|
||||
CXX: `aarch64-linux-gnu-cpp`,
|
||||
},
|
||||
Vers: list_vers{
|
||||
``: {
|
||||
Tags: `go_json`,
|
||||
},
|
||||
},
|
||||
},
|
||||
// 针对部分OpenWrt路由器系统 暂不支持开启CGO
|
||||
`mips`: {
|
||||
Vers: list_vers{
|
||||
|
2
go.mod
2
go.mod
@ -47,5 +47,5 @@ require (
|
||||
|
||||
replace (
|
||||
github.com/ZxwyWebSite/cr-go-sdk v0.0.2 => ../cr-go-sdk
|
||||
github.com/ZxwyWebSite/ztool v0.0.1 => ./pkg/ztool // ../ztool
|
||||
github.com/ZxwyWebSite/ztool v0.0.1 => ../ztool // ./pkg/ztool
|
||||
)
|
||||
|
107
release.go
Normal file
107
release.go
Normal file
@ -0,0 +1,107 @@
|
||||
//go:build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 获取版本号
|
||||
func version() string {
|
||||
fenv, _ := os.Open(`src/env/env.go`)
|
||||
benv := bufio.NewReader(fenv)
|
||||
var ever string
|
||||
for {
|
||||
line, _, _ := benv.ReadLine()
|
||||
length := len(line)
|
||||
if length == 0 {
|
||||
continue
|
||||
}
|
||||
sline := string(line)
|
||||
if strings.HasPrefix(sline, ` Version`) {
|
||||
ever = `v` + sline[12:length-1]
|
||||
break
|
||||
}
|
||||
}
|
||||
fenv.Close()
|
||||
if ever == `` {
|
||||
panic(`No Version`)
|
||||
} else {
|
||||
return ever
|
||||
}
|
||||
}
|
||||
|
||||
// 生成更新日志
|
||||
func changelog(ever string) string {
|
||||
fupd, _ := os.Open(`update.md`)
|
||||
bupd := bufio.NewReader(fupd)
|
||||
var eupd strings.Builder
|
||||
eupd.WriteString(`### 更新内容:`)
|
||||
eupd.WriteByte('\n')
|
||||
for {
|
||||
line, _, _ := bupd.ReadLine()
|
||||
length := len(line)
|
||||
if length == 0 {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(string(line), ever) {
|
||||
for {
|
||||
lline, _, _ := bupd.ReadLine()
|
||||
length := len(lline)
|
||||
if length == 0 {
|
||||
break
|
||||
}
|
||||
eupd.WriteString(string(lline))
|
||||
eupd.WriteByte('\n')
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
fupd.Close()
|
||||
eupd.WriteByte('\n')
|
||||
eupd.WriteString(`### CDN加速下载:`)
|
||||
eupd.WriteByte('\n')
|
||||
for _, v := range []string{
|
||||
`lx-source-android-arm.zip`,
|
||||
`lx-source-android-arm64.zip`,
|
||||
`lx-source-linux-amd64v2.zip`,
|
||||
`lx-source-linux-amd64v3.zip`,
|
||||
`lx-source-linux-arm7.zip`,
|
||||
`lx-source-linux-arm64.zip`,
|
||||
`lx-source-windows-amd64v2.zip`,
|
||||
`lx-source-windows-amd64v2-go1.20.14.zip`,
|
||||
`lx-source-windows-amd64v3.zip`,
|
||||
} {
|
||||
eupd.WriteByte('+')
|
||||
eupd.WriteByte(' ')
|
||||
|
||||
eupd.WriteByte('[')
|
||||
eupd.WriteString(v)
|
||||
eupd.WriteByte(']')
|
||||
eupd.WriteByte('(')
|
||||
eupd.WriteString(`https://r2eu.zxwy.link/gh/lx-source/`)
|
||||
eupd.WriteString(ever)
|
||||
eupd.WriteByte('/')
|
||||
eupd.WriteString(v)
|
||||
eupd.WriteByte(')')
|
||||
|
||||
eupd.WriteByte('\n')
|
||||
}
|
||||
return eupd.String()
|
||||
}
|
||||
|
||||
func main() {
|
||||
ever := version()
|
||||
fmt.Println(ever)
|
||||
|
||||
eupd := changelog(ever)
|
||||
file, err := os.Create(`changelog.md`)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
file.WriteString(eupd)
|
||||
file.Close()
|
||||
}
|
32
src/env/env.go
vendored
32
src/env/env.go
vendored
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Version = `1.0.3.0614`
|
||||
Version = `1.0.3.0622`
|
||||
)
|
||||
|
||||
var (
|
||||
@ -159,12 +159,22 @@ type (
|
||||
// Lx_Enable bool `comment:"是否启用小洛源"`
|
||||
}
|
||||
// 脚本
|
||||
Conf_Script struct {
|
||||
Conf_Script_Update struct {
|
||||
Ver string `comment:"自定义脚本版本" json:"ver"`
|
||||
Log string `comment:"更新日志" json:"log"`
|
||||
Url string `comment:"脚本下载地址 (public目录内文件名)" json:"url"`
|
||||
Force bool `comment:"强制推送更新" json:"force"`
|
||||
Auto int `comment:"自动填写配置(beta) 0: 关闭, 1: 仅api地址, 2: 包含密钥" json:"-"`
|
||||
}
|
||||
Conf_Script struct {
|
||||
Name string `comment:"源的名字,建议不要过长,24个字符以内"`
|
||||
Descript string `comment:"源的描述,建议不要过长,36个字符以内,可不填"`
|
||||
Version string `comment:"源的版本号,可不填"`
|
||||
Author string `comment:"脚本作者名字,可不填"`
|
||||
Homepage string `comment:"脚本主页,可不填"`
|
||||
|
||||
Update Conf_Script_Update `ini:"Script"`
|
||||
|
||||
Auto int `comment:"自动填写配置(beta) 0: 关闭, 1: 仅api地址, 2: 包含密钥"`
|
||||
}
|
||||
// 缓存
|
||||
Conf_Cache struct {
|
||||
@ -266,12 +276,20 @@ var (
|
||||
Tx_Refresh_Interval: 86000,
|
||||
},
|
||||
Script: Conf_Script{
|
||||
Log: `发布更新 (请删除旧源后重新导入):进行了部分优化,修复了部分Bug`, // 更新日志
|
||||
Name: `Lx-Source-Script`,
|
||||
Descript: `洛雪音乐自定义源脚本`,
|
||||
Version: `1.1.0`,
|
||||
Author: `Zxwy`,
|
||||
Homepage: `https://github.com/ZxwyWebSite/lx-script`,
|
||||
|
||||
Ver: `1.0.3`, // 自定义脚本版本
|
||||
Force: true, // 强制推送更新
|
||||
Update: Conf_Script_Update{
|
||||
Log: `发布更新 (请删除旧源后重新导入):进行了部分优化,修复了部分Bug`, // 更新日志
|
||||
|
||||
Url: `lx-custom-source.js`, // 脚本下载地址
|
||||
Ver: `1.0.3`, // 自定义脚本版本
|
||||
Force: true, // 强制推送更新
|
||||
|
||||
Url: `lx-custom-source.js`, // 脚本下载地址
|
||||
},
|
||||
},
|
||||
Cache: Conf_Cache{
|
||||
Mode: `local`, // 缓存模式
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"lx-source/src/env"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
"github.com/ZxwyWebSite/ztool/x/bytesconv"
|
||||
@ -106,6 +107,63 @@ func loadPublic(r *gin.Engine) {
|
||||
} else {
|
||||
r.StaticFileFS(`/lx-custom-source.js`, `lx-custom-source.js`, httpFS)
|
||||
}
|
||||
// 新版源脚本
|
||||
{
|
||||
// 构建文件头
|
||||
var b strings.Builder
|
||||
b.Grow(75 +
|
||||
len(env.Config.Script.Name) +
|
||||
len(env.Config.Script.Descript) +
|
||||
len(env.Config.Script.Version) +
|
||||
len(env.Config.Script.Author) +
|
||||
len(env.Config.Script.Homepage),
|
||||
)
|
||||
b.WriteString("/*!\n * @name ")
|
||||
b.WriteString(env.Config.Script.Name)
|
||||
b.WriteString("\n * @description ")
|
||||
b.WriteString(env.Config.Script.Descript)
|
||||
b.WriteString("\n * @version v")
|
||||
b.WriteString(env.Config.Script.Version)
|
||||
b.WriteString("\n * @author ")
|
||||
b.WriteString(env.Config.Script.Author)
|
||||
b.WriteString("\n * @homepage ")
|
||||
b.WriteString(env.Config.Script.Homepage)
|
||||
b.WriteString("\n */\n")
|
||||
// 构建文件体
|
||||
file, _ := publicFS.Open(`lx-source-script.js`)
|
||||
data, _ := io.ReadAll(file)
|
||||
file.Close()
|
||||
r.GET(`/lx-source-script.js`, func(c *gin.Context) {
|
||||
var mime string
|
||||
if _, ok := c.GetQuery(`raw`); ok {
|
||||
mime = `application/octet-stream`
|
||||
} else {
|
||||
mime = `text/javascript; charset=utf-8`
|
||||
}
|
||||
// 构建文件尾
|
||||
var d strings.Builder
|
||||
d.WriteString(`globalThis.ls={api:{addr:'`)
|
||||
d.WriteString(env.Config.Cache.Local_Bind)
|
||||
d.WriteString(`',pass:'`)
|
||||
if env.Config.Auth.ApiKey_Enable {
|
||||
if env.Config.Script.Auto >= 2 {
|
||||
d.WriteString(env.Config.Auth.ApiKey_Value)
|
||||
} else {
|
||||
if key, ok := c.GetQuery(`key`); ok {
|
||||
d.WriteString(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
d.WriteString(`'}};`)
|
||||
d.WriteByte('\n')
|
||||
// Render
|
||||
c.Status(http.StatusOK)
|
||||
c.Writer.Header()[`Content-Type`] = []string{mime}
|
||||
c.Writer.WriteString(b.String())
|
||||
c.Writer.WriteString(d.String())
|
||||
c.Writer.Write(data)
|
||||
})
|
||||
}
|
||||
r.StaticFileFS(`/favicon.ico`, `lx-icon.ico`, httpFS)
|
||||
r.StaticFileFS(`/status`, `status.html`, httpFS)
|
||||
r.StaticFS(`/public`, httpFS)
|
||||
|
2
src/server/public/lx-source-script.js
Normal file
2
src/server/public/lx-source-script.js
Normal file
File diff suppressed because one or more lines are too long
@ -50,7 +50,7 @@ func InitRouter() *gin.Engine {
|
||||
sources.S_lx: qmap[sources.I_lx],
|
||||
},
|
||||
// 自定义源脚本更新
|
||||
`script`: env.DefCfg.Script, //env.Config.Script,
|
||||
`script`: env.Config.Script.Update, //env.Config.Script,
|
||||
// 数据统计
|
||||
`summary`: gin.H{
|
||||
`StartAt`: startime, // 启动时间
|
||||
|
@ -3,6 +3,12 @@
|
||||
<!-- #### \# 2024-02-14 v1.0.3-rel (release)
|
||||
+ **停止更新:感谢这三个月的陪伴,现因无力维护,停止后续更新,发布最后版本,大家有缘再见** -->
|
||||
|
||||
#### \# 2024-06-22 v1.0.3.0622 (dev)
|
||||
+ 临近期末,暂缓更新,计划假期重构服务端v1.1.0
|
||||
+ 更新源脚本,使用 WebPack 构建,支持自定义更多参数
|
||||
+ 体验地址 `/lx-source-script.js`,添加 `?key=请求密钥`
|
||||
+ 更新编译脚本,支持MuslLibC、静态构建,支持自动发布Release
|
||||
|
||||
#### \# 2024-06-14 v1.0.3.0614 (dev)
|
||||
+ 更新编译脚本,支持更多架构
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user