mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-13 03:26:30 +00:00
Referer cleanup
This commit is contained in:
parent
1e55f21fa5
commit
7bdf5b0f76
3 changed files with 15 additions and 10 deletions
|
@ -1,6 +1,7 @@
|
|||
import tables, macros, strformat, xmltree
|
||||
import karax/[karaxdsl, vdom, vstyles]
|
||||
|
||||
import renderutils
|
||||
import ../types, ../prefs_impl
|
||||
|
||||
proc genCheckbox(pref, label: string; state: bool): VNode =
|
||||
|
@ -55,14 +56,11 @@ proc renderPreferences*(prefs: Prefs; path: string): VNode =
|
|||
buildHtml(tdiv(class="preferences-container")):
|
||||
fieldset(class="preferences"):
|
||||
form(`method`="post", action="/saveprefs"):
|
||||
verbatim "<input name=\"referer\" style=\"display: none\" value=\"$1\"/>" % path
|
||||
refererField path
|
||||
|
||||
renderPrefs()
|
||||
|
||||
button(`type`="submit", class="pref-submit"):
|
||||
text "Save preferences"
|
||||
|
||||
form(`method`="post", action="/resetprefs", class="pref-reset"):
|
||||
verbatim "<input name=\"referer\" style=\"display: none\" value=\"$1\"/>" % path
|
||||
button(`type`="submit"):
|
||||
text "Reset preferences"
|
||||
buttonReferer "/resetprefs", "Reset Preferences", path, class="pref-reset"
|
||||
|
|
|
@ -39,8 +39,18 @@ proc linkText*(text: string; class=""): VNode =
|
|||
buildHtml():
|
||||
a(href=url, class=class): text text
|
||||
|
||||
proc refererField*(path: string): VNode =
|
||||
buildHtml():
|
||||
verbatim "<input name=\"referer\" style=\"display: none\" value=\"$1\"/>" % path
|
||||
|
||||
proc iconReferer*(icon, action, path: string, title=""): VNode =
|
||||
buildHtml(form(`method`="get", action=action, class="icon-button")):
|
||||
verbatim "<input name=\"referer\" style=\"display: none\" value=\"$1\"/>" % path
|
||||
refererField path
|
||||
button(`type`="submit"):
|
||||
icon icon, title=title
|
||||
|
||||
proc buttonReferer*(action, text, path: string; class=""; `method`="post"): VNode =
|
||||
buildHtml(form(`method`=`method`, action=action, class=class)):
|
||||
refererField path
|
||||
button(`type`="submit"):
|
||||
text text
|
||||
|
|
|
@ -58,10 +58,7 @@ proc renderVideoDisabled(video: Video; path: string): VNode =
|
|||
of mp4:
|
||||
p: text "mp4 playback disabled in preferences"
|
||||
of m3u8, vmap:
|
||||
form(`method`="post", action=("/enablehls")):
|
||||
verbatim "<input name=\"referer\" style=\"display: none\" value=\"$1\"/>" % path
|
||||
button(`type`="submit"):
|
||||
text "Enable hls playback"
|
||||
buttonReferer "/enablehls", "Enable hls playback", path
|
||||
|
||||
proc renderVideoUnavailable(video: Video): VNode =
|
||||
buildHtml(tdiv):
|
||||
|
|
Loading…
Reference in a new issue