Piped login: real username from /feed/rss subtitle (Split-based parse); profiles DELETE needs X-Playlet header + urlencoded id
This commit is contained in:
1 parent
da85f182bb
commit
fcd21e72e5
3 files changed
+27
-7
No files matched your search
@@ -40,7 +40,7 @@ requires_widevine_version=1.0
|
|||||||
playlet_lib_squashfs_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg
|
playlet_lib_squashfs_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg
|
||||||
playlet_lib_zip_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
playlet_lib_zip_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
||||||
playlet_lib_zip_embedded_url=pkg:/lib/playlet-lib.zip
|
playlet_lib_zip_embedded_url=pkg:/lib/playlet-lib.zip
|
||||||
playlet_lib_zip_debug_url=https://gitea.spaghet.io/spaghet/playlet-piped/raw/branch/main/piped/playlet-lib-1795491297.zip
|
playlet_lib_zip_debug_url=https://gitea.spaghet.io/spaghet/playlet-piped/raw/branch/main/piped/playlet-lib-1795495815.zip
|
||||||
|
|
||||||
git_commit_sha=unknown
|
git_commit_sha=unknown
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace Http
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function LibBuildTag() as string
|
function LibBuildTag() as string
|
||||||
return "PIPED-LIB-19"
|
return "PIPED-LIB-23"
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function FetchJson(path as string, params = invalid as object) as dynamic
|
function FetchJson(path as string, params = invalid as object) as dynamic
|
||||||
|
|||||||
@@ -383,20 +383,40 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
' The fork has no /user endpoint, but the authenticated RSS feed names
|
||||||
|
' the account: its <subtitle> is "Piped's RSS subscription feed for
|
||||||
|
' <username>.". Read the username from there; fall back to a stable
|
||||||
|
' uuid label if the shape ever changes. (The profile name is cosmetic.)
|
||||||
function LookupUsername(sessionUuid as string) as string
|
function LookupUsername(sessionUuid as string) as string
|
||||||
instance = m.GetInstance()
|
instance = m.GetInstance()
|
||||||
if StringUtils.IsNullOrEmpty(instance)
|
if StringUtils.IsNullOrEmpty(instance)
|
||||||
return "piped"
|
return "piped"
|
||||||
end if
|
end if
|
||||||
|
|
||||||
res = HttpClient.Get(`${instance}/subscriptions`).Header("Authorization", sessionUuid).Await()
|
' /feed/rss authenticates via ?authToken= (same contract as /feed).
|
||||||
|
' The pb nonce keeps this off Piped's ThrottlingCache replay keys.
|
||||||
|
nonce = CreateObject("roDeviceInfo").GetRandomUUID()
|
||||||
|
url = `${instance}/feed/rss?authToken=${sessionUuid}&pb=${nonce}`
|
||||||
|
res = HttpClient.Get(url).Await()
|
||||||
|
xml = ""
|
||||||
if res.IsSuccess()
|
if res.IsSuccess()
|
||||||
' no username in the body; just prove the session works
|
xml = res.Text()
|
||||||
|
end if
|
||||||
|
if not StringUtils.IsNullOrEmpty(xml)
|
||||||
|
' Split instead of Mid/InStr: substring indexing disagreed with
|
||||||
|
' the docs on this firmware (both off-by-one directions shipped
|
||||||
|
' wrong results); Split boundaries are unambiguous.
|
||||||
|
marker = "feed for "
|
||||||
|
parts = xml.Split(marker)
|
||||||
|
if parts.Count() > 1
|
||||||
|
tail = ValidString(parts[1])
|
||||||
|
name = ValidString(tail.Split(".")[0])
|
||||||
|
if name.Len() > 0 and name.Len() < 25
|
||||||
|
return name
|
||||||
|
end if
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
' Piped has no /user endpoint on this fork; the SSO broker's username
|
|
||||||
' equals the Authentik identity, which we can't see here. Fall back
|
|
||||||
' to a stable label. (The profile display name is cosmetic.)
|
|
||||||
return "piped-" + Left(sessionUuid, 8)
|
return "piped-" + Left(sessionUuid, 8)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user