Merge commit 'refs/pull/62/head' of https://github.com/MathMan05/JankClient
This commit is contained in:
commit
9ec5dfe4fb
2 changed files with 4 additions and 4 deletions
|
@ -28,7 +28,7 @@ async function updateInstances(): Promise<void> {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"https://raw.githubusercontent.com/spacebarchat/spacebarchat/master/instances/instances.json"
|
"https://raw.githubusercontent.com/spacebarchat/spacebarchat/master/instances/instances.json"
|
||||||
);
|
);
|
||||||
const json: Instance[] = await response.json();
|
const json = await response.json() as Instance[];
|
||||||
for (const instance of json) {
|
for (const instance of json) {
|
||||||
if (!instanceNames.has(instance.name)) {
|
if (!instanceNames.has(instance.name)) {
|
||||||
instances.push(instance as any);
|
instances.push(instance as any);
|
||||||
|
|
|
@ -25,12 +25,12 @@ export async function getApiUrls(url: string): Promise<ApiUrls | null> {
|
||||||
url += "/";
|
url += "/";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const info = await fetch(`${url}.well-known/spacebar`).then((res) =>
|
const info: ApiUrls = await fetch(`${url}.well-known/spacebar`).then(
|
||||||
res.json()
|
(res) => res.json() as Promise<ApiUrls>
|
||||||
);
|
);
|
||||||
const api = info.api;
|
const api = info.api;
|
||||||
const apiUrl = new URL(api);
|
const apiUrl = new URL(api);
|
||||||
const policies = await fetch(
|
const policies: any = await fetch(
|
||||||
`${api}${
|
`${api}${
|
||||||
apiUrl.pathname.includes("api") ? "" : "api"
|
apiUrl.pathname.includes("api") ? "" : "api"
|
||||||
}/policies/instance/domains`
|
}/policies/instance/domains`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue