Afficher les derniers auteurs
| author | version | line-number | content |
|---|---|---|---|
| 1 | Page //news// : capteurs du Pico W, image astronomique du jour, flux RSS, vols à Roissy, actualités, crypto-monnaies. Déploiement et configuration commune : [[Dashy>>Wiki Batcave John.Infrastructure.ServeurPrincipal.Dashy.WebHome]]. | ||
| 2 | |||
| 3 | {{toc/}} | ||
| 4 | |||
| 5 | == pageInfo == | ||
| 6 | |||
| 7 | {{code language="yaml"}} | ||
| 8 | pageInfo: | ||
| 9 | title: News | ||
| 10 | description: Some RSS feed | ||
| 11 | navLinks: | ||
| 12 | - title: Home | ||
| 13 | path: / | ||
| 14 | {{/code}} | ||
| 15 | |||
| 16 | == pages == | ||
| 17 | |||
| 18 | {{code language="yaml"}} | ||
| 19 | pages: | ||
| 20 | - name: bookmarks | ||
| 21 | path: bookmark.yml | ||
| 22 | - name: cpu | ||
| 23 | path: cpu.yml | ||
| 24 | - name: news | ||
| 25 | path: news.yml | ||
| 26 | {{/code}} | ||
| 27 | |||
| 28 | == Widgets == | ||
| 29 | |||
| 30 | |=Widget|=Section|=Affiche|=Identifiants | ||
| 31 | |##embed##|IoT — Pico W|Température, humidité, pression et altitude du Pico W|— | ||
| 32 | |##apod##|NASA|Image astronomique du jour de la NASA|— | ||
| 33 | |##rss-feed##|Debian CVE, News|Derniers articles d'un flux RSS|— | ||
| 34 | |##flight-data##|Aeroport|Départs et arrivées d'un aéroport|Clé RapidAPI | ||
| 35 | |##news-headlines##|Medias|Titres d'actualité par pays et langue|Clé Currents API | ||
| 36 | |##crypto-watch-list##|Crypto market|Cours CoinGecko des monnaies listées|— | ||
| 37 | |##wallet-balance##|Binance Wallets, Uphold Wallets|Solde et transactions d'une adresse Ethereum|— | ||
| 38 | |||
| 39 | == Sections == | ||
| 40 | |||
| 41 | === IoT — Pico W === | ||
| 42 | |||
| 43 | {{code language="yaml"}} | ||
| 44 | sections: | ||
| 45 | - name: IoT — Pico W | ||
| 46 | icon: hl-raspberry-pi | ||
| 47 | displayData: | ||
| 48 | cols: 1 | ||
| 49 | rows: 2 | ||
| 50 | items: | ||
| 51 | - title: Pico W | ||
| 52 | description: Interface Web LED + État | ||
| 53 | icon: hl-raspberry-pi | ||
| 54 | url: http://<IP_PICO> | ||
| 55 | statusCheck: true | ||
| 56 | id: 0_268_picow | ||
| 57 | widgets: | ||
| 58 | - type: embed | ||
| 59 | options: | ||
| 60 | html: | | ||
| 61 | <div id="pico-widget"> | ||
| 62 | <div id="pico-content"> | ||
| 63 | <p style="text-align:center;color:#888;">Chargement…</p> | ||
| 64 | </div> | ||
| 65 | </div> | ||
| 66 | css: | | ||
| 67 | #pico-widget { font-family: sans-serif; color: #e0e0e0; padding: 8px 4px; } | ||
| 68 | #pico-widget .pico-grid { display: flex; gap: 12px; justify-content: space-around; flex-wrap: wrap; } | ||
| 69 | #pico-widget .pico-card { background: rgba(255,255,255,0.06); border-radius: 12px; padding: 14px 18px; text-align: center; min-width: 90px; flex: 1; } | ||
| 70 | #pico-widget .pico-icon { font-size: 1.8em; margin-bottom: 6px; } | ||
| 71 | #pico-widget .pico-value { font-size: 1.5em; font-weight: bold; color: #fff; } | ||
| 72 | #pico-widget .pico-label { font-size: 0.72em; color: #aaa; margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; } | ||
| 73 | #pico-widget .pico-footer { text-align: center; font-size: 0.68em; color: #666; margin-top: 10px; } | ||
| 74 | #pico-widget .pico-error { color: #ff6b6b; text-align: center; padding: 10px; font-size: 0.85em; } | ||
| 75 | script: | | ||
| 76 | (function() { | ||
| 77 | var API = 'http://<IP_PICO>/api'; | ||
| 78 | function getColor(t) { | ||
| 79 | if (t < 10) return '#74b9ff'; | ||
| 80 | if (t < 20) return '#55efc4'; | ||
| 81 | if (t < 27) return '#fdcb6e'; | ||
| 82 | return '#ff7675'; | ||
| 83 | } | ||
| 84 | function render(d) { | ||
| 85 | var now = new Date().toLocaleTimeString('fr-FR', {hour:'2-digit',minute:'2-digit',second:'2-digit'}); | ||
| 86 | document.getElementById('pico-content').innerHTML = | ||
| 87 | '<div class="pico-grid">' + | ||
| 88 | '<div class="pico-card"><div class="pico-icon">🌡️</div>' + | ||
| 89 | '<div class="pico-value" style="color:' + getColor(d.temperature) + '">' + d.temperature.toFixed(1) + '°C</div>' + | ||
| 90 | '<div class="pico-label">Température</div></div>' + | ||
| 91 | '<div class="pico-card"><div class="pico-icon">💧</div>' + | ||
| 92 | '<div class="pico-value">' + d.humidity.toFixed(1) + '%</div>' + | ||
| 93 | '<div class="pico-label">Humidité</div></div>' + | ||
| 94 | '<div class="pico-card"><div class="pico-icon">🔵</div>' + | ||
| 95 | '<div class="pico-value">' + d.pressure.toFixed(1) + '</div>' + | ||
| 96 | '<div class="pico-label">Pression hPa</div></div>' + | ||
| 97 | '<div class="pico-card"><div class="pico-icon">⛰️</div>' + | ||
| 98 | '<div class="pico-value">' + d.altitude.toFixed(1) + ' m</div>' + | ||
| 99 | '<div class="pico-label">Altitude</div></div>' + | ||
| 100 | '</div>' + | ||
| 101 | '<div class="pico-footer">Mis à jour à ' + now + ' · Pico W <IP_PICO></div>'; | ||
| 102 | } | ||
| 103 | function fetchData() { | ||
| 104 | fetch('/cors-proxy', { headers: { 'Target-URL': API } }) | ||
| 105 | .then(function(r) { return r.json(); }) | ||
| 106 | .then(render) | ||
| 107 | .catch(function() { | ||
| 108 | document.getElementById('pico-content').innerHTML = | ||
| 109 | '<p class="pico-error">⚠️ Impossible de joindre le Pico (<IP_PICO>)</p>'; | ||
| 110 | }); | ||
| 111 | } | ||
| 112 | fetchData(); | ||
| 113 | setInterval(fetchData, 30000); | ||
| 114 | })(); | ||
| 115 | id: 0_268_picow_sensor | ||
| 116 | {{/code}} | ||
| 117 | |||
| 118 | Le script du widget ##embed## appelle ##/cors-proxy## avec l'en-tête ##Target-URL##, car le Pico est en http sur le LAN. L'API du Pico renvoie un JSON avec ##temperature##, ##humidity##, ##pressure## et ##altitude##. ##<IP_PICO>## doit figurer dans ##allowed_internal## de SWAG. | ||
| 119 | |||
| 120 | === NASA === | ||
| 121 | |||
| 122 | {{code language="yaml"}} | ||
| 123 | sections: | ||
| 124 | - name: NASA | ||
| 125 | icon: hl-nasa | ||
| 126 | displayData: | ||
| 127 | sortBy: default | ||
| 128 | rows: 1 | ||
| 129 | cols: 1 | ||
| 130 | collapsed: false | ||
| 131 | hideForGuests: false | ||
| 132 | items: [] | ||
| 133 | widgets: | ||
| 134 | - type: apod | ||
| 135 | id: 0_291_apod | ||
| 136 | {{/code}} | ||
| 137 | |||
| 138 | === Debian CVE === | ||
| 139 | |||
| 140 | {{code language="yaml"}} | ||
| 141 | sections: | ||
| 142 | - name: Debian CVE | ||
| 143 | icon: hl-debian-linux | ||
| 144 | useProxy: true | ||
| 145 | widgets: | ||
| 146 | - type: rss-feed | ||
| 147 | options: | ||
| 148 | rssUrl: https://www.debian.org/security/dsa | ||
| 149 | id: 0_833_rssfeed | ||
| 150 | {{/code}} | ||
| 151 | |||
| 152 | ##useProxy## est placé sur la section : il est ignoré, le widget appelle rss2json directement. | ||
| 153 | |||
| 154 | === Aeroport === | ||
| 155 | |||
| 156 | {{code language="yaml"}} | ||
| 157 | sections: | ||
| 158 | - name: Aeroport | ||
| 159 | icon: hl-flightaware | ||
| 160 | useProxy: true | ||
| 161 | widgets: | ||
| 162 | - type: flight-data | ||
| 163 | options: | ||
| 164 | airport: LFPG | ||
| 165 | apiKey: <CLE_API_RAPIDAPI> | ||
| 166 | limit: 12 | ||
| 167 | direction: all | ||
| 168 | id: 0_844_flightdata | ||
| 169 | {{/code}} | ||
| 170 | |||
| 171 | * ##apiKey## : créer un compte RapidAPI, s'abonner à l'API AeroDataBox (offre gratuite) et copier la clé ##X-RapidAPI-Key##. | ||
| 172 | * La clé est envoyée dans un en-tête que ##/cors-proxy## ne relaie pas : laisser ce widget sans ##useProxy##. Celui de la section est ignoré. | ||
| 173 | * ##airport## : code OACI de l'aéroport. | ||
| 174 | |||
| 175 | === News === | ||
| 176 | |||
| 177 | {{code language="yaml"}} | ||
| 178 | sections: | ||
| 179 | - name: News | ||
| 180 | icon: fad fa-newspaper | ||
| 181 | displayData: | ||
| 182 | rows: 1 | ||
| 183 | sortBy: random | ||
| 184 | cols: 1 | ||
| 185 | collapsed: true | ||
| 186 | hideForGuests: false | ||
| 187 | widgets: | ||
| 188 | - type: rss-feed | ||
| 189 | options: | ||
| 190 | limit: '2' | ||
| 191 | rssUrl: https://omgubuntu.co.uk/feed | ||
| 192 | id: 0_413_rssfeed | ||
| 193 | {{/code}} | ||
| 194 | |||
| 195 | === Medias === | ||
| 196 | |||
| 197 | {{code language="yaml"}} | ||
| 198 | sections: | ||
| 199 | - name: Medias | ||
| 200 | icon: hl-youtube | ||
| 201 | displayData: | ||
| 202 | rows: 1 | ||
| 203 | cols: 1 | ||
| 204 | sortBy: default | ||
| 205 | collapsed: true | ||
| 206 | hideForGuests: false | ||
| 207 | widgets: | ||
| 208 | - type: news-headlines | ||
| 209 | useProxy: true | ||
| 210 | options: | ||
| 211 | lang: fr | ||
| 212 | country: FR | ||
| 213 | count: '2' | ||
| 214 | apiKey: <CLE_API_CURRENTS> | ||
| 215 | id: 0_595_newsheadlines | ||
| 216 | {{/code}} | ||
| 217 | |||
| 218 | ##apiKey## : clé obtenue en créant un compte gratuit sur Currents API. Elle passe dans l'URL et traverse ##/cors-proxy## sans réglage. | ||
| 219 | |||
| 220 | === Crypto market === | ||
| 221 | |||
| 222 | {{code language="yaml"}} | ||
| 223 | sections: | ||
| 224 | - name: Crypto market | ||
| 225 | icon: hl-bitcoin | ||
| 226 | widgets: | ||
| 227 | - type: crypto-watch-list | ||
| 228 | options: | ||
| 229 | currency: EUR | ||
| 230 | assets: | ||
| 231 | - ethereum | ||
| 232 | - bnb | ||
| 233 | - wrapped-beacon-eth | ||
| 234 | - basic-attention-token | ||
| 235 | - paris-saint-germain-fan-token | ||
| 236 | - fc-porto | ||
| 237 | id: 0_1317_cryptowatchlist | ||
| 238 | displayData: | ||
| 239 | sortBy: default | ||
| 240 | rows: 1 | ||
| 241 | cols: 1 | ||
| 242 | collapsed: false | ||
| 243 | hideForGuests: false | ||
| 244 | {{/code}} | ||
| 245 | |||
| 246 | === Binance Wallets === | ||
| 247 | |||
| 248 | {{code language="yaml"}} | ||
| 249 | sections: | ||
| 250 | - name: Binance Wallets | ||
| 251 | icon: hl-gollum | ||
| 252 | widgets: | ||
| 253 | - type: wallet-balance | ||
| 254 | options: | ||
| 255 | coin: eth | ||
| 256 | network: main | ||
| 257 | address: '<ADRESSE_WALLET_1>' | ||
| 258 | id: 0_1452_walletbalance | ||
| 259 | displayData: | ||
| 260 | sortBy: default | ||
| 261 | rows: 2 | ||
| 262 | cols: 2 | ||
| 263 | collapsed: false | ||
| 264 | hideForGuests: false | ||
| 265 | {{/code}} | ||
| 266 | |||
| 267 | === Uphold Wallets === | ||
| 268 | |||
| 269 | {{code language="yaml"}} | ||
| 270 | sections: | ||
| 271 | - name: Uphold Wallets | ||
| 272 | icon: https://uphold.com/favicon.ico | ||
| 273 | widgets: | ||
| 274 | - type: wallet-balance | ||
| 275 | options: | ||
| 276 | coin: eth | ||
| 277 | network: main | ||
| 278 | address: '<ADRESSE_WALLET_2>' | ||
| 279 | id: 0_1384_walletbalance | ||
| 280 | displayData: | ||
| 281 | sortBy: default | ||
| 282 | rows: 2 | ||
| 283 | cols: 2 | ||
| 284 | collapsed: false | ||
| 285 | hideForGuests: false | ||
| 286 | {{/code}} | ||
| 287 | |||
| 288 | == Fichier complet == | ||
| 289 | |||
| 290 | Le fichier ##news.yml## en un seul bloc, à copier tel quel dans ##user-data##. | ||
| 291 | |||
| 292 | {{html wiki="true"}} | ||
| 293 | <details><summary>Afficher news.yml complet</summary> | ||
| 294 | |||
| 295 | {{code language="yaml"}} | ||
| 296 | pageInfo: | ||
| 297 | title: News | ||
| 298 | description: Some RSS feed | ||
| 299 | navLinks: | ||
| 300 | - title: Home | ||
| 301 | path: / | ||
| 302 | pages: | ||
| 303 | - name: bookmarks | ||
| 304 | path: bookmark.yml | ||
| 305 | - name: cpu | ||
| 306 | path: cpu.yml | ||
| 307 | - name: news | ||
| 308 | path: news.yml | ||
| 309 | sections: | ||
| 310 | - name: IoT — Pico W | ||
| 311 | icon: hl-raspberry-pi | ||
| 312 | displayData: | ||
| 313 | cols: 1 | ||
| 314 | rows: 2 | ||
| 315 | items: | ||
| 316 | - title: Pico W | ||
| 317 | description: Interface Web LED + État | ||
| 318 | icon: hl-raspberry-pi | ||
| 319 | url: http://<IP_PICO> | ||
| 320 | statusCheck: true | ||
| 321 | id: 0_268_picow | ||
| 322 | widgets: | ||
| 323 | - type: embed | ||
| 324 | options: | ||
| 325 | html: | | ||
| 326 | <div id="pico-widget"> | ||
| 327 | <div id="pico-content"> | ||
| 328 | <p style="text-align:center;color:#888;">Chargement…</p> | ||
| 329 | </div> | ||
| 330 | </div> | ||
| 331 | css: | | ||
| 332 | #pico-widget { font-family: sans-serif; color: #e0e0e0; padding: 8px 4px; } | ||
| 333 | #pico-widget .pico-grid { display: flex; gap: 12px; justify-content: space-around; flex-wrap: wrap; } | ||
| 334 | #pico-widget .pico-card { background: rgba(255,255,255,0.06); border-radius: 12px; padding: 14px 18px; text-align: center; min-width: 90px; flex: 1; } | ||
| 335 | #pico-widget .pico-icon { font-size: 1.8em; margin-bottom: 6px; } | ||
| 336 | #pico-widget .pico-value { font-size: 1.5em; font-weight: bold; color: #fff; } | ||
| 337 | #pico-widget .pico-label { font-size: 0.72em; color: #aaa; margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; } | ||
| 338 | #pico-widget .pico-footer { text-align: center; font-size: 0.68em; color: #666; margin-top: 10px; } | ||
| 339 | #pico-widget .pico-error { color: #ff6b6b; text-align: center; padding: 10px; font-size: 0.85em; } | ||
| 340 | script: | | ||
| 341 | (function() { | ||
| 342 | var API = 'http://<IP_PICO>/api'; | ||
| 343 | function getColor(t) { | ||
| 344 | if (t < 10) return '#74b9ff'; | ||
| 345 | if (t < 20) return '#55efc4'; | ||
| 346 | if (t < 27) return '#fdcb6e'; | ||
| 347 | return '#ff7675'; | ||
| 348 | } | ||
| 349 | function render(d) { | ||
| 350 | var now = new Date().toLocaleTimeString('fr-FR', {hour:'2-digit',minute:'2-digit',second:'2-digit'}); | ||
| 351 | document.getElementById('pico-content').innerHTML = | ||
| 352 | '<div class="pico-grid">' + | ||
| 353 | '<div class="pico-card"><div class="pico-icon">🌡️</div>' + | ||
| 354 | '<div class="pico-value" style="color:' + getColor(d.temperature) + '">' + d.temperature.toFixed(1) + '°C</div>' + | ||
| 355 | '<div class="pico-label">Température</div></div>' + | ||
| 356 | '<div class="pico-card"><div class="pico-icon">💧</div>' + | ||
| 357 | '<div class="pico-value">' + d.humidity.toFixed(1) + '%</div>' + | ||
| 358 | '<div class="pico-label">Humidité</div></div>' + | ||
| 359 | '<div class="pico-card"><div class="pico-icon">🔵</div>' + | ||
| 360 | '<div class="pico-value">' + d.pressure.toFixed(1) + '</div>' + | ||
| 361 | '<div class="pico-label">Pression hPa</div></div>' + | ||
| 362 | '<div class="pico-card"><div class="pico-icon">⛰️</div>' + | ||
| 363 | '<div class="pico-value">' + d.altitude.toFixed(1) + ' m</div>' + | ||
| 364 | '<div class="pico-label">Altitude</div></div>' + | ||
| 365 | '</div>' + | ||
| 366 | '<div class="pico-footer">Mis à jour à ' + now + ' · Pico W <IP_PICO></div>'; | ||
| 367 | } | ||
| 368 | function fetchData() { | ||
| 369 | fetch('/cors-proxy', { headers: { 'Target-URL': API } }) | ||
| 370 | .then(function(r) { return r.json(); }) | ||
| 371 | .then(render) | ||
| 372 | .catch(function() { | ||
| 373 | document.getElementById('pico-content').innerHTML = | ||
| 374 | '<p class="pico-error">⚠️ Impossible de joindre le Pico (<IP_PICO>)</p>'; | ||
| 375 | }); | ||
| 376 | } | ||
| 377 | fetchData(); | ||
| 378 | setInterval(fetchData, 30000); | ||
| 379 | })(); | ||
| 380 | id: 0_268_picow_sensor | ||
| 381 | - name: NASA | ||
| 382 | icon: hl-nasa | ||
| 383 | displayData: | ||
| 384 | sortBy: default | ||
| 385 | rows: 1 | ||
| 386 | cols: 1 | ||
| 387 | collapsed: false | ||
| 388 | hideForGuests: false | ||
| 389 | items: [] | ||
| 390 | widgets: | ||
| 391 | - type: apod | ||
| 392 | id: 0_291_apod | ||
| 393 | - name: Debian CVE | ||
| 394 | icon: hl-debian-linux | ||
| 395 | useProxy: true | ||
| 396 | widgets: | ||
| 397 | - type: rss-feed | ||
| 398 | options: | ||
| 399 | rssUrl: https://www.debian.org/security/dsa | ||
| 400 | id: 0_833_rssfeed | ||
| 401 | - name: Aeroport | ||
| 402 | icon: hl-flightaware | ||
| 403 | useProxy: true | ||
| 404 | widgets: | ||
| 405 | - type: flight-data | ||
| 406 | options: | ||
| 407 | airport: LFPG | ||
| 408 | apiKey: <CLE_API_RAPIDAPI> | ||
| 409 | limit: 12 | ||
| 410 | direction: all | ||
| 411 | id: 0_844_flightdata | ||
| 412 | - name: News | ||
| 413 | icon: fad fa-newspaper | ||
| 414 | displayData: | ||
| 415 | rows: 1 | ||
| 416 | sortBy: random | ||
| 417 | cols: 1 | ||
| 418 | collapsed: true | ||
| 419 | hideForGuests: false | ||
| 420 | widgets: | ||
| 421 | - type: rss-feed | ||
| 422 | options: | ||
| 423 | limit: '2' | ||
| 424 | rssUrl: https://omgubuntu.co.uk/feed | ||
| 425 | id: 0_413_rssfeed | ||
| 426 | - name: Medias | ||
| 427 | icon: hl-youtube | ||
| 428 | displayData: | ||
| 429 | rows: 1 | ||
| 430 | cols: 1 | ||
| 431 | sortBy: default | ||
| 432 | collapsed: true | ||
| 433 | hideForGuests: false | ||
| 434 | widgets: | ||
| 435 | - type: news-headlines | ||
| 436 | useProxy: true | ||
| 437 | options: | ||
| 438 | lang: fr | ||
| 439 | country: FR | ||
| 440 | count: '2' | ||
| 441 | apiKey: <CLE_API_CURRENTS> | ||
| 442 | id: 0_595_newsheadlines | ||
| 443 | - name: Crypto market | ||
| 444 | icon: hl-bitcoin | ||
| 445 | widgets: | ||
| 446 | - type: crypto-watch-list | ||
| 447 | options: | ||
| 448 | currency: EUR | ||
| 449 | assets: | ||
| 450 | - ethereum | ||
| 451 | - bnb | ||
| 452 | - wrapped-beacon-eth | ||
| 453 | - basic-attention-token | ||
| 454 | - paris-saint-germain-fan-token | ||
| 455 | - fc-porto | ||
| 456 | id: 0_1317_cryptowatchlist | ||
| 457 | displayData: | ||
| 458 | sortBy: default | ||
| 459 | rows: 1 | ||
| 460 | cols: 1 | ||
| 461 | collapsed: false | ||
| 462 | hideForGuests: false | ||
| 463 | - name: Binance Wallets | ||
| 464 | icon: hl-gollum | ||
| 465 | widgets: | ||
| 466 | - type: wallet-balance | ||
| 467 | options: | ||
| 468 | coin: eth | ||
| 469 | network: main | ||
| 470 | address: '<ADRESSE_WALLET_1>' | ||
| 471 | id: 0_1452_walletbalance | ||
| 472 | displayData: | ||
| 473 | sortBy: default | ||
| 474 | rows: 2 | ||
| 475 | cols: 2 | ||
| 476 | collapsed: false | ||
| 477 | hideForGuests: false | ||
| 478 | - name: Uphold Wallets | ||
| 479 | icon: https://uphold.com/favicon.ico | ||
| 480 | widgets: | ||
| 481 | - type: wallet-balance | ||
| 482 | options: | ||
| 483 | coin: eth | ||
| 484 | network: main | ||
| 485 | address: '<ADRESSE_WALLET_2>' | ||
| 486 | id: 0_1384_walletbalance | ||
| 487 | displayData: | ||
| 488 | sortBy: default | ||
| 489 | rows: 2 | ||
| 490 | cols: 2 | ||
| 491 | collapsed: false | ||
| 492 | hideForGuests: false | ||
| 493 | {{/code}} | ||
| 494 | |||
| 495 | </details> | ||
| 496 | {{/html}} |