Skip to content

Commit

Permalink
block opening regedit before user accepts prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
BomberFish committed Dec 2, 2024
1 parent e1ec05f commit 4bf9f9e
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/coreapps/RegEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,25 +248,34 @@ class RegEdit extends App {
);

async open(): Promise<WMWindow | undefined> {
const win = anura.wm.create(this, {
title: "Registry Editor",
width: "910px",
height: `${(720 * window.innerHeight) / 1080}px`,
resizable: true,
});

win.content.appendChild(await this.page());
let win: WMWindow | undefined;
if (!anura.settings.get("disable-regedit-warning")) {
anura.dialog
.confirm(
"Are you sure you want to continue?",
"Editing the registry can cause irreparable damage to your system!",
)
.then((value) => {
if (value === false) {
win.close();
.then(async (value) => {
if (value === true) {
win = anura.wm.create(this, {
title: "Registry Editor",
width: "910px",
height: `${(720 * window.innerHeight) / 1080}px`,
resizable: true,
});

win.content.appendChild(await this.page());
}
});
} else {
win = anura.wm.create(this, {
title: "Registry Editor",
width: "910px",
height: `${(720 * window.innerHeight) / 1080}px`,
resizable: true,
});

win.content.appendChild(await this.page());
}

return win;
Expand Down

0 comments on commit 4bf9f9e

Please sign in to comment.