Skip to content

Commit

Permalink
fix(Favicon): 修复域名相近的站点Favicon重置时出错
Browse files Browse the repository at this point in the history
closed: #498
  • Loading branch information
Rhilip committed Feb 27, 2022
1 parent 2fabf84 commit 83a909a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/background/config.ts
Expand Up @@ -147,10 +147,10 @@ class Config {
.then((results: any[]) => {
results.forEach((result: any) => {
let site = this.options.sites.find((item: Site) => {
let cdn = [item.url].concat(item.cdn, item.formerHosts);
let cdn = [item.url].concat(item.cdn, item.formerHosts?.map(x => `//${x}`));
return (
item.host == result.host ||
cdn.join("").indexOf(result.host) > -1
cdn.join("").indexOf(`//${result.host}`) > -1
);
});

Expand Down Expand Up @@ -180,9 +180,10 @@ class Config {
.get(url, reset)
.then((result: ISiteIcon) => {
let site = this.options.sites.find((item: Site) => {
let cdn = [item.url].concat(item.cdn, item.formerHosts);
let cdn = [item.url].concat(item.cdn, item.formerHosts?.map(x => `//${x}`));
return (
item.host == result.host || cdn.join("").indexOf(result.host) > -1
item.host == result.host ||
cdn.join("").indexOf(`//${result.host}`) > -1
);
});

Expand Down

0 comments on commit 83a909a

Please sign in to comment.