-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1db89a
commit 273af9e
Showing
10 changed files
with
327 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,274 @@ | ||
function hasChildren(entry: any[]) { | ||
return ( | ||
Object.entries(entry[1]).filter((setting) => { | ||
return ( | ||
setting[1] instanceof Object && !(setting[1] instanceof Array) | ||
); | ||
}).length > 0 | ||
); | ||
} | ||
|
||
const DisclosureGroup: Component<{ | ||
entry: any[]; | ||
sel: { [key: string]: any }; | ||
level?: number; | ||
}> = function () { | ||
if (!this.level) this.level = 1; | ||
|
||
this.css = ` | ||
margin-left: ${0.8 * this.level!}em; | ||
`; | ||
|
||
return ( | ||
<div> | ||
{hasChildren(this.entry) ? ( | ||
<details> | ||
<summary> | ||
<span | ||
on:click={(e: MouseEvent) => { | ||
e.preventDefault(); | ||
this.sel = this.entry[1]; | ||
}} | ||
> | ||
{this.entry[0]} | ||
</span> | ||
</summary> | ||
{Object.entries(this.entry[1]) | ||
.filter((setting) => { | ||
return ( | ||
setting[1] instanceof Object && | ||
!(setting[1] instanceof Array) | ||
); | ||
}) | ||
.map((item: any) => ( | ||
<DisclosureGroup | ||
entry={item} | ||
bind:sel={use(this.sel)} | ||
sel={this.sel} | ||
level={this.level! + 1} | ||
/> | ||
))} | ||
</details> | ||
) : ( | ||
<span | ||
on:click={() => { | ||
this.sel = this.entry[1]; | ||
}} | ||
> | ||
{this.entry[0]} | ||
</span> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
class RegEdit extends App { | ||
hidden = false; | ||
constructor() { | ||
super(); | ||
this.name = "Registry Editor"; | ||
this.icon = "/assets/icons/regedit.svg"; | ||
this.package = "anura.regedit"; | ||
} | ||
|
||
css = css` | ||
display: flex; | ||
border-top: 1px solid var(--theme-border) #pane-left { | ||
width: max(10%, 200px); | ||
border-right: 1px solid var(--theme-border); | ||
overflow: scroll; | ||
text-overflow: nowrap; | ||
white-space: nowrap; | ||
padding-left: 0.5em; | ||
} | ||
#pane-right { | ||
width: calc(100% - max(10%, 200px)); | ||
min-width: 400px; | ||
padding-inline: 0.5em; | ||
} | ||
#detail { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
table { | ||
width: 100%; | ||
margin: 0; | ||
} | ||
.value { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
max-width: 8em; | ||
} | ||
.name { | ||
max-width: 8em; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
`; | ||
state = $state({ | ||
selected: anura.settings.cache, | ||
}); | ||
|
||
page = async () => ( | ||
<div | ||
style={{ | ||
height: "100%", | ||
width: "100%", | ||
position: "absolute", | ||
color: use(anura.ui.theme.state.foreground), | ||
background: use(anura.ui.theme.state.background), | ||
}} | ||
class={`background ${this.css}`} | ||
> | ||
<div id="pane-left"> | ||
<div id="detail"> | ||
<details open> | ||
<summary> | ||
<span | ||
on:click={(e: MouseEvent) => { | ||
e.preventDefault(); | ||
this.state.selected = anura.settings.cache; | ||
}} | ||
> | ||
System | ||
</span> | ||
</summary> | ||
{Object.entries(anura.settings.cache) | ||
.filter((setting) => { | ||
return ( | ||
setting[1] instanceof Object && | ||
!(setting[1] instanceof Array) | ||
); | ||
}) | ||
.map((item: any) => ( | ||
<DisclosureGroup | ||
entry={item} | ||
bind:sel={use(this.state.selected)} | ||
sel={this.state.selected} | ||
/> | ||
))} | ||
</details> | ||
</div> | ||
</div> | ||
|
||
<div id="pane-right"> | ||
{/* someone else can make this resizable, i cba */} | ||
<table> | ||
<tr> | ||
<th>Name</th> | ||
<th>Type</th> | ||
<th>Value</th> | ||
</tr> | ||
{use(this.state.selected, (sel) => | ||
Object.entries(sel) | ||
.filter((setting) => { | ||
return ( | ||
!(setting[1] instanceof Object) || | ||
setting[1] instanceof Array | ||
); | ||
}) | ||
.map((item: any) => ( | ||
<tr | ||
on:dblclick={() => { | ||
switch (typeof item[1]) { | ||
case "boolean": | ||
anura.dialog | ||
.confirm( | ||
`The key will be set to ${!item[1]}`, | ||
`Change value of ${item[0]}?`, | ||
) | ||
.then((value) => { | ||
if (value) { | ||
sel[item[0]] = | ||
!item[1]; | ||
anura.settings.save(); | ||
} | ||
}); | ||
break; | ||
case "number": | ||
anura.dialog | ||
.prompt( | ||
`Enter new value for ${item[0]}`, | ||
item[1], | ||
) | ||
.then((value) => { | ||
if (value !== null) { | ||
const val2 = parseInt( | ||
value as string, | ||
); | ||
sel[item[0]] = val2; | ||
anura.settings.save(); | ||
} | ||
}); | ||
break; | ||
case "object": | ||
// anura.dialog.prompt(`Enter new value for ${item[0]}`, item[1]) | ||
// .then((value) => { | ||
// if (value !== null) { | ||
// let val2 = JSON.parse(value as string); | ||
// sel[item[0]] = val2; | ||
// anura.settings.save(); | ||
// } | ||
// }); | ||
break; | ||
default: | ||
anura.dialog | ||
.prompt( | ||
`Enter new value for ${item[0]}`, | ||
item[1], | ||
) | ||
.then((value) => { | ||
if (value !== null) { | ||
const val2 = | ||
value as string; | ||
sel[item[0]] = val2; | ||
anura.settings.save(); | ||
} | ||
}); | ||
break; | ||
} | ||
}} | ||
> | ||
<td class="name">{item[0]}</td> | ||
<td class="type">{typeof item[1]}</td> | ||
<td class="value">{item[1]}</td> | ||
</tr> | ||
)), | ||
)} | ||
</table> | ||
</div> | ||
</div> | ||
); | ||
|
||
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()); | ||
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(); | ||
} | ||
}); | ||
} | ||
|
||
return win; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule v86
updated
22 files
+0 −6 | .github/workflows/ci.yml | |
+2 −2 | Makefile | |
+6 −8 | Readme.md | |
+1 −6 | debug.html | |
+0 −1 | eslint.config.mjs | |
+0 −5 | index.html | |
+137 −142 | lib/9p-filer.js | |
+16 −25 | lib/marshall.js | |
+7 −3 | lib/utf8.js | |
+0 −97 | nodejs-loader.mjs | |
+0 −1,148 | src/browser/fake_network.js | |
+1,170 −97 | src/browser/fetch_network.js | |
+6 −6 | src/browser/filestorage.js | |
+2 −28 | src/browser/main.js | |
+29 −29 | src/browser/mouse.js | |
+6 −9 | src/browser/starter.js | |
+0 −309 | src/browser/wisp_network.js | |
+39 −39 | src/buffer.js | |
+4 −4 | src/cpu.js | |
+0 −4 | src/vga.js | |
+0 −312 | tests/devices/wisp_network.js | |
+10 −3 | tools/fetch_network_harness.js |
Submodule twisp
updated
4 files
+0 −7 | Cargo.lock | |
+0 −1 | twisp/Cargo.toml | |
+11 −18 | twisp/src/main.rs | |
+1 −1 | twisptest/src/main.rs |