Fix downloading event ICS files

This commit is contained in:
Sqaaakoi 2024-11-10 18:17:54 +13:00
parent 5d675efb64
commit 7d6964a325
No known key found for this signature in database
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,32 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2024 Vendicated and Vencord contributors
*/
import { addPatch } from "./shared";
addPatch({
patches: [
{
find: "discord-event.ics",
replacement: {
match: /("discord-event\.ics".{0,10}?)window\.open/,
replace: "$1$self.downloadEvent"
}
}
],
downloadEvent(uri: string) {
const a = document.createElement("a");
a.href = uri;
a.download = "discord-event.ics";
document.body.appendChild(a);
a.click();
setImmediate(() => {
URL.revokeObjectURL(a.href);
document.body.removeChild(a);
});
}
});

View file

@ -5,6 +5,7 @@
*/
// TODO: Possibly auto generate glob if we have more patches in the future
import "./downloadEventFile";
import "./enableNotificationsByDefault";
import "./platformClass";
import "./hideSwitchDevice";