2023-07-07 19:22:30 +00:00
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
import * as os from "@/os";
|
|
|
|
|
|
|
|
export async function lookupInstance() {
|
2023-07-23 13:31:28 +00:00
|
|
|
const { canceled, result: q } = await os.inputText({
|
|
|
|
title: i18n.ts.instance,
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
2023-07-07 19:22:30 +00:00
|
|
|
|
2023-07-23 13:31:28 +00:00
|
|
|
os.api(
|
|
|
|
"federation/show-instance",
|
|
|
|
q.startsWith("http://") || q.startsWith("https://")
|
|
|
|
? { host: q.replace("https://", "") }
|
|
|
|
: { host: q }
|
|
|
|
)
|
|
|
|
.then((instance) => {
|
|
|
|
os.pageWindow(`/instance-info/${instance.host}`);
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
os.alert({
|
|
|
|
type: "error",
|
|
|
|
text: i18n.ts.notFound,
|
|
|
|
});
|
|
|
|
});
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|