@bsv/overlay-express 0.1.3 → 0.1.5

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.
@@ -1,188 +1,192 @@
1
- export default () => `<!DOCTYPE html>
1
+ export default (config = {}) => {
2
+ const { faviconUrl = 'https://bsvblockchain.org/favicon.ico', backgroundColor = '#282E33', primaryColor = '#B6C2CF', secondaryColor = '#579DFF', fontFamily = 'Arial, sans-serif', headingFontFamily = 'Arial Black, Gadget, sans-serif', additionalStyles = '', sectionBackgroundColor = '#323940', linkColor = '#579DFF', hoverColor = '#3A4147', borderColor = '#B6C2CF', } = config;
3
+ return `<!DOCTYPE html>
2
4
  <html>
3
5
  <head>
4
6
  <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
8
  <title>Overlay Services</title>
9
+ <link rel="icon" type="image/x-icon" href="${faviconUrl}">
7
10
  <style>
11
+ :root {
12
+ --background-color: ${backgroundColor};
13
+ --primary-color: ${primaryColor};
14
+ --secondary-color: ${secondaryColor};
15
+ --font-family: ${fontFamily};
16
+ --heading-font-family: ${headingFontFamily};
17
+ --section-background-color: ${sectionBackgroundColor};
18
+ --link-color: ${linkColor};
19
+ --hover-color: ${hoverColor};
20
+ --border-color: ${borderColor};
21
+ }
22
+
8
23
  body {
9
- font-family: Arial;
10
- background-color: #282E33;
11
- overflow: hidden;
24
+ font-family: var(--font-family);
25
+ background-color: var(--background-color);
26
+ margin: 0;
27
+ padding: 0;
12
28
  }
13
29
 
