about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-06-08 23:30:03 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-08 23:30:03 +0200
commit5df9ef4c810a1f1975f6e140f4c97aa602d37724 (patch)
tree2d85634809a464d0199dc0e1ba23b106ad0b7c4c /src
parent8776e58beb524ff26c171e0b8765aefcfd56fcc9 (diff)
downloadchawan-5df9ef4c810a1f1975f6e140f4c97aa602d37724.tar.gz
pager: send Accept: */* for viewImage
Diffstat (limited to 'src')
-rw-r--r--src/local/pager.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim
index 16cd20a0..8076020f 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -1302,8 +1302,13 @@ proc load(pager: Pager; s = "") {.jsfunc.} =
     pager.setLineEdit(lmLocation, s)
 
 # Go to specific URL (for JS)
-proc jsGotoURL(pager: Pager; s: string): JSResult[void] {.jsfunc: "gotoURL".} =
-  pager.gotoURL(newRequest(?newURL(s)))
+proc jsGotoURL(pager: Pager; v: JSValue): JSResult[void] {.jsfunc: "gotoURL".} =
+  let req = fromJS[JSRequest](pager.jsctx, v)
+  if req.isSome:
+    pager.gotoURL(req.get.request)
+  else:
+    let s = ?fromJS[string](pager.jsctx, v)
+    pager.gotoURL(newRequest(?newURL(s)))
   ok()
 
 # Reload the page in a new buffer, then kill the previous buffer.