@jetthai/cuora 1.1.382 → 1.1.383

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.383](https://github.com/jetthai/cuora-module/compare/v1.1.382...v1.1.383) (2025-09-16)
6
+
5
7
  ### [1.1.382](https://github.com/jetthai/cuora-module/compare/v1.1.381...v1.1.382) (2025-09-16)
6
8
 
7
9
  ### [1.1.381](https://github.com/jetthai/cuora-module/compare/v1.1.380...v1.1.381) (2025-09-15)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.382",
3
+ "version": "1.1.383",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -295,8 +295,7 @@ export default function (request) {
295
295
  services: {
296
296
  fetchTags: async (context, event) => {
297
297
  const { keyword, lang } = context
298
- const encodedKeyword = encodeURIComponent(keyword)
299
- const { result } = await request.send(game.getGameTags({ q: encodedKeyword, lang }))
298
+ const { result } = await request.send(game.getGameTags({ q: keyword, lang }))
300
299
  return {
301
300
  tagList: result,
302
301
  }
@@ -341,8 +341,7 @@ export default function (request) {
341
341
  services: {
342
342
  fetchTags: async (context, event) => {
343
343
  const { keyword, lang } = context
344
- const encodedKeyword = encodeURIComponent(keyword)
345
- const { result } = await request.send(game.getGameTags({ q: encodedKeyword, lang }))
344
+ const { result } = await request.send(game.getGameTags({ q: keyword, lang }))
346
345
  return result
347
346
  },
348
347
  fetchInitialData: async (context, event) => {
@@ -159,6 +159,30 @@ export default class Request {
159
159
  }
160
160
 
161
161
  initialize() {
162
+ // 自定義參數序列化器 - 避免使用 URLSearchParams
163
+ this.axios.defaults.paramsSerializer = function (params) {
164
+ return Object.keys(params)
165
+ .map((key) => {
166
+ let value = params[key]
167
+ if (value === null || value === undefined) {
168
+ return null
169
+ }
170
+ // 針對key為q的參數進行手動編碼,避免雙重編碼
171
+ if (key === 'q' && typeof value === 'string') {
172
+ // 處理其他需要編碼的字符
173
+ value = value.replace(/[!'()*]/g, function (c) {
174
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
175
+ })
176
+ } else {
177
+ // 對其他參數使用標準編碼
178
+ value = encodeURIComponent(value)
179
+ }
180
+ return `${encodeURIComponent(key)}=${value}`
181
+ })
182
+ .filter(Boolean)
183
+ .join('&')
184
+ }
185
+
162
186
  this.axios.interceptors.request.use((axiosConfig) => {
163
187
  axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version
164
188
  axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform