about summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-10-18 00:14:26 +0200
committerbptato <nincsnevem662@gmail.com>2024-10-18 00:28:59 +0200
commit1e23aefe5012af0f4dcbae3dc2d4e517948db6e6 (patch)
tree25b1082e6327b44d888d7bc137bcbbca96057c0e /res
parent6751b1a1aef638d6a831b57b32199fb60dc5b142 (diff)
downloadchawan-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.toml8
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);
 }