XSOverlay: fix profile images (#2788)
Fixes https://github.com/Vendicated/Vencord/issues/2787 Co-authored-by: v <vendicated@riseup.net>
This commit is contained in:
parent
be02baffaa
commit
40512d7294
1 changed files with 23 additions and 17 deletions
|
@ -86,7 +86,7 @@ interface NotificationObject {
|
||||||
title: string;
|
title: string;
|
||||||
content: string;
|
content: string;
|
||||||
useBase64Icon: boolean;
|
useBase64Icon: boolean;
|
||||||
icon: ArrayBuffer | string;
|
icon: string;
|
||||||
sourceApp: string;
|
sourceApp: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +320,13 @@ function shouldIgnoreForChannelType(channel: Channel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMsgNotif(titleString: string, content: string, message: Message) {
|
function sendMsgNotif(titleString: string, content: string, message: Message) {
|
||||||
fetch(`https://cdn.discordapp.com/avatars/${message.author.id}/${message.author.avatar}.png?size=128`).then(response => response.arrayBuffer()).then(result => {
|
fetch(`https://cdn.discordapp.com/avatars/${message.author.id}/${message.author.avatar}.png?size=128`)
|
||||||
|
.then(response => response.blob())
|
||||||
|
.then(blob => new Promise<string>(resolve => {
|
||||||
|
const r = new FileReader();
|
||||||
|
r.onload = () => resolve((r.result as string).split(",")[1]);
|
||||||
|
r.readAsDataURL(blob);
|
||||||
|
})).then(result => {
|
||||||
const msgData: NotificationObject = {
|
const msgData: NotificationObject = {
|
||||||
type: 1,
|
type: 1,
|
||||||
timeout: settings.store.lengthBasedTimeout ? calculateTimeout(content) : settings.store.timeout,
|
timeout: settings.store.lengthBasedTimeout ? calculateTimeout(content) : settings.store.timeout,
|
||||||
|
@ -331,7 +337,7 @@ function sendMsgNotif(titleString: string, content: string, message: Message) {
|
||||||
title: titleString,
|
title: titleString,
|
||||||
content: content,
|
content: content,
|
||||||
useBase64Icon: true,
|
useBase64Icon: true,
|
||||||
icon: new TextDecoder().decode(result),
|
icon: result,
|
||||||
sourceApp: "Vencord"
|
sourceApp: "Vencord"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue