1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 13:19:02 +08:00

fix: auto migrate download link

This commit is contained in:
zu1k 2023-02-04 10:39:09 +08:00
parent e196c6834f
commit 25b0af0632
2 changed files with 5 additions and 13 deletions

View File

@ -1,6 +1,6 @@
package migration
func init() {
migration2v4()
migration2v6()
migration2v7()
}

View File

@ -6,11 +6,10 @@ import (
"github.com/spf13/viper"
"github.com/zu1k/nali/internal/constant"
"github.com/zu1k/nali/internal/db"
"github.com/zu1k/nali/pkg/cdn"
"github.com/zu1k/nali/pkg/ip2region"
"github.com/zu1k/nali/pkg/qqwry"
)
func migration2v4() {
func migration2v7() {
viper.SetConfigName("config")
viper.SetConfigType("yaml")
viper.AddConfigPath(constant.ConfigDirPath)
@ -28,16 +27,9 @@ func migration2v4() {
needOverwrite := false
for _, adb := range dbList {
if adb.Name == "ip2region" && adb.File != "ip2region.xdb" {
if adb.Name == "qqwry" && len(adb.DownloadUrls) == 1 && adb.DownloadUrls[0] == "https://99wry.cf/qqwry.dat" {
needOverwrite = true
adb.File = "ip2region.xdb"
adb.DownloadUrls = ip2region.DownloadUrls
}
if adb.Name == "cdn" && adb.Format != "cdn-yml" {
needOverwrite = true
adb.Format = "cdn-yml"
adb.DownloadUrls = cdn.DownloadUrls
adb.DownloadUrls = qqwry.DownloadUrls
}
}