Skip to content

Commit 6644fc0

Browse files
authored
Update worker.js
1 parent 27dbd88 commit 6644fc0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

worker.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,15 @@ async function onInlineQuery (inlineQuery) {
9999
const regex = new RegExp(entry.source, "gi")
100100
if (regex.test(url.hostname)) {
101101
console.log("Regex detected: ", entry.source)
102-
//url.hostname.replace(regex, entry.target)
103-
url.hostname = entry.target
104-
console.log("New hostname: ", url.hostname)
105-
title = entry.name
106-
return false
102+
const validTarget = entry.target.find(urlExists)
103+
console.log("Valid target URL: ", validTarget)
104+
if (validTarget !== undefined) {
105+
//url.hostname.replace(regex, validTarget)
106+
url.hostname = validTarget
107+
console.log("New hostname: ", url.hostname)
108+
title = entry.name
109+
return false
110+
}
107111
}
108112
return true
109113
})

0 commit comments

Comments
 (0)