このコミットが含まれているのは:
テクニカル諏訪子 2022-02-23 19:02:43 +09:00
コミット 11b319844d
3個のファイルの変更10行の追加7行の削除

ファイルの表示

@ -1,14 +1,14 @@
import std/[algorithm, unicode, re, strutils, strformat, options]
import std/[algorithm, unicode, re, strutils, strformat, options, nre]
import jsony
import utils, slices
import ../types/user as userType
from ../../types import User, Error
let
unRegex = re"(^|[^A-z0-9-_./?])@([A-z0-9_]{1,15})"
unRegex = re.re"(^|[^A-z0-9-_./?])@([A-z0-9_]{1,15})"
unReplace = "$1<a href=\"/$2\">@$2</a>"
htRegex = re"(^|[^\w-_./?])([#$])([\w_]+)"
htRegex = nre.re"""(*U)(^|[^\w-_.?])([#$])([\w_]*+)(?!</a>|">|#)"""
htReplace = "$1<a href=\"/search?q=%23$3\">$2$3</a>"
proc expandUserEntities(user: var User; raw: RawUser) =
@ -29,7 +29,7 @@ proc expandUserEntities(user: var User; raw: RawUser) =
user.bio = orig.replacedWith(replacements, 0 .. orig.len)
.replacef(unRegex, unReplace)
.replacef(htRegex, htReplace)
.replace(htRegex, htReplace)
proc getBanner(user: RawUser): string =
if user.profileBannerUrl.len > 0:

ファイルの表示

@ -98,8 +98,6 @@
}
.avatar {
position: absolute;
&.round {
border-radius: 50%;
}
@ -133,8 +131,13 @@
.card-image img {
height: auto;
}
.avatar {
position: absolute;
}
}
.attribution {
display: flex;
pointer-events: all;

ファイルの表示

@ -93,7 +93,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
meta(property="og:site_name", content="Nitter")
meta(property="og:locale", content="en_US")
if banner.len > 0:
if banner.len > 0 and not banner.startsWith('#'):
let bannerUrl = getPicUrl(banner)
link(rel="preload", type="image/png", href=bannerUrl, `as`="image")