From 11136fe63d494ac800df3a52560237500ca024a3 Mon Sep 17 00:00:00 2001 From: self-similarity <137652432+self-similarity@users.noreply.github.com> Date: Sun, 5 Nov 2023 22:33:11 +0000 Subject: [PATCH 1/4] Fix selecting sources in cast (#752) --- .../java/com/lagradost/cloudstream3/utils/ExtractorApi.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index d89e67fa..923c3531 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -1,6 +1,7 @@ package com.lagradost.cloudstream3.utils import android.net.Uri +import com.fasterxml.jackson.annotation.JsonIgnore import com.lagradost.cloudstream3.SubtitleFile import com.lagradost.cloudstream3.TvType import com.lagradost.cloudstream3.USER_AGENT @@ -377,7 +378,8 @@ open class ExtractorLink constructor( ) : VideoDownloadManager.IDownloadableMinimum { val isM3u8 : Boolean get() = type == ExtractorLinkType.M3U8 val isDash : Boolean get() = type == ExtractorLinkType.DASH - + + @JsonIgnore fun getAllHeaders() : Map { if (referer.isBlank()) { return headers @@ -920,4 +922,4 @@ abstract class ExtractorApi { open fun getExtractorUrl(id: String): String { return id } -} \ No newline at end of file +} From 22a0c25d8309097efbe92ac6af945e8438307b60 Mon Sep 17 00:00:00 2001 From: Sofie <117321707+Sofie99@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:28:27 +0700 Subject: [PATCH 2/4] extractor: fixed Rabbitstream (#757) * Extractor: added Rabbitstream * Extractor: added Rabbitstream * fixed Rabbitstream --------- Co-authored-by: Sofie99 --- .../cloudstream3/extractors/Rabbitstream.kt | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Rabbitstream.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Rabbitstream.kt index 0154b4e8..d5b52dd7 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Rabbitstream.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Rabbitstream.kt @@ -16,13 +16,13 @@ import javax.crypto.Cipher import javax.crypto.spec.IvParameterSpec import javax.crypto.spec.SecretKeySpec -// No License found in https://github.com/enimax-anime/key -// special credits to @enimax for providing key +// Code found in https://github.com/theonlymo/keys +// special credits to @theonlymo for providing key class Megacloud : Rabbitstream() { override val name = "Megacloud" override val mainUrl = "https://megacloud.tv" override val embed = "embed-2/ajax/e-1" - override val key = "https://raw.githubusercontent.com/enimax-anime/key/e6/key.txt" + override val key = "https://raw.githubusercontent.com/theonlymo/keys/e1/key" } class Dokicloud : Rabbitstream() { @@ -35,7 +35,7 @@ open class Rabbitstream : ExtractorApi() { override val mainUrl = "https://rabbitstream.net" override val requiresReferer = false open val embed = "ajax/embed-4" - open val key = "https://raw.githubusercontent.com/enimax-anime/key/e4/key.txt" + open val key = "https://raw.githubusercontent.com/theonlymo/keys/e4/key" override suspend fun getUrl( url: String, @@ -86,21 +86,23 @@ open class Rabbitstream : ExtractorApi() { private suspend fun getRawKey(): String = app.get(key).text - private fun extractRealKey(originalString: String?, stops: String): Pair { - val table = parseJson>>(stops) - val decryptedKey = StringBuilder() - var offset = 0 - var encryptedString = originalString + private fun extractRealKey(sources: String, stops: String): Pair { + val decryptKey = parseJson>>(stops) + val sourcesArray = sources.toCharArray() - table.forEach { (start, end) -> - decryptedKey.append(encryptedString?.substring(start - offset, end - offset)) - encryptedString = encryptedString?.substring( - 0, - start - offset - ) + encryptedString?.substring(end - offset) - offset += end - start + var extractedKey = "" + var currentIndex = 0 + for (index in decryptKey) { + val start = index[0] + currentIndex + val end = start + index[1] + for (i in start until end) { + extractedKey += sourcesArray[i].toString() + sourcesArray[i] = ' ' + } + currentIndex += index[1] } - return decryptedKey.toString() to encryptedString.toString() + + return extractedKey to sourcesArray.joinToString("") } private inline fun decryptMapped(input: String, key: String): T? { From 7e2908c0bbd3fd242cd4576b58039cfe01a378b0 Mon Sep 17 00:00:00 2001 From: KingLucius Date: Fri, 10 Nov 2023 16:36:38 +0200 Subject: [PATCH 3/4] Fix top bar in Extensions & Test settings (#753) --- .../cloudstream3/ui/settings/SettingsFragment.kt | 9 +++++++++ .../ui/settings/extensions/ExtensionsFragment.kt | 3 ++- .../ui/settings/extensions/PluginsFragment.kt | 2 ++ .../cloudstream3/ui/settings/testing/TestFragment.kt | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt index cb48b086..6ea6363e 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt @@ -65,6 +65,15 @@ class SettingsFragment : Fragment() { } } } + fun Fragment?.setToolBarScrollFlags() { + if (isTvSettings()) { + val settingsAppbar = this?.view?.findViewById(R.id.settings_toolbar) + + settingsAppbar?.updateLayoutParams { + scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL + } + } + } fun Fragment?.setUpToolbar(title: String) { if (this == null) return val settingsToolbar = view?.findViewById(R.id.settings_toolbar) ?: return diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/ExtensionsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/ExtensionsFragment.kt index 553e7675..f0b8a0bd 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/ExtensionsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/ExtensionsFragment.kt @@ -30,6 +30,7 @@ import com.lagradost.cloudstream3.ui.result.FOCUS_SELF import com.lagradost.cloudstream3.ui.result.setLinearListLayout import com.lagradost.cloudstream3.ui.result.setText import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings +import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar import com.lagradost.cloudstream3.utils.AppUtils.downloadAllPluginsDialog import com.lagradost.cloudstream3.utils.AppUtils.setDefaultFocus @@ -85,7 +86,7 @@ class ExtensionsFragment : Fragment() { //context?.fixPaddingStatusbar(extensions_root) setUpToolbar(R.string.extensions) - + setToolBarScrollFlags() binding?.repoRecyclerView?.apply { setLinearListLayout( diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginsFragment.kt index 172ea659..b490386f 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginsFragment.kt @@ -18,6 +18,7 @@ import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.bindChips import com.lagradost.cloudstream3.ui.result.FOCUS_SELF import com.lagradost.cloudstream3.ui.result.setLinearListLayout import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings +import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar import com.lagradost.cloudstream3.ui.settings.appLanguages import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog @@ -73,6 +74,7 @@ class PluginsFragment : Fragment() { return } + setToolBarScrollFlags() setUpToolbar(name) binding?.settingsToolbar?.apply { setOnMenuItemClickListener { menuItem -> diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/testing/TestFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/testing/TestFragment.kt index 59b1b856..3fbd1131 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/testing/TestFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/testing/TestFragment.kt @@ -12,6 +12,7 @@ import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import com.lagradost.cloudstream3.mvvm.observe import com.lagradost.cloudstream3.mvvm.observeNullable import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings +import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar @@ -27,6 +28,7 @@ class TestFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { setUpToolbar(R.string.category_provider_test) + setToolBarScrollFlags() super.onViewCreated(view, savedInstanceState) binding?.apply { From c4aab5e5a827a051dd089c568dcb1d22d0215c42 Mon Sep 17 00:00:00 2001 From: IndusAryan <125901294+IndusAryan@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:32:51 +0530 Subject: [PATCH 4/4] feat: make cloudstream fast boi, ksp migration (#689) * migrate from kapt to ksp * fook codefactor --- app/build.gradle.kts | 19 +++++++++++++------ .../lagradost/cloudstream3/AcraApplication.kt | 3 --- .../ui/settings/extensions/PluginAdapter.kt | 3 +-- .../lagradost/cloudstream3/utils/UIHelper.kt | 4 ++-- .../utils/VideoDownloadManager.kt | 2 +- build.gradle.kts | 4 ++++ 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e0e4bb1d..12859af5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,6 +5,7 @@ import java.net.URL plugins { id("com.android.application") + id("com.google.devtools.ksp") id("kotlin-android") id("kotlin-kapt") id("org.jetbrains.dokka") @@ -87,6 +88,11 @@ android { ) testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + ksp { + arg("room.schemaLocation", "$projectDir/schemas") + arg("exportSchema", "true") + } + kapt { includeCompileClasspath = true } @@ -181,9 +187,13 @@ dependencies { implementation("androidx.preference:preference-ktx:1.2.1") - implementation("com.github.bumptech.glide:glide:4.13.1") - kapt("com.github.bumptech.glide:compiler:4.13.1") - implementation("com.github.bumptech.glide:okhttp3-integration:4.13.0") + implementation("com.github.bumptech.glide:glide:4.15.1") + ksp("com.github.bumptech.glide:ksp:4.15.1") + implementation("com.github.bumptech.glide:okhttp3-integration:4.15.1") + // for ksp + ksp("dev.zacsweers.autoservice:auto-service-ksp:1.1.0") + implementation("dev.zacsweers.autoservice:auto-service-ksp:1.1.0") + implementation("com.google.guava:guava:32.1.2-android") implementation("jp.wasabeef:glide-transformations:4.3.0") @@ -207,9 +217,6 @@ dependencies { implementation("ch.acra:acra-core:5.11.2") implementation("ch.acra:acra-toast:5.11.2") - compileOnly("com.google.auto.service:auto-service-annotations:1.1.1") - //either for java sources: - annotationProcessor("com.google.auto.service:auto-service:1.1.1") //or for kotlin sources (requires kapt gradle plugin): kapt("com.google.auto.service:auto-service:1.1.1") diff --git a/app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt b/app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt index 5f3162b4..c93f0f9b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt @@ -8,7 +8,6 @@ import android.content.Intent import android.widget.Toast import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity -import com.google.auto.service.AutoService import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall import com.lagradost.cloudstream3.plugins.PluginManager @@ -37,7 +36,6 @@ import java.lang.ref.WeakReference import kotlin.concurrent.thread import kotlin.system.exitProcess - class CustomReportSender : ReportSender { // Sends all your crashes to google forms override fun send(context: Context, errorContent: CrashReportData) { @@ -65,7 +63,6 @@ class CustomReportSender : ReportSender { } } -@AutoService(ReportSenderFactory::class) class CustomSenderFactory : ReportSenderFactory { override fun create(context: Context, config: CoreConfiguration): ReportSender { return CustomReportSender() diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginAdapter.kt index eb0082b8..c3fb4fc2 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginAdapter.kt @@ -21,7 +21,6 @@ import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueT import com.lagradost.cloudstream3.utils.AppUtils.html import com.lagradost.cloudstream3.utils.Coroutines.ioSafe import com.lagradost.cloudstream3.utils.Coroutines.main -import com.lagradost.cloudstream3.utils.GlideApp import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTwoLettersToLanguage import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso import com.lagradost.cloudstream3.utils.UIHelper.setImage @@ -87,7 +86,7 @@ class PluginAdapter( override fun onViewRecycled(holder: RecyclerView.ViewHolder) { if (holder is PluginViewHolder) { holder.binding.entryIcon.let { pluginIcon -> - GlideApp.with(pluginIcon).clear(pluginIcon) + com.bumptech.glide.Glide.with(pluginIcon).clear(pluginIcon) } } super.onViewRecycled(holder) diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt index d5357e0c..231a634d 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt @@ -301,7 +301,7 @@ object UIHelper { } ?: return false return try { - var builder = GlideApp.with(this) + var builder = com.bumptech.glide.Glide.with(this) .load(glideImage) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.ALL).let { req -> @@ -368,7 +368,7 @@ object UIHelper { ) { if (this == null || url.isNullOrBlank()) return try { - val res = GlideApp.with(this) + val res = com.bumptech.glide.Glide.with(this) .load(GlideUrl(url) { headers ?: emptyMap() }) .apply(bitmapTransform(BlurTransformation(radius, sample))) .transition( diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt index d108daed..50a8df02 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt @@ -234,7 +234,7 @@ object VideoDownloadManager { return cachedBitmaps[url] } - val bitmap = GlideApp.with(this) + val bitmap = com.bumptech.glide.Glide.with(this) .asBitmap() .load(GlideUrl(url) { headers ?: emptyMap() }) .into(720, 720) diff --git a/build.gradle.kts b/build.gradle.kts index 762e4588..5d7ea527 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,6 +22,10 @@ allprojects { } } +plugins { + id("com.google.devtools.ksp") version "1.8.20-1.0.11" apply false +} + tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } \ No newline at end of file