diff --git a/src/parser.nim b/src/parser.nim index 10d2866..95a1fbc 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -466,14 +466,6 @@ proc parseGraphTweet(js: JsonNode; isLegacy=false): Tweet = if result.quote.isSome: result.quote = some(parseGraphTweet(js{"quoted_status_result", "result"}, isLegacy)) - with communityNote, js{"birdwatch_pivot"}: - let note = BirdwatchNote( - id: communityNote{"note", "rest_id"}.getId, - title: communityNote{"title"}.getStr, - ) - note.expandBirdwatchEntities(communityNote{"subtitle"}) - result.birdwatch = some(note) - proc parseGraphThread(js: JsonNode): tuple[thread: Chain; self: bool] = for t in js{"content", "items"}: let entryId = t{"entryId"}.getStr diff --git a/src/parserutils.nim b/src/parserutils.nim index 0995fee..00ea6f4 100644 --- a/src/parserutils.nim +++ b/src/parserutils.nim @@ -319,28 +319,3 @@ proc expandNoteTweetEntities*(tweet: Tweet; js: JsonNode) = tweet.expandTextEntities(entities, text, textSlice) tweet.text = tweet.text.multiReplace((unicodeOpen, xmlOpen), (unicodeClose, xmlClose)) - -proc expandBirdwatchEntities*(note: BirdwatchNote; js: JsonNode) = - let - entities = ? js{"entities"} - text = js{"text"}.getStr - runes = text.toRunes - - var replacements = newSeq[ReplaceSlice]() - - for ent in entities: - let - # twitter devs in their infinite wisdom making these entities of all others 1 indexed - slice = (ent{"fromIndex"}.getInt - 1) .. (ent{"toIndex"}.getInt - 1) - refType = ent{"ref", "type"}.getStr - - case refType - of "TimelineUrl": - let - url = ent{"ref", "url"}.getStr - display = $runes[slice] - - replacements.add ReplaceSlice(kind: rkUrl, slice: slice, url: url, display: display) - - note.text = runes.replacedWith(replacements, 0 .. runes.len) - diff --git a/src/routes/status.nim b/src/routes/status.nim index 66bddb4..232b55e 100644 --- a/src/routes/status.nim +++ b/src/routes/status.nim @@ -86,12 +86,12 @@ proc createStatusRouter*(cfg: Config) = let gif = get(conv.tweet.gif) images = @[gif.thumb] video = getPicUrl(gif.url) - #elif conv.tweet.card.isSome(): - # let card = conv.tweet.card.get() - # if card.image.len > 0: - # images = @[card.image] - # elif card.video.isSome(): - # images = @[card.video.get().thumb] + elif conv.tweet.card.isSome(): + let card = conv.tweet.card.get() + if card.image.len > 0: + images = @[card.image] + elif card.video.isSome(): + images = @[card.video.get().thumb] let html = renderConversation(conv, prefs, getPath() & "#m") resp renderMain(html, request, cfg, prefs, title, desc, ogTitle, diff --git a/src/sass/tweet/_base.scss b/src/sass/tweet/_base.scss index 6621a3f..3431a7b 100644 --- a/src/sass/tweet/_base.scss +++ b/src/sass/tweet/_base.scss @@ -7,7 +7,6 @@ @import 'card'; @import 'poll'; @import 'quote'; -@import 'community_note'; .tweet-body { flex: 1; diff --git a/src/sass/tweet/community_note.scss b/src/sass/tweet/community_note.scss deleted file mode 100644 index 9643dd9..0000000 --- a/src/sass/tweet/community_note.scss +++ /dev/null @@ -1,30 +0,0 @@ -@import '_variables'; - -.community-note { - margin-top: 10px; - border: solid 1px var(--dark_grey); - border-radius: 10px; - background-color: var(--bg_elements); - overflow: hidden; - pointer-events: all; - position: relative; - width: 100%; - - &:hover { - border-color: var(--grey); - } - - .community-note-title { - font-weight: bold; - background-color: var(--bg_overlays); - padding: 6px 8px; - margin-top: 1px; - } - - .community-note-text { - overflow: hidden; - white-space: pre-wrap; - word-wrap: break-word; - padding: 8px; - } -} diff --git a/src/types.nim b/src/types.nim index 4fdef5a..d60248d 100644 --- a/src/types.nim +++ b/src/types.nim @@ -198,11 +198,6 @@ type likes*: int quotes*: int - BirdwatchNote* = ref object - id*: int64 - title*: string - text*: string - Tweet* = ref object id*: int64 threadId*: int64 @@ -228,7 +223,6 @@ type gif*: Option[Gif] video*: Option[Video] photos*: seq[string] - birdwatch*: Option[BirdwatchNote] Tweets* = seq[Tweet] diff --git a/src/views/tweet.nim b/src/views/tweet.nim index 1603b2a..4081900 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -263,14 +263,6 @@ proc renderQuote(quote: Tweet; prefs: Prefs; path: string): VNode = if quote.photos.len > 0 or quote.video.isSome or quote.gif.isSome: renderQuoteMedia(quote, prefs, path) -proc renderCommunityNote(note: BirdwatchNote; prefs: Prefs): VNode = - buildHtml(tdiv(class="community-note")): - tdiv(class="community-note-title"): - text note.title - - tdiv(class="community-note-text", dir="auto"): - verbatim replaceUrls(note.text, prefs) - proc renderLocation*(tweet: Tweet): string = let (place, url) = tweet.getLocation() if place.len == 0: return @@ -351,9 +343,6 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0; if tweet.quote.isSome: renderQuote(tweet.quote.get(), prefs, path) - if mainTweet and tweet.birdwatch.isSome: - renderCommunityNote(tweet.birdwatch.get(), prefs) - if mainTweet: p(class="tweet-published"): text &"{getTime(tweet)}"