Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ class MediaRepository @Inject constructor(
fun getDefaultCatalogConfigs(): List<CatalogConfig> = buildPreinstalledDefaults()

companion object {
const val STREAMING_COLLECTION_ADDON_URL = "https://pastebin.com/raw/P4gfd98n"
const val STREAMING_COLLECTION_ADDON_URL = "https://raw.githubusercontent.com/ProdigyV21/ARVIO/main/config/streaming_addon.txt"
const val PASTEBIN_STREAMING_ADDON_URL = "https://pastebin.com/raw/P4gfd98n"
private val UPLOADED_COVER_BASE = "https://" + "nu" + "vioapp.space/uploads/covers/"

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1268,24 +1268,47 @@ class StreamRepository @Inject constructor(

private suspend fun resolveAddonInstallUrl(rawUrl: String): String {
val normalized = normalizeAddonInputUrl(rawUrl)
if (!normalized.contains("pastebin.com/raw/", ignoreCase = true)) {
val isRawTextManifest = normalized.contains("pastebin.com/raw/", ignoreCase = true) ||
normalized.contains("raw.githubusercontent.com/", ignoreCase = true) ||
normalized.endsWith(".txt", ignoreCase = true)
if (!isRawTextManifest) {
return normalized
}
val request = Request.Builder().url(normalized).build()
val body = runCatching {
okHttpClient.newCall(request).execute().use { response ->
if (!response.isSuccessful) return normalized
response.body?.string().orEmpty()
}
}.getOrDefault("")
val link = body.lineSequence()
.map { it.trim() }
.firstOrNull { line ->
line.startsWith("stremio://", ignoreCase = true) ||
line.startsWith("https://", ignoreCase = true) ||
line.startsWith("http://", ignoreCase = true)
}
return if (link.isNullOrBlank()) normalized else normalizeAddonInputUrl(link)

val fastClient = okHttpClient.newBuilder()
.connectTimeout(3500, java.util.concurrent.TimeUnit.MILLISECONDS)
.readTimeout(3500, java.util.concurrent.TimeUnit.MILLISECONDS)
.build()

fun fetchManifestUrl(targetUrl: String): String? {
val request = Request.Builder().url(targetUrl).build()
val body = runCatching {
fastClient.newCall(request).execute().use { response ->
if (!response.isSuccessful) return null
response.body?.string().orEmpty()
}
}.getOrNull() ?: return null

val link = body.lineSequence()
.map { it.trim() }
.firstOrNull { line ->
line.startsWith("stremio://", ignoreCase = true) ||
line.startsWith("https://", ignoreCase = true) ||
line.startsWith("http://", ignoreCase = true)
}
return link?.takeIf { it.isNotBlank() }?.let { normalizeAddonInputUrl(it) }
}

val primaryResult = fetchManifestUrl(normalized)
if (primaryResult != null) return primaryResult

val fallbackUrl = if (normalized.contains("pastebin.com", ignoreCase = true)) {
MediaRepository.STREAMING_COLLECTION_ADDON_URL
} else {
MediaRepository.PASTEBIN_STREAMING_ADDON_URL
}
val fallbackResult = fetchManifestUrl(fallbackUrl)
return fallbackResult ?: normalized
}

suspend fun getAddonCatalogPage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,7 @@ class HomeViewModel @Inject constructor(
runCatching {
streamRepository.removeCustomAddonsByUrl(
CollectionTemplateManifest.autoInstalledAddonUrls() +
listOf(MediaRepository.STREAMING_COLLECTION_ADDON_URL)
listOf(MediaRepository.STREAMING_COLLECTION_ADDON_URL, MediaRepository.PASTEBIN_STREAMING_ADDON_URL)
)
val addons = streamRepository.installedAddons.first()
catalogRepository.syncAddonCatalogs(addons)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.arflix.tv.data.repository

import org.junit.Assert.assertEquals
import org.junit.Test

class StreamAddonFallbackTest {

@Test
fun constants_verifyPrimaryAndFallbackUrlsAreConfigured() {
assertEquals(
"https://raw.githubusercontent.com/ProdigyV21/ARVIO/main/config/streaming_addon.txt",
MediaRepository.STREAMING_COLLECTION_ADDON_URL
)
assertEquals(
"https://pastebin.com/raw/P4gfd98n",
MediaRepository.PASTEBIN_STREAMING_ADDON_URL
)
}
}
1 change: 1 addition & 0 deletions config/streaming_addon.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://7a82163c306e-stremio-netflix-catalog-addon.baby-beamup.club/bmZ4LGRucCxhbXAsYXRwLGhibSxwbXAscGNwLGhsdTo6OjE3NzU5MzEzMzkxNzU6MDowOg%3D%3D/manifest.json