14
- * {
15
- color: #B6C2CF;
30
+ h1, h2, h3 {
31
+ font-family: var(--heading-font-family);
16
32
  }
17
33
 
18
- .main {
19
- height: 100vh;
20
- word-wrap: break-word;
21
- display: flex;
22
- flex-direction: row;
34
+ * {
35
+ color: var(--primary-color);
23
36
  }
24
37
 
25
38
  a {
26
- color: #579DFF;
39
+ color: var(--link-color);
40
+ text-decoration: none;
27
41
  }
28
42
 
29
- .docs_heading {
30
- text-align: center;
31
- padding-bottom: 0.5em;
32
- border-bottom: thin solid #B6C2CF;
43
+ a:hover {
44
+ color: var(--secondary-color);
33
45
  }
34
46
 
35
- .topic_container {
36
- padding-top: 1.5em;
47
+ .main {
48
+ display: flex;
49
+ flex-direction: row;
50
+ height: 100vh;
51
+ overflow: hidden;
37
52
  }
38
53
 
39
- .provider_container {
40
- padding-top: 1.5em;
54
+ .column_left, .column_right {
55
+ padding: 1.5em;
56
+ overflow-y: auto;
41
57
  }
42
58
 
43
- li {
44
- display: block;
45
- padding: 0.2em;
46
- margin-top: 0.5em;
47
- width: 10em;
48
- border-radius: 5%;
59
+ .column_left {
60
+ width: 35%;
61
+ background-color: var(--section-background-color);
49
62
  }
50
63
 
51
- .list_a {
52
- display: block;
53
- width: 10em;
54
- color: #B6C2CF;
55
- text-decoration: none;
64
+ .column_right {
65
+ width: 65%;
66
+ border-left: 1px solid var(--border-color);
56
67
  }
57
68
 
58
- li:hover,
59
- li:active {
60
- cursor: pointer;
61
- background-color: #323940;
69
+ .docs_heading {
70
+ text-align: center;
71
+ padding-bottom: 0.5em;
72
+ border-bottom: 1px solid var(--border-color);
62
73
  }
63
74
 
64
75
  ul {
65
76
  list-style-type: none;
66
- margin-top: 1em;
77
+ padding: 0;
67
78
  }
68
79
 
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;
80
+ li {
81
+ margin: 0.5em 0;
77
82
  }
78
83
 
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;
84
+ li a {
85
+ display: block;
86
+ padding: 0.5em;
87
+ background-color: transparent;
88
+ border-radius: 5px;
89
+ transition: background-color 0.3s;
88
90
  }
89
91
 
90
- @media screen and (max-width: 850px) {
92
+ li a:hover {
93
+ background-color: var(--hover-color);
94
+ cursor: pointer;
95
+ }
91
96
 
97
+ /* Responsive design */
98
+ @media screen and (max-width: 850px) {
92
99
  .main {
93
- width: 100vw;
94
- float: none;
95
- overflow-y: scroll;
96
- display: block;
100
+ flex-direction: column;
97
101
  }
98
102
 
99
- .column_left {
100
- width: 100vw;
101
- height: auto;
102
- float: none;
103
- overflow-y: visible;
104
- display: block;
103
+ .column_left, .column_right {
104
+ width: 100%;
105
105
  }
106
106
 
107
107
  .column_right {
108
- width: 100vw;
109
- height: auto;
110
- float: none;
111
- overflow-y: visible;
112
- display: block;
113
- border: none;
108
+ border-left: none;
109
+ border-top: 1px solid var(--border-color);
114
110
  }
115
-
116
111
  }
112
+
113
+ ${additionalStyles}
117
114
  </style>
118
115
  <script src="https://cdn.jsdelivr.net/npm/showdown@2.0.3/dist/showdown.min.js"></script>
119
116
  <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>
117
+ const showdown = window.showdown;
118
+
119
+ const Convert = (md) => {
120
+ let converter = new showdown.Converter();
121
+ return converter.makeHtml(md);
122
+ };
123
+
124
+ window.managerDocumentation = async (manager) => {
125
+ try {
126
+ let res = await fetch(\`/getDocumentationForTopicManager?manager=\${manager}\`);
127
+ let docs = await res.text();
128
+ let managerReadme = Convert(docs);
129
+ document.getElementById('documentation_container').innerHTML = managerReadme;
130
+ document.getElementById('documentation_title').innerHTML = \`<h1 class="docs_heading">\${manager} Topic Manager</h1>\`;
131
+ } catch (error) {
132
+ console.error('Error fetching manager documentation:', error);
133
+ }
134
+ };
135
+
136
+ window.topicDocumentation = async (provider) => {
137
+ try {
138
+ let res = await fetch(\`/getDocumentationForLookupServiceProvider?lookupServices=\${provider}\`);
139
+ let docs = await res.text();
140
+ let providerReadme = Convert(docs);
141
+ document.getElementById('documentation_container').innerHTML = providerReadme;
142
+ document.getElementById('documentation_title').innerHTML = \`<h1 class="docs_heading">\${provider} Lookup Service</h1>\`;
143
+ } catch (error) {
144
+ console.error('Error fetching provider documentation:', error);
145
+ }
146
+ };
147
+
148
+ document.addEventListener('DOMContentLoaded', () => {
149
+ fetch('/listTopicManagers')
150
+ .then(res => res.json())
151
+ .then(managers => {
152
+ const managerList = document.getElementById('manager_list');
153
+ managers.forEach(manager => {
154
+ let li = document.createElement('li');
155
+ li.innerHTML = \`<a onclick="window.managerDocumentation('\${manager}')">\${manager}</a>\`;
156
+ managerList.appendChild(li);
157
+ });
158
+ })
159
+ .catch(() => {
160
+ let message = document.createElement('h4');
161
+ message.innerText = 'Something went wrong!';
162
+ manager_list.insertBefore(message, manager_list.children[0]);
163
+ });
164
+
165
+ fetch('/listLookupServiceProviders')
166
+ .then(res => res.json())
167
+ .then(providers => {
168
+ const providerList = document.getElementById('provider_list');
169
+ providers.forEach(provider => {
170
+ let li = document.createElement('li');
171
+ li.innerHTML = \`<a onclick="window.topicDocumentation('\${provider}')">\${provider}</a>\`;
172
+ providerList.appendChild(li);
173
+ });
174
+ })
175
+ .catch(() => {
176
+ let message = document.createElement('h4');
177
+ message.innerText = 'Something went wrong!';
178
+ provider_list.insertBefore(message, provider_list.children[0]);
179
+ });
180
+ });
181
+ </script>
178
182
  </head>
179
183
 
180
184
  <body>
181
- <div class='main'>
185
+ <div class="main">
182
186
  <div class="column_left">
183
187
  <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>
188
+ <h1>Welcome to Overlay Services</h1>
189
+ <p>Learn more on <a href="https://github.com/bitcoin-sv/overlay-services" target="_blank">GitHub</a></p>
186
190
  </div>
187
191
  <div class="topic_container">
188
192
  <h2>Endpoint Documentation:</h2>
@@ -193,14 +197,13 @@ export default () => `<!DOCTYPE html>
193
197
  <h3>Supported Lookup Service Providers:</h3>
194
198
  <ul id="provider_list"></ul>
195
199
  </div>
196
- <br />
197
200
  </div>
198
201
  <div class="column_right">
199
202
  <div id="documentation_title"></div>
200
- <div id="documentation_container" style="margin-left: 1.5em">
201
- </div>
203
+ <div id="documentation_container" style="margin-left: 1.5em"></div>
202
204
  </div>
203
205
  </div>
204
206
  </body>
205
207
  </html>`;
208
+ };
206
209
  //# sourceMappingURL=makeUserInterface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"makeUserInterface.js","sourceRoot":"","sources":["../../../src/makeUserInterface.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4Mb,CAAA"}
1
+ {"version":3,"file":"makeUserInterface.js","sourceRoot":"","sources":["../../../src/makeUserInterface.ts"],"names":[],"mappings":"AAcA,eAAe,CAAC,SAAmB,EAAE,EAAU,EAAE;IAC/C,MAAM,EACJ,UAAU,GAAG,uCAAuC,EACpD,eAAe,GAAG,SAAS,EAC3B,YAAY,GAAG,SAAS,EACxB,cAAc,GAAG,SAAS,EAC1B,UAAU,GAAG,mBAAmB,EAChC,iBAAiB,GAAG,iCAAiC,EACrD,gBAAgB,GAAG,EAAE,EACrB,sBAAsB,GAAG,SAAS,EAClC,SAAS,GAAG,SAAS,EACrB,UAAU,GAAG,SAAS,EACtB,WAAW,GAAG,SAAS,GACxB,GAAG,MAAM,CAAC;IAEX,OAAO;;;;;;+CAMsC,UAAU;;;4BAG7B,eAAe;yBAClB,YAAY;2BACV,cAAc;uBAClB,UAAU;+BACF,iBAAiB;oCACZ,sBAAsB;sBACpC,SAAS;uBACR,UAAU;wBACT,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6F7B,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8Fd,CAAC;AACT,CAAC,CAAC"}