mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-12-03 23:28:00 -07:00
26 lines
532 B
TypeScript
26 lines
532 B
TypeScript
|
import { i18n } from "@/i18n";
|
||
|
import * as os from "@/os";
|
||
|
|
||
|
export async function lookupInstance() {
|
||
|
const { canceled, result: q } = await os.inputText({
|
||
|
title: i18n.ts.instance,
|
||
|
});
|
||
|
if (canceled) return;
|
||
|
|
||
|
os.api(
|
||
|
"federation/show-instance",
|
||
|
q.startsWith("http://") || q.startsWith("https://")
|
||
|
? { url: q.trim() }
|
||
|
: { fileId: q.trim() },
|
||
|
)
|
||
|
.then((instance) => {
|
||
|
os.pageWindow(`/instance-info/${instance.host}`);
|
||
|
})
|
||
|
.catch(() => {
|
||
|
os.alert({
|
||
|
type: "error",
|
||
|
text: i18n.ts.notFound,
|
||
|
});
|
||
|
});
|
||
|
}
|