Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-10-13 16:03:14 +08:00
commit aa094e549d
3 changed files with 17 additions and 4 deletions

View file

@ -791,10 +791,15 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
text := textBuf.String()
text = strings.ToLower(text)
text = luteEngine.Space(text)
var contain bool
for _, mentionKeyword := range mentionKeywords {
parts := strings.Split(text, " ")
for _, part := range parts {
if "" == part {
continue
}
if gulu.Str.IsASCII(mentionKeyword) {
if part == mentionKeyword {
contain = true

View file

@ -649,8 +649,14 @@ func markReplaceSpan(text string, keywords []string, replacementStart, replaceme
for _, k := range keywords {
if gulu.Str.IsASCII(k) {
if part == k {
parts[i] = replacementStart + k + replacementEnd
if gulu.Str.IsASCII(part) {
if part == k {
parts[i] = replacementStart + k + replacementEnd
}
} else {
if strings.Contains(part, k) {
parts[i] = strings.ReplaceAll(part, k, replacementStart+k+replacementEnd)
}
}
} else {
if strings.Contains(part, k) {

View file

@ -156,8 +156,10 @@ func downloadInstallPkg(pkgURL, checksum string) {
logging.LogInfof("downloading install package [%s]", pkgURL)
msgId := util.PushMsg(Conf.Language(103), 60*1000*10)
client := req.C().SetTLSHandshakeTimeout(7 * time.Second).SetTimeout(10 * time.Minute)
err = client.NewParallelDownload(pkgURL).SetConcurrency(8).SetSegmentSize(1024 * 1024 * 2).
SetOutputFile(savePath).Do()
callback := func(info req.DownloadInfo) {
//logging.LogDebugf("downloading install package [%s %.2f%%]", pkgURL, float64(info.DownloadedSize)/float64(info.Response.ContentLength)*100.0)
}
_, err = client.R().SetOutputFile(savePath).SetDownloadCallback(callback).Get(pkgURL)
if nil != err {
logging.LogErrorf("download install package failed: %s", err)
util.PushUpdateMsg(msgId, Conf.Language(104), 7000)