0 Votes

News

Modifié par john le 2026/09/26 17:02

Page news : capteurs du Pico W, image astronomique du jour, flux RSS, vols à Roissy, actualités, crypto-monnaies. Déploiement et configuration commune : Dashy.

pageInfo

pageInfo:
 title: News
 description: Some RSS feed
 navLinks:
    - title: Home
     path: /

pages

pages:
  - name: bookmarks
   path: bookmark.yml
  - name: cpu
   path: cpu.yml
  - name: news
   path: news.yml

Widgets

WidgetSectionAfficheIdentifiants
embedIoT — Pico WTempérature, humidité, pression et altitude du Pico W—
apodNASAImage astronomique du jour de la NASA—
rss-feedDebian CVE, NewsDerniers articles d'un flux RSS—
flight-dataAeroportDéparts et arrivées d'un aéroportClé RapidAPI
news-headlinesMediasTitres d'actualité par pays et langueClé Currents API
crypto-watch-listCrypto marketCours CoinGecko des monnaies listées—
wallet-balanceBinance Wallets, Uphold WalletsSolde et transactions d'une adresse Ethereum—

Sections

IoT — Pico W

sections:
  - name: IoT — Pico W
   icon: hl-raspberry-pi
   displayData:
     cols: 1
     rows: 2
   items:
      - title: Pico W
       description: Interface Web LED + État
       icon: hl-raspberry-pi
       url: http://<IP_PICO>
       statusCheck: true
       id: 0_268_picow
   widgets:
      - type: embed
       options:
         html: |
           <div id="pico-widget">
             <div id="pico-content">
               <p style="text-align:center;color:#888;">Chargement…</p>
             </div>
           </div>
         css: |
           #pico-widget { font-family: sans-serif; color: #e0e0e0; padding: 8px 4px; }
           #pico-widget .pico-grid { display: flex; gap: 12px; justify-content: space-around; flex-wrap: wrap; }
           #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; }
           #pico-widget .pico-icon { font-size: 1.8em; margin-bottom: 6px; }
           #pico-widget .pico-value { font-size: 1.5em; font-weight: bold; color: #fff; }
           #pico-widget .pico-label { font-size: 0.72em; color: #aaa; margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; }
           #pico-widget .pico-footer { text-align: center; font-size: 0.68em; color: #666; margin-top: 10px; }
           #pico-widget .pico-error { color: #ff6b6b; text-align: center; padding: 10px; font-size: 0.85em; }
         script: |
           (function() {
             var API = 'http://<IP_PICO>/api';
             function getColor(t) {
               if (t < 10) return '#74b9ff';
               if (t < 20) return '#55efc4';
               if (t < 27) return '#fdcb6e';
               return '#ff7675';
             }
             function render(d) {
               var now = new Date().toLocaleTimeString('fr-FR', {hour:'2-digit',minute:'2-digit',second:'2-digit'});
               document.getElementById('pico-content').innerHTML =
                 '<div class="pico-grid">' +
                   '<div class="pico-card"><div class="pico-icon">🌡️</div>' +
                     '<div class="pico-value" style="color:' + getColor(d.temperature) + '">' + d.temperature.toFixed(1) + '°C</div>' +
                     '<div class="pico-label">Température</div></div>' +
                   '<div class="pico-card"><div class="pico-icon">💧</div>' +
                     '<div class="pico-value">' + d.humidity.toFixed(1) + '%</div>' +
                     '<div class="pico-label">Humidité</div></div>' +
                   '<div class="pico-card"><div class="pico-icon">🔵</div>' +
                     '<div class="pico-value">' + d.pressure.toFixed(1) + '</div>' +
                     '<div class="pico-label">Pression hPa</div></div>' +
                   '<div class="pico-card"><div class="pico-icon">⛰️</div>' +
                     '<div class="pico-value">' + d.altitude.toFixed(1) + ' m</div>' +
                     '<div class="pico-label">Altitude</div></div>' +
                 '</div>' +
                 '<div class="pico-footer">Mis à jour à ' + now + ' · Pico W <IP_PICO></div>';
             }
             function fetchData() {
               fetch('/cors-proxy', { headers: { 'Target-URL': API } })
                 .then(function(r) { return r.json(); })
                 .then(render)
                 .catch(function() {
                   document.getElementById('pico-content').innerHTML =
                     '<p class="pico-error">⚠️ Impossible de joindre le Pico (<IP_PICO>)</p>';
                 });
             }
             fetchData();
             setInterval(fetchData, 30000);
           })();
       id: 0_268_picow_sensor

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.

NASA

sections:
  - name: NASA
   icon: hl-nasa
   displayData:
     sortBy: default
     rows: 1
     cols: 1
     collapsed: false
     hideForGuests: false
   items: []
   widgets:
      - type: apod
       id: 0_291_apod

