cache key

This commit is contained in:
LagradOst 2022-05-28 18:01:36 +02:00
parent 3c5b9ab4d5
commit 4b185019fe

View file

@ -1,10 +1,14 @@
package com.lagradost.cloudstream3.extractors.helper package com.lagradost.cloudstream3.extractors.helper
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.app
class WcoHelper { class WcoHelper {
companion object { companion object {
private const val BACKUP_KEY_DATA = "github_keys_backup"
data class ExternalKeys( data class ExternalKeys(
@JsonProperty("wco_key") @JsonProperty("wco_key")
val wcoKey: String? = null, val wcoKey: String? = null,
@ -16,7 +20,9 @@ class WcoHelper {
private suspend fun getKeys() { private suspend fun getKeys() {
keys = keys keys = keys
?: app.get("https://raw.githubusercontent.com/LagradOst/CloudStream-3/master/docs/keys.json") ?: app.get("https://raw.githubusercontent.com/LagradOst/CloudStream-3/master/docs/keys.json")
.parsedSafe() .parsedSafe<ExternalKeys>()?.also { setKey(BACKUP_KEY_DATA, it) } ?: getKey(
BACKUP_KEY_DATA
)
} }
suspend fun getWcoKey(): String? { suspend fun getWcoKey(): String? {