working
This commit is contained in:
parent
100f9bf58e
commit
0493a76117
|
@ -21,8 +21,10 @@ window.VencordNative = {
|
|||
webclass.vencordSend(event, args);
|
||||
},
|
||||
sendSync: (event: string, ...args: any[]) => {
|
||||
if (event === "VencordGetSettings") return "{}";
|
||||
else throw new Error("Synchroneous IPC not implemented");
|
||||
if (event === "VencordGetSettings") {
|
||||
console.log("stub: IPC VencordGetSettings");
|
||||
return "{}";
|
||||
} else throw new Error("Synchroneous IPC not implemented");
|
||||
},
|
||||
on(event: string, listener: () => {}) {
|
||||
// TODO quickCss
|
||||
|
@ -30,11 +32,9 @@ window.VencordNative = {
|
|||
off(event: string, listener: () => {}) {
|
||||
// not used for now
|
||||
},
|
||||
invoke:
|
||||
(event: string, ...args: any[]) =>
|
||||
async () => {
|
||||
await prepareWebclass();
|
||||
return webclass.vencordSend(event, args);
|
||||
},
|
||||
invoke: async (event: string, ...args: any[]) => {
|
||||
await prepareWebclass();
|
||||
return webclass.vencordSend(event, args);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,9 @@
|
|||
#include "webclass.h"
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QStandardPaths>
|
||||
#include <QUrl>
|
||||
|
||||
QVariant WebClass::vencordSend(QString event, QVariantList args) {
|
||||
|
@ -8,11 +11,20 @@ QVariant WebClass::vencordSend(QString event, QVariantList args) {
|
|||
return true;
|
||||
}
|
||||
if (event == "VencordGetSettingsDir") {
|
||||
return "~/.config/discord-screenaudio/vencord";
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
||||
}
|
||||
if (event == "VencordGetQuickCss") {
|
||||
// TODO
|
||||
return "";
|
||||
QString filename =
|
||||
QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) +
|
||||
"/vencord/quickCss.css";
|
||||
if (QFile::exists(filename)) {
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
auto content = file.readAll();
|
||||
file.close();
|
||||
return QString(content);
|
||||
} else
|
||||
return "";
|
||||
}
|
||||
if (event == "VencordGetSettings") {
|
||||
return m_vencordSettings;
|
||||
|
|
Loading…
Reference in New Issue