mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-21 01:41:32 +00:00
Fixed crash when signature fields are wrongly populated.
This commit is contained in:
parent
13100dc38d
commit
bcab3bccbc
1 changed files with 13 additions and 5 deletions
|
@ -4,6 +4,7 @@ import android.net.Uri
|
||||||
import com.futo.platformplayer.SignatureProvider
|
import com.futo.platformplayer.SignatureProvider
|
||||||
import com.futo.platformplayer.api.media.Serializer
|
import com.futo.platformplayer.api.media.Serializer
|
||||||
import com.futo.platformplayer.engine.IV8PluginConfig
|
import com.futo.platformplayer.engine.IV8PluginConfig
|
||||||
|
import com.futo.platformplayer.logging.Logger
|
||||||
import com.futo.platformplayer.matchesDomain
|
import com.futo.platformplayer.matchesDomain
|
||||||
import com.futo.platformplayer.states.StatePlugins
|
import com.futo.platformplayer.states.StatePlugins
|
||||||
import kotlinx.serialization.Contextual
|
import kotlinx.serialization.Contextual
|
||||||
|
@ -168,12 +169,17 @@ class SourcePluginConfig(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun validate(text: String): Boolean {
|
fun validate(text: String): Boolean {
|
||||||
if(scriptPublicKey.isNullOrEmpty())
|
try {
|
||||||
|
if (scriptPublicKey.isNullOrEmpty())
|
||||||
throw IllegalStateException("No public key present");
|
throw IllegalStateException("No public key present");
|
||||||
if(scriptSignature.isNullOrEmpty())
|
if (scriptSignature.isNullOrEmpty())
|
||||||
throw IllegalStateException("No signature present");
|
throw IllegalStateException("No signature present");
|
||||||
|
|
||||||
return SignatureProvider.verify(text, scriptSignature, scriptPublicKey);
|
return SignatureProvider.verify(text, scriptSignature, scriptPublicKey);
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
Logger.e(TAG, "Failed to verify due to an unhandled exception", e)
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isUrlAllowed(url: String): Boolean {
|
fun isUrlAllowed(url: String): Boolean {
|
||||||
|
@ -204,6 +210,8 @@ class SourcePluginConfig(
|
||||||
obj.sourceUrl = sourceUrl;
|
obj.sourceUrl = sourceUrl;
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val TAG = "SourcePluginConfig"
|
||||||
}
|
}
|
||||||
|
|
||||||
@kotlinx.serialization.Serializable
|
@kotlinx.serialization.Serializable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue