This commit is contained in:
Simple-Tracker 2024-04-13 18:43:40 +08:00
parent 6901e015a7
commit 650a359942
4 changed files with 9 additions and 12 deletions

View File

@ -67,8 +67,7 @@ func Tr_SetURL() bool {
return false
}
func Tr_DetectVersion() bool {
getStruct := Tr_GetStruct { Field: []string { "version" } }
detectJSON, err := json.Marshal(Tr_RequestStruct { Method: "session-get", Args: getStruct })
detectJSON, err := json.Marshal(Tr_RequestStruct { Method: "session-get", Args: Tr_GetStruct { Field: []string { "version" } } })
if err != nil {
Log("DetectVersion", GetLangText("Error-GenJSON"), true, err.Error())
return false
@ -99,8 +98,7 @@ func Tr_SetCSRFToken(csrfToken string) {
Log("SetCSRFToken", GetLangText("Success-SetCSRFToken"), true, csrfToken)
}
func Tr_FetchTorrents() *Tr_TorrentsStruct {
getStruct := Tr_GetStruct { Field: []string { "hashString", "totalSize", "isPrivate", "peers" } }
loginJSON, err := json.Marshal(Tr_RequestStruct { Method: "torrent-get", Args: getStruct })
loginJSON, err := json.Marshal(Tr_RequestStruct { Method: "torrent-get", Args: Tr_GetStruct { Field: []string { "hashString", "totalSize", "isPrivate", "peers" } } })
if err != nil {
Log("FetchTorrents", GetLangText("Error-GenJSON"), true, err.Error())
return nil
@ -178,8 +176,7 @@ func Tr_SubmitBlockPeer(blockPeerMap map[string]BlockPeerInfoStruct) bool {
}
blocklistURL += "/ipfilter.dat?t=" + strconv.FormatInt(currentTimestamp, 10)
sessionSetStruct := Tr_SessionSetStruct { BlocklistEnabled: true, BlocklistSize: ipfilterCount, BlocklistURL: blocklistURL }
sessionSetJSON, err := json.Marshal(Tr_RequestStruct { Method: "session-set", Args: sessionSetStruct })
sessionSetJSON, err := json.Marshal(Tr_RequestStruct { Method: "session-set", Args: Tr_SessionSetStruct { BlocklistEnabled: true, BlocklistSize: ipfilterCount, BlocklistURL: blocklistURL } })
if err != nil {
Log("SubmitBlockPeer", GetLangText("Error-GenJSON"), true, err.Error())
return false

View File

@ -167,11 +167,11 @@ func CheckUpdate() {
Log("CheckUpdate", GetLangText("CheckUpdate-ShowVersion"), true, currentVersion, latestReleaseStruct.TagName, latestPreReleaseStruct.TagName)
if hasNewReleaseVersion {
Log("CheckUpdate", GetLangText("CheckUpdate-DetectNewVersion"), true, latestReleaseStruct.TagName, strings.Replace(latestReleaseStruct.Body, "\r", "", -1))
Log("CheckUpdate", GetLangText("CheckUpdate-DetectNewVersion"), true, latestReleaseStruct.TagName, ("https://github.com/Simple-Tracker/" + programName + "/releases/tag/" + latestReleaseStruct.TagName), strings.Replace(latestReleaseStruct.Body, "\r", "", -1))
}
if hasNewPreReleaseVersion {
Log("CheckUpdate", GetLangText("CheckUpdate-DetectNewBetaVersion"), true, latestPreReleaseStruct.TagName, strings.Replace(latestPreReleaseStruct.Body, "\r", "", -1))
Log("CheckUpdate", GetLangText("CheckUpdate-DetectNewBetaVersion"), true, latestPreReleaseStruct.TagName, ("https://github.com/Simple-Tracker/" + programName + "/releases/tag/" + latestPreReleaseStruct.TagName), strings.Replace(latestPreReleaseStruct.Body, "\r", "", -1))
}
}
func Task() {

View File

@ -24,8 +24,8 @@ var defaultLangContent = map[string]string {
"GetConfig_UseConfig": "使用客户端配置文件: %s",
"LoadLog_HotReload": "发现日志目录更改, 正在进行热重载 (%s)",
"CheckUpdate-ShowVersion": "当前版本: %s, 最新版本: %s, 最新版本 (Beta): %s",
"CheckUpdate-DetectNewVersion": "检测到新的版本: %s, 更新内容如下: \n%s",
"CheckUpdate-DetectNewBetaVersion": "检测到新的版本 (Beta): %s, 更新内容如下: \n%s",
"CheckUpdate-DetectNewVersion": "检测到新的版本: %s, 可访问 %s 以进行更新, 更新内容如下: \n%s",
"CheckUpdate-DetectNewBetaVersion": "检测到新的版本 (Beta): %s, 可访问 %s 以进行更新, 更新内容如下: \n%s",
"CheckUpdate-Ignore_UnknownVersion": "跳过自动检查更新: 未知版本",
"CheckUpdate-Ignore_NightlyVersion": "跳过自动检查更新: 夜间构建版本",
"CheckUpdate-Ignore_BadVersion": "跳过自动检查更新: 错误版本 %s",

View File

@ -14,8 +14,8 @@
"GetConfig_UseConfig": "Use client config: %s",
"LoadLog_HotReload": "Log directory change found, hot reload in progress (%s)",
"CheckUpdate-ShowVersion": "Current version: %s, Latest version: %s, Latest version (Beta): %s",
"CheckUpdate-DetectNewVersion": "Detected new version: %s, as below: \n%s",
"CheckUpdate-DetectNewBetaVersion": "Detected new version (Beta): %s, as below: \n%s",
"CheckUpdate-DetectNewVersion": "Detected new version: %s, you can update it by visit %s, update content are below: \n%s",
"CheckUpdate-DetectNewBetaVersion": "Detected new version (Beta): %s, you can update it by visit %s, update content are below: \n%s",
"CheckUpdate-Ignore_UnknownVersion": "Skip auto check update: Unknwon version",
"CheckUpdate-Ignore_NightlyVersion": "Skip auto check update: Nightly version",
"CheckUpdate-Ignore_BadVersion": "Skip auto check update: Error version %s",