package reader import ( "strings" "testing" ) // 图片解密(coverDecodeJs / ruleContent.imageDecode)与 HLS 判定链路。 // 正文图片解密:书源规则把字节异或 0x55 后返回,服务端解密应还原原文。 func TestDecodeImageBytesRunsRuleJS(t *testing.T) { svc, srv, book := prepareCacheTestBook(t) ctx := t.Context() // 动态给书源加上 imageDecode 规则:XOR 0x55 还原。 raw := strings.Replace( cacheTestSourceJSON(srv.URL), `"ruleContent": {"content": "id.content@textNodes"}`, `"ruleContent": {"content": "id.content@textNodes", "imageDecode": "var src = new Uint8Array(result); var out = new Uint8Array(src.length); for (var i=0;i