cache key

This commit is contained in:
LagradOst 2022-05-28 18:01:36 +02:00
parent 3c5b9ab4d5
commit 4b185019fe
1 changed files with 7 additions and 1 deletions

View File

@ -1,10 +1,14 @@
package com.lagradost.cloudstream3.extractors.helper
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
class WcoHelper {
companion object {
private const val BACKUP_KEY_DATA = "github_keys_backup"
data class ExternalKeys(
@JsonProperty("wco_key")
val wcoKey: String? = null,
@ -16,7 +20,9 @@ class WcoHelper {
private suspend fun getKeys() {
keys = keys
?: 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? {