mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
lint
This commit is contained in:
parent
4f31bcb32e
commit
ab60e43bf1
2 changed files with 18 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
|||
import {BrowserWindow, app, ipcMain, shell, dialog} from "electron";
|
||||
import {BrowserWindow, app, dialog, ipcMain, shell} from "electron";
|
||||
import {sleep} from "../utils";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
@ -141,22 +141,22 @@ export function createTManagerWindow(): void {
|
|||
mainWindow.webContents.reload();
|
||||
});
|
||||
ipcMain.on("addToDisabled", async (_event, name: string) => {
|
||||
fs.appendFileSync(path.join(userDataPath, "/disabled.txt"), name + "\n");
|
||||
fs.appendFileSync(path.join(userDataPath, "/disabled.txt"), `${name}\n`);
|
||||
sleep(1000);
|
||||
});
|
||||
ipcMain.on("disabled", async (e) => {
|
||||
e.returnValue = fs.readFileSync(path.join(userDataPath, "/disabled.txt")).toString();
|
||||
});
|
||||
ipcMain.on("removeFromDisabled", async (_event, name: string) => {
|
||||
var e = await fs.readFileSync(path.join(userDataPath, "/disabled.txt")).toString();
|
||||
let e = await fs.readFileSync(path.join(userDataPath, "/disabled.txt")).toString();
|
||||
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), e.replace(name, ""));
|
||||
sleep(1000);
|
||||
});
|
||||
ipcMain.on("installBDTheme", async (_event, link: string) => {
|
||||
try {
|
||||
var code = await (await fetch(link)).text();
|
||||
var manifest = parseBDManifest(code);
|
||||
var themePath = path.join(themesFolder, manifest.name?.replace(" ", "-") + "-BD");
|
||||
let code = await (await fetch(link)).text();
|
||||
let manifest = parseBDManifest(code);
|
||||
let themePath = path.join(themesFolder, `${manifest.name?.replace(" ", "-")}-BD`);
|
||||
if (!fs.existsSync(themePath)) {
|
||||
fs.mkdirSync(themePath);
|
||||
console.log(`Created ${manifest.name} folder`);
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import {ipcRenderer} from "electron";
|
||||
import {sleep} from "../utils";
|
||||
ipcRenderer.on("themeManifest", (_event, json) => {
|
||||
var manifest = JSON.parse(json);
|
||||
let manifest = JSON.parse(json);
|
||||
console.log(manifest);
|
||||
sleep(1000);
|
||||
var e = document.getElementById("cardBox");
|
||||
var id = manifest.name.replace(" ", "-");
|
||||
let e = document.getElementById("cardBox");
|
||||
let id = manifest.name.replace(" ", "-");
|
||||
e?.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
`
|
||||
<div class="card">
|
||||
<div class="flex-box">
|
||||
<h3 id="${id + "header"}">${manifest.name}</h3>
|
||||
<h3 id="${`${id}header`}">${manifest.name}</h3>
|
||||
<input id="${id}" class="tgl tgl-light left" type="checkbox" />
|
||||
<label class="tgl-btn left" for="${id}"></label>
|
||||
</div>
|
||||
|
@ -20,10 +20,10 @@ ipcRenderer.on("themeManifest", (_event, json) => {
|
|||
</div>
|
||||
`
|
||||
);
|
||||
document.getElementById(id + "header")!.addEventListener("click", () => {
|
||||
document.getElementById(`${id}header`)!.addEventListener("click", () => {
|
||||
document.getElementById("themeInfoModal")!.style.display = "block";
|
||||
document.getElementById("themeInfoName")!.textContent = `${manifest.name} by ${manifest.author}`;
|
||||
document.getElementById("themeInfoDesc")!.textContent = manifest.description + "\n\n" + manifest.version;
|
||||
document.getElementById("themeInfoDesc")!.textContent = `${manifest.description}\n\n${manifest.version}`;
|
||||
if (manifest.source != undefined)
|
||||
document.getElementById(
|
||||
"themeInfoButtons"
|
||||
|
@ -33,14 +33,14 @@ ipcRenderer.on("themeManifest", (_event, json) => {
|
|||
"themeInfoButtons"
|
||||
)!.innerHTML += `<a href="${manifest.website}" class="button">Website</a>`;
|
||||
if (manifest.invite != undefined)
|
||||
document.getElementById("themeInfoButtons")!.innerHTML += `<a href="${
|
||||
"https://discord.gg/" + manifest.invite
|
||||
}" class="button">Support Discord</a>`;
|
||||
document.getElementById(
|
||||
"themeInfoButtons"
|
||||
)!.innerHTML += `<a href="${`https://discord.gg/${manifest.invite}`}" class="button">Support Discord</a>`;
|
||||
});
|
||||
if (!ipcRenderer.sendSync("disabled").includes(id)) {
|
||||
(<HTMLInputElement>document.getElementById(id)).checked = true;
|
||||
(document.getElementById(id) as HTMLInputElement).checked = true;
|
||||
}
|
||||
(<HTMLInputElement>document.getElementById(id))!.addEventListener("input", function (evt) {
|
||||
(document.getElementById(id) as HTMLInputElement)!.addEventListener("input", function (evt) {
|
||||
ipcRenderer.send("reloadMain");
|
||||
if (this.checked) {
|
||||
ipcRenderer.send("removeFromDisabled", id);
|
||||
|
@ -55,6 +55,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
document.getElementById("themeInfoButtons")!.innerHTML = "";
|
||||
});
|
||||
document.getElementById("download")!.addEventListener("click", () => {
|
||||
ipcRenderer.send("installBDTheme", (<HTMLInputElement>document.getElementById("themeLink"))!.value);
|
||||
ipcRenderer.send("installBDTheme", (document.getElementById("themeLink") as HTMLInputElement)!.value);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue