Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9ba0661
Test kotlinx-serialization support
Luna712 May 13, 2026
d7db2e0
-
Luna712 May 13, 2026
94a6bc9
Add
Luna712 May 13, 2026
450e767
Update
Luna712 May 14, 2026
bcad70a
Try
Luna712 May 14, 2026
167b3ba
Update
Luna712 May 14, 2026
67a4439
-
Luna712 May 14, 2026
4329599
Fix
Luna712 May 14, 2026
4f0d867
Data class
Luna712 May 14, 2026
809e9bd
Fix
Luna712 May 14, 2026
11d07f4
No data class
Luna712 May 14, 2026
19fdb83
Add
Luna712 May 14, 2026
52e5689
add
Luna712 May 14, 2026
0e552c1
Add
Luna712 May 14, 2026
2167bf2
Add
Luna712 May 14, 2026
e26c8fc
Update
Luna712 May 14, 2026
80fff23
JsonElement
Luna712 May 14, 2026
817b5d3
Use JsonElement
Luna712 May 14, 2026
bc8efcd
Fix
Luna712 May 14, 2026
2694184
Fix
Luna712 May 14, 2026
ca8032f
Fix val
Luna712 May 14, 2026
e062e6e
Try transient
Luna712 May 14, 2026
b451213
Fix defaults
Luna712 May 14, 2026
5a9517a
Fix cast
Luna712 May 14, 2026
b913d2c
Fix defaults
Luna712 May 14, 2026
120bb73
+ExtractorLink
Luna712 May 14, 2026
2a9aca2
+SubtitleData
Luna712 May 14, 2026
52e468b
+ResultEpisode
Luna712 May 14, 2026
164331f
Transient
Luna712 May 14, 2026
8a1d1f8
+AudioFile
Luna712 May 14, 2026
35c0d65
+SeasonData
Luna712 May 14, 2026
95f553f
Add UriSerializer
Luna712 May 14, 2026
bc54724
Use UriSerializer
Luna712 May 14, 2026
cb4e6d3
Use UriSerializer
Luna712 May 14, 2026
74960ea
Fix parser
Luna712 May 14, 2026
9aeac02
Try support in DataStore
Luna712 May 14, 2026
f152393
Fix
Luna712 May 14, 2026
2494687
Fix
Luna712 May 14, 2026
e8cad16
Public
Luna712 May 14, 2026
162e23f
Try AppUtils support
Luna712 May 14, 2026
03f3905
Fix?
Luna712 May 14, 2026
1c1ee88
-
Luna712 May 14, 2026
3d893a9
-
Luna712 May 14, 2026
f9cc1d5
Fix parse
Luna712 May 14, 2026
656477c
Fix
Luna712 May 14, 2026
fda2886
Fix
Luna712 May 14, 2026
b49ca7a
Fix
Luna712 May 14, 2026
9cef364
Fix
Luna712 May 14, 2026
a1faeb4
Try fix
Luna712 May 14, 2026
a0aeb13
Fix
Luna712 May 14, 2026
0f3e2e3
-
Luna712 May 14, 2026
58244ec
Fix
Luna712 May 14, 2026
64f77aa
Merge branch 'coil-ktor' into test-kotlinx
Luna712 May 15, 2026
392caec
Merge branch 'coil-ktor' into test-kotlinx
Luna712 May 15, 2026
f465a06
Merge branch 'coil-ktor' into test-kotlinx
Luna712 May 15, 2026
56bbf25
Support
Luna712 May 15, 2026
63dc8e2
Fix
Luna712 May 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.dokka)
alias(libs.plugins.kotlin.serialization)
}

