Revert name changes

This commit is contained in:
CranberrySoup 2024-06-20 19:35:15 +02:00
parent 4428431bad
commit c38bc8aabf
5 changed files with 10 additions and 12 deletions

View file

@ -622,8 +622,8 @@ abstract class MainAPI {
/**Used for testing and can be used to disable the providers if WebView is not available*/
open val usesWebView = false
/** Determines which plugin a given provider is from */
var sourcePluginPath: String? = null
/** Determines which plugin a given provider is from. This is the full path to the plugin. */
var sourcePlugin: String? = null
open val hasMainPage = false
open val hasQuickSearch = false

View file

@ -34,7 +34,7 @@ abstract class Plugin {
*/
fun registerMainAPI(element: MainAPI) {
Log.i(PLUGIN_TAG, "Adding ${element.name} (${element.mainUrl}) MainAPI")
element.sourcePluginPath = this.__filepath
element.sourcePlugin = this.__filepath
// Race condition causing which would case duplicates if not for distinctBy
synchronized(APIHolder.allProviders) {
APIHolder.allProviders.add(element)
@ -48,7 +48,7 @@ abstract class Plugin {
*/
fun registerExtractorAPI(element: ExtractorApi) {
Log.i(PLUGIN_TAG, "Adding ${element.name} (${element.mainUrl}) ExtractorApi")
element.sourcePluginPath = this.__filepath
element.sourcePlugin = this.__filepath
extractorApis.add(element)
}

View file

@ -18,7 +18,6 @@ import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings
import com.lagradost.cloudstream3.APIHolder.removePluginMapping
import com.lagradost.cloudstream3.AcraApplication.Companion.getActivity
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
import com.lagradost.cloudstream3.AcraApplication.Companion.removeKey
import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
import com.lagradost.cloudstream3.CommonActivity.showToast
import com.lagradost.cloudstream3.MainAPI.Companion.settingsForProvider
@ -567,14 +566,14 @@ object PluginManager {
// remove all registered apis
synchronized(APIHolder.apis) {
APIHolder.apis.filter { api -> api.sourcePluginPath == plugin.__filepath }.forEach {
APIHolder.apis.filter { api -> api.sourcePlugin == plugin.__filepath }.forEach {
removePluginMapping(it)
}
}
synchronized(APIHolder.allProviders) {
APIHolder.allProviders.removeIf { provider: MainAPI -> provider.sourcePluginPath == plugin.__filepath }
APIHolder.allProviders.removeIf { provider: MainAPI -> provider.sourcePlugin == plugin.__filepath }
}
extractorApis.removeIf { provider: ExtractorApi -> provider.sourcePluginPath == plugin.__filepath }
extractorApis.removeIf { provider: ExtractorApi -> provider.sourcePlugin == plugin.__filepath }
classLoaders.values.removeIf { v -> v == plugin }

View file

@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.ui.settings.testing
import android.app.AlertDialog
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
@ -89,7 +88,7 @@ class TestResultAdapter(override val items: MutableList<Pair<MainAPI, TestingUti
// Ok button just closes the dialog
.setPositiveButton(R.string.ok) { _, _ -> }
api.sourcePluginPath?.let { path ->
api.sourcePlugin?.let { path ->
val pluginFile = File(path)
// Cannot delete a deleted plugin
if (!pluginFile.exists()) return@let

View file

@ -1000,8 +1000,8 @@ abstract class ExtractorApi {
abstract val mainUrl: String
abstract val requiresReferer: Boolean
/** Determines which plugin a given extractor is from */
var sourcePluginPath: String? = null
/** Determines which plugin a given provider is from. This is the full path to the plugin. */
var sourcePlugin: String? = null
//suspend fun getSafeUrl(url: String, referer: String? = null): List<ExtractorLink>? {
// return suspendSafeApiCall { getUrl(url, referer) }