various fixes
This commit is contained in:
parent
8ab475061b
commit
548e11c788
5 changed files with 53 additions and 44 deletions
|
@ -1397,7 +1397,7 @@ class Channel extends SnowFlake {
|
||||||
{
|
{
|
||||||
attachments = [],
|
attachments = [],
|
||||||
replyingto = null,
|
replyingto = null,
|
||||||
}: {attachments: Blob[]; embeds: embedjson; replyingto: Message | null},
|
}: {attachments: Blob[]; embeds: embedjson[]; replyingto: Message | null},
|
||||||
) {
|
) {
|
||||||
let replyjson: any;
|
let replyjson: any;
|
||||||
if (replyingto) {
|
if (replyingto) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Direct extends Guild {
|
||||||
this.headers = this.localuser.headers;
|
this.headers = this.localuser.headers;
|
||||||
this.channels = [];
|
this.channels = [];
|
||||||
this.channelids = {};
|
this.channelids = {};
|
||||||
// @ts-ignore
|
// @ts-ignore it's a hack, but it's a hack that works
|
||||||
this.properties = {};
|
this.properties = {};
|
||||||
this.roles = [];
|
this.roles = [];
|
||||||
this.roleids = new Map();
|
this.roleids = new Map();
|
||||||
|
@ -337,8 +337,7 @@ dmPermissions.setPermission("CONNECT", 1);
|
||||||
dmPermissions.setPermission("SPEAK", 1);
|
dmPermissions.setPermission("SPEAK", 1);
|
||||||
dmPermissions.setPermission("STREAM", 1);
|
dmPermissions.setPermission("STREAM", 1);
|
||||||
dmPermissions.setPermission("USE_VAD", 1);
|
dmPermissions.setPermission("USE_VAD", 1);
|
||||||
|
//@ts-ignore No clue how to fix this dumb bug lol
|
||||||
// @ts-ignore I need to look into this lol
|
|
||||||
class Group extends Channel {
|
class Group extends Channel {
|
||||||
user: User;
|
user: User;
|
||||||
static contextmenu = new Contextmenu<Group, undefined>("channel menu");
|
static contextmenu = new Contextmenu<Group, undefined>("channel menu");
|
||||||
|
|
|
@ -182,7 +182,6 @@ import {I18n} from "./i18n.js";
|
||||||
}
|
}
|
||||||
channel.sendMessage(markdown.rawString, {
|
channel.sendMessage(markdown.rawString, {
|
||||||
attachments: images,
|
attachments: images,
|
||||||
// @ts-ignore This is valid according to the API
|
|
||||||
embeds: [], // Add an empty array for the embeds property
|
embeds: [], // Add an empty array for the embeds property
|
||||||
replyingto: replyingTo,
|
replyingto: replyingTo,
|
||||||
});
|
});
|
||||||
|
|
|
@ -161,4 +161,4 @@ async function tosLogic() {
|
||||||
|
|
||||||
tosLogic();
|
tosLogic();
|
||||||
|
|
||||||
(checkInstance as any).alt = tosLogic;
|
checkInstance.alt = tosLogic;
|
||||||
|
|
|
@ -224,6 +224,9 @@ const stringURLsMap = new Map<
|
||||||
login?: string;
|
login?: string;
|
||||||
}
|
}
|
||||||
>();
|
>();
|
||||||
|
/**
|
||||||
|
* this fucntion checks if a string is an instance, it'll either return the API urls or false
|
||||||
|
*/
|
||||||
export async function getapiurls(str: string): Promise<
|
export async function getapiurls(str: string): Promise<
|
||||||
| {
|
| {
|
||||||
api: string;
|
api: string;
|
||||||
|
@ -331,48 +334,56 @@ export async function getapiurls(str: string): Promise<
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function checkInstance(instance: string) {
|
/**
|
||||||
await instancefetch;
|
*
|
||||||
const verify = document.getElementById("verify");
|
* This function takes in a string and checks if the string is a valid instance
|
||||||
const loginButton = (document.getElementById("loginButton") ||
|
* the string may be a URL or the name of the instance
|
||||||
document.getElementById("createAccount") ||
|
* the alt property is something you may fire on success.
|
||||||
document.createElement("button")) as HTMLButtonElement;
|
*/
|
||||||
try {
|
const checkInstance = Object.assign(
|
||||||
loginButton.disabled = true;
|
async function (instance: string) {
|
||||||
verify!.textContent = I18n.getTranslation("login.checking");
|
await instancefetch;
|
||||||
const instanceValue = instance;
|
const verify = document.getElementById("verify");
|
||||||
const instanceinfo = (await getapiurls(instanceValue)) as {
|
const loginButton = (document.getElementById("loginButton") ||
|
||||||
wellknown: string;
|
document.getElementById("createAccount") ||
|
||||||
api: string;
|
document.createElement("button")) as HTMLButtonElement;
|
||||||
cdn: string;
|
try {
|
||||||
gateway: string;
|
loginButton.disabled = true;
|
||||||
login: string;
|
verify!.textContent = I18n.getTranslation("login.checking");
|
||||||
value: string;
|
const instanceValue = instance;
|
||||||
};
|
const instanceinfo = (await getapiurls(instanceValue)) as {
|
||||||
if (instanceinfo) {
|
wellknown: string;
|
||||||
instanceinfo.value = instanceValue;
|
api: string;
|
||||||
localStorage.setItem("instanceinfo", JSON.stringify(instanceinfo));
|
cdn: string;
|
||||||
verify!.textContent = I18n.getTranslation("login.allGood");
|
gateway: string;
|
||||||
loginButton.disabled = false;
|
login: string;
|
||||||
// @ts-ignore
|
value: string;
|
||||||
if (checkInstance.alt) {
|
};
|
||||||
// @ts-ignore
|
if (instanceinfo) {
|
||||||
checkInstance.alt();
|
instanceinfo.value = instanceValue;
|
||||||
|
localStorage.setItem("instanceinfo", JSON.stringify(instanceinfo));
|
||||||
|
verify!.textContent = I18n.getTranslation("login.allGood");
|
||||||
|
loginButton.disabled = false;
|
||||||
|
if (checkInstance.alt) {
|
||||||
|
checkInstance.alt();
|
||||||
|
}
|
||||||
|
setTimeout((_: any) => {
|
||||||
|
console.log(verify!.textContent);
|
||||||
|
verify!.textContent = "";
|
||||||
|
}, 3000);
|
||||||
|
} else {
|
||||||
|
verify!.textContent = I18n.getTranslation("login.invalid");
|
||||||
|
loginButton.disabled = true;
|
||||||
}
|
}
|
||||||
setTimeout((_: any) => {
|
} catch {
|
||||||
console.log(verify!.textContent);
|
console.log("catch");
|
||||||
verify!.textContent = "";
|
|
||||||
}, 3000);
|
|
||||||
} else {
|
|
||||||
verify!.textContent = I18n.getTranslation("login.invalid");
|
verify!.textContent = I18n.getTranslation("login.invalid");
|
||||||
loginButton.disabled = true;
|
loginButton.disabled = true;
|
||||||
}
|
}
|
||||||
} catch {
|
},
|
||||||
console.log("catch");
|
{} as {alt?: Function},
|
||||||
verify!.textContent = I18n.getTranslation("login.invalid");
|
);
|
||||||
loginButton.disabled = true;
|
export {checkInstance};
|
||||||
}
|
|
||||||
}
|
|
||||||
export function getInstances() {
|
export function getInstances() {
|
||||||
return instances;
|
return instances;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue