1
0
mirror of https://github.com/zedeus/nitter.git synced 2026-04-14 01:32:32 -04:00

Add support for viewing account info

Fixes #1381
This commit is contained in:
Zed
2026-03-30 00:58:02 +02:00
parent 741060c78b
commit e7e7050c6e
12 changed files with 281 additions and 6 deletions

View File

@@ -158,6 +158,19 @@ proc getCachedUsername*(userId: string): Future[string] {.async.} =
# if not result.isNil:
# await cache(result)
proc cache*(data: AccountInfo; name: string) {.async.} =
await setEx("ai:" & toLower(name), baseCacheTime * 24, compress(toFlatty(data)))
proc getCachedAccountInfo*(username: string; fetch=true): Future[AccountInfo] {.async.} =
if username.len == 0: return
let name = toLower(username)
let cached = await get("ai:" & name)
if cached != redisNil:
cached.deserialize(AccountInfo)
elif fetch:
result = await getAboutAccount(username)
await cache(result, name)
proc getCachedPhotoRail*(id: string): Future[PhotoRail] {.async.} =
if id.len == 0: return
let rail = await get("pr2:" & toLower(id))