Skip to content

Commit

Permalink
Update worker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kerivin authored Nov 22, 2024
1 parent 27dbd88 commit 6644fc0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,15 @@ async function onInlineQuery (inlineQuery) {
const regex = new RegExp(entry.source, "gi")
if (regex.test(url.hostname)) {
console.log("Regex detected: ", entry.source)
//url.hostname.replace(regex, entry.target)
url.hostname = entry.target
console.log("New hostname: ", url.hostname)
title = entry.name
return false
const validTarget = entry.target.find(urlExists)
console.log("Valid target URL: ", validTarget)
if (validTarget !== undefined) {
//url.hostname.replace(regex, validTarget)
url.hostname = validTarget
console.log("New hostname: ", url.hostname)
title = entry.name
return false
}
}
return true
})
Expand Down

0 comments on commit 6644fc0

Please sign in to comment.