val javaTarget = JvmTarget.fromTarget(libs.versions.jvmTarget.get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import com.fasterxml.jackson.annotation.JsonProperty
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import com.lagradost.cloudstream3.actions.OpenInAppAction
import com.lagradost.cloudstream3.BuildConfig
import com.lagradost.cloudstream3.ui.player.ExtractorUri
Expand All @@ -22,6 +23,7 @@ import com.lagradost.cloudstream3.utils.newExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromCodeToLangTagIETF
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromLanguageToTagIETF
import com.lagradost.cloudstream3.utils.serializer.UriSerializer
import com.lagradost.cloudstream3.utils.txt

/**
Expand Down Expand Up @@ -49,18 +51,20 @@ class CloudStreamPackage : OpenInAppAction(
const val DURATION_EXTRA: String = "dur" // Duration time in MS (Long)
}

@Serializable
data class MinimalVideoLink(
@JsonProperty("uri")
@SerialName("uri")
@Serializable(with = UriSerializer::class)
val uri: Uri?,
@JsonProperty("url")
@SerialName("url")
val url: String?,
@JsonProperty("mimeType")
@SerialName("mimeType")
val mimeType: String = "video/mp4",
@JsonProperty("name")
@SerialName("name")
val name: String?,
@JsonProperty("headers")
@SerialName("headers")
var headers: Map<String, String> = mapOf(),
@JsonProperty("quality")
@SerialName("quality")
val quality: Int?,
) {
companion object {
Expand Down Expand Up @@ -97,15 +101,15 @@ class CloudStreamPackage : OpenInAppAction(
}
}


@Serializable
data class MinimalSubtitleLink(
@JsonProperty("url")
@SerialName("url")
val url: String,
@JsonProperty("mimeType")
@SerialName("mimeType")
val mimeType: String = "text/vtt",
@JsonProperty("name")
@SerialName("name")
val name: String?,
@JsonProperty("headers")
@SerialName("headers")
var headers: Map<String, String> = mapOf(),
) {
companion object {
Expand Down Expand Up @@ -159,4 +163,4 @@ class CloudStreamPackage : OpenInAppAction(
override fun onResult(activity: Activity, intent: Intent?) {
// No results yet
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.fragment.app.FragmentActivity
import com.fasterxml.jackson.annotation.JsonProperty
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.APIHolder.removePluginMapping
import com.lagradost.cloudstream3.AllLanguagesName
Expand Down Expand Up @@ -73,12 +74,13 @@ const val EXTENSIONS_CHANNEL_NAME = "Extensions"
const val EXTENSIONS_CHANNEL_DESCRIPT = "Extension notification channel"

// Data class for internal storage
@Serializable
data class PluginData(
@JsonProperty("internalName") val internalName: String,
@JsonProperty("url") val url: String?,
@JsonProperty("isOnline") val isOnline: Boolean,
@JsonProperty("filePath") val filePath: String,
@JsonProperty("version") val version: Int,
@SerialName("internalName") val internalName: String,
@SerialName("url") val url: String?,
@SerialName("isOnline") val isOnline: Boolean,
@SerialName("filePath") val filePath: String,
@SerialName("version") val version: Int,
) {
@WorkerThread
fun toSitePlugin(): SitePlugin {
Expand Down Expand Up @@ -610,7 +612,7 @@ object PluginManager {
return false
}
InputStreamReader(stream).use { reader ->
manifest = parseJson(reader, BasePlugin.Manifest::class.java)
manifest = parseJson<BasePlugin.Manifest>(reader.readText())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package com.lagradost.cloudstream3.plugins

import android.content.Context
import androidx.annotation.WorkerThread
import com.fasterxml.jackson.annotation.JsonProperty
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import com.lagradost.cloudstream3.CloudStreamApp.Companion.context
import com.lagradost.cloudstream3.CloudStreamApp.Companion.getKey
import com.lagradost.cloudstream3.CloudStreamApp.Companion.setKey
Expand Down Expand Up @@ -30,12 +31,13 @@ import java.util.concurrent.atomic.AtomicInteger
* Comes with the app, always available in the app, non removable.
* */

@Serializable
data class Repository(
@JsonProperty("iconUrl") val iconUrl: String?,
@JsonProperty("name") val name: String,
@JsonProperty("description") val description: String?,
@JsonProperty("manifestVersion") val manifestVersion: Int,
@JsonProperty("pluginLists") val pluginLists: List<String>
@SerialName("iconUrl") val iconUrl: String?,
@SerialName("name") val name: String,
@SerialName("description") val description: String?,
@SerialName("manifestVersion") val manifestVersion: Int,
@SerialName("pluginLists") val pluginLists: List<String>
)

/**
Expand All @@ -45,32 +47,33 @@ data class Repository(
* 2: Slow
* 3: Beta only
* */
@Serializable
data class SitePlugin(
// Url to the .cs3 file
@JsonProperty("url") val url: String,
@SerialName("url") val url: String,
// Status to remotely disable the provider
@JsonProperty("status") val status: Int,
@SerialName("status") val status: Int,
// Integer over 0, any change of this will trigger an auto update
@JsonProperty("version") val version: Int,
@SerialName("version") val version: Int,
// Unused currently, used to make the api backwards compatible?
// Set to 1
@JsonProperty("apiVersion") val apiVersion: Int,
@SerialName("apiVersion") val apiVersion: Int,
// Name to be shown in app
@JsonProperty("name") val name: String,
@SerialName("name") val name: String,
// Name to be referenced internally. Separate to make name and url changes possible
@JsonProperty("internalName") val internalName: String,
@JsonProperty("authors") val authors: List<String>,
@JsonProperty("description") val description: String?,
@SerialName("internalName") val internalName: String,
@SerialName("authors") val authors: List<String>,
@SerialName("description") val description: String?,
// Might be used to go directly to the plugin repo in the future
@JsonProperty("repositoryUrl") val repositoryUrl: String?,
@SerialName("repositoryUrl") val repositoryUrl: String?,
// These types are yet to be mapped and used, ignore for now
@JsonProperty("tvTypes") val tvTypes: List<String>?,
@SerialName("tvTypes") val tvTypes: List<String>?,
// Most often a language tag like "en" or "zh-TW"
@JsonProperty("language") val language: String?,
@JsonProperty("iconUrl") val iconUrl: String?,
@SerialName("language") val language: String?,
@SerialName("iconUrl") val iconUrl: String?,
// Automatically generated by the gradle plugin
@JsonProperty("fileSize") val fileSize: Long?,
@JsonProperty("fileHash") val fileHash: String?,
@SerialName("fileSize") val fileSize: Long?,
@SerialName("fileHash") val fileHash: String?,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package com.lagradost.cloudstream3.syncproviders

import android.util.Base64
import androidx.annotation.WorkerThread
import com.fasterxml.jackson.annotation.JsonProperty
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import com.lagradost.cloudstream3.APIHolder.unixTime
import com.lagradost.cloudstream3.ActorData
import com.lagradost.cloudstream3.CloudStreamApp.Companion.getKey
Expand Down Expand Up @@ -56,28 +57,29 @@ data class AuthLoginPage(
val payload: String? = null,
)

@Serializable
data class AuthToken(
/**
* This is the general access tokens/api token representing a logged in user.
*
* `Access tokens are the thing that applications use to make API requests on behalf of a user.`
* */
@JsonProperty("accessToken")
@SerialName("accessToken")
val accessToken: String? = null,
/**
* For OAuth a special refresh token is issues to refresh the access token.
* */
@JsonProperty("refreshToken")
@SerialName("refreshToken")
val refreshToken: String? = null,
/** In UnixTime (sec) when it expires */
@JsonProperty("accessTokenLifetime")
@SerialName("accessTokenLifetime")
val accessTokenLifetime: Long? = null,
/** In UnixTime (sec) when it expires */
@JsonProperty("refreshTokenLifetime")
@SerialName("refreshTokenLifetime")
val refreshTokenLifetime: Long? = null,
/** Sometimes AuthToken needs to be customized to store e.g. username/password,
* this acts as a catch all to store text or JSON data. */
@JsonProperty("payload")
@SerialName("payload")
val payload: String? = null,
) {
fun isAccessTokenExpired(marginSec: Long = 10L) =
Expand All @@ -87,19 +89,20 @@ data class AuthToken(
refreshTokenLifetime != null && (System.currentTimeMillis() / 1000) + marginSec >= refreshTokenLifetime
}

@Serializable
data class AuthUser(
/** Account display-name, can also be email if name does not exist */
@JsonProperty("name")
@SerialName("name")
val name: String?,
/** Unique account identifier,
* if a subsequent login is done then it will be refused if another account with the same id exists*/
@JsonProperty("id")
@SerialName("id")
val id: Int,
/** Profile picture URL */
@JsonProperty("profilePicture")
@SerialName("profilePicture")
val profilePicture: String? = null,
/** Profile picture Headers of the URL */
@JsonProperty("profilePictureHeader")
@SerialName("profilePictureHeader")
val profilePictureHeaders: Map<String, String>? = null
)

Expand All @@ -111,10 +114,11 @@ data class AuthUser(
* Any local set/get key should use user.id.toString(),
* as token.accessToken (even hashed) is unsecure, and will rotate.
* */
@Serializable
data class AuthData(
@JsonProperty("user")
@SerialName("user")
val user: AuthUser,
@JsonProperty("token")
@SerialName("token")
val token: AuthToken,
)

Expand All @@ -138,14 +142,15 @@ data class AuthLoginRequirement(
)

/** What the user responds to the AuthLoginRequirement */
@Serializable
data class AuthLoginResponse(
@JsonProperty("password")
@SerialName("password")
val password: String?,
@JsonProperty("username")
@SerialName("username")
val username: String?,
@JsonProperty("email")
@SerialName("email")
val email: String?,
@JsonProperty("server")
@SerialName("server")
val server: String?,
)

Expand Down
Loading