Sfoglia il codice sorgente

Use the correct format string for fetching files from twitter.
Per their docs https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/entities#photo_format

decoy-walrus 4 anni fa
parent
commit
644fe41a08
2 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 1 1
      src/routes/media.nim
  2. 2 2
      src/views/tweet.nim

+ 1 - 1
src/routes/media.nim

@@ -94,7 +94,7 @@ proc createMediaRouter*(cfg: Config) =
         url.insert(twimg)
       if not url.startsWith(https):
         url.insert(https)
-      url.add(":orig")
+      url.add("?name=orig")
 
       let uri = parseUri(url)
       cond isTwitterUrl(uri) == true

+ 2 - 2
src/views/tweet.nim

@@ -10,7 +10,7 @@ import general
 proc getSmallPic(url: string): string =
   result = url
   if "?" notin url and not url.endsWith("placeholder.png"):
-    result &= ":small"
+    result &= "?name=small"
   result = getPicUrl(result)
 
 proc renderMiniAvatar(user: User; prefs: Prefs): VNode =
@@ -58,7 +58,7 @@ proc renderAlbum(tweet: Tweet): VNode =
             let
               named = "name=" in photo
               orig = photo
-              small = if named: photo else: photo & ":small"
+              small = if named: photo else: photo & "?name=small"
             a(href=getOrigPicUrl(orig), class="still-image", target="_blank"):
               genImg(small)