Debian CVE

sections:
  - name: Debian CVE
   icon: hl-debian-linux
   useProxy: true
   widgets:
      - type: rss-feed
       options:
         rssUrl: https://www.debian.org/security/dsa
       id: 0_833_rssfeed

useProxy est placé sur la section : il est ignoré, le widget appelle rss2json directement.

Aeroport

sections:
  - name: Aeroport
   icon: hl-flightaware
   useProxy: true
   widgets:
      - type: flight-data
       options:
         airport: LFPG
         apiKey: <CLE_API_RAPIDAPI>
         limit: 12
         direction: all
       id: 0_844_flightdata
  • apiKey : créer un compte RapidAPI, s'abonner à l'API AeroDataBox (offre gratuite) et copier la clé X-RapidAPI-Key.
  • 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é.
  • airport : code OACI de l'aéroport.

News

sections:
  - name: News
   icon: fad fa-newspaper
   displayData:
     rows: 1
     sortBy: random
     cols: 1
     collapsed: true
     hideForGuests: false
   widgets:
      - type: rss-feed
       options:
         limit: '2'
         rssUrl: https://omgubuntu.co.uk/feed
       id: 0_413_rssfeed

Medias

sections:
  - name: Medias
   icon: hl-youtube
   displayData:
     rows: 1
     cols: 1
     sortBy: default
     collapsed: true
     hideForGuests: false
   widgets:
      - type: news-headlines
       useProxy: true
       options:
         lang: fr
         country: FR
         count: '2'
         apiKey: <CLE_API_CURRENTS>
       id: 0_595_newsheadlines

apiKey : clé obtenue en créant un compte gratuit sur Currents API. Elle passe dans l'URL et traverse /cors-proxy sans réglage.

Crypto market

sections:
  - name: Crypto market
   icon: hl-bitcoin
   widgets:
      - type: crypto-watch-list
       options:
         currency: EUR
         assets:
            - ethereum
            - bnb
            - wrapped-beacon-eth
            - basic-attention-token
            - paris-saint-germain-fan-token
            - fc-porto
       id: 0_1317_cryptowatchlist
   displayData:
     sortBy: default
     rows: 1
     cols: 1
     collapsed: false
     hideForGuests: false

Binance Wallets

sections:
  - name: Binance Wallets
   icon: hl-gollum
   widgets:
      - type: wallet-balance
       options:
         coin: eth
         network: main
         address: '<ADRESSE_WALLET_1>'
       id: 0_1452_walletbalance
   displayData:
     sortBy: default
     rows: 2
     cols: 2
     collapsed: false
     hideForGuests: false

Uphold Wallets

sections:
  - name: Uphold Wallets
   icon: https://uphold.com/favicon.ico
   widgets:
      - type: wallet-balance
       options:
         coin: eth
         network: main
         address: '<ADRESSE_WALLET_2>'
       id: 0_1384_walletbalance
   displayData:
     sortBy: default
     rows: 2
     cols: 2
     collapsed: false
     hideForGuests: false

Fichier complet

Le fichier news.yml en un seul bloc, à copier tel quel dans user-data.

Afficher news.yml complet
pageInfo:
 title: News
 description: Some RSS feed
 navLinks:
    - title: Home
     path: /
pages:
  - name: bookmarks
   path: bookmark.yml
  - name: cpu
   path: cpu.yml
  - name: news
   path: news.yml
