-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.html
More file actions
183 lines (160 loc) · 6.17 KB
/
index.html
File metadata and controls
183 lines (160 loc) · 6.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PyScript PoC</title>
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
<style>
body {
font-family: system-ui, sans-serif;
max-width: 800px;
margin: 40px auto;
padding: 20px;
background: #ffffff;
color: #000000;
}
h1 {
color: #000000;
margin-bottom: 10px;
}
.subtitle {
color: #666;
margin-bottom: 30px;
}
.input-group {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
input[type="text"] {
flex: 1;
padding: 10px;
font-size: 15px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background: #f0f0f0;
color: #000;
border: 1px solid #ccc;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
font-weight: 500;
font-size: 15px;
}
button:hover {
background: #e0e0e0;
}
button:disabled {
background: #f9f9f9;
color: #999;
cursor: wait;
}
#output {
background: #ffffff;
border: 1px solid #ddd;
border-radius: 4px;
padding: 15px;
min-height: 150px;
font-family: monospace;
font-size: 13px;
white-space: pre-wrap;
color: #000;
}
.success {
color: #006600;
}
.info {
color: #0044cc;
}
.fail {
color: #cc0000;
}
.loading {
color: #999;
font-style: italic;
}
</style>
</head>
<body>
<h1>PyScript + Package Tests</h1>
<p class="subtitle">Testing all packages in Pyodide via PyScript</p>
<div class="input-group">
<button id="pkgTestBtn" py-click="run_tests">Run Package Tests</button>
<button id="fullTestBtn" py-click="run_full_suite">Run Full Pysodium Tests</button>
<button id="liboqsTestBtn">Run Liboqs Tests</button>
<button id="hioClientBtn" py-click="run_hio_client_bridge">Run Hio Client (JS bridge)</button>
<button id="blake3TestBtn" py-click="run_blake3_suite">Run Blake3 Tests</button>
<button id="indexeddbTestBtn" py-click="run_indexeddb_suite">Run IndexedDB Tests</button>
<button id="indexeddbProbeBtn" py-click="run_indexeddb_probe">Run IndexedDB Probe</button>
</div>
<div id="output"><span class="loading">Loading PyScript and packages... (may take 30-60s first time)</span></div>
<script type="py" src="./python/package_tests.py" config="pyscript.toml"></script>
<script type="py" src="./python/run_pysodium_suite.py" config="pyscript.toml"></script>
<script type="py" src="./python/run_blake3_suite.py" config="pyscript.toml"></script>
<script type="py" src="./python/run_hio_client_bridge.py" config="pyscript.toml"></script>
<script type="py" src="./python/run_indexeddb_suite.py" config="pyscript.toml"></script>
<script type="py" src="./python/indexeddb_probe.py" config="pyscript.toml"></script>
<script type="module">
const output = document.getElementById("output");
const liboqsBtn = document.getElementById("liboqsTestBtn");
let liboqsWorker = null;
let liboqsRunning = false;
function setLiboqsRunning(running) {
liboqsRunning = running;
liboqsBtn.disabled = running;
liboqsBtn.textContent = running ? "Running Liboqs Tests..." : "Run Liboqs Tests";
}
function appendBatch(entries) {
if (!entries || entries.length === 0) return;
let html = "";
for (const entry of entries) {
html += `<span class="${entry.css}">[${entry.time}] ${entry.msg}</span>\n`;
}
output.insertAdjacentHTML("beforeend", html);
output.scrollTop = output.scrollHeight;
}
function ensureLiboqsWorker() {
if (liboqsWorker) return liboqsWorker;
liboqsWorker = new Worker("./workers/liboqs_worker.js");
liboqsWorker.onmessage = (event) => {
const { type, state, entries, error } = event.data || {};
if (type === "log-batch") {
appendBatch(entries);
return;
}
if (type === "status") {
if (state === "done" || state === "error") {
setLiboqsRunning(false);
}
if (state === "error" && error) {
appendBatch([{
time: new Date().toLocaleTimeString("en-US", { hour12: false }) + "." + String(new Date().getMilliseconds()).padStart(3, "0"),
msg: error.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
css: "fail"
}]);
}
}
};
liboqsWorker.onerror = (event) => {
setLiboqsRunning(false);
appendBatch([{
time: new Date().toLocaleTimeString("en-US", { hour12: false }) + "." + String(new Date().getMilliseconds()).padStart(3, "0"),
msg: String(event.message || "Liboqs worker error").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
css: "fail"
}]);
};
return liboqsWorker;
}
liboqsBtn.addEventListener("click", () => {
if (liboqsRunning) return;
output.innerHTML = '<span class="loading">Starting liboqs worker...</span>\n';
setLiboqsRunning(true);
ensureLiboqsWorker().postMessage({ type: "run" });
});
</script>
</body>
</html>