fix shortcodes

This commit is contained in:
Cloudburst 2023-02-21 12:28:32 +01:00
parent 88491beffc
commit e9343bafc2
2 changed files with 10 additions and 5 deletions

View file

@ -1118,7 +1118,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
suspend fun checkGithubConnectivity(): Boolean { suspend fun checkGithubConnectivity(): Boolean {
return try { return try {
app.get("https://raw.githubusercontent.com/recloudstream/.github/master/connectivitycheck").text.trim() == "ok" app.get("https://raw.githubusercontent.com/recloudstream/.github/master/connectivitycheck", timeout = 5).text.trim() == "ok"
} catch (t: Throwable) { } catch (t: Throwable) {
false false
} }

View file

@ -93,10 +93,15 @@ object RepositoryManager {
} }
} else if (fixedUrl.matches("^[a-zA-Z0-9!_-]+$".toRegex())) { } else if (fixedUrl.matches("^[a-zA-Z0-9!_-]+$".toRegex())) {
suspendSafeApiCall { suspendSafeApiCall {
app.get("https://l.cloudstream.cf/${fixedUrl}").let { app.get("https://l.cloudstream.cf/${fixedUrl}", allowRedirects = false).let {
return@let if (it.isSuccessful && !it.url.startsWith("https://cutt.ly/branded-domains")) it.url it.headers["Location"]?.let { url ->
else app.get("https://cutt.ly/${fixedUrl}").let let2@{ it2 -> return@suspendSafeApiCall if (!url.startsWith("https://cutt.ly/branded-domains")) url
return@let2 if (it2.isSuccessful) it2.url else null else null
}
app.get("https://cutt.ly/${fixedUrl}", allowRedirects = false).let { it2 ->
it2.headers["Location"]?.let { url ->
return@suspendSafeApiCall if (url.startsWith("https://cutt.ly/404")) url else null
}
} }
} }
} }