Skip to content

Commit 076efff

Browse files
committed
[release] 5.4.8
1 parent ecd9db5 commit 076efff

File tree

13 files changed

+374
-347
lines changed

13 files changed

+374
-347
lines changed

app/src/main/assets/extension_test.js

Lines changed: 220 additions & 330 deletions
Large diffs are not rendered by default.

app/src/main/assets/update_log.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
- 2025/08/03 5.4.7
2+
修复 历史记录丢失问题
3+
修复 添加 js 源时崩溃问题
4+
5+
16
- 2024/11/10 5.4.6 紧急修复
27
新增 js 番剧源加载和添加功能(调试套件下版本添加)
38
修复 录制视频 Bug

app/src/main/java/com/heyanle/easybangumi4/plugin/extension/push/PushFromRepo.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ class PushFromRepo(
6262
// 2. 解析 jsonl
6363
val taskList = repoJsonlFile.bufferedReader().use {
6464
it.readLines().map {
65-
JSONObject(it)
65+
runCatching {
66+
JSONObject(it)
67+
}.getOrNull()
6668
}.mapNotNull {
67-
val url = it.optString("url")
68-
val key = it.optString("key")
69-
if (url.isEmpty() || key.isEmpty()) {
69+
val url = it?.optString("url")
70+
val key = it?.optString("key")
71+
if (url?.isEmpty() != false || key?.isEmpty() != false) {
7072
return@mapNotNull null
7173
}
7274
key to url

app/src/main/java/com/heyanle/easybangumi4/plugin/js/component/JSPageComponent.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ class JSPageComponent(
190190
if (data.isNotEmpty() && data.first() !is CartoonCover) {
191191
throw ParserException("js parse error")
192192
}
193-
return@requestRunWithScope nextKey to data.filterIsInstance<CartoonCover>()
193+
return@requestRunWithScope nextKey to data.filterIsInstance<CartoonCover>().apply {
194+
this.forEach {
195+
// it.coverUrl.logi("JsPageComponent")
196+
}
197+
}
194198
}
195199
}.apply {
196200
this.logi("JSPageComponent")

app/src/main/java/com/heyanle/easybangumi4/plugin/js/source/JSComponentBundle.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,26 @@ class JSComponentBundle(
6767

6868

6969
jsSource.jsScope.runWithScope { context, scriptable ->
70-
// 2. import
71-
context.evaluateString(
72-
scriptable,
73-
JsSource.JS_IMPORT,
74-
"import",
75-
1,
76-
null
77-
)
7870

79-
// 3. 注入工具给 JS
71+
72+
73+
// 2. 注入工具给 JS
8074
bundle.forEach { (k, v) ->
8175
val simpleName = k.simpleName ?: return@forEach
8276
val name = "Inject_${simpleName}"
8377
name.logi("JsImport")
8478
scriptable.put(name, scriptable, v)
8579
}
8680

81+
// 3. import
82+
context.evaluateString(
83+
scriptable,
84+
JsSource.JS_IMPORT,
85+
"import",
86+
1,
87+
null
88+
)
89+
8790
// 4. 加载插件源代码
8891
if (jsFile == null) {
8992
context.evaluateString(

app/src/main/java/com/heyanle/easybangumi4/plugin/js/source/JsSource.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ class JsSource(
4141
importPackage(Packages.java.net);
4242
4343
importPackage(Packages.org.jsoup);
44+
importPackage(Packages.org.json);
4445
importPackage(Packages.okhttp3);
4546
47+
4648
4749
var Log = JSLogUtils;
50+
var SourceUtils = JSSourceUtils;
51+
var source = Inject_Source;
4852
4953
5054
function makeCartoonCover(map) {

app/src/main/java/com/heyanle/easybangumi4/plugin/js/utils/JSSourceUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import com.heyanle.easybangumi4.source_api.utils.core.SourceUtils;
55

6+
import org.jsoup.Jsoup;
7+
68
import kotlin.text.Regex;
79

810
/**
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.heyanle.easybangumi4.plugin.js.utils
2+
3+
import com.heyanle.easybangumi4.source_api.utils.core.network.GET
4+
import com.heyanle.easybangumi4.source_api.utils.core.network.POST
5+
import okhttp3.FormBody
6+
import okhttp3.Headers
7+
import okhttp3.Request
8+
import org.jsoup.Jsoup
9+
10+
/**
11+
* Created by heyanle on 2025/8/3
12+
* https://github.com/heyanLE
13+
*/
14+
object OkhttpRequestKtWrapper {
15+
fun get(url: String): Request {
16+
return GET(url)
17+
}
18+
19+
fun get(url: String, headerMap: Map<String, String>): Request {
20+
val hb = Headers.Builder()
21+
headerMap.forEach { (key, value) ->
22+
hb.add(key, value)
23+
}
24+
return GET(url, hb.build())
25+
}
26+
27+
fun post(url: String): Request {
28+
return POST(url)
29+
}
30+
31+
fun postFormBody(
32+
url: String,
33+
formBody: Map<String, Any> = emptyMap(),
34+
headerMap: Map<String, Any> = emptyMap()
35+
): Request {
36+
val hb = Headers.Builder()
37+
headerMap.forEach { (key, value) ->
38+
hb.add(key, value.toString())
39+
}
40+
val fb = FormBody.Builder()
41+
formBody.forEach { (key, value) ->
42+
fb.add(key, value.toString())
43+
}
44+
45+
46+
return POST(
47+
url,
48+
hb.build(),
49+
fb.build()
50+
)
51+
}
52+
53+
54+
fun postFormBody(
55+
url: String,
56+
formBody: Map<String, Any> = emptyMap(),
57+
): Request {
58+
59+
val fb = FormBody.Builder()
60+
formBody.forEach { (key, value) ->
61+
fb.add(key, value.toString())
62+
}
63+
64+
65+
return POST(
66+
url,
67+
Headers.Builder().build(),
68+
fb.build()
69+
)
70+
}
71+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.heyanle.easybangumi4.plugin.js.utils;
2+
3+
import com.google.gson.JsonObject;
4+
import com.heyanle.easybangumi4.source_api.utils.core.network.RequestKt;
5+
6+
import org.json.JSONObject;
7+
import org.jsoup.Jsoup;
8+
9+
import java.util.Map;
10+
11+
import okhttp3.Request;
12+
13+
/**
14+
* Created by heyanle on 2025/8/3
15+
* https://github.com/heyanLE
16+
*/
17+
public class OkhttpUtils {
18+
19+
public static Request get(String url){
20+
return OkhttpRequestKtWrapper.INSTANCE.get(url);
21+
}
22+
23+
public static Request get(String url, Map<String, String> header){
24+
return OkhttpRequestKtWrapper.INSTANCE.get(url, header);
25+
}
26+
27+
public static Request post(String url){
28+
return OkhttpRequestKtWrapper.INSTANCE.post(url);
29+
}
30+
31+
public static Request postFromBody(String url, Map<String, Object> fromBody){
32+
return OkhttpRequestKtWrapper.INSTANCE.postFormBody(url, fromBody);
33+
}
34+
35+
36+
37+
38+
}

app/src/main/java/com/heyanle/easybangumi4/plugin/source/utils/network/OkhttpHelperImpl.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import com.heyanle.easybangumi4.plugin.source.utils.network.interceptor.UserAgen
1010
import com.heyanle.easybangumi4.source_api.utils.api.NetworkHelper
1111
import com.heyanle.easybangumi4.source_api.utils.api.OkhttpHelper
1212
import com.heyanle.easybangumi4.source_api.utils.api.WebViewHelper
13+
import com.heyanle.easybangumi4.source_api.utils.core.network.GET
1314
import okhttp3.Cache
1415
import okhttp3.OkHttpClient
1516
import okhttp3.logging.HttpLoggingInterceptor
17+
import org.jsoup.Jsoup
1618
import java.io.File
1719
import java.security.SecureRandom
1820
import java.security.cert.CertificateException
@@ -81,6 +83,9 @@ class OkhttpHelperImpl(
8183
override val cloudflareWebViewClient: OkHttpClient
8284
get() = _cloudflareWebViewClient
8385

86+
init {
87+
}
88+
8489
private fun createSSLSocketFactory(): SSLSocketFactory {
8590
return runCatching {
8691
SSLContext.getInstance("TLS").let {

0 commit comments

Comments
 (0)