From 447ed6bf21a39e82317bb10222501030b26fad20 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Fri, 31 May 2024 21:59:07 +0200 Subject: [PATCH 1/3] Live chat interval removel, non-self return http calls to prevent crash, minor doc fix, more logs --- app/src/main/assets/devportal/plugin.d.ts | 2 +- .../media/models/live/ILiveChatWindowDescriptor.kt | 1 + .../api/media/platforms/js/DevJSClient.kt | 4 +++- .../js/models/JSLiveChatWindowDescriptor.kt | 3 ++- .../platformplayer/engine/packages/PackageHttp.kt | 12 ++++-------- .../platformplayer/views/overlays/LiveChatOverlay.kt | 9 ++++++++- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/src/main/assets/devportal/plugin.d.ts b/app/src/main/assets/devportal/plugin.d.ts index 23db7d2f..702fb745 100644 --- a/app/src/main/assets/devportal/plugin.d.ts +++ b/app/src/main/assets/devportal/plugin.d.ts @@ -127,7 +127,7 @@ declare class PlatformVideoDetails extends PlatformVideo { } declare interface PlatformPostDef extends PlatformContentDef { - thumbnails: string[], + thumbnails: Thumbnails[], images: string[], description: string } diff --git a/app/src/main/java/com/futo/platformplayer/api/media/models/live/ILiveChatWindowDescriptor.kt b/app/src/main/java/com/futo/platformplayer/api/media/models/live/ILiveChatWindowDescriptor.kt index ef5096fa..c6df8f21 100644 --- a/app/src/main/java/com/futo/platformplayer/api/media/models/live/ILiveChatWindowDescriptor.kt +++ b/app/src/main/java/com/futo/platformplayer/api/media/models/live/ILiveChatWindowDescriptor.kt @@ -3,4 +3,5 @@ package com.futo.platformplayer.api.media.models.live interface ILiveChatWindowDescriptor { val url: String; val removeElements: List; + val removeElementsInterval: List; } \ No newline at end of file diff --git a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/DevJSClient.kt b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/DevJSClient.kt index 47dfb1cb..f488929d 100644 --- a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/DevJSClient.kt +++ b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/DevJSClient.kt @@ -8,6 +8,8 @@ import com.futo.platformplayer.api.media.models.contents.IPlatformContentDetails import com.futo.platformplayer.api.media.structures.IPager import com.futo.platformplayer.states.StateApp import com.futo.platformplayer.states.StateDeveloper +import kotlinx.serialization.encodeToString +import kotlinx.serialization.json.Json import java.util.UUID class DevJSClient : JSClient { @@ -115,7 +117,7 @@ class DevJSClient : JSClient { //Video override fun isContentDetailsUrl(url: String): Boolean { - return StateDeveloper.instance.handleDevCall(devID, "isVideoDetailsUrl"){ + return StateDeveloper.instance.handleDevCall(devID, "isVideoDetailsUrl(${Json.encodeToString(url)})"){ super.isContentDetailsUrl(url); }; } diff --git a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/models/JSLiveChatWindowDescriptor.kt b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/models/JSLiveChatWindowDescriptor.kt index abb6e5e5..808728ec 100644 --- a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/models/JSLiveChatWindowDescriptor.kt +++ b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/models/JSLiveChatWindowDescriptor.kt @@ -14,12 +14,13 @@ import java.time.ZoneOffset class JSLiveChatWindowDescriptor: ILiveChatWindowDescriptor { override val url: String; override val removeElements: List; - + override val removeElementsInterval: List; constructor(config: SourcePluginConfig, obj: V8ValueObject) { val contextName = "LiveChatWindowDescriptor"; url = obj.getOrThrow(config, "url", contextName); removeElements = obj.getOrDefault(config, "removeElements", contextName, listOf()) ?: listOf(); + removeElementsInterval = obj.getOrDefault(config, "removeElementsInterval", contextName, listOf()) ?: listOf(); } } \ No newline at end of file diff --git a/app/src/main/java/com/futo/platformplayer/engine/packages/PackageHttp.kt b/app/src/main/java/com/futo/platformplayer/engine/packages/PackageHttp.kt index bbac4acf..7822beb5 100644 --- a/app/src/main/java/com/futo/platformplayer/engine/packages/PackageHttp.kt +++ b/app/src/main/java/com/futo/platformplayer/engine/packages/PackageHttp.kt @@ -211,28 +211,24 @@ class PackageHttp: V8Package { } @V8Function - fun setDefaultHeaders(defaultHeaders: Map): PackageHttpClient { + fun setDefaultHeaders(defaultHeaders: Map) { for(pair in defaultHeaders) _defaultHeaders[pair.key] = pair.value; - return this; } @V8Function - fun setDoApplyCookies(apply: Boolean): PackageHttpClient { + fun setDoApplyCookies(apply: Boolean) { if(_client is JSHttpClient) _client.doApplyCookies = apply; - return this; } @V8Function - fun setDoUpdateCookies(update: Boolean): PackageHttpClient { + fun setDoUpdateCookies(update: Boolean) { if(_client is JSHttpClient) _client.doUpdateCookies = update; - return this; } @V8Function - fun setDoAllowNewCookies(allow: Boolean): PackageHttpClient { + fun setDoAllowNewCookies(allow: Boolean) { if(_client is JSHttpClient) _client.doAllowNewCookies = allow; - return this; } @V8Function diff --git a/app/src/main/java/com/futo/platformplayer/views/overlays/LiveChatOverlay.kt b/app/src/main/java/com/futo/platformplayer/views/overlays/LiveChatOverlay.kt index 1e6160df..fc3eff23 100644 --- a/app/src/main/java/com/futo/platformplayer/views/overlays/LiveChatOverlay.kt +++ b/app/src/main/java/com/futo/platformplayer/views/overlays/LiveChatOverlay.kt @@ -106,8 +106,15 @@ class LiveChatOverlay : LinearLayout { override fun onPageFinished(view: WebView?, url: String?) { super.onPageFinished(view, url); _window?.let { + var toRemoveJS = ""; for(req in it.removeElements) - view?.evaluateJavascript("document.querySelectorAll(" + _argJsonSerializer.encodeToString(req) + ").forEach(x=>x.remove());") {}; + toRemoveJS += "document.querySelectorAll(" + _argJsonSerializer.encodeToString(req) + ").forEach(x=>x.remove());\n"; + view?.evaluateJavascript(toRemoveJS) {}; + var toRemoveJSInterval = ""; + for(req in it.removeElementsInterval) + toRemoveJSInterval += "document.querySelectorAll(" + _argJsonSerializer.encodeToString(req) + ").forEach(x=>x.remove());\n"; + //Cleanup every second as fallback + view?.evaluateJavascript("setInterval(()=>{" + toRemoveJSInterval + "}, 1000)") {}; }; } }; From 035d19f581daaa3c773ab8e6e1bc5ad970605f4d Mon Sep 17 00:00:00 2001 From: Koen Date: Mon, 3 Jun 2024 16:30:05 +0000 Subject: [PATCH 2/3] Update LICENSE --- LICENSE | 61 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/LICENSE b/LICENSE index a3d0f019..f3d7e742 100644 --- a/LICENSE +++ b/LICENSE @@ -1,32 +1,43 @@ -# FUTO TEMPORARY LICENSE -This license grants you the rights, and only the rights, set out below in respect of the source code provided. If you take advantage of these rights, you accept this license. If you do not accept the license, do not access the code. +# Grayjay Core License 1.0 -Words used in the Terms of Service have the same meaning in this license. Where there is any inconsistency between this license and those Terms of Service, these terms prevail. +## Acceptance +By using the software, you agree to all of the terms and conditions below. -## Section 1: Definitions -- "code" means the source code made available from time, in our sole discretion, for access under this license. Reference to code in this license means the code and any part of it and any derivative of it. -- “compilation” means to compile the code from ‘source code’ to ‘machine code’. -- "defect" means a defect, bug, backdoor, security issue or other deficiency in the code. -- “non-commercial distribution” means distribution of the code or any compilation of the code, or of any other application or program containing the code or any compilation of the code, where such distribution is not intended for or directed towards commercial advantage or monetary compensation. -- "review" means to access, analyse, test and otherwise review the code as a reference, for the sole purpose of analysing it for defects. -- "you" means the licensee of rights set out in this license. +## Copyright License +FUTO Holdings, Inc. (the “Licensor”) grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations below. -## Section 2: Grant of Rights -1. Subject to the terms of this license, we grant you a non-transferable, non-exclusive, worldwide, royalty-free license to access and use the code solely for the purposes of review, compilation and non-commercial distribution. -2. You may provide the code to anyone else and publish excerpts of it for the purposes of review, compilation and non-commercial distribution, provided that when you do so you make any recipient of the code aware of the terms of this license, they must agree to be bound by the terms of this license and you must attribute the code to the provider. -3. Other than in respect of those parts of the code that were developed by other parties and as specified strictly in accordance with the open source and other licenses under which those parts of the code have been made available, as set out on our website or in those items of code, you are not entitled to use or do anything with the code for any commercial or other purpose, other than review, compilation and non-commercial distribution in accordance with the terms of this license. -4. Subject to the terms of this license, you must at all times comply with and shall be bound by our Terms of Use, Privacy and Data Policy. +## Limitations +You may use or modify the software for only for non-commercial purposes such as personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, all without any anticipated commercial application. -## Section 3: Limitations -1. This license does not grant you any rights to use the provider's name, logo, or trademarks and you must not in any way indicate you are authorised to speak on behalf of the provider. -2. If you issue proceedings in any jurisdiction against the provider because you consider the provider has infringed copyright or any patent right in respect of the code (including any joinder or counterclaim), your license to the code is automatically terminated. -3. THE CODE IS MADE AVAILABLE "AS-IS" AND WITHOUT ANY EXPRESS OR IMPLIED GUARANTEES AS TO FITNESS, MERCHANTABILITY, NON-INFRINGEMENT OR OTHERWISE. IT IS NOT BEING PROVIDED IN TRADE BUT ON A VOLUNTARY BASIS ON OUR PART AND IS NOT MADE AVAILABLE FOR ANY USE OUTSIDE THE TERMS OF THIS LICENSE. ANYONE ACCESSING THE CODE MUST ENSURE THEY HAVE THE REQUISITE EXPERTISE TO SECURE THEIR OWN SYSTEM AND DEVICES AND TO ACCESS AND USE THE CODE IN ACCORDANCE WITH THE TERMS OF THIS LICENSE. YOU BEAR THE RISK OF ACCESSING AND USING THE CODE. IN PARTICULAR, THE PROVIDER BEARS NO LIABILITY FOR ANY INTERFERENCE WITH OR ADVERSE EFFECT ON YOUR SYSTEM OR DEVICES AS A RESULT OF YOUR ACCESSING AND USING THE CODE IN ACCORDANCE WITH THE TERMS OF THIS LICENSE OR OTHERWISE. +You may distribute the software or provide it to others only if you do so free of charge for non-commercial purposes. -## Section 4: Termination, suspension and variation -1. We may suspend, terminate or vary the terms of this license and any access to the code at any time, without notice, for any reason or no reason, in respect of any licensee, group of licensees or all licensees including as may be applicable any sub-licensees. +Notwithstanding the above, you may not remove or obscure any functionality in the software related to payment to the Licensor in any copy you distribute to others. -## Section 5: General -1. This license and its interpretation and operation are governed solely by the local law. You agree to submit to the exclusive jurisdiction of the local arbitral tribunals as further described in our Terms of Service and you agree not to raise any jurisdictional issue if we need to enforce an arbitral award or judgment in our jurisdiction or another country. -2. Questions and comments regarding this license are welcomed and should be addressed at https://chat.futo.org/login/. +You may not alter, remove, or obscure any licensing, copyright, or other notices of the Licensor in the software. Any use of the Licensor’s trademarks is subject to applicable law. -Last updated 7 June 2023. +## Patents +If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company. + +## Notices +You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms. If you modify the software, you must include in any modified copies of the software a prominent notice stating that you have modified the software, such as but not limited to, a statement in a readme file or an in-application about section. + +## Fair Use +You may have "fair use" rights for the software under the law. These terms do not limit them. + +## No Other Rights +These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the Licensor from granting licenses to anyone else. These terms do not imply any other licenses. + +## Termination +If you use the software in violation of these terms, such use is not licensed, and your license will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your license will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your license to terminate automatically and permanently. + +## No Liability +As far as the law allows, the software comes as is, without any warranty or condition, and the Licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim. + +## Definitions +- The “Licensor” is the entity offering these terms, FUTO Holdings, Inc. +- The “software” is the software the licensor makes available under these terms, including any portion of it. +- “You” refers to the individual or entity agreeing to these terms. +- “Your company” is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. Control means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect. +- “Your license” is the license granted to you for the software under these terms. +- “Use” means anything you do with the software requiring your license. +- “Trademark” means trademarks, service marks, and similar rights. From 309332ac9cacc6ed0abcc9f5bf95d58db65da630 Mon Sep 17 00:00:00 2001 From: Koen Date: Mon, 3 Jun 2024 16:30:27 +0000 Subject: [PATCH 3/3] Update LICENSE --- LICENSE => LICENSE.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename LICENSE => LICENSE.md (100%) diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md