sections:
  - name: IoT — Pico W
   icon: hl-raspberry-pi
   displayData:
     cols: 1
     rows: 2
   items:
      - title: Pico W
       description: Interface Web LED + État
       icon: hl-raspberry-pi
       url: http://<IP_PICO>
       statusCheck: true
       id: 0_268_picow
   widgets:
      - type: embed
       options:
         html: |
           <div id="pico-widget">
             <div id="pico-content">
               <p style="text-align:center;color:#888;">Chargement…</p>
             </div>
           </div>
         css: |
           #pico-widget { font-family: sans-serif; color: #e0e0e0; padding: 8px 4px; }
           #pico-widget .pico-grid { display: flex; gap: 12px; justify-content: space-around; flex-wrap: wrap; }
           #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; }
           #pico-widget .pico-icon { font-size: 1.8em; margin-bottom: 6px; }
           #pico-widget .pico-value { font-size: 1.5em; font-weight: bold; color: #fff; }
           #pico-widget .pico-label { font-size: 0.72em; color: #aaa; margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; }
           #pico-widget .pico-footer { text-align: center; font-size: 0.68em; color: #666; margin-top: 10px; }
           #pico-widget .pico-error { color: #ff6b6b; text-align: center; padding: 10px; font-size: 0.85em; }
         script: |
           (function() {
             var API = 'http://<IP_PICO>/api';
             function getColor(t) {
               if (t < 10) return '#74b9ff';
               if (t < 20) return '#55efc4';
               if (t < 27) return '#fdcb6e';
               return '#ff7675';
             }
             function render(d) {
               var now = new Date().toLocaleTimeString('fr-FR', {hour:'2-digit',minute:'2-digit',second:'2-digit'});
               document.getElementById('pico-content').innerHTML =
                 '<div class="pico-grid">' +
                   '<div class="pico-card"><div class="pico-icon">🌡️</div>' +
                     '<div class="pico-value" style="color:' + getColor(d.temperature) + '">' + d.temperature.toFixed(1) + '°C</div>' +
                     '<div class="pico-label">Température</div></div>' +
                   '<div class="pico-card"><div class="pico-icon">💧</div>' +
                     '<div class="pico-value">' + d.humidity.toFixed(1) + '%</div>' +
                     '<div class="pico-label">Humidité</div></div>' +
                   '<div class="pico-card"><div class="pico-icon">🔵</div>' +
                     '<div class="pico-value">' + d.pressure.toFixed(1) + '</div>' +
                     '<div class="pico-label">Pression hPa</div></div>' +
                   '<div class="pico-card"><div class="pico-icon">⛰️</div>' +
                     '<div class="pico-value">' + d.altitude.toFixed(1) + ' m</div>' +
                     '<div class="pico-label">Altitude</div></div>' +
                 '</div>' +
                 '<div class="pico-footer">Mis à jour à ' + now + ' · Pico W <IP_PICO></div>';
             }
             function fetchData() {
               fetch('/cors-proxy', { headers: { 'Target-URL': API } })
                 .then(function(r) { return r.json(); })
                 .then(render)
                 .catch(function() {
                   document.getElementById('pico-content').innerHTML =
                     '<p class="pico-error">⚠️ Impossible de joindre le Pico (<IP_PICO>)</p>';
                 });
             }
             fetchData();
             setInterval(fetchData, 30000);
           })();
       id: 0_268_picow_sensor
  - name: NASA
   icon: hl-nasa
   displayData:
     sortBy: default
     rows: 1
     cols: 1
     collapsed: false
     hideForGuests: false
   items: []
   widgets:
      - type: apod
       id: 0_291_apod
  - name: Debian CVE
   icon: hl-debian-linux
   useProxy: true
   widgets:
      - type: rss-feed
       options:
         rssUrl: https://www.debian.org/security/dsa
       id: 0_833_rssfeed
  - name: Aeroport
   icon: hl-flightaware
   useProxy: true
   widgets:
      - type: flight-data
       options:
         airport: LFPG
         apiKey: <CLE_API_RAPIDAPI>
         limit: 12
         direction: all
       id: 0_844_flightdata
  - name: News
   icon: fad fa-newspaper
   displayData:
     rows: 1
     sortBy: random
     cols: 1
     collapsed: true
     hideForGuests: false
   widgets:
      - type: rss-feed
       options:
         limit: '2'
         rssUrl: https://omgubuntu.co.uk/feed
       id: 0_413_rssfeed
  - name: Medias
   icon: hl-youtube
   displayData:
     rows: 1
     cols: 1
     sortBy: default
     collapsed: true
     hideForGuests: false
   widgets:
      - type: news-headlines
       useProxy: true
       options:
         lang: fr
         country: FR
         count: '2'
         apiKey: <CLE_API_CURRENTS>
       id: 0_595_newsheadlines
  - name: Crypto market
   icon: hl-bitcoin
   widgets:
      - type: crypto-watch-list
       options:
         currency: EUR
         assets:
            - ethereum
            - bnb
            - wrapped-beacon-eth
            - basic-attention-token
            - paris-saint-germain-fan-token
            - fc-porto
       id: 0_1317_cryptowatchlist
   displayData:
     sortBy: default
     rows: 1
     cols: 1
     collapsed: false
     hideForGuests: false
  - name: Binance Wallets
   icon: hl-gollum
   widgets:
      - type: wallet-balance
       options:
         coin: eth
         network: main
         address: '<ADRESSE_WALLET_1>'
       id: 0_1452_walletbalance
   displayData:
     sortBy: default
     rows: 2
     cols: 2
     collapsed: false
     hideForGuests: false
  - name: Uphold Wallets
   icon: https://uphold.com/favicon.ico
   widgets:
      - type: wallet-balance
       options:
         coin: eth
         network: main
         address: '<ADRESSE_WALLET_2>'
       id: 0_1384_walletbalance
   displayData:
     sortBy: default
     rows: 2
     cols: 2
     collapsed: false
     hideForGuests: false