-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex1.html
328 lines (313 loc) · 15.3 KB
/
index1.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
<!DOCTYPE html>
<html>
<head>
<title>Web Services Settings Page</title>
<style>
* {
box-sizing: border-box;
font: 16px Arial;
padding: 5px;
}
div {
padding: 2px;
background-color: #f6f6f6;
overflow: hidden;
}
input[type=text], textarea, select {
font: 12px Arial;
width: 75%;
padding: 6px;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type=button]{
font: 12px Arial;
width: auto;
float: left;
cursor: pointer;
padding: 6px;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type=select]{
font: 12px Arial;
width: 75%;
cursor: pointer;
padding: 2px;
border: 1px solid rgba(7,114,125,1);
}
label[for=text]{
font: 12px Arial;
color: #fff;
background-color: rgba(86,95,103,1);
width: 25%;
text-align: right;
float: left;
padding: 2px 2px 2px 2px;
display: inline-block;
border: 1px solid rgba(86,95,103,1);
border-radius: 4px;
}
h2{
font: 20px Arial bold;
}
</style>
</head>
<body>
<h1 style "font-size:20px;">Web Services Settings</h1>
<div>
<!--Add elements to the form-->
<div>
<label for="text">Latitude</label>
</div>
<div>
<input type="text" id="txtLat" placeholder="Enter your latitude" />
</div>
<div>
<label for="text">Longitude</label>
</div>
<div>
<input type="text" id="txtLat" placeholder="Enter your Longitude" />
</div>
<div>
<label for="text">Language</label>
</div>
<div>
<input type="text" id="txtLang" placeholder="Enter your Language" />
</div>
<div>
<label for="text">AQI Key</label>
</div>
<div>
<input type="text" id="txtAqkey" placeholder="Enter your AQI Key" />
</div>
<div>
<label for="text">DarkSky Key</label>
</div>
<div>
<input type="text" id="txtDskey" placeholder="Enter your DarkSky Key" />
</div>
<div>
<label for="text">DarkSky Units</label>
</div>
<div>
<select id="selDsunits">
<option selected value="">-- Choose the units --</option>
<option value="us">US</option>
<option value="si">SI Metric</option>
<option value="ca">Canada</option>
<option value="uk2">UK (Metric with mph and miles)</option>
<option value="auto">auto</option>
</select>
</div>
<div>
<label for="text">Weather Underground Key</label>
</div>
<div>
<input type="text" id="txtWukey" placeholder="Enter your Weather Underground Key" />
</div>
<div>
<label for="text">Weather Underground Units</label>
</div>
<div>
<select id="selWuunits">
<option selected value="">-- Choose the units --</option>
<option value="e">Imperial</option>
<option value="m">Metric</option>
<option value="s">Scandinavia</option>
<option value="h">United Kingdom</option>
</select>
</div>
<div>
<label for="text">METAR Key</label>
</div>
<div>
<input type="text" id="txtMekey" placeholder="Enter your METAR Key" />
</div>
<div>
<label for="text">METAR Code</label>
</div>
<div>
<input type="text" id="txtMecode" placeholder="Enter your Metar Code" />
</div>
<div>
<label for="text">Purpleair ID</label>
</div>
<div>
<input type="text" id="txtPuid" placeholder="Enter your Purpleair ID" />
</div>
<div>
<label for="text">Local Web Server IP Address</label>
</div>
<div>
<input type="text" id="txtAlip" placeholder="Enter your Local Web Server IP Address" />
</div>
<div>
<label for="text">Meteoalarm Country Code</label>
</div>
<div>
<input type="text" id="txtAlcountry" placeholder="Enter your Meteoalarm Country Code (European Users Only)" />
</div>
<div>
<label for="text">Meteoalarm Region Code</label>
</div>
<div>
<input type="text" id="txtAlregion" placeholder="Enter your Meteoalarm Region Code (European Users Only)" />
</div>
<div>
<label for="text">Web Services String</label>
</div>
<div>
<input type="text" id="txtServices" placeholder="Enter your Web Services String (Minimum requirement me.wu.eq.ki)" />
</div>
<div>
<label for="text">Enable Cloud Cover</label>
</div>
<div>
<select id="selCloud">
<option selected value="">-- Choose True or False --</option>
<option value="True">True</option>
<option value="False">False</option>
</select>
</div>
<div>
<label for="text">Land Mass</label>
</div>
<div>
<select id="selContinent">
<option selected value="">-- Choose Land Mass --</option>
<option value="eu">Europe</option>
<option value="af">Africa, Middle East</option>
<option value="ana">North America</option>
<option value="ama">Central America</option>
<option value="asa">South America</option>
<option value="seasia">South East Asia</option>
<option value="oce">Oceania</option>
</select>
</div>
<div>
<input type="button" id="bt" value="Click to Save" onclick="saveFile()" />
<label type="text">Save data to services.txt in your default Download folder</label><br>
</div>
</div>
</body>
<script>
let saveFile = () => {
// Get the data from each element on the form.
const lat = document.getElementById('txtLat');
const lon = document.getElementById('txtLon');
const lang = document.getElementById('txtLang');
const aq_apikey = document.getElementById('txtAqkey');
const ds_apikey = document.getElementById('txtDskey');
const ds_units = document.getElementById('selDsunits');
const wu_apikey = document.getElementById('txtWukey');
const wu_units = document.getElementById('selWuunits');
const me_apikey = document.getElementById('txtMekey');
const me_code = document.getElementById('txtMecode');
const pu_id = document.getElementById('txtPuid');
const al_ip = document.getElementById('txtAlip');
const al_country = document.getElementById('txtAlcountry');
const al_region = document.getElementById('txtAlregion');
const services = document.getElementById('txtServices');
const enable = document.getElementById('selCloud');
const continent = document.getElementById('selContinent');
// This variable stores all the data.
let data =
'\r {' + ' \r\n ' +
'"##'+'Start of user fields' +'",'+ ' \r\n ' +
'"' + 'lat'+'"' + ':' +"'" + lat.value +"',"+ ' \r\n ' +
'"' + 'lon'+'"' + ':' +"'" +lon.value +"'," + ' \r\n ' +
'"' + 'lang'+'"' + ':' +"'" + lang.value +"'," + ' \r\n ' +
'"' + 'continent'+'"' + ':' +"'" + continent.value +"'," + ' \r\n ' +
'"' + 'aq_apikey'+'"' + ':' +"'" + aq_apikey.value +"'," + ' \r\n ' +
'"' + 'ds_apikey'+'"' + ':' +"'" + ds_apikey.value +"'," + ' \r\n ' +
'"' + 'ds_units'+'"' + ':' +"'" + ds_units.value +"'," + ' \r\n ' +
'"' + 'wu_apikey'+'"' + ':' +"'" + wu_apikey.value +"'," + ' \r\n ' +
'"' + 'wu_units'+'"' + ':' +"'" + wu_units.value +"'," + ' \r\n ' +
'"' + 'me_apikey'+'"' + ':' +"'" + me_apikey.value +"'," + ' \r\n ' +
'"' + 'me_code'+'"' + ':' +"'" + me_code.value +"'," + ' \r\n ' +
'"' + 'pu_id'+'"' + ':' +"'" + pu_id.value +"'," + ' \r\n ' +
'"' + 'al_ip'+'"' + ':' +"'" + al_ip.value +"'," + ' \r\n ' +
'"' + 'al_country'+'"' + ':' +"'" + al_country.value +"'," + ' \r\n ' +
'"' + 'al_region'+'"' + ':' +"'" + al_region.value +"'," + ' \r\n ' +
'"##'+'List of all user fields above to be replaced in strings below' +'",'+ ' \r\n ' +
'"sub_fields"'+':'+"'lat,lon,lang,continent,aq_apikey,ds_apikey,ds_units,wu_apikey,wu_units,me_apikey,me_code,pu_id,al_ip,al_country,al_region'," + ' \r\n ' +
'"config_entries3"'+':'+"'''="+ ' \r\n ' +
"'Weather34WebServices' "+':'+ ' \r\n ' +
'"# Air quality, your own latitude, longitude, token and interval in seconds are required\\n"' + ' \r\n ' +
'"# Dark Sky, your own latitude, longitude, API key, language, units and interval in seconds required\\n"' + ' \r\n ' +
'"# DarkSky Units key us = US Units, ca = METRIC Units, si = METRICWX Units, uk2 = UK(metric with mph) Units\\n"' + ' \r\n ' +
'"# Example https://api.forecast.io/forecast/yourtokenhere/51.94,-0.987?lang=en&units=uk2\\n"' + ' \r\n ' +
'"# Weather Underground, your own latitude, longitude, API key, language, units and interval in seconds required\\n"' + ' \r\n ' +
'"# Weather Underground Units key e = US, m = METRIC, s = SI(with m/s Scandinavia), h = UK(with mph)\\n"' + ' \r\n ' +
'"# Example https://api.weather.com/v3/wx/forecast/daily/5day?geocode=51.94,-0.987&language=en&format=json&units=h&apiKey=yourapikeyhere\\n"' + ' \r\n ' +
'"# Earthquake reports interval in seconds required\\n"' + ' \r\n ' +
'"# K-Index reports interval in seconds required\\n"' + ' \r\n ' +
'"# Metar reports airport code, API Key and interval in seconds required\\n"' + ' \r\n ' +
'"# Example https://api.checkwx.com/metar/EGTK/decoded\\n"' + ' \r\n ' +
'"# Example X-API-Key:yourapikeyhere\\n"' + ' \r\n ' +
'"# Purpleair reports device ID and interval in seconds required\\n"' + ' \r\n ' +
'"# Example https://www.purpleair.com/json?show=38365\\n"' + ' \r\n ' +
'"# Meteoalrm European weather warnings country code, region code and interval in seconds required\\n"' + ' \r\n ' +
'"# Example http://192.168.1.232/weewx/weather34/eualert.php?country=UK®ion=013\\n"' + ' \r\n ' +
'"# Select the services you require by creating a string of the services above\\n"' + ' \r\n ' +
'"# Example services = ds.me.eq.ki.wu.aq.al.ah.ao.aa.pu\\n"' + ' \r\n ' +
'"# Select your prefered time interval in seconds for each service\\n"' + ' \r\n ' +
'{' + ' \r\n ' +
" 'aq_url':'https://api.waqi.info/feed/geo:"+lat.value+';'+lon.value+'/?token='+aq_apikey.value+"'"+','+ ' \r\n ' +
" 'aq_interval':'3600'"+','+ ' \r\n ' +
" 'aq_filename':'/var/www/html/weewx/weather34/jsondata/aqi.txt'"+','+ ' \r\n ' +
" 'ds_url':'https://api.forecast.io/forecast/"+ds_apikey.value+'/'+lat.value+','+lon.value+'?lang='+lang.value+'&units'+'='+ds_units.value+"'"+','+ ' \r\n ' +
" 'ds_interval':'3600'"+','+ ' \r\n ' +
" 'ds_filename':'/var/www/html/weewx/weather34/jsondata/darksky.txt'"+','+ ' \r\n ' +
" 'wu_url':'https://api.weather.com/v3/wx/forecast/daily/5day?geocode="+lat.value+','+lon.value+'&language='+lang.value+'&format=json&units='+wu_units.value+'&apiKey='+wu_apikey.value+"'"+','+ ' \r\n ' +
" 'wu_interval':'3600'"+','+ ' \r\n ' +
" 'wu_filename':'/var/www/html/weewx/weather34/jsondata/wuforecast.txt'"+','+ ' \r\n ' +
" 'eq_url':'https://earthquake-report.com/feeds/recent-eq?json'"+','+ ' \r\n ' +
" 'eq_interval':'3600'"+','+ ' \r\n ' +
" 'eq_filename':'/var/www/html/weewx/weather34/jsondata/eqnotification.txt'"+','+ ' \r\n ' +
" 'ki_url':'https://services.swpc.noaa.gov/products/geospace/planetary-k-index-dst.json'"+','+ ' \r\n ' +
" 'ki_interval':'43200'"+','+ ' \r\n ' +
" 'ki_filename':'/var/www/html/weewx/weather34/jsondata/kindex.txt'"+','+ ' \r\n ' +
" 'me_url':'https://api.checkwx.com/metar/"+me_code.value+'/decoded'+"',"+ ' \r\n ' +
" 'me_header':'X-API-Key:"+me_apikey.value+"'"+','+ ' \r\n ' +
" 'me_interval':'3600'"+','+ ' \r\n ' +
" 'me_filename':'/var/www/html/weewx/weather34/jsondata/metar34.txt'"+','+ ' \r\n ' +
" 'pu_url':'https://www.purpleair.com/json?show="+pu_id.value+"'"+','+ ' \r\n ' +
" 'pu_interval':'3600'"+','+ ' \r\n ' +
" 'pu_filename':'/var/www/html/weewx/weather34/jsondata/purpleair.txt'"+','+ ' \r\n ' +
" 'al_url':'http://"+al_ip.value+'/weewx/weather34/eualert.php?country='+al_country.value+'®ion='+al_region.value+"'"+','+ ' \r\n ' +
" 'al_interval':'3600'"+','+ ' \r\n ' +
" 'al_filename':'/var/www/html/weewx/weather34/jsondata/meteoalarm.txt'"+','+ ' \r\n ' +
" 'services':'"+services.value+"'"+ ' \r\n ' +
" }'''"+','+ ' \r\n ' +
'"config_entries4"'+":'''="+ ' \r\n ' +
"'Weather34CloudCover' :"+ ' \r\n ' +
'"# Apply your own latitude and longitude and continent to the URLs in this section\\n"' + ' \r\n ' +
'{' + ' \r\n ' +
" 'enable':'"+enable.value+"'"+','+ ' \r\n ' +
" 'db_field':'signal8'"+','+ ' \r\n ' +
" 'cc_interval':'300'"+','+ ' \r\n ' +
" 'cc1_url':'https://api.sat24.com/crop?type=visual5hdcomplete&lat="+lat.value+'&lon='+lon.value+'&width=300&height=300&zoom=1.00&continent='+continent.value+"'"+','+ ' \r\n ' +
" 'cc1_filename':'/tmp/sat1.png'"+','+ ' \r\n ' +
" 'cc2_url':'https://api.sat24.com/crop?type=infraPolair&lat="+lat.value+'&lon='+lon.value+'&width=300&height=300&zoom=1.00&continent='+continent.value+"'"+','+ ' \r\n ' +
" 'cc2_filename':'/tmp/sat2.png'"+','+ ' \r\n ' +
" }'''"+','+ ' \r\n ' +
'}'
// Convert the text to BLOB.
const textToBLOB = new Blob([data], { type: 'text/plain' });
const sFileName = 'services.txt'; // The file to save the data.
let newLink = document.createElement("a");
newLink.download = sFileName;
if (window.webkitURL != null) {
newLink.href = window.webkitURL.createObjectURL(textToBLOB);
}
else {
newLink.href = window.URL.createObjectURL(textToBLOB);
newLink.style.display = "none";
document.body.appendChild(newLink);
}
newLink.click();
}
</script>
</html>