-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
113 lines (104 loc) · 2.96 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Nostr Relay and PubKey Input</title>
<style>
body {
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
background-color: white;
padding: 20px;
border-radius: 8px;
width: 100%;
max-width: 800px;
}
input,
button {
width: 100%;
padding: 15px;
margin: 10px 0;
border: none;
border-radius: 4px;
box-sizing: border-box;
}
input {
background-color: #eee;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
button {
background-color: #6200ea;
color: white;
font-weight: bold;
text-transform: uppercase;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #3700b3;
}
pre {
background-color: #e0e0e0;
padding: 15px;
overflow-x: auto;
margin-top: 20px;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="container">
<input
type="text"
id="relayInput"
placeholder="Enter Relay URL"
value="wss://relay.damus.io"
/>
<input
type="text"
id="pubKeyInput"
placeholder="Enter PubKey"
value="de7ecd1e2976a6adb2ffa5f4db81a7d812c8bb6698aa00dcf1e76adb55efd645"
/>
<button id="fetchButton">Fetch Profile</button>
<pre id="result"></pre>
</div>
<script type="module">
import { processUsers } from './index.js' // Adjust the path as necessary
document.getElementById('fetchButton').addEventListener('click', () => {
const relay = document.getElementById('relayInput').value
const pubKey = document.getElementById('pubKeyInput').value
if (relay && pubKey) {
processUsers([pubKey], [relay])
.then(profiles => {
// Assuming profiles is an object where the key is the user ID and the value is their profile
const userProfile = profiles[pubKey] // Get the profile for the entered public key
document.getElementById('result').textContent = JSON.stringify(
userProfile,
null,
2
)
})
.catch(error => {
document.getElementById(
'result'
).textContent = `Error: ${error.message}`
})
} else {
document.getElementById('result').textContent =
'Please enter both a relay URL and a pubkey.'
}
})
</script>
</body>
</html>