Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
fix: chinese characters not considered in URL
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzeng committed Jun 24, 2022
1 parent e6140ba commit 11e3521
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pinkoi-bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const missionKeyNames = [
'add_fav_shop',
'weekly_bonus'
]
const urlRegex = /https:\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])/g
const urlRegex = /https:\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w\p{Script=Han}.,@?^=%&:\/~+#-]*[\w\p{Script=Han}@?^=%&\/~+#-])/gu
const referer = 'https://www.pinkoi.com/event/mission_game'

function outdate(): never {
Expand Down Expand Up @@ -105,11 +105,11 @@ export default class PinkoiBot {
log.debug(`${missionKey}: url clicked: ${url}`)
}

await solve(urls[0])
await solve(encodeURI(urls[0]))
await sleep()
await solve(urls[1])
await solve(encodeURI(urls[1]))
await sleep()
await solve(urls[2])
await solve(encodeURI(urls[2]))
await sleep()

log.info(`Mission ${missionKey} solved.`)
Expand Down

0 comments on commit 11e3521

Please sign in to comment.