forked from supertestnet/superstore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
onboard.html
337 lines (337 loc) · 15.7 KB
/
onboard.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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<title>Magic Webstore</title>
<link rel="shortcut icon" type="image/png" href="favicon.png">
<script src="https://bundle.run/[email protected]"></script>
<style>
* {
box-sizing: border-box;
font-size: 1.15rem;
font-family: Arial, sans-serif;
}
html {
max-width: 120ch;
padding: 3rem 1rem;
margin: auto;
line-height: 1.25;
background-color: #ebebeb;
}
h1 {
font-size: 2rem;
}
h2 {
font-size: 1.5rem;
}
input {
line-height: 1.25;
width: 100%;
height: 1.8rem;
font-size: 1.15rem;
border: 1px solid grey;
}
.border {
border: 1px solid black;
}
.row {
display: flex;
justify-content: space-between;
filter: drop-shadow(0 0 3px #000);
background-color: white;
margin-bottom: 1rem;
margin-top: 1rem;
padding: 1rem;
border-radius: 0.5rem;
}
.video {
display: flex;
justify-content: center;
align-items: center;
flex: 5;
}
.video img {
max-width: 450px;
}
.basics {
display: flex;
flex-direction: column;
flex: 4;
align-items: center;
padding: 1rem;
}
.big_title {
text-align: center;
}
.simple_desc {
width: 90%;
text-align: center;
}
.big_buttons {
width: 100%;
display: flex;
justify-content: center;
margin-bottom: 2rem;
}
.big_button {
padding: 1rem;
background-color: red;
color: white;
font-weight: bold;
text-align: center;
min-width: 8rem;
cursor: pointer;
}
.genie {
max-height: 15rem;
}
.signup {
display: none;
border: 1px solid black;
border-radius: 1rem;
padding: 1rem;
max-width: 25rem;
margin: auto;
background-color: white;
filter: drop-shadow(0 0 3px #000);
}
.circle_row {
display: flex;
align-items: center;
}
.circle {
display: flex;
justify-content: center;
align-items: center;
width: 4rem;
height: 4rem;
border: 1px solid black;
border-radius: 2rem;
margin: 1rem;
}
.blue {
color: blue;
text-decoration: underline;
cursor: pointer;
}
.black-bg {
display: none;
width: 100%;
position: fixed;
top: 0;
left: 0;
background-color: black;
opacity: .5;
width: 100vw;
height: 100vh;
}
.modal {
display: none;
position: fixed;
box-sizing: border-box;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 90%;
max-width: 560px;
background-color: white;
border-radius: 1rem;
padding: 20px;
color: black;
text-align: center;
word-wrap: break-word;
}
.back_btn {
display: none;
}
@media screen and (max-width: 700px) {
.row {
display: block;
}
@media screen and (max-width: 400px) {
.big_buttons {
display: block;
}
.genie {
max-height: initial;
width: 100%;
}
}
</style>
<script>
var $ = document.querySelector.bind( document );
var $$ = document.querySelectorAll.bind( document );
var url_params = new URLSearchParams( window.location.search );
var url_keys = url_params.keys();
var $_GET = {}
for ( var key of url_keys ) $_GET[ key ] = url_params.get( key );
var relays = [
"wss://nostrue.com",
"wss://nostr.noones.com",
"wss://nos.lol"
]
</script>
<script>
function bytesToHex( bytes ) {
return bytes.reduce( ( str, byte ) => str + byte.toString( 16 ).padStart( 2, "0" ), "" );
}
function textToHex( text ) {
var encoder = new TextEncoder().encode( text );
return [...new Uint8Array(encoder)]
.map( x => x.toString( 16 ).padStart( 2, "0" ) )
.join( "" );
}
function hexToText( hex ) {
var bytes = new Uint8Array(Math.ceil(hex.length / 2));
for (var i = 0; i < hex.length; i++) bytes[i] = parseInt(hex.substr(i * 2, 2), 16);
var text = new TextDecoder().decode( bytes );
return text;
}
function modalVanish() {
$( ".black-bg" ).style.display = "none";
$( ".modal" ).style.display = "none";
}
function showModal( content, block_til_clear ) {
if ( block_til_clear ) var fn = `modalVanish();sessionStorage[ 'modal_cleared' ] = true;`; else var fn = `modalVanish();`;
$( ".modal" ).innerHTML = `<div style="position: absolute;right: 1rem;top: 0.5rem;font-size: 2rem; cursor: pointer;" onclick="${fn}">×</div>`;
$( ".modal" ).innerHTML += `<div style="overflow-y: scroll; max-height: 80vh; margin-top: 1.5rem;">${content}</div>`;
$( ".black-bg" ).style.display = "block";
$( ".modal" ).style.display = "block";
}
</script>
</head>
<body>
<h1>
Magic Webstore 🪄
</h1>
<div class="explain">
<div class="row">
<div class="video">
<a href="https://www.youtube.com/watch?v=cAH0384V1Bo" target="_blank"><img style="width: 100%; filter: drop-shadow(0 0 3px #000);" src="https://camo.githubusercontent.com/2224bee86d24077884a26c7aa6e72596ca60ec004a9ac4f8f2b73d78dc291c1a/68747470733a2f2f7375706572746573746e65742e6769746875622e696f2f737570657273746f72652f737570657273746f72652d7468756d626e61696c2e706e67"></a>
</div>
<div class="basics">
<h2 class="big_title">
Ecommerce Simplified
</h2>
<p class="simple_desc">
Magic Webstore is focused on reducing the headaches of running a webstore.
</p>
<div class="big_buttons">
<div class="big_button signup_btn">Get started</div>
<span> </span>
<div class="big_button login_btn">Log in</div>
</div>
</div>
</div>
<div class="row">
<div class="basics">
<h2 class="big_title">
The Magic String
</h2>
<p class="simple_desc">
With Magic Webstore, your entire store is contained in your magic string, like a genie in a lamp. You just need to save that one string (back it up and store it safely) and you can do everything you need: add products to your store, manage your inventory, track your income, and keep your money safe.
</p>
</div>
<div class="video">
<img class="genie" src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Magic_lamp.svg/614px-Magic_lamp.svg.png">
</div>
</div>
<div class="row">
<div class="video">
<img style="width: 100%" src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Teacher_%2814016%29_-_The_Noun_Project.svg/768px-Teacher_%2814016%29_-_The_Noun_Project.svg.png">
</div>
<div class="basics">
<h2 class="big_title">
The Big Difference
</h2>
<p class="simple_desc">
Unlike traditional webstores, Magic Webstore doesn't need your identity or bank account information, so the onboarding process is sleek and simple. Your Magic Webstore will automatically create a bitcoin wallet for you and even your private key is contained in your Magic String.<br><br>You just start adding products to your store and then share the link with people. They can view your products, buy items from you, and send you messages.
</p>
</div>
</div>
<div class="row">
<div class="basics">
<h2 class="big_title">
How can I use Magic Webstore?
</h2>
<p class="simple_desc">
Magic Webstore lets you monetize your life. Have a youtube channel? Start selling merchandise through Magic Webstore. Have a blog? Let people support you through sales and branding. Want to sell items at a farmer's market? Treat Magic Webstore as your point of sale system and let people check out with ease.<br><br>Try it out today! Magic Webstore is proudly built on bitcoin, the money of the internet, and nostr, a distributed data caching protocol. Magic Webstore is completely free and open source and you can dive into its source code by <a href="https://github.com/supertestnet/superstore" target="_blank">clicking here</a>.
</p>
</div>
<div class="video">
<img style="width: 100%; max-width: 18rem;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/Home_Business_BLUE_Graphic.png/693px-Home_Business_BLUE_Graphic.png">
</div>
</div>
</div>
<div style="text-align: right; margin: auto; margin-bottom: 1rem; max-width: 25rem;"><button class="back_btn">Back</button></div>
<div class="signup">
<div style="text-align: center;">
Magic Webstore does not use traditional usernames and passwords, it uses magic strings. Make sure to back yours up! Your magic string is the only way to access your store.<br>
</div>
<div class="circle_row">
<div class="circle"><div>1</div></div>
<div class="instruction"><span class="blue" onclick="genString()">Generate</span> your magic string</div>
</div>
<div style="flex-direction: column; justify-content: center; align-items: center; word-wrap: break-word; overflow-wrap: anywhere; padding: 1rem; border: 1px solid black; margin-top: 1rem; display: none;" class="magic_string_box"><p style="font-weight: bold; text-decoration: underline;">Your magic string</p><div class="magic_string"></div></div>
<div class="circle_row">
<div class="circle"><div>2</div></div>
<div class="instruction"><span class="blue" onclick="backupString()">Back up</span> your magic string</div>
</div>
<div class="circle_row">
<div class="circle"><div>3</div></div>
<div class="instruction"><span class="blue" onclick="useString()">Log in</span> with your magic string</div>
</div>
</div>
<script>
var useString = () => {
var ms = prompt( "Please enter your magic string" );
if ( !ms ) return;
var privkey = ms.substring( 0, 64 );
var relays = hexToText( ms.substring( 64 ) );
var index = window.location.pathname.indexOf( "onboard.htm" ) > -1 ? window.location.pathname.indexOf( "onboard.htm" ):100000;
var extra_slash = window.location.pathname.substring( 0, index ).endsWith( "/" ) ? "":"/";
var port = "";
if ( window.location.port ) port = `:${window.location.port}`;
var url = window.location.protocol + "//" + window.location.hostname + port + window.location.pathname.substring( 0, index ) + extra_slash + "index.html?privkey=" + privkey + "&relays=" + encodeURI( relays );
window.location.href = url;
}
var genString = () => {
$( '.magic_string_box' ).style.display = "flex";
$( '.magic_string' ).innerText = "•";
$( '.magic_string' ).style.fontSize = "250%";
setTimeout( function() {$( '.magic_string' ).innerText = "••";}, 200 );
setTimeout( function() {$( '.magic_string' ).innerText = "•••";}, 400 );
setTimeout( function() {
$( '.magic_string_box' ).innerHTML = `<p style="font-weight: bold; text-decoration: underline;">Your magic string</p><div class="magic_string" style="text-align: center;"></div>`;
$( '.magic_string' ).style.fontSize = "100%";
$( '.magic_string' ).innerText = "00" + bytesToHex( nobleSecp256k1.utils.randomPrivateKey() ).substring( 2, 64 ) + textToHex( JSON.stringify( relays ) );
}, 600 );
}
var backupString = () => {
var content = `<p>Did you back up your magic string? Save it somewhere safe where only you can access it. Your magic string is the only way to access your store. If you lose it, you will not only lose access to your store but also to any money you received since the last time you withdrew. Make sure you back this up before continuing:</p><p style="text-decoration: underline; font-weight: bold;">Your magic string</p><p>${$( '.magic_string' ).innerText}</p>`;
showModal( content );
}
</script>
<script>
$( '.signup_btn' ).onclick = () => {
$( '.explain' ).style.display = "none";
$( '.signup_btn' ).style.display = "none";
$( '.back_btn' ).style.display = "inline";
$( '.signup' ).style.display = "block";
$( '.magic_string_box' ).style.display = "none";
}
$( '.login_btn' ).onclick = () => {
useString();
}
$( '.back_btn' ).onclick = () => {
$( '.explain' ).style.display = "block";
$( '.signup_btn' ).style.display = "inline";
$( '.back_btn' ).style.display = "none";
$( '.signup' ).style.display = "none";
}
</script>
<div class="black-bg"></div>
<div class="modal"></div>
</body>
</html>