-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
52 lines (46 loc) · 2.06 KB
/
index.html
File metadata and controls
52 lines (46 loc) · 2.06 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Proxyman Electron Test</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; padding: 24px; background: #1e1e2e; color: #cdd6f4; }
h1 { font-size: 18px; margin-bottom: 16px; }
.status { padding: 8px 12px; margin: 8px 0; border-radius: 6px; font-size: 14px; }
.pending { background: #313244; color: #a6adc8; }
.success { background: #1e3a2f; color: #a6e3a1; }
.error { background: #3a1e1e; color: #f38ba8; }
</style>
</head>
<body>
<h1>Proxyman Electron Test</h1>
<div id="get-status" class="status pending">GET /get — pending...</div>
<div id="post-status" class="status pending">POST /post — pending...</div>
<div id="overall" class="status pending">Waiting for requests...</div>
<script>
// Renderer triggers HTTPS requests via IPC to the main process.
// Main process performs the actual network calls and returns results.
function setStatus(id, text, cls) {
const el = document.getElementById(id);
el.className = 'status ' + cls;
el.textContent = text;
}
async function run() {
try {
// GET request — triggered from renderer, executed in main process
const getResult = await window.api.fetchGet();
setStatus('get-status', 'GET /get — ' + getResult.status + ' OK', 'success');
// POST request — triggered from renderer, executed in main process
const postResult = await window.api.fetchPost();
setStatus('post-status', 'POST /post — ' + postResult.status + ' OK', 'success');
setStatus('overall', 'All requests completed successfully!', 'success');
} catch (err) {
setStatus('overall', 'Error: ' + err.message, 'error');
}
// Signal main process that all requests are done
window.api.notifyDone();
}
run();
</script>
</body>
</html>