mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
actions java 11 -> 17 & fixed parent job is cancelling message
This commit is contained in:
parent
9755bbacb9
commit
da6577e587
6 changed files with 74 additions and 62 deletions
4
.github/workflows/build_to_archive.yml
vendored
4
.github/workflows/build_to_archive.yml
vendored
|
@ -32,10 +32,10 @@ jobs:
|
||||||
private_key: ${{ secrets.GH_APP_KEY }}
|
private_key: ${{ secrets.GH_APP_KEY }}
|
||||||
repository: "recloudstream/cloudstream-archive"
|
repository: "recloudstream/cloudstream-archive"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
|
|
4
.github/workflows/generate_dokka.yml
vendored
4
.github/workflows/generate_dokka.yml
vendored
|
@ -42,10 +42,10 @@ jobs:
|
||||||
cd $GITHUB_WORKSPACE/dokka/
|
cd $GITHUB_WORKSPACE/dokka/
|
||||||
rm -rf "./-cloudstream"
|
rm -rf "./-cloudstream"
|
||||||
|
|
||||||
- name: Setup JDK 11
|
- name: Setup JDK 17
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 17
|
||||||
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v2
|
uses: android-actions/setup-android@v2
|
||||||
|
|
4
.github/workflows/prerelease.yml
vendored
4
.github/workflows/prerelease.yml
vendored
|
@ -24,10 +24,10 @@ jobs:
|
||||||
private_key: ${{ secrets.GH_APP_KEY }}
|
private_key: ${{ secrets.GH_APP_KEY }}
|
||||||
repository: "recloudstream/secrets"
|
repository: "recloudstream/secrets"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
|
|
4
.github/workflows/pull_request.yml
vendored
4
.github/workflows/pull_request.yml
vendored
|
@ -7,10 +7,10 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
|
|
|
@ -129,6 +129,70 @@ fun CoroutineScope.launchSafe(
|
||||||
return this.launch(context, start, obj)
|
return this.launch(context, start, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun<T> throwAbleToResource(
|
||||||
|
throwable: Throwable
|
||||||
|
): Resource<T> {
|
||||||
|
return when (throwable) {
|
||||||
|
is NullPointerException -> {
|
||||||
|
for (line in throwable.stackTrace) {
|
||||||
|
if (line?.fileName?.endsWith("provider.kt", ignoreCase = true) == true) {
|
||||||
|
return Resource.Failure(
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
"NullPointerException at ${line.fileName} ${line.lineNumber}\nSite might have updated or added Cloudflare/DDOS protection"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
safeFail(throwable)
|
||||||
|
}
|
||||||
|
is SocketTimeoutException, is InterruptedIOException -> {
|
||||||
|
Resource.Failure(
|
||||||
|
true,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
"Connection Timeout\nPlease try again later."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is HttpException -> {
|
||||||
|
Resource.Failure(
|
||||||
|
false,
|
||||||
|
throwable.statusCode,
|
||||||
|
null,
|
||||||
|
throwable.message ?: "HttpException"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is UnknownHostException -> {
|
||||||
|
Resource.Failure(true, null, null, "Cannot connect to server, try again later.\n${throwable.message}")
|
||||||
|
}
|
||||||
|
is ErrorLoadingException -> {
|
||||||
|
Resource.Failure(
|
||||||
|
true,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
throwable.message ?: "Error loading, try again later."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is NotImplementedError -> {
|
||||||
|
Resource.Failure(false, null, null, "This operation is not implemented.")
|
||||||
|
}
|
||||||
|
is SSLHandshakeException -> {
|
||||||
|
Resource.Failure(
|
||||||
|
true,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
(throwable.message ?: "SSLHandshakeException") + "\nTry a VPN or DNS."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is CancellationException -> {
|
||||||
|
throwable.cause?.let {
|
||||||
|
throwAbleToResource(it)
|
||||||
|
} ?: safeFail(throwable)
|
||||||
|
}
|
||||||
|
else -> safeFail(throwable)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun <T> safeApiCall(
|
suspend fun <T> safeApiCall(
|
||||||
apiCall: suspend () -> T,
|
apiCall: suspend () -> T,
|
||||||
): Resource<T> {
|
): Resource<T> {
|
||||||
|
@ -137,60 +201,7 @@ suspend fun <T> safeApiCall(
|
||||||
Resource.Success(apiCall.invoke())
|
Resource.Success(apiCall.invoke())
|
||||||
} catch (throwable: Throwable) {
|
} catch (throwable: Throwable) {
|
||||||
logError(throwable)
|
logError(throwable)
|
||||||
when (throwable) {
|
throwAbleToResource(throwable)
|
||||||
is NullPointerException -> {
|
|
||||||
for (line in throwable.stackTrace) {
|
|
||||||
if (line?.fileName?.endsWith("provider.kt", ignoreCase = true) == true) {
|
|
||||||
return@withContext Resource.Failure(
|
|
||||||
false,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"NullPointerException at ${line.fileName} ${line.lineNumber}\nSite might have updated or added Cloudflare/DDOS protection"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
safeFail(throwable)
|
|
||||||
}
|
|
||||||
is SocketTimeoutException, is InterruptedIOException -> {
|
|
||||||
Resource.Failure(
|
|
||||||
true,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"Connection Timeout\nPlease try again later."
|
|
||||||
)
|
|
||||||
}
|
|
||||||
is HttpException -> {
|
|
||||||
Resource.Failure(
|
|
||||||
false,
|
|
||||||
throwable.statusCode,
|
|
||||||
null,
|
|
||||||
throwable.message ?: "HttpException"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
is UnknownHostException -> {
|
|
||||||
Resource.Failure(true, null, null, "Cannot connect to server, try again later.")
|
|
||||||
}
|
|
||||||
is ErrorLoadingException -> {
|
|
||||||
Resource.Failure(
|
|
||||||
true,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
throwable.message ?: "Error loading, try again later."
|
|
||||||
)
|
|
||||||
}
|
|
||||||
is NotImplementedError -> {
|
|
||||||
Resource.Failure(false, null, null, "This operation is not implemented.")
|
|
||||||
}
|
|
||||||
is SSLHandshakeException -> {
|
|
||||||
Resource.Failure(
|
|
||||||
true,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
(throwable.message ?: "SSLHandshakeException") + "\nTry a VPN or DNS."
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else -> safeFail(throwable)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -370,6 +370,7 @@ class HomeViewModel : ViewModel() {
|
||||||
|
|
||||||
else -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
|
onGoingLoad = null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun click(callback: SearchClickCallback) {
|
fun click(callback: SearchClickCallback) {
|
||||||
|
|
Loading…
Reference in a new issue