From 2228ea084649c078dbd93530ceeb430b8d3e85a3 Mon Sep 17 00:00:00 2001 From: memset0 Date: Mon, 22 Jul 2024 09:11:05 +0800 Subject: [PATCH] fix: matching rules of uri --- src/app.ts | 6 +++--- src/config.ts | 1 + src/types/feature.ts | 8 +++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app.ts b/src/app.ts index 96beeaa..dc153e8 100644 --- a/src/app.ts +++ b/src/app.ts @@ -5,8 +5,8 @@ import ModuleVjudge from './modules/vjudge/main'; import ModuleCodeforces from './modules/codeforces/main'; export default class App { - modules: Dict - _queuedPlugins: Dict void }>> + modules: Dict; + _queuedPlugins: Dict void }>>; log(...args: any[]) { return console.log('[CPAssistant.js]', ...args); @@ -41,4 +41,4 @@ export default class App { export const app = new App(); app.register(new ModuleVjudge(app)); -app.register(new ModuleCodeforces(app)); \ No newline at end of file +app.register(new ModuleCodeforces(app)); diff --git a/src/config.ts b/src/config.ts index 10c0c51..6f62a32 100644 --- a/src/config.ts +++ b/src/config.ts @@ -12,6 +12,7 @@ const config: Dict = { ], vjudge: [ 'vjudge.net', + 'vjudge.net.cn', 'cn.vjudge.net', 'vjudge.z180.cn', ], diff --git a/src/types/feature.ts b/src/types/feature.ts index 8507957..72276a4 100644 --- a/src/types/feature.ts +++ b/src/types/feature.ts @@ -46,8 +46,14 @@ export default class Feature { const args: Dict = {} const matchParts = match.slice(1).split('/') const pathParts = location.pathname.slice(1).split('/') + if (matchParts[matchParts.length - 1] == '') { + --matchParts.length; + } + if (pathParts[pathParts.length - 1] == '') { + --pathParts.length; + } - if (pathParts.length < matchParts.length) { + if (pathParts.length != matchParts.length) { return false }