mirror of
https://github.com/misskey-dev/summerflare.git
synced 2025-08-06 00:33:56 +09:00
fix: correctly normalize encoding
This commit is contained in:
@ -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)
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user