feat(greader): compatible with Miniflux login

This commit is contained in:
Ash 2024-01-19 14:58:36 +08:00
parent 193ed198a9
commit 3a645006b6
2 changed files with 23 additions and 5 deletions

View File

@ -62,11 +62,15 @@ class GoogleReaderAPI private constructor(
}
}
authData.clientLoginToken = clBody
.split("\n")
.find { it.startsWith("Auth=") }
?.substring(5)
?: throw Exception("body format error for CL Token:\n$clBody")
authData.clientLoginToken = try {
toDTO<GoogleReaderDTO.MinifluxAuthData>(clBody).Auth
} catch (ignore: Exception) {
clBody
.split("\n")
.find { it.startsWith("Auth=") }
?.substring(5)
?: throw Exception("body format error for CL Token:\n$clBody")
}
// Get action token
val actResponse = client.newCall(

View File

@ -8,6 +8,20 @@ object GoogleReaderDTO {
@SerializedName("errors") val errors: List<String>,
)
/**
* @sample
*{
* "SID": "demo/718*********************************7fa",
* "LSID": "demo/718*********************************7fa",
* "Auth": "demo/718*********************************7fa"
* }
*/
data class MinifluxAuthData(
val SID: String?,
val LSID: String?,
val Auth: String?,
)
/**
* @link reader/api/0/user-info?output=json
* @sample