diff --git a/CHANGELOG.md b/CHANGELOG.md index 1557bd5..69a5f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [0.14.4](https://github.com/XYShaoKang/refined-leetcode/compare/v0.14.3...v0.14.4) (2024-09-29) + + +### Bug Fixes + +* lint ([103374e](https://github.com/XYShaoKang/refined-leetcode/commit/103374e9a1edbd85747351667cfd8917738b164a)) +* 修复题库页评分过滤失效 ([3e73745](https://github.com/XYShaoKang/refined-leetcode/commit/3e73745f9bfae624ace4d8b35546487790b3f7a0)) + ## [0.14.3](https://github.com/XYShaoKang/refined-leetcode/compare/v0.14.2...v0.14.3) (2024-09-22) diff --git a/package.json b/package.json index 9a84fb6..f4c9113 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "refined-leetcode", - "version": "0.14.3", + "version": "0.14.4", "main": "index.js", "author": "XYShaoKang", "license": "MIT", diff --git a/src/content/pages/problemset/intercept.tsx b/src/content/pages/problemset/intercept.tsx index 6cff5c8..e798a20 100644 --- a/src/content/pages/problemset/intercept.tsx +++ b/src/content/pages/problemset/intercept.tsx @@ -19,10 +19,17 @@ export function intercept(): void { password?: string, disbaleIntercept?: boolean ) { + let pathname = url + try { + const urlObj = new URL(url) + pathname = urlObj.pathname + } catch (error) { + // + } if ( !disbaleIntercept && method.toLocaleLowerCase() === 'post' && - url === `/graphql/` + pathname === `/graphql/` ) { const originalSend = this.send @@ -115,6 +122,21 @@ export function intercept(): void { } catch (error) { // } + } else if (typeof str === 'string') { + try { + const body = JSON.parse(str) + const sortOrder = body?.variables?.filters?.sortOrder + if ( + sortOrder && + sortOrder !== 'DESCENDING' && + sortOrder !== 'ASCENDING' + ) { + body.variables.filters.sortOrder = 'DESCENDING' + str = JSON.stringify(body) + } + } catch (error) { + // + } } return originalSend.call(this, str) }