From 4b185019feea83e37dfabe82ca9eca6c6bd8bbb9 Mon Sep 17 00:00:00 2001 From: LagradOst <11805592+LagradOst@users.noreply.github.com> Date: Sat, 28 May 2022 18:01:36 +0200 Subject: [PATCH] cache key --- .../lagradost/cloudstream3/extractors/helper/WcoHelper.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/helper/WcoHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/helper/WcoHelper.kt index f14000c0..0590a8fe 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/helper/WcoHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/helper/WcoHelper.kt @@ -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()?.also { setKey(BACKUP_KEY_DATA, it) } ?: getKey( + BACKUP_KEY_DATA + ) } suspend fun getWcoKey(): String? {