Skip to content

Commit

Permalink
Corrected region-stripping regex in msgs getter ↞ [auto-sync from `ad…
Browse files Browse the repository at this point in the history
…amlui/chatgpt-apps/chatgpt-infinity/greasemonkey`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Jun 17, 2024
1 parent 13c4501 commit 77001bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions greasemonkey/chatgpt-infinity.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
// @description:zh-TW 從無所不知的 ChatGPT 生成無窮無盡的答案 (用任何語言!)
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.6.12
// @version 2024.6.16
// @license MIT
// @match *://chatgpt.com/*
// @match *://chat.openai.com/*
Expand Down Expand Up @@ -270,7 +270,7 @@
} catch (err) { // if bad response
msgXHRtries++ ; if (msgXHRtries == 3) return resolve({}) // try up to 3X (original/region-stripped/EN) only
msgHref = config.userLanguage.includes('-') && msgXHRtries == 1 ? // if regional lang on 1st try...
msgHref.replace(/([^_]*)_[^/]*(\/.*)/, '$1$2') // ...strip region before retrying
msgHref.replace(/([^_]+_[^_]+)_[^/]*(\/.*)/, '$1$2') // ...strip region before retrying
: ( msgHostDir + 'en/messages.json' ) // else use default English messages
GM.xmlHttpRequest({ method: 'GET', url: msgHref, onload: onLoad })
}
Expand Down

0 comments on commit 77001bc

Please sign in to comment.