Skip to content

Commit

Permalink
feat(greader): compatible with Miniflux login
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashinch committed Jan 19, 2024
1 parent 193ed19 commit 3a64500
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3a64500

Please sign in to comment.