diff options
author | bptato <nincsnevem662@gmail.com> | 2024-10-18 00:14:26 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-10-18 00:28:59 +0200 |
commit | 1e23aefe5012af0f4dcbae3dc2d4e517948db6e6 (patch) | |
tree | 25b1082e6327b44d888d7bc137bcbbca96057c0e /res | |
parent | 6751b1a1aef638d6a831b57b32199fb60dc5b142 (diff) | |
download | chawan-1e23aefe5012af0f4dcbae3dc2d4e517948db6e6.tar.gz |
config.toml: add ?q=/path Google redirect
apparently this is relative to the current page
Diffstat (limited to 'res')
-rw-r--r-- | res/config.toml | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/res/config.toml b/res/config.toml index 43a61072..56847db7 100644 --- a/res/config.toml +++ b/res/config.toml @@ -328,8 +328,12 @@ substitute-url = 'x => `https://www.google.com/search?gbv=1&ucbcb=1&q=${x.split( url = '^https?://(www\.)?google\.com' rewrite-url = ''' x => { - if (x.pathname == "/url") - return new URL(x.searchParams.get("q")); + if (x.pathname == "/url") { + let q = x.searchParams.get("q"); + if (q[0] == '/') + q = x.protocol + x.host + q; + return new URL(q); + } for (const name of ["sca_esv", "sca_upv", "oq", "aqs", "ved", "sa", "source", "ei"]) x.searchParams.delete(name); } |