Skip to content

Commit

Permalink
Add redirect to use gh pages for r2wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jan 15, 2024
1 parent 9981325 commit fea20c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 219 deletions.
108 changes: 4 additions & 104 deletions w/index.html
Original file line number Diff line number Diff line change
@@ -1,106 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<link rel="shortcut icon" href="../favicon.ico">
<title>My Web Component</title>
<script src="https://unpkg.com/@antonz/runno/dist/runno.js"></script>
<script src="ansi_to_html.js"></script>
</head>
<body>
<textarea id="script">
pd 2
?E Hello World
</textarea>
<button onclick="run_r2()">Run R2</button>
<button onclick="run_js()">Run JS</button>
<div id="shell" style="display:block;background-color:black;color:white;white-space:pre;font-family:monospace">
</div>

<script>
const { WASI } = window.Runno;

//...
let script_name = "/script.r2";
let script_r2_js = `
pd 2
?E Hello World
`;
let script_r2 = `
pd 2
?E Hello World
`;
function run_js() {
script_name = "/script.r2.js";
const el = document.getElementById("script");
script_r2_js = el.value;
div = document.getElementById("shell");
div.innerHTML = 'Loading...';
run_wasm();
}
function run_r2() {
script_name = "/script.r2";
const el = document.getElementById("script");
script_r2 = el.value;
div = document.getElementById("shell");
div.innerHTML = 'Loading...';
run_wasm();
}
var convert = new Convert();

function run_wasm() {
div = document.getElementById("shell");
div.innerHTML = '';
const result = WASI.start(fetch("radare2.wasm?v=5.8.8"), {
//args: ["radare2", "-qescr.color=0", "-i", script_name, "some-file.txt"],
args: ["radare2", "-i", script_name, "some-file.txt"],
env: { SOME_KEY: "some value" },
stdout: (out) => {
div = document.getElementById("shell");
div.innerHTML += convert.toHtml(out);
///console.log("stdout", out),
},
stderr: (err) => {
console.error("stderr", err),
div = document.getElementById("shell");
div.innerHTML += out;
},
/// stdin: () => prompt("stdin:"),
fs: {
"/script.r2": {
path: "/script.r2",
timestamps: {
access: new Date(),
change: new Date(),
modification: new Date(),
},
mode: "string",
content: script_r2,
},
"/script.r2.js": {
path: "/script.r2.js",
timestamps: {
access: new Date(),
change: new Date(),
modification: new Date(),
},
mode: "string",
content: script_r2_js,
},
"/some-file.txt": {
path: "/some-file.txt",
timestamps: {
access: new Date(),
change: new Date(),
modification: new Date(),
},
mode: "string",
content: "Some content for the file.",
},
},
});
}
</script>
</body>
<meta http-equiv="refresh" content="0; url=https://radareorg.github.io/r2wasm/index.html" />
</head>
</html>

115 changes: 0 additions & 115 deletions w/index2.html

This file was deleted.

0 comments on commit fea20c3

Please sign in to comment.