Skip to content

Commit 2302906

Browse files
committed
修复lint问题
1 parent cc01854 commit 2302906

1 file changed

Lines changed: 0 additions & 42 deletions

File tree

src/pages/install/App.tsx

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -57,48 +57,6 @@ const closeWindow = (shouldGoBack: boolean) => {
5757
}
5858
};
5959

60-
const getCandidateUrls = (targetUrlHref: string) => {
61-
const encodedUrl = toEncodedURL(targetUrlHref);
62-
const inputU = new URL(encodedUrl);
63-
const extraCandidateUrls = new Set<string>();
64-
extraCandidateUrls.add(inputU.href);
65-
66-
const hostname = inputU.hostname;
67-
// 兼容 .greasyfork.org, cn-greasyfork.org
68-
const hostText = `.${hostname}`.replace(/\W/g, ".");
69-
const isGreasyFork = hostText.endsWith(".greasyfork.org");
70-
const isSleazyFork = hostText.endsWith(".sleazyfork.org");
71-
72-
if (isGreasyFork || isSleazyFork) {
73-
// example:
74-
// CASE 1
75-
// raw 'https://update.greasyfork.org/scripts/550295/100%解锁CSDN文库vip文章阅读限制.user.js'
76-
// encoded 'https://update.greasyfork.org/scripts/550295/100%25%E8%A7%A3%E9%94%81CSDN%E6%96%87%E5%BA%93vip%E6%96%87%E7%AB%A0%E9%98%85%E8%AF%BB%E9%99%90%E5%88%B6.user.js'
77-
// correct 'https://update.greasyfork.org/scripts/550295/100%25%E8%A7%A3%E9%94%81CSDN%E6%96%87%E5%BA%93vip%E6%96%87%E7%AB%A0%E9%98%85%E8%AF%BB%E9%99%90%E5%88%B6.user.js'
78-
// CASE 2
79-
// raw 'https://update.greasyfork.org/scripts/519037/Nexus No Wait ++.user.js'
80-
// encoded 'https://update.greasyfork.org/scripts/519037/Nexus%20No%20Wait%20++.user.js'
81-
// correct 'https://update.greasyfork.org/scripts/519037/Nexus%20No%20Wait%20%2B%2B.user.js'
82-
try {
83-
const encodedPathname = inputU.pathname;
84-
const lastSlashIndex = encodedPathname.lastIndexOf("/");
85-
const basePath = encodedPathname.substring(0, lastSlashIndex);
86-
const fileName = encodedPathname.substring(lastSlashIndex + 1);
87-
const reEncodedFileName = encodeURIComponent(decodeURI(fileName));
88-
if (reEncodedFileName !== fileName) {
89-
const reEncodedPathName = `${basePath}/${reEncodedFileName}`;
90-
const reEncodedUrl = `${inputU.origin}${reEncodedPathName}${inputU.search}${inputU.hash}`;
91-
extraCandidateUrls.add(reEncodedUrl);
92-
}
93-
} catch (e) {
94-
// can skip if it cannot be converted using decodeURI
95-
console.warn(e); // just a warning for debug purpose.
96-
}
97-
}
98-
99-
return [...extraCandidateUrls];
100-
};
101-
10260
const fetchScriptBody = async (url: string, { onProgress }: { [key: string]: any }) => {
10361
let origin;
10462
try {

0 commit comments

Comments
 (0)