Add support for business and gov verification

Also improve icon rendering on Firefox
This commit is contained in:
Zed
2023-11-25 10:06:12 +00:00
parent d6be08d093
commit f8254c2f0f
14 changed files with 59 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
import options
import jsony
import user, ../types/[graphuser, graphlistmembers]
from ../../types import User, Result, Query, QueryKind
from ../../types import User, VerifiedType, Result, Query, QueryKind
proc parseGraphUser*(json: string): User =
if json.len == 0 or json[0] != '{':
@@ -14,7 +14,8 @@ proc parseGraphUser*(json: string): User =
result = raw.data.userResult.result.legacy
result.id = raw.data.userResult.result.restId
result.verified = result.verified or raw.data.userResult.result.isBlueVerified
if result.verifiedType == none and raw.data.userResult.result.isBlueVerified:
result.verifiedType = blue
proc parseGraphListMembers*(json, cursor: string): Result[User] =
result = Result[User](

View File

@@ -1,7 +1,6 @@
import std/[options, tables, strutils, strformat, sugar]
import jsony
import user
import ../types/unifiedcard
import user, ../types/unifiedcard
from ../../types import Card, CardKind, Video
from ../../utils import twimg, https

View File

@@ -56,7 +56,7 @@ proc toUser*(raw: RawUser): User =
tweets: raw.statusesCount,
likes: raw.favouritesCount,
media: raw.mediaCount,
verified: raw.verified or raw.extIsBlueVerified,
verifiedType: raw.verifiedType,
protected: raw.protected,
joinDate: parseTwitterDate(raw.createdAt),
banner: getBanner(raw),

View File

@@ -1,5 +1,6 @@
import options
import common
from ../../types import VerifiedType
type
RawUser* = object
@@ -15,8 +16,7 @@ type
favouritesCount*: int
statusesCount*: int
mediaCount*: int
verified*: bool
extIsBlueVerified*: bool
verifiedType*: VerifiedType
protected*: bool
profileLinkColor*: string
profileBannerUrl*: string