소스 검색

sort rules

Gildas 7 년 전
부모
커밋
46e89e8218
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      extension/core/bg/config.js

+ 1 - 1
extension/core/bg/config.js

@@ -209,7 +209,7 @@ singlefile.config = (() => {
 		},
 		async getOptions(profileName, url, autoSave) {
 			const config = await getConfig();
-			const urlRule = config.rules.find(rule => url && url.includes(rule.url));
+			const urlRule = config.rules.sort((ruleLeft, ruleRight) => ruleRight.url.length - ruleLeft.url.length).find(rule => url && url.includes(rule.url));
 			return urlRule ? config.profiles[urlRule[autoSave ? "autoSaveProfile" : "profile"]] : config.profiles[profileName || singlefile.config.DEFAULT_PROFILE_NAME];
 		},
 		async updateProfile(profileName, profile) {