fix: correctly normalize encoding

This commit is contained in:
Acid Chicken (硫酸鶏)
2024-05-28 15:11:27 +09:00
parent 60507c3a88
commit 0cfacfeacc
29 changed files with 1371 additions and 1307 deletions

View File

@ -1,33 +1,33 @@
import { assign } from "../common";
import type { PrioritizedReference } from "../common";
import { assign } from "../common"
import type { PrioritizedReference } from "../common"
export default function getSiteName(url: URL, html: HTMLRewriter) {
const result: PrioritizedReference<string | null> = {
bits: 2, // 0-3
priority: 0,
content: url.hostname,
};
}
html.on('meta[property="og:site_name"]', {
element(element) {
const content = element.getAttribute("content");
const content = element.getAttribute("content")
if (content) {
assign(result, 3, content);
assign(result, 3, content)
}
},
});
})
html.on('meta[name="application-name"]', {
element(element) {
const content = element.getAttribute("content");
const content = element.getAttribute("content")
if (content) {
assign(result, 2, content);
assign(result, 2, content)
}
},
});
})
return new Promise<string | null>((resolve) => {
html.onDocument({
end() {
resolve(result.content);
resolve(result.content)
},
});
});
})
})
}