-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
983 lines (897 loc) · 41.2 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
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Openbazaar-restapi-ui by drwasho</title>
<!-- Bootstrap -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link href="https://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row marketing"><img class="col-lg-12 col-xs-12" src="https://i.imgur.com/Vrbvrfa.png"></div>
<div class="header clearfix">
<h2 class="text-muted">OpenBazaar API Tools</h2>
</div>
<!-- GET STARTED -->
<div class="row marketing">
<h2>Getting Started</h2>
<p><b>You must be running</b> the <a href="https://github.com/OpenBazaar/OpenBazaar-Server" target="_blank">OpenBazaar server</a> for this page to work! Ubuntu users you will need to install 'python-dev', 'libffi-dev', and 'gcc' before running 'requirements.txt' (check the installation instructions to know what I'm talking about.</p>
<p>During development, most of the network will be using the Testnet, so run your servers using the following command: <mark>$ python openbazaard.py start --testnet</mark></p>
<p>You can get the code for this page <a href="https://github.com/drwasho/openbazaar-restapi-ui/tree/gh-pages" target="_blank">here</a>.</p>
<h3>Latest features:</h3>
<ul>
<li>Websockets now added! Supports: <mark>'get_vendors'</mark>, <mark>'get_moderators'</mark>, and <mark>'get_homepage_listings'</mark>!</li>
</ul>
<h3>Server</h3>
<p>Add your own server IP address below; by default it is set to <mark>localhost</mark> (i.e. you're running the OpenBazaar daemon on your computer). The default port for the REST API is <mark>18469</mark>, while the default websocket port is <mark>18466</mark>. If your server is hosted remotely, your port <b>must be open</b> for this to work!</p>
<p>To connect to your remote server, run the OpenBazaar server with the following command:<p>
<p><mark>$ python openbazaard.py start -t -r [IP address of your server]</mark>.</p>
<p>Please note that running the server this way is <b>not secure</b>, and for testing purposes only. I've tested this with Digital Ocean + Ubuntu 14.04, and it works great.</p>
<h4>Server IP Address:</h4>
<p><input id="daemon" class="col-lg-7" value="localhost" /></p>
<br>
<h3>Known Bugs</h3>
<ul>
<li>Websockets won't work with <mark>https</mark>, only <mark>http</mark>. You're better off cloning the repo into your machine and running the <mark>index.html</mark> file directly</li>
</ul>
</div>
<!-- WEBSOCKET CONTROL PANEL -->
<!-- DISCOVERY -->
<div class="row marketing">
<h1 align="right"><b>Websocket Panel</b></h1>
<hr></hr>
<h3>Controls</h3>
<!-- Open Websockets -->
<div class="col-lg-12">
<h4>Start here</h4>
<button class="btn btn-info" type="button" id="open" onclick="openws()">Open WS Connection</button>
</div>
<!-- Get Vendors -->
<div class="col-lg-12">
<br>
<form action="#" method="post" id="get_vendors">
<h4>Discover</h4>
<row class="col-lg-12"><button class="btn btn-success" type="submit">Get Vendors</button>
</row>
</form>
</div>
<!-- Get Moderators -->
<div class="col-lg-12">
<br>
<form action="#" method="post" id="get_moderators">
<row class="col-lg-12"><button class="btn btn-success" type="submit">Get Moderators</button>
</row>
</form>
</div>
<!-- Get Homepage Listings -->
<div class="col-lg-12">
<br>
<form action="#" method="post" id="get_homepage_listings">
<row class="col-lg-12"><button class="btn btn-success" type="submit">Get Homepage Listings</button>
</row>
</form>
</div>
<!-- Search -->
<div class="col-lg-12">
<br>
<form action="#" method="post" id="search">
<h4>Search for listings</h4>
<row class="col-lg-5">Keywords</row>
<row class="col-lg-7"><input id="keywords" name="keyword" required/></row>
<row class="col-lg-12"><button class="btn btn-success" type="submit">Search</button>
</row>
</form>
</div>
<!-- Send Chat Message -->
<div class="col-lg-12">
<br>
<form action="#" method="post" id="chat">
<h4>Send Chat Message</h4>
<row class="col-lg-5">GUID</row>
<row class="col-lg-7"><input id="chat_guid" name="guid" /></row><br><br>
<row class="col-lg-5">Handle</row>
<row class="col-lg-7"><input id="chat_handle" name="handle" /></row><br><br>
<row class="col-lg-5">Message</row>
<row class="col-lg-7"><input id="chat_message" name="message" /></row><br><br>
<row class="col-lg-5">Subject</row>
<row class="col-lg-7"><input id="chat_subject" name="subject" /></row><br><br>
<row class="col-lg-5">Message Type</row>
<row class="col-lg-7"><input id="chat_msgtype" name="message_type" /></row><br><br>
<row class="col-lg-5">Key</row>
<row class="col-lg-7"><input id="chat_key" name="recipient_key" disabled /></row><br><br>
<row class="col-lg-8"><button class="btn btn-success" type="submit">Send Chat</button>
</row>
</form>
</div>
<!-- Websocket Output -->
<div class="col-lg-12">
<br>
<textarea class="col-lg-12" id="terminal" rows="15" placeholder="Websocket Output"></textarea>
</div>
<!-- Close Websocket -->
<div class="col-lg-12">
<br>
<button class="btn btn-danger" type="button" id="close">Close WS Connection</button>
</div>
</div>
<!-- DISCOVERY -->
<!-- VIEW OTHER PROFILES -->
<div class="row marketing">
<h1 align="right"><b>Discovery</b></h1>
<hr></hr>
<h3>View Profile</h3>
<div class="col-lg-12">
<form value="/api/v1/profile" method="get" enctype="multipart/form-data" id="view_profile" class="navbar-form" target="_blank">
<row class="col-lg-5">GUID:</row>
<row class="col-lg-7"><input id="view_guid" name="guid" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="View" />
</row>
</form>
</div>
</div>
<!-- VIEW LISTINGS -->
<div class="row marketing">
<h3>View Listings</h3>
<div class="col-lg-12">
<form value="/api/v1/get_listings" method="get" enctype="multipart/form-data" id="get_listings" class="navbar-form" target="_blank">
<row class="col-lg-5">GUID:</row>
<row class="col-lg-7"><input id="listing_target_guid" name="guid" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="View"/></row>
</form>
</div>
</div>
<!-- VIEW CONTRACT -->
<div class="row marketing">
<h3>View Contract</h3>
<div class="col-lg-12">
<form value="/api/v1/contracts" method="get" enctype="multipart/form-data" id="get_contract" class="navbar-form" target="_blank">
<row class="col-lg-5">GUID:</row>
<row class="col-lg-7"><input id="contract_target_guid" name="guid" required></row></br></br>
<row class="col-lg-5">Contract ID:</row>
<row class="col-lg-7"><input id="contract_id" name="id" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="View"/></row>
</form>
</div>
</div>
<!-- VIEW FOLLOWERS/UNFOLLOWING -->
<div class="row marketing">
<h3>View Followers/Following</h3>
<div class="col-lg-12">
<form value="/api/v1/get_followers" method="get" enctype="multipart/form-data" id="get_followers" class="navbar-form" target="_blank">
<row class="col-lg-5">Get Followers:</row>
<row class="col-lg-7"><input id="get_user_followers" name="guid" autocomplete="off" placeholder="GUID" required></row><br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Submit"/></row>
</form>
<br>
<br>
<form value="/api/v1/get_following" method="get" enctype="multipart/form-data" id="get_following" class="navbar-form" target="_blank">
<row class="col-lg-5">Get Following:</row>
<row class="col-lg-7"><input id="get_user_following" name="guid" autocomplete="off" placeholder=" GUID" required></row><br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Submit"/></row>
</form>
</div>
</div>
<!-- MY NODE -->
<!-- VIEW MY PROFILE -->
<div class="row marketing">
<h1 align="right"><b>My Node</b></h1>
<hr></hr>
<h3>My Profile</h3>
<div class="col-lg-12">
<row class="col-lg-3">
<form value="/api/v1/profile" method="get" enctype="multipart/form-data" id="view_my_profile" class="navbar-form" target="_blank">
<input class="btn btn-success" type="submit" value="My Profile" />
</form>
</row>
<row class="col-lg-3">
<!-- VIEW LISTINGS -->
<form value="/api/v1/get_listings" method="get" enctype="multipart/form-data" id="get_my_listings" class="navbar-form" target="_blank">
<input class="btn btn-success" type="submit" value="My Listings"/>
</form>
</row>
<row class="col-lg-3">
<!-- VIEW FOLLOWERS -->
<form value="/api/v1/get_followers" method="get" enctype="multipart/form-data" id="get_my_followers" class="navbar-form" target="_blank">
<input class="btn btn-success" type="submit" value="My Followers"/>
</form>
</row>
<row class="col-lg-3">
<!-- VIEW FOLLOWING -->
<form value="/api/v1/get_following" method="get" enctype="multipart/form-data" id="get_my_following" class="navbar-form" target="_blank">
<input class="btn btn-success" type="submit" value="My Following"/>
</form>
</row>
</div>
<div class="col-lg-12">
<br>
<!-- VIEW CONTRACT -->
<form value="/api/v1/contracts" method="get" enctype="multipart/form-data" id="get_contract" class="navbar-form" target="_blank">
<row class="col-lg-12">Contract ID:</row><br>
<row class="col-lg-12"><input id="contract_id" name="id" required></row><br><br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Search"/></row>
</form>
</div>
</div>
<!-- PROFILE CONTROLS -->
<!-- UPDATE PROFILE -->
<div class="row marketing">
<br>
<h1 align="right"><b>Profile Settings</b></h1>
<hr></hr>
<h3>Update Your Profile</h3>
<div class="col-lg-12">
<form value="/api/v1/profile" method="post" enctype="multipart/form-data" id="profile" class="navbar-form" target="_blank" onsubmit="sanity()">
<row class="col-lg-5">Name:</row>
<row class="col-lg-7"><input id="name" autocomplete="off"></row></br></br>
<row class="col-lg-5">Handle:</row>
<row class="col-lg-7"><input id="handle" autocomplete="off"></row></br></br>
<row class="col-lg-5">About:</row>
<row class="col-lg-7"><input id="about" autocomplete="off"></row></br></br>
<row class="col-lg-5">Short Description:</row>
<row class="col-lg-7"><input id="short_description" autocomplete="off"></row></br></br>
<row class="col-lg-5">Location:</row>
<row class="col-lg-7">
<select id="location" name="location" >
<option value="NA">NA</option>
<option value="AUSTRALIA">Australia</option>
<option value="UNITED_STATES">United States</option>
</select>
</row></br></br>
<row class="col-lg-5">Website:</row>
<row class="col-lg-7"><input id="website" autocomplete="off"></row></br></br>
<row class="col-lg-5">Email:</row>
<row class="col-lg-7"><input id="email" autocomplete="off"></row></br></br>
<row class="col-lg-5">Vendor:</row>
<row class="col-lg-7">
<select id="vendor" name="vendor" >
<option value="true">true</option>
<option value="false">false</option>
</select>
</row></br></br>
<row class="col-lg-5">NSFW:</row>
<row class="col-lg-7">
<select id="nsfw" name="nsfw" >
<option value="true">true</option>
<option value="false">false</option>
</select>
</row></br></br>
<row class="col-lg-5">Add a Moderator:</row>
<row class="col-lg-7"><input id="choose_mod" autocomplete="off"></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Submit"/></row>
</form>
</div>
</div>
<!-- SOCIAL ACCOUNTS -->
<div class="row marketing">
<h3>Add Social Accounts</h3>
<div class="col-lg-12">
<form value="/api/v1/social_accounts" method="post" enctype="multipart/form-data" id="social_accounts" class="navbar-form" target="_blank">
<row class="col-lg-5">Select Social Account:</row>
<row class="col-lg-7">
<select id="account_type" name="account_type" >
<option value="facebook">Facebook</option>
<option value="snapchat">Snapchat</option>
<option value="twitter">Twitter</option>
<option value="instagram">Instagram</option>
</select>
</row></br></br>
<row class="col-lg-5">Username:</row>
<row class="col-lg-7"><input id="username" name="username" autocomplete="off" id="username" required></row></br></br>
<row class="col-lg-5">Proof URL:</row>
<row class="col-lg-7"><input id="proof" name="proof" autocomplete="off" id="proof" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Submit"/></row>
</form>
</div>
</div>
<!-- MODERATOR -->
<div class="row marketing">
<h3>Moderator Settings</h3>
<div class="col-lg-12">
<form value="/api/v1/make_moderator" method="post" enctype="multipart/form-data" id="become_moderator" class="navbar-form" target="_blank">
<row class="col-lg-5">Become a Moderator</row>
<row class="col-lg-7"><input class="btn btn-info" type="submit" value="Approve"/></row>
</form>
</div>
<div class="col-lg-12">
<form value="/api/v1/unmake_moderator" method="post" enctype="multipart/form-data" id="cancel_moderator" class="navbar-form" target="_blank">
<row class="col-lg-5">Become a Moderator</row>
<row class="col-lg-7"><input class="btn btn-danger" type="submit" value="Cancel"/></row>
</form>
</div>
</div>
<!-- FOLLOW/UNFOLLOW USERS -->
<div class="row marketing">
<h3>Follow/Unfollow User</h3>
<div class="col-lg-12">
<form value="/api/v1/follow" method="post" enctype="multipart/form-data" id="follow" class="navbar-form" target="_blank">
<row class="col-lg-5">Follow:</row>
<row class="col-lg-7"><input id="follow_user" name="guid" autocomplete="off" placeholder=" GUID" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Follow" id="yo"/></row>
</form>
</div>
<row class="col-lg-12"><br></row>
<div class="col-lg-12">
<form value="/api/v1/unfollow" method="post" enctype="multipart/form-data" id="unfollow" class="navbar-form" target="_blank">
<row class="col-lg-5">Unfollow:</row>
<row class="col-lg-7"><input id="unfollow_user" name="guid" autocomplete="off" placeholder=" GUID" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Unfollow"/></row>
</form>
</div>
</div>
<!-- IMAGES -->
<!-- VIEW IMAGES -->
<div class="row marketing">
<br>
<h1 align="right"><b>Images</b></h1>
<hr></hr>
<h3>View Images</h3>
<div class="col-lg-12">
<form value="/api/v1/get_image" method="get" enctype="multipart/form-data" id="get_image" class="navbar-form" target="_blank">
<row class="col-lg-12"><label>If the GUID field is empty, your own images will be queried.</label></row></br></br>
<row class="col-lg-5">GUID:</row>
<row class="col-lg-7"><input id="image_target_guid" name="guid"></row></br></br>
<row class="col-lg-5">Image Hash:</row>
<row class="col-lg-7"><input id="target_image_hash" name="hash" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="View" /></row>
</form>
</div>
</div>
<!-- UPLOAD IMAGES -->
<div class="row marketing">
<h3>Upload Images</h3>
<p>You will not be able to upload images without setting your 'name' and 'location' for your profile.</p>
<div class="col-lg-12">
<form value="/api/v1/upload_image" method="post" enctype="multipart/form-data" id="image_upload" class="navbar-form" target="_blank" onsubmit="convert64()">
<row class="col-lg-5">Image:</row>
<row class="col-lg-7"><input id="image_file" type="file"></row></br></br>
<row class="col-lg-5">Base64:</row>
<row class="col-lg-7"><input id="base64text" name="image" style="background-color: lightgrey" readonly/></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Upload" /></row>
</form>
</div>
</div>
<!-- NOTIFICATIONS -->
<!-- NOTIFICATION CENTRE -->
<div class="row marketing">
</br>
<h1 align="right"><b>Notifications</b></h1>
<hr></hr>
<h3><b>Commands</b></h3>
<div class="col-lg-12">
<form value="/api/v1/get_notifications" method="get" enctype="multipart/form-data" id="get_notifications" class="navbar-form" target="_blank">
<h4>Get Notifications</h4>
<row class="col-lg-12"><input class="btn btn-info" type="submit" value="Retrieve" /></row></br></br>
</form>
</div>
<div class="col-lg-12">
<form value="/api/v1/mark_notification_as_read" method="post" enctype="multipart/form-data" id="get_notifications" class="navbar-form" target="_blank">
<h4>Mark Notification as Read</h4>
<row class="col-lg-5">Notification ID:</row>
<row class="col-lg-7"><input id="notification_id" name="id" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-danger" type="submit" value="Mark as Read" /></row></br></br>
</form>
</div>
<div class="col-lg-12">
<form value="/api/v1/broadcast" method="post" enctype="multipart/form-data" id="broadcast" class="navbar-form" target="_blank">
<h4>Broadcast Message</h4>
<row class="col-lg-5">Message:</row>
<row class="col-lg-7"><input class="col-lg-12" id="notification_message" name="message" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Send Message" /></row>
</form>
</div>
</div>
<!-- MARKET -->
<!-- STAGE 1: CREATE LISTING -->
<div class="row marketing">
</br>
<h1 align="right"><b>Trade Flow</b></h1>
<hr></hr>
<h3><b>Stage 1:</b> Create Listing</h3>
<div class="col-lg-12">
<form value="/api/v1/contracts" method="post" enctype="multipart/form-data" id="create_contract" class="navbar-form" target="_blank">
<!-- ITEM -->
<h4>Item</h4>
<row class="col-lg-5">Title:</row>
<row class="col-lg-7"><input id="listing_title" name="title" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Description:</row>
<row class="col-lg-7"><input id="listing_description" name="description" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Price:</row>
<row class="col-lg-7"><input id="listing_price" type="float" name="price" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Currency Code:</row>
<row class="col-lg-7"><input id="listing_currency_code" name="currency_code" autocomplete="off" value="BTC" required></row></br></br>
<row class="col-lg-5">Category:</row>
<row class="col-lg-7"><input id="listing_category" name="category" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Image Hash:</row>
<row class="col-lg-7"><input id="listing_images" name="images" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Condition:</row>
<row class="col-lg-7">
<select id="condition" name="condition" >
<option value="new">New</option>
</select>
</row></br></br>
<!-- ORDER -->
<h4>Order</h4>
<row class="col-lg-5">Process Time:</row>
<row class="col-lg-7"><input id="listing_process_time" type="number" name="process_time" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Terms and Conditions:</row>
<row class="col-lg-7"><input id="listing_terms_conditions" name="terms_conditions" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Returns:</row>
<row class="col-lg-7"><input id="listing_returns" name="returns" autocomplete="off" required></row></br></br>
<row class="col-lg-5">SKU:</row>
<row class="col-lg-7"><input id="listing_sku" name="sku" autocomplete="off" required></row></br></br>
<row class="col-lg-5">NSFW:</row>
<row class="col-lg-7">
<select id="listing_nsfw" name="nsfw" >
<option value="true">true</option>
<option value="false">false</option>
</select>
</row></br></br>
<row class="col-lg-5">Keywords:</row>
<row class="col-lg-7"><input id="listing_keywords" name="keywords" autocomplete="off" required></row></br></br>
<!-- SHIPPING -->
<h4>Shipping</h4>
<row class="col-lg-5">Shipping Origin:</row>
<row class="col-lg-7"><input id="listing_shipping_origin" name="shipping_origin" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Free Shipping:</row>
<row class="col-lg-7">
<select id="listing_free_shipping" name="free_shipping" >
<option value="true">true</option>
<option value="false">false</option>
</select>
</row></br></br>
<row class="col-lg-5">Shipping - Domestic:</row>
<row class="col-lg-7">
<select id="listing_shipping_domestic" name="shipping_domestic" >
<option value="true">true</option>
<option value="false">false</option>
</select>
</row></br></br>
<row class="col-lg-5">Estimated Delivery - Domestic:</row>
<row class="col-lg-7"><input id="listing_est_delivery_domestic" type="number" name="est_delivery_domestic" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Shipping - International:</row>
<row class="col-lg-7">
<select id="listing_shipping_international" name="shipping_international" >
<option value="true">true</option>
<option value="false">false</option>
</select>
</row></br></br>
<row class="col-lg-5">Estimated Delivery - International:</row>
<row class="col-lg-7"><input id="listing_est_delivery_international" name="est_delivery_international" type="number" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Shipping Currency Code:</row>
<row class="col-lg-7">
<select id="listing_shipping_currency_code" name="shipping_currency_code" >
<option value="BTC">BTC</option>
</select>
</row></br></br>
<!-- MODERATORS -->
<h4>Moderators</h4>
<row class="col-lg-5">Moderators (GUID):</row>
<row class="col-lg-7"><input id="listing_add_moderators" name="moderators" autocomplete="off" required></row></br></br>
<!-- METADATA -->
<h4>Metadata</h4>
<row class="col-lg-5">Expiration:</row>
<row class="col-lg-7"><input id="listing_exp_date" name="expiration_date" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Metadata Category:</row>
<row class="col-lg-7">
<select id="listing_meta_category" name="metadata_category">
<option value="Physical Good">Physical Good</option>
<option value="Digital Content">Digital Content</option>
<option value="Services">Services</option>
</select>
</row></br></br>
<!-- SUBMIT BUTTON -->
<row class="col-lg-12"><button class="btn btn-warning col-lg-2" type="button" onclick="test()" value="Test">Test</button></row>
<br></br>
<row class="col-lg-12"><input class="btn btn-success col-lg-2" type="submit" value="Create"></row>
</form>
</div>
</div>
<!-- STAGE 2: PLACE AN ORDER -->
<div class="row marketing">
</br>
<h3><b>Stage 2:</b> Place an Order</h3>
<div class="col-lg-12">
<form value="/api/v1/purchase_contract" method="post" enctype="multipart/form-data" id="place_order" class="navbar-form" target="_blank">
<h4>Order Details</h4>
<row class="col-lg-5">Contract ID (hash):</row>
<row class="col-lg-7"><input id="order_id" name="id" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Quantity:</row>
<row class="col-lg-7"><input id="order_quantity" name="quantity" type="number" min="1" autocomplete="off" required></row></br></br>
<h4>Buyer Details</h4>
<row class="col-lg-5">Buyer Name:</row>
<row class="col-lg-7"><input id="order_buyer_name" name="ship_to" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Address:</row>
<row class="col-lg-7"><input id="order_buyer_addr" name="address" autocomplete="off" required></row></br></br>
<row class="col-lg-5">City:</row>
<row class="col-lg-7"><input id="order_buyer_city" name="city" autocomplete="off" required></row></br></br>
<row class="col-lg-5">State:</row>
<row class="col-lg-7"><input id="order_buyer_state" name="state" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Postcode:</row>
<row class="col-lg-7"><input id="order_postcode" name="postal_code" autocomplete="off" type="number" required></row></br></br>
<row class="col-lg-5">Country:</row>
<row class="col-lg-7"><select id="order_buyer_country" name="country" required>
<option value="UNITED_STATES">United States</option>
<option value="UNITED_KINGDOM">United Kingdom</option>
<option value="AUSTRALIA">Australia</option>
<option value="MEXICO">Mexico</option>
</select></row></br></br>
<h4>Moderator</h4>
<row class="col-lg-5">Moderator GUID:</row>
<row class="col-lg-7"><input id="order_buyer_guid" name="moderator" autocomplete="off"></row></br></br>
<row class="col-lg-12"><input class="btn btn-success col-lg-2" type="submit" value="Place Order"></row>
</form>
</div>
</div>
<!-- STAGE 3: CONFIRM ORDER -->
<div class="row marketing">
</br>
<h3><b>Stage 3:</b> Confirm Order</h3>
<div class="col-lg-12">
<form value="/api/v1/confirm_order" method="post" enctype="multipart/form-data" id="confirm_order" class="navbar-form" target="_blank">
<h4>Order Details</h4>
<row class="col-lg-5">Select order:</row>
<row class="col-lg-7"><input id="confirm_id" name="id"></row></br></br>
<row class="col-lg-5">Payout Address:</row>
<row class="col-lg-7"><input id="payout_address" name="payout_address" autocomplete="off" required></row></br></br>
<row class="col-lg-5">Comments:</row>
<row class="col-lg-7"><input id="confirm_comments" name="comments" autocomplete="off"></row></br></br>
<h4>Physical Item</h4>
<row class="col-lg-5">Shipper:</row>
<row class="col-lg-7"><input id="confirm_shipper" name="shipper" autocomplete="off"></row></br></br>
<row class="col-lg-5">Tracking Number:</row>
<row class="col-lg-7"><input id="tracking_number" name="tracking_number" autocomplete="off"></row></br></br>
<row class="col-lg-5">Estimated delivery:</row>
<row class="col-lg-7"><input id="confirm_est_delivery" name="est_delivery" autocomplete="off"></row></br></br>
<h4>Digital Content</h4>
<row class="col-lg-5">URL:</row>
<row class="col-lg-7"><input id="confirm_url" name="url" autocomplete="off"></row></br></br>
<row class="col-lg-5">Password:</row>
<row class="col-lg-7"><input id="confirm_password" name="password" autocomplete="off"></row></br></br>
<row class="col-lg-12"><input class="btn btn-success col-lg-3" type="submit" value="Confirm Order"></row>
</form>
</div>
</div>
<!-- STAGE 4: COMPLETE ORDER -->
<div class="row marketing">
</br>
<h3><b>Stage 4:</b> Complete Order</h3>
<div class="col-lg-12">
<form value="/api/v1/complete_order" method="post" enctype="multipart/form-data" id="complete_order" class="navbar-form" target="_blank">
<h4>Ratings and Review</h4>
<row class="col-lg-5">Order ID:</row>
<row class="col-lg-7"><input id="complete_order_file" name="id"></row></br></br>
<row class="col-lg-5">Feedback:</row>
<row class="col-lg-7"><input id="feedback" name="feedback" type="number" min="1" max="5" autocomplete="off" required> stars</row></br></br>
<row class="col-lg-5">Quality:</row>
<row class="col-lg-7"><input id="quality" name="quality" type="number" min="1" max="5" autocomplete="off" required> stars</row></br></br>
<row class="col-lg-5">Product Description:</row>
<row class="col-lg-7"><input id="rating_description" name="description" type="number" min="1" max="5" autocomplete="off" required> stars</row></br></br>
<row class="col-lg-5">Delivery Time:</row>
<row class="col-lg-7"><input id="rate_delivery_time" name="delivery_time" type="number" min="1" max="5" autocomplete="off" required> stars</row></br></br>
<row class="col-lg-5">Customer service:</row>
<row class="col-lg-7"><input id="customer_service" name="customer_service" type="number" min="1" max="5" autocomplete="off" required> stars</row></br></br>
<row class="col-lg-5">Review:</row>
<row class="col-lg-7"><input id="review" name="review"autocomplete="off" required></row></br></br>
<row class="col-lg-12"><input class="btn btn-success col-lg-3" type="submit" value="Complete Order"></row>
</form>
</div>
</div>
<!-- NETWORK -->
<!-- CONNECTED PEERS -->
<div class="row marketing">
<br>
<h1 align="right"><b>Network</b></h1>
<hr></hr>
<h3>Get a list of connected peers</h3>
<div class="col-lg-12">
<form value="/api/v1/connected_peers" method="get" enctype="multipart/form-data" id="connected_peers" class="navbar-form navbar-left" target="_blank">
<row class="col-lg-12"><input class="btn btn-info" type="submit" value="View"/></row>
</form>
</div>
<row class="col-lg-12"><br></row>
<!-- DISPLAY ROUTING TABLE -->
<h3>Display routing table</h3>
<div class="col-lg-12">
<form value="/api/v1/routing_table" method="get" enctype="multipart/form-data" id="routing_table" class="navbar-form navbar-left" target="_blank">
<row class="col-lg-12"><input class="btn btn-info" type="submit" value="View"/></row>
</form>
</div>
</div>
<!-- SETTINGS -->
<div class="row marketing">
<br>
<h1 align="right"><b>Settings</b></h1>
<hr></hr>
<!-- VIEW SETTINGS -->
<h3>View Settings</h3>
<div class="col-lg-12">
<form value="/api/v1/settings" method="get" enctype="multipart/form-data" id="get_settings" class="navbar-form" target="_blank">
<row class="col-lg-12"><input class="btn btn-info" type="submit" value="View Settings" /></row>
</form>
</div>
<row class="col-lg-12"><br></row>
<!-- NODE SETTINGS -->
<h3>Change Settings</h3>
<p><b>Note:</b> All fields are required for this form to be submitted!</p>
<div class="col-lg-12">
<form value="/api/v1/settings" method="post" enctype="multipart/form-data" id="post_settings" class="navbar-form" target="_blank" onsubmit="sanity2()">
<row class="col-lg-5">Refund Address</row>
<row class="col-lg-7"><input id="settings_refundaddr" name="refund_address" required/></row></br></br>
<row class="col-lg-5">Currency Code</row>
<row class="col-lg-7">
<select id="settings_currencycode" name="currency_code">
<option value="BTC">Bitcoin</option>
<option value="USD">US Dollar</option>
<option value="AUD">Australian Dollar</option>
</select>
</row></br></br>
<row class="col-lg-5">Country</row>
<row class="col-lg-7">
<select id="settings_country" name="country">
<option value="AUSTRALIA">Australia</option>
<option value="UNITED_STAGES">United States</option>
</select>
</row></br></br>
<row class="col-lg-5">Language</row>
<row class="col-lg-7">
<select id="settings_language" name="lanuage">
<option value="ENGLISH">English</option>
</select>
</row></br></br>
<row class="col-lg-5">Time Zone</row>
<row class="col-lg-7"><input id="settings_timezone" name="time_zone" required/></row></br></br>
<row class="col-lg-5">Notifications</row>
<row class="col-lg-7">
<select id="settings_notifications" name="notifications">
<option value="TRUE">True</option>
<option value="FALSE">False</option>
</select>
</row></br></br>
<row class="col-lg-5">Shipping Addresses</row>
<row class="col-lg-7"><input id="settings_shipaddr" name="shipping_addresses" required/></row></br></br>
<row class="col-lg-5">Blocked Nodes</row>
<row class="col-lg-7"><input id="settings_blocked" name="blocked" required/></row></br></br>
<row class="col-lg-5">Libbitcoin Server</row>
<row class="col-lg-7"><input id="settings_libbitcoin" name="libbitcoin_server" required/></row></br></br>
<row class="col-lg-5">SSL</row>
<row class="col-lg-7">
<select id="settings_ssl" name="ssl">
<option value="TRUE">True</option>
<option value="FALSE">False</option>
</select>
</row></br></br>
<row class="col-lg-5">Terms and Conditions</row>
<row class="col-lg-7"><input id="settings_tc" name="terms_conditions"/></row></br></br>
<row class="col-lg-5">Refund Policy</row>
<row class="col-lg-7"><input id="settings_refund" name="refund_policy"/></row></br></br>
<row class="col-lg-12"><input class="btn btn-success" type="submit" value="Submit" /></row>
</form>
</div>
<row class="col-lg-12"><br></row>
<!-- SHUTDOWN -->
<h3>Safe Node Shutdown</h3>
<div class="col-lg-12">
<form value="/api/v1/shutdown" method="get" enctype="multipart/form-data" id="shutdown" class="navbar-form navbar-left" target="_blank">
<row class="col-lg-12"><input class="btn btn-danger" type="submit" value="Shutdown"/></row>
</form>
</div>
<row class="col-lg-12"><br></row>
</div>
</br>
</br>
<footer class="footer">
<p>© OB1 Company 2015</p>
</footer>
</div> <!-- /container -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- REST API Form Script -->
<script>
/*Websockets*/
function openws() {
// Get references to elements on the page.
var getvendorsform = document.getElementById('get_vendors');
var getmoderatorsform = document.getElementById('get_moderators');
var getlistingsform = document.getElementById('get_homepage_listings');
var searchform = document.getElementById('search');
var chatform = document.getElementById('chat');
var closeBtn = document.getElementById('close');
// Create a new WebSocket
var daemonaddr = document.getElementById('daemon').value;
var socket = new WebSocket('ws://' + daemonaddr + ':18466');
// Handle any errors that occur.
socket.onerror = function(error) {
console.log('WebSocket Error: ' + error);
};
// Show a connected message when the WebSocket is opened.
socket.onopen = function(event) {
console.log('Socket is open!');
document.getElementById('terminal').value = 'Socket it open!';
};
// Handle messages sent by the server.
socket.onmessage = function(e) {
var dasmessage = e.data;
console.log(dasmessage);
document.getElementById('terminal').value += dasmessage;
};
// Show a disconnected message when the WebSocket is closed.
socket.onclose = function(event) {
console.log('Disconnected from Socket!');
};
// Send a message when the get_vendors form is sumitted
getvendorsform.onsubmit = function(e) {
document.getElementById('terminal').value = '';
// Message Details
var vendors_message = {"request": {
"api": "v1",
"id" : Math.floor((Math.random() * 10000) + 1),
"guid": "39805f8892e0187d26ec8970e245f12a78bd8f6f",
"command": "get_vendors"
}};
// Send the message through the WebSocket.
socket.send(JSON.stringify(vendors_message));
return false;
};
// Send a message when the get_moderators form is sumitted
getmoderatorsform.onsubmit = function(e) {
document.getElementById('terminal').value = '';
e.preventDefault();
// Message Details
var mods_message = {"request": {
"api": "v1",
"id" : Math.floor((Math.random() * 10000) + 1),
"guid": "39805f8892e0187d26ec8970e245f12a78bd8f6f",
"command": "get_moderators"
}};
// Send the message through the WebSocket.
socket.send(JSON.stringify(mods_message));
return false;
};
// Send a message when the get_homepage_listings form is sumitted
getlistingsform.onsubmit = function(e) {
document.getElementById('terminal').value = '';
e.preventDefault();
// Message Details
var home_message = {"request": {
"api": "v1",
"id" : Math.floor((Math.random() * 100000) + 1),
"guid" : "39805f8892e0187d26ec8970e245f12a78bd8f6f",
"command": "get_homepage_listings"
}};
// Send the message through the WebSocket.
socket.send(JSON.stringify(home_message));
return false;
};
// Search on the network
searchform.onsubmit = function(e) {
document.getElementById('terminal').value = '';
e.preventDefault();
// Keywords
var daskeywords = document.getElementById('keywords').value;
var search_message = {"request": {
"api" : "v1",
"id" : Math.floor((Math.random() * 100000) + 1),
"guid" : "39805f8892e0187d26ec8970e245f12a78bd8f6f",
"command" : "search",
"keyword" : daskeywords
}};
// Send the message through the WebSocket.
socket.send(JSON.stringify(search_message));
return false;
};
// Send a chat message
chatform.onsubmit = function(e) {
document.getElementById('terminal').value = '';
e.preventDefault();
// Chat details
var chat_guid = document.getElementById('chat_guid').value;
var chat_handle = document.getElementById('chat_handle').value;
var chat_message = document.getElementById('chat_message').value;
var chat_subject = document.getElementById('chat_subject').value;
var chat_msgtype = document.getElementById('chat_msgtype').value;
var chat_key = document.getElementById('chat_key').value;
var im_message = {"request": {
"api" : "v1",
"command" : "send_message",
"guid" : chat_guid,
"handle" : chat_handle,
"message" : chat_message,
"subject" : chat_subject,
"message_type" : chat_msgtype,
"recipient_key" : "163ec30a409fc9fe2c752192cea212316a29d02c9c3c85430ac90501b3987412"
}};
// Send the message through the Websocket.
socket.send(JSON.stringify(im_message));
return false;
};
// Close the WebSocket connection when the close button is clocked.
closeBtn.onclick = function(e) {
e.preventDefault();
// Close the WebSocket.
socket.close();
document.getElementById('terminal').value = 'Socket is closed!';
return false;
};
};
/*Convert images to base64*/
var handleFileSelect = function(evt) {
var files = evt.target.files;
var file = files[0];
if (files && file) {
var reader = new FileReader();
reader.onload = function(readerEvt) {
var binaryString = readerEvt.target.result;
var base64image = btoa(binaryString);
document.getElementById('base64text').value = base64image;
};
reader.readAsBinaryString(file);
}
};
if (window.File && window.FileReader && window.FileList && window.Blob) {
document.getElementById('image_file').addEventListener('change', handleFileSelect, false);
} else {
alert('The File APIs are not fully supported in this browser.');
};
/*Removes fields from being submitted into the form if they're blank*/
function sanity() {
if (document.getElementById("name").value != "") {
document.getElementById("name").name = "name";
};
if (document.getElementById("handle").value != "") {
document.getElementById("handle").name = "handle";
};
if (document.getElementById("about").value != "") {
document.getElementById("about").name = "about";
};
if (document.getElementById("short_description").value != "") {
document.getElementById("short_description").name = "short_description";
};
if (document.getElementById("website").value != "") {
document.getElementById("website").name = "website";
};
if (document.getElementById("email").value != "") {
document.getElementById("email").name = "email";
};
if (document.getElementById("choose_mod").value != "") {
document.getElementById("choose_mod").name = "moderator_list";
};
};
/*Loads some template data to create a contract*/
function test() {
document.getElementById("listing_title").value = "Crap";
document.getElementById("listing_description").value = "Quality dog crap";
document.getElementById("listing_price").value = 1;
document.getElementById("listing_category").value = "Dog Feces";
document.getElementById("listing_images").value = "adbaa11b6ffc14ea9a720dd875babb59354e9e36";
document.getElementById("listing_process_time").value = 1;
document.getElementById("listing_terms_conditions").value = "Dogs aren't liable for fecal quality. No refunds";
document.getElementById("listing_returns").value = "No returns";
document.getElementById("listing_sku").value = "001-dog-feces";
document.getElementById("listing_keywords").value = "dog crap";
document.getElementById("listing_shipping_origin").value = "AUSTRALIA";
document.getElementById("listing_exp_date").value = "2016";
document.getElementById("listing_est_delivery_domestic").value = 3;
document.getElementById("listing_est_delivery_international").value = 30;
document.getElementById("listing_add_moderators").value = "b446f60831850c2bbe2b9b1af31b50adf4295979";
};
/*Select IP address for the server daemon other than localhost by default*/
$("form").on('submit', function() {
execute = '';
var predaemon = $('#daemon').val();
var daemonrestaddr = 'http://' + predaemon + ':18469';
console.log(daemonrestaddr);
var formAction = $(this).attr('value');
console.log(formAction);
var execute = daemonrestaddr + formAction;
console.log(execute);
$(this).attr('action', execute);
});
</script>
</body>
</html>