Skip to content

Commit

Permalink
Merge pull request #86 from MercuryWorkshop/main
Browse files Browse the repository at this point in the history
Updated Docs Branch
  • Loading branch information
markrosenbaum authored Sep 21, 2023
2 parents 86eb5e6 + d4683d1 commit 6bb8bea
Show file tree
Hide file tree
Showing 27 changed files with 763 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rootfs/*
node_modules
anurax86.tar.gz
symlinks
images/
build/images/
build/
dist/
bios/
Expand Down
27 changes: 26 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
#TODO
# Credits

- Contributors

- A full list of contributors can be found [here](https://github.com/MercuryWorkshop/anuraOS/graphs/contributors)

- Libraries

- Filesystem - [Filer.js](https://filer.js.org/)
- Filesystem HTTP bridge - [MercuryWorkshop Nohost](https://github.com/MercuryWorkshop/nohost) (Fork of [Humphd Nohost](https://github.com/humphd/nohost))
- x86 Emulation - [v86](https://copy.sh/v86/)
- A full list of dependencies can be found [here](https://github.com/MercuryWorkshop/anuraOS/network/dependencies)

- Code snippets used

Note: This list is non-exhaustive and may not contain all of the code snippets used in production of this software.

- [original base](https://gist.github.com/chwkai/290488)
- [Material Design Pure CSS Switch](https://codepen.io/sajran/pen/dMKvpb) by [sajran](https://codepen.io/sajran)
- [Material Design Pure CSS Contained Button](https://codepen.io/finnhvman/pen/MQyJxV) by [finnhvman](https://codepen.io/finnhvman)

- Design & Assets

- UI design inspiration - [Google ChromeOS](https://www.google.com/chromebook/chrome-os/)
- Various icons - [papirus icon theme](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme)
- Various assets - [Google ChromeOS](https://www.google.com/chromebook/chrome-os/)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
WebOS complete with v86 integration and a minimal yet capable desktop enviroment.
Formerly known as Chimera. Based off of the AliceWM.

### Easy Install(When in a codespace)
### Easy Install (When in a codespace)

- Run `bash codespace-basic-setup.sh`

Expand Down
1 change: 0 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ If you are wondering what counts as a vulnerability, heres a good list:
- The ability to execute arbitrary code on the server hosting Anura(not in Anura itself, as this is an intended feature)
- The ability to crash Anura(As in for everyone, not just your browser session)


## Implementing Security(For Project Members and Contributors)

See [SECURITY-BP.md](./documentation/SECURITY-BP.md) for instructions on implementing security in your code.
68 changes: 37 additions & 31 deletions apps/term.app/term.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,60 @@ const $ = document.querySelector.bind(document);

window.addEventListener("load", async () => {

/** @type {Anura} */
let anura = top.anura;
/** @type {Anura} */
let anura = top.anura;

const t = new hterm.Terminal();
top.t = t;
const t = new hterm.Terminal();
top.t = t;

let htermNode = $("#terminal");
let htermNode = $("#terminal");




t.decorate(htermNode);

t.decorate(htermNode);

const decoder = new TextDecoder("UTF-8");
t.onTerminalReady = async () => {
let currentCol;
let currentRow;
let e = document.querySelector("iframe").contentDocument.querySelector("x-screen");
console.log(e);
e.style.overflow = "hidden"
let io = t.io.push();

const decoder = new TextDecoder("UTF-8");
t.onTerminalReady = async () => {
t.setBackgroundColor("#141516");
t.setCursorColor("#bbb");
currentCol = t.screenSize.width;
currentRow = t.screenSize.height;
const pty = await anura.x86.openpty("TERM=xterm DISPLAY=:0 bash", t.screenSize.width, t.screenSize.height, (data) => {
io.print(data);
});

let e = document.querySelector("iframe").contentDocument.querySelector("x-screen");
console.log(e);
e.style.overflow = "hidden"
let io = t.io.push();

t.setBackgroundColor("#141516");
t.setCursorColor("#bbb");
const pty = await anura.x86.openpty("TERM=xterm DISPLAY=:0 bash", t.screenSize.width, t.screenSize.height, (data) => {
io.print(data);
});


function writeData(str) {
anura.x86.writepty(pty, str)
}

io.onVTKeystroke = writeData;
io.sendString = writeData;

function writeData(str) {
anura.x86.writepty(pty, str)
}
io.onTerminalResize = (cols, rows) => {
currentCol = cols;
currentRow = rows;
}

io.onVTKeystroke = writeData;
io.sendString = writeData;
io.onTerminalResize = (cols, rows) => {
anura.x86.resizepty(pty, cols, rows);
}
t.installKeyboard();

t.installKeyboard();

htermNode.querySelector("iframe").style.position = "relative";
console.log("wtf")
anura.apps['anura.term'].windows[anura.apps['anura.term'].windows.length - 1].onresize = () => {
anura.x86.resizepty(pty, currentCol, currentRow);
}

htermNode.querySelector("iframe").style.position = "relative";
console.log("wtf")


}
}
});
22 changes: 11 additions & 11 deletions documentation/SECURITY-BP.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Security Blueprint
This Document will explain what and how security features are implemented in AnuraOS.


This Document will explain what and how security features are implemented in AnuraOS.

## Secure Math

In Anura, when coding in a cryptographic/security sensitive context, we replace `Math.random()` with our own function `cryptoRandom()`. `cryptoRandom()` is a direct replacement for `Math.random()` and the two are fully interchangeable. If you would like to implement `cryptoRandom()` you can use the following steps(for TypeScript):
In Anura, when coding in a cryptographic/security sensitive context, we replace `Math.random()` with our own function `cryptoRandom()`. `cryptoRandom()` is a direct replacement for `Math.random()` and the two are fully interchangeable. If you would like to implement `cryptoRandom()` you can use the following steps(for TypeScript):

1. If not already installed, run `npm install @types/node`
2. Add `import * as crypto from "crypto";` to the head of whatever file in which you would like to replace `Math.random()`
3. Add the following function to your code:

1. If not already installed, run `npm install @types/node`
2. Add `import * as crypto from "crypto";` to the head of whatever file in which you would like to replace `Math.random()`
3. Add the following function to your code:

```ts
function cryptoRandom() {
const typedArray = new Uint8Array(1);
const randomValue = crypto.getRandomValues(typedArray)[0];
const randomFloat = randomValue / Math.pow(2, 8);
return randomFloat;
const typedArray = new Uint8Array(1);
const randomValue = crypto.getRandomValues(typedArray)[0];
const randomFloat = randomValue / Math.pow(2, 8);
return randomFloat;
}
```

4. You can now replace `Math.random()` anywhere in your code with `cryptoRandom()`.

## TODO
Binary file added public/assets/icons/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 25 additions & 1 deletion public/assets/icons/chrome.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/assets/icons/launcher.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/lagtrain.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6bb8bea

Please sign in to comment.