Fixed 267U.pre2

This commit is contained in:
2026-07-26 18:25:37 +09:00
parent 50bfaeafdf
commit 317d00a284
1286 changed files with 80222 additions and 1 deletions
@@ -0,0 +1,21 @@
import { URL } from "node:url";
import config from "../config/index.js";
import punycode from "punycode/";
export function getFullApAccount(username, host) {
return host ? `${username}@${toPuny(host)}` : `${username}@${toPuny(config.domain)}`;
}
export function isSelfHost(host) {
if (host == null) return true;
return toPuny(config.domain) === toPuny(host) || toPuny(config.host) === toPuny(host);
}
export function extractDbHost(uri) {
const url = new URL(uri);
return toPuny(url.hostname);
}
export function toPuny(host) {
return punycode.toASCII(host.toLowerCase());
}
export function toPunyNullable(host) {
if (host == null) return null;
return punycode.toASCII(host.toLowerCase());
}