From 0c1333fa15c2ec29ce963a16d5906b157f712237 Mon Sep 17 00:00:00 2001 From: Kelvin K Date: Wed, 18 Jun 2025 12:40:25 +0200 Subject: [PATCH 1/5] Downgrade v8, revert comments on diff thread --- app/build.gradle | 4 +-- .../com/futo/platformplayer/Extensions_V8.kt | 2 +- .../futo/platformplayer/engine/V8Plugin.kt | 33 ++++++++++++++++++- .../platformplayer/states/StatePlatform.kt | 2 +- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8c30e58d..278e8b0f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -179,8 +179,8 @@ dependencies { implementation 'com.google.code.gson:gson:2.10.1' //Used for complex/anonymous cases like during development conversions (eg. V8RemoteObject) //JS - //implementation("com.caoccao.javet:javet-android:3.0.2") - implementation 'com.caoccao.javet:javet-v8-android:4.1.4' + implementation("com.caoccao.javet:javet-android:3.0.2") + //implementation 'com.caoccao.javet:javet-v8-android:4.1.4' //Change after extensive testing the freezing edge cases are solved. //Exoplayer implementation 'androidx.media3:media3-exoplayer:1.2.1' diff --git a/app/src/main/java/com/futo/platformplayer/Extensions_V8.kt b/app/src/main/java/com/futo/platformplayer/Extensions_V8.kt index 7a43f078..aa51393f 100644 --- a/app/src/main/java/com/futo/platformplayer/Extensions_V8.kt +++ b/app/src/main/java/com/futo/platformplayer/Extensions_V8.kt @@ -118,7 +118,7 @@ inline fun V8Value.ensureIsBusy() { } inline fun V8Value.expectV8Variant(config: IV8PluginConfig, contextName: String): T { - if(true) + if(false) ensureIsBusy(); return when(T::class) { String::class -> this.expectOrThrow(config, contextName).value as T; diff --git a/app/src/main/java/com/futo/platformplayer/engine/V8Plugin.kt b/app/src/main/java/com/futo/platformplayer/engine/V8Plugin.kt index 170c2d56..0cb2f196 100644 --- a/app/src/main/java/com/futo/platformplayer/engine/V8Plugin.kt +++ b/app/src/main/java/com/futo/platformplayer/engine/V8Plugin.kt @@ -4,7 +4,6 @@ import android.content.Context import com.caoccao.javet.exceptions.JavetCompilationException import com.caoccao.javet.exceptions.JavetException import com.caoccao.javet.exceptions.JavetExecutionException -import com.caoccao.javet.interfaces.IJavetEntityError import com.caoccao.javet.interop.V8Host import com.caoccao.javet.interop.V8Runtime import com.caoccao.javet.values.V8Value @@ -321,6 +320,37 @@ class V8Plugin { throw ScriptCompilationException(config, "Compilation: [${context}]: ${scriptEx.message}\n(${scriptEx.scriptingError.lineNumber})[${scriptEx.scriptingError.startColumn}-${scriptEx.scriptingError.endColumn}]: ${scriptEx.scriptingError.sourceLine}", null, codeStripped); } catch(executeEx: JavetExecutionException) { + val obj = executeEx.scriptingError?.context + if(obj != null && obj.containsKey("plugin_type") == true) { + val pluginType = obj["plugin_type"].toString(); + + //Captcha + if (pluginType == "CaptchaRequiredException") { + throw ScriptCaptchaRequiredException(config, + obj["url"]?.toString(), + obj["body"]?.toString(), + executeEx, executeEx.scriptingError?.stack, codeStripped); + } + + //Reload Required + if (pluginType == "ReloadRequiredException") { + throw ScriptReloadRequiredException(config, + obj["msg"]?.toString(), + obj["reloadData"]?.toString(), + executeEx, executeEx.scriptingError?.stack, codeStripped); + } + + //Others + throwExceptionFromV8( + config, + pluginType, + (extractJSExceptionMessage(executeEx) ?: ""), + executeEx, + executeEx.scriptingError?.stack, + codeStripped + ); + } + /* //Required for newer V8 versions if(executeEx.scriptingError?.context is IJavetEntityError) { val obj = executeEx.scriptingError?.context as IJavetEntityError if(obj.context.containsKey("plugin_type") == true) { @@ -354,6 +384,7 @@ class V8Plugin { } } + */ throw ScriptExecutionException(config, extractJSExceptionMessage(executeEx) ?: "", null, executeEx.scriptingError?.stack, codeStripped); } catch(ex: Exception) { diff --git a/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt b/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt index 9376644f..1f1e5625 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt @@ -958,7 +958,7 @@ class StatePlatform { //Comments fun getComments(content: IPlatformContentDetails): IPager { val client = getContentClient(content.url); - val pager = null;//content.getComments(client); + val pager = content.getComments(client); return pager ?: getComments(content.url); } From 7922aa6f80d4ef4db9ec68e0a7d37c88e34f4dfc Mon Sep 17 00:00:00 2001 From: Kelvin K Date: Wed, 18 Jun 2025 12:41:21 +0200 Subject: [PATCH 2/5] Log on busy on main --- app/src/main/java/com/futo/platformplayer/Extensions_V8.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/Extensions_V8.kt b/app/src/main/java/com/futo/platformplayer/Extensions_V8.kt index aa51393f..240a6cfc 100644 --- a/app/src/main/java/com/futo/platformplayer/Extensions_V8.kt +++ b/app/src/main/java/com/futo/platformplayer/Extensions_V8.kt @@ -98,16 +98,14 @@ inline fun V8ValueArray.expectV8Variants(config: IV8PluginConfig, co inline fun V8Plugin.ensureIsBusy() { this.let { if (!it.isThreadAlreadyBusy()) { - throw IllegalStateException("Tried to access V8Plugin without busy"); - /* + //throw IllegalStateException("Tried to access V8Plugin without busy"); val stacktrace = Thread.currentThread().stackTrace; Logger.w("Extensions_V8", "V8 USE OUTSIDE BUSY: " + stacktrace.drop(3)?.firstOrNull().toString() + ", " + stacktrace.drop(4)?.firstOrNull().toString() + ", " + stacktrace.drop(5)?.firstOrNull()?.toString() + ", " + stacktrace.drop(6)?.firstOrNull()?.toString() - ) - */ + ); } } } From 11992af81bb0a1e811bb39c0e9ab5bed24c6b2de Mon Sep 17 00:00:00 2001 From: Kelvin K Date: Wed, 18 Jun 2025 14:27:20 +0200 Subject: [PATCH 3/5] Hide duration if unknown --- .../views/adapters/VideoListEditorViewHolder.kt | 8 +++++++- .../views/adapters/feedtypes/PreviewVideoView.kt | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/views/adapters/VideoListEditorViewHolder.kt b/app/src/main/java/com/futo/platformplayer/views/adapters/VideoListEditorViewHolder.kt index 42cef197..b059d2c9 100644 --- a/app/src/main/java/com/futo/platformplayer/views/adapters/VideoListEditorViewHolder.kt +++ b/app/src/main/java/com/futo/platformplayer/views/adapters/VideoListEditorViewHolder.kt @@ -95,7 +95,13 @@ class VideoListEditorViewHolder : ViewHolder { .into(_imageThumbnail); _textName.text = v.name; _textAuthor.text = v.author.name; - _textVideoDuration.text = v.duration.toHumanTime(false); + + if(v.duration > 0) { + _textVideoDuration.text = v.duration.toHumanTime(false); + _textVideoDuration.visibility = View.VISIBLE; + } + else + _textVideoDuration.visibility = View.GONE; val historyPosition = StateHistory.instance.getHistoryPosition(v.url) _timeBar.progress = historyPosition.toFloat() / v.duration.toFloat(); diff --git a/app/src/main/java/com/futo/platformplayer/views/adapters/feedtypes/PreviewVideoView.kt b/app/src/main/java/com/futo/platformplayer/views/adapters/feedtypes/PreviewVideoView.kt index bcabda4f..898b7e14 100644 --- a/app/src/main/java/com/futo/platformplayer/views/adapters/feedtypes/PreviewVideoView.kt +++ b/app/src/main/java/com/futo/platformplayer/views/adapters/feedtypes/PreviewVideoView.kt @@ -204,8 +204,14 @@ open class PreviewVideoView : LinearLayout { .into(_imageVideo); }; - if(!isPlanned) - _textVideoDuration.text = video.duration.toHumanTime(false); + if(!isPlanned) { + if(video.duration > 0) { + _textVideoDuration.text = video.duration.toHumanTime(false); + _textVideoDuration.visibility = View.VISIBLE; + } + else + _textVideoDuration.visibility = View.GONE; + } else _textVideoDuration.text = context.getString(R.string.planned); From e0e90c5f7462ff136e225af36caf2f0fbc14dd61 Mon Sep 17 00:00:00 2001 From: Kelvin K Date: Wed, 18 Jun 2025 14:33:07 +0200 Subject: [PATCH 4/5] submodules --- app/src/stable/assets/sources/kick | 2 +- app/src/stable/assets/sources/patreon | 2 +- app/src/stable/assets/sources/soundcloud | 2 +- app/src/stable/assets/sources/youtube | 2 +- app/src/unstable/assets/sources/kick | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/stable/assets/sources/kick b/app/src/stable/assets/sources/kick index ffdf4cda..b7173f15 160000 --- a/app/src/stable/assets/sources/kick +++ b/app/src/stable/assets/sources/kick @@ -1 +1 @@ -Subproject commit ffdf4cda380e5e4e9e370412f014e704bd14c09e +Subproject commit b7173f1538a8259ace0c606dfc3441426a659536 diff --git a/app/src/stable/assets/sources/patreon b/app/src/stable/assets/sources/patreon index d98c7f8a..b811f8bd 160000 --- a/app/src/stable/assets/sources/patreon +++ b/app/src/stable/assets/sources/patreon @@ -1 +1 @@ -Subproject commit d98c7f8aee36101d60a0c671d16a0800d5d715d0 +Subproject commit b811f8bdfbbff73cf0d7581c9d7596911cb132b6 diff --git a/app/src/stable/assets/sources/soundcloud b/app/src/stable/assets/sources/soundcloud index 54564312..048acef1 160000 --- a/app/src/stable/assets/sources/soundcloud +++ b/app/src/stable/assets/sources/soundcloud @@ -1 +1 @@ -Subproject commit 54564312683a0ae06d7085405478f96cade325e3 +Subproject commit 048acef152823d2621da177d3b4e1535cf4ca8ac diff --git a/app/src/stable/assets/sources/youtube b/app/src/stable/assets/sources/youtube index 0167dfb4..71285696 160000 --- a/app/src/stable/assets/sources/youtube +++ b/app/src/stable/assets/sources/youtube @@ -1 +1 @@ -Subproject commit 0167dfb471e6f90ab08e997ac7151072576c42db +Subproject commit 712856962838dc229bf1b91aa99d22e101957f15 diff --git a/app/src/unstable/assets/sources/kick b/app/src/unstable/assets/sources/kick index ffdf4cda..b7173f15 160000 --- a/app/src/unstable/assets/sources/kick +++ b/app/src/unstable/assets/sources/kick @@ -1 +1 @@ -Subproject commit ffdf4cda380e5e4e9e370412f014e704bd14c09e +Subproject commit b7173f1538a8259ace0c606dfc3441426a659536 From a2986a72bd945f4a5a1c926f4c3d789daa0de99d Mon Sep 17 00:00:00 2001 From: Kelvin K Date: Wed, 18 Jun 2025 14:43:20 +0200 Subject: [PATCH 5/5] Refs --- app/src/stable/assets/sources/youtube | 2 +- app/src/unstable/assets/sources/youtube | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/stable/assets/sources/youtube b/app/src/stable/assets/sources/youtube index 71285696..568d5605 160000 --- a/app/src/stable/assets/sources/youtube +++ b/app/src/stable/assets/sources/youtube @@ -1 +1 @@ -Subproject commit 712856962838dc229bf1b91aa99d22e101957f15 +Subproject commit 568d560520d6eff77d710aeac66057c76aedd9c0 diff --git a/app/src/unstable/assets/sources/youtube b/app/src/unstable/assets/sources/youtube index 0167dfb4..568d5605 160000 --- a/app/src/unstable/assets/sources/youtube +++ b/app/src/unstable/assets/sources/youtube @@ -1 +1 @@ -Subproject commit 0167dfb471e6f90ab08e997ac7151072576c42db +Subproject commit 568d560520d6eff77d710aeac66057c76aedd9c0