@bsv/overlay-express 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,205 @@
1
+ export default () => `<!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
6
+ <title>Overlay Services</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial;
10
+ background-color: #282E33;
11
+ overflow: hidden;
12
+ }
13
+
14
+ * {
15
+ color: #B6C2CF;
16
+ }
17
+
18
+ .main {
19
+ height: 100vh;
20
+ word-wrap: break-word;
21
+ display: flex;
22
+ flex-direction: row;
23
+ }
24
+
25
+ a {
26
+ color: #579DFF;
27
+ }
28
+
29
+ .docs_heading {
30
+ text-align: center;
31
+ padding-bottom: 0.5em;
32
+ border-bottom: thin solid #B6C2CF;
33
+ }
34
+
35
+ .topic_container {
36
+ padding-top: 1.5em;
37
+ }
38
+
39
+ .provider_container {
40
+ padding-top: 1.5em;
41
+ }
42
+
43
+ li {
44
+ display: block;
45
+ padding: 0.2em;
46
+ margin-top: 0.5em;
47
+ width: 10em;
48
+ border-radius: 5%;
49
+ }
50
+
51
+ .list_a {
52
+ display: block;
53
+ width: 10em;
54
+ color: #B6C2CF;
55
+ text-decoration: none;
56
+ }
57
+
58
+ li:hover,
59
+ li:active {
60
+ cursor: pointer;
61
+ background-color: #323940;
62
+ }
63
+
64
+ ul {
65
+ list-style-type: none;
66
+ margin-top: 1em;
67
+ }
68
+
69
+ .column_left {
70
+ display: flex;
71
+ flex-direction: column;
72
+ float: left;
73
+ width: 40%;
74
+ height: 100vh;
75
+ overflow-y: scroll;
76
+ padding-top: 1.5em;
77
+ }
78
+
79
+ .column_right {
80
+ display: flex;
81
+ flex-direction: column;
82
+ float: right;
83
+ width: 60%;
84
+ height: 100vh;
85
+ overflow-y: scroll;
86
+ border-left: thin solid #B6C2CF;
87
+ padding-top: 1.5em;
88
+ }
89
+
90
+ @media screen and (max-width: 850px) {
91
+
92
+ .main {
93
+ width: 100vw;
94
+ float: none;
95
+ overflow-y: scroll;
96
+ display: block;
97
+ }
98
+
99
+ .column_left {
100
+ width: 100vw;
101
+ height: auto;
102
+ float: none;
103
+ overflow-y: visible;
104
+ display: block;
105
+ }
106
+
107
+ .column_right {
108
+ width: 100vw;
109
+ height: auto;
110
+ float: none;
111
+ overflow-y: visible;
112
+ display: block;
113
+ border: none;
114
+ }
115
+
116
+ }
117
+ </style>
118
+ <script src="https://cdn.jsdelivr.net/npm/showdown@2.0.3/dist/showdown.min.js"></script>
119
+ <script>
120
+ const showdown = window.showdown
121
+
122
+ const Convert = (md) => {
123
+ let converter = new showdown.Converter()
124
+ let converted = converter.makeHtml(md)
125
+ return converted
126
+ }
127
+
128
+ window.managerDocumentation = async (manager) => {
129
+ let res = await window.fetch(\`/getDocumentationForTopicManager?manager=\${manager}\`)
130
+ let docs = await res.json()
131
+ let managerReadme = Convert(docs)
132
+ document.getElementById('documentation_container').innerHTML = managerReadme
133
+ document.getElementById('documentation_title').innerHTML = \`<h1 class="docs_heading">\${manager + ' Topic Manager'}</h1>\`
134
+ }
135
+
136
+ window.topicDocumentation = async (provider) => {
137
+ let res = await window.fetch(\`/getDocumentationForLookupServiceProvider?lookupServices=\${provider}\`)
138
+ let docs = await res.json()
139
+ let providerReadme = Convert(docs)
140
+ document.getElementById('documentation_container').innerHTML = providerReadme
141
+ document.getElementById('documentation_title').innerHTML = \`<h1 class="docs_heading">\${provider + ' Lookup Service'}</h1>\`
142
+ }
143
+
144
+ window.fetch('/listTopicManagers')
145
+ .then((res) => {
146
+ return res.json()
147
+ })
148
+ .then((managers) => {
149
+ for (i = 0; i < managers.length; i++) {
150
+ let li = document.createElement('li')
151
+ li.innerHTML = \`<a class="list_a" onclick="window.managerDocumentation('\${managers[i]}')">\${managers[i]}</a>\`
152
+ manager_list.appendChild(li)
153
+ }
154
+ })
155
+ .catch(() => {
156
+ let message = document.createElement('h4')
157
+ message.innerText = 'Something went wrong!'
158
+ manager_list.insertBefore(message, manager_list.children[0])
159
+ })
160
+
161
+ window.fetch('/listLookupServiceProviders')
162
+ .then((res) => {
163
+ return res.json()
164
+ })
165
+ .then((providers) => {
166
+ for (i = 0; i < providers.length; i++) {
167
+ let li = document.createElement('li')
168
+ li.innerHTML = \`<a class="list_a" onclick="window.topicDocumentation('\${providers[i]}')">\${providers[i]}</a>\`
169
+ provider_list.appendChild(li)
170
+ }
171
+ })
172
+ .catch(() => {
173
+ let message = document.createElement('h4')
174
+ message.innerText = 'Something went wrong!'
175
+ provider_list.insertBefore(message, provider_list.children[0])
176
+ })
177
+ </script>
178
+ </head>
179
+
180
+ <body>
181
+ <div class='main'>
182
+ <div class="column_left">
183
+ <div class="page_head">
184
+ <h1>Hello Overlay Services</h1>
185
+ <p>Learn more on <a href='https://github.com/bitcoin-sv/overlay-services'>GitHub</a></p>
186
+ </div>
187
+ <div class="topic_container">
188
+ <h2>Endpoint Documentation:</h2>
189
+ <h3>Supported Topic Managers:</h3>
190
+ <ul id="manager_list"></ul>
191
+ </div>
192
+ <div class="provider_container">
193
+ <h3>Supported Lookup Service Providers:</h3>
194
+ <ul id="provider_list"></ul>
195
+ </div>
196
+ <br />
197
+ </div>
198
+ <div class="column_right">
199
+ <div id="documentation_title"></div>
200
+ <div id="documentation_container" style="margin-left: 1.5em">
201
+ </div>
202
+ </div>
203
+ </div>
204
+ </body>
205
+ </html>`