mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-11 07:46:37 +08:00
fix(subscription): prevent duplicate qb downloads
This commit is contained in:
@@ -3,6 +3,7 @@ package service
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ShukeBta/MediaStationGo/internal/model"
|
||||
@@ -101,6 +102,23 @@ func TestSiteSearchKeywordCanUseIMDB(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStableSiteSearchGUIDIgnoresPrivateTokenChanges(t *testing.T) {
|
||||
item := SearchResult{
|
||||
SiteID: "mteam",
|
||||
Title: "Some Show S01E01 1080p",
|
||||
Category: "TV",
|
||||
Size: 1024,
|
||||
}
|
||||
first := stableSiteSearchGUID(item, "https://pt.example/download?id=123&passkey=old")
|
||||
second := stableSiteSearchGUID(item, "https://pt.example/download?id=123&passkey=new")
|
||||
if first != second {
|
||||
t.Fatalf("stableSiteSearchGUID changed with token: %q != %q", first, second)
|
||||
}
|
||||
if strings.Contains(first, "passkey") || strings.Contains(first, "old") || strings.Contains(first, "new") {
|
||||
t.Fatalf("stableSiteSearchGUID leaked private token: %q", first)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSelectSiteSearchCandidatesOnlyQueuesMissingLocalEpisodes(t *testing.T) {
|
||||
sub := &model.Subscription{Name: "间谍过家家 自动订阅", Filter: "间谍过家家", MediaType: "tv", TotalEpisodes: 3}
|
||||
results := []SearchResult{
|
||||
|
||||
Reference in New Issue
Block a user