mirror of
https://github.com/Vencord/Vesktop.git
synced 2025-02-22 21:35:08 +00:00
Fix downloading event ICS files
This commit is contained in:
parent
5d675efb64
commit
7d6964a325
2 changed files with 33 additions and 0 deletions
32
src/renderer/patches/downloadEventFile.tsx
Normal file
32
src/renderer/patches/downloadEventFile.tsx
Normal 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);
|
||||
});
|
||||
}
|
||||
});
|
|
@ -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";
|
||||
|
|
Loading…
Add table
Reference in a new issue