TODO: 重构inject.js.

This commit is contained in:
eson 2020-11-23 19:40:28 +08:00
parent ff18ad3fcd
commit be862559bc
3 changed files with 4 additions and 4 deletions

View File

@ -200,7 +200,7 @@ func (cli *Client) open(label *Label, urlstr string) (bodyRes string, ok bool) {
func() { func() {
label.conditionlock.Lock() label.conditionlock.Lock()
defer label.conditionlock.Unlock() defer label.conditionlock.Unlock()
data["content_script"] = []string{label.conditionJS} data["content_condition"] = []string{label.conditionJS}
}() }()
resp, err := http.DefaultClient.PostForm(cli.chromeProxyAddr+"/task/put", data) resp, err := http.DefaultClient.PostForm(cli.chromeProxyAddr+"/task/put", data)

View File

@ -17,8 +17,8 @@ func TestPort(t *testing.T) {
cli.Connect() cli.Connect()
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser")) log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser"))
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/yanngu?lang=en&deviceType=browser")) log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/yanngu?lang=en&deviceType=browser"))
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser")) // log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser"))
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/yanngu?lang=en&deviceType=browser")) // log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/yanngu?lang=en&deviceType=browser"))
http.ListenAndServe(":42311", nil) http.ListenAndServe(":42311", nil)
} }

View File

@ -2,5 +2,5 @@
function condition() { function condition() {
var href = window.location.href; var href = window.location.href;
var content = document.documentElement.innerHTML; var content = document.documentElement.innerHTML;
return href.startsWith("https://playerduo.com") && content.startsWith('<head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">') return href.startsWith("https://playerduo.com") && content.startsWith('<ad></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">')
} }