Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • hugo-member-color
  • hugo-member-name
  • https_mixed_content
4 results

index.html

Blame
  • index.html 3.16 KiB
    <!DOCTYPE html>
    <html lang="fr">
    <head>
      <meta charset="UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Kazou</title>
    <link rel="stylesheet" href="style.css">
    </head>
    <body>
    
      <header>
        <h1>Kazou</h1>
        <i>Des noeuds Duniter à jour !</i>
        <nav>
          <a href="help.html">Aide</a>
          <a href="license.html">Licence</a>
        </nav>
      </header>
      
      <main>
      
        <div class="part form">
          <h2>Noeud de base</h2>
    
          <select name="launch_node" id="node_select">
            <option value="https://g1.duniter.org:443">g1.duniter.org</option>
            <!-- <option value="https://duniter.coinduf.eu:443">duniter.coinduf.eu</option> -->
            <option value="https://g1.nuaje.fr:443">g1.nuaje.fr</option>
            <!-- <option value="https://g1.cloud-libre.eu:443">g1.cloud-libre.eu</option> -->
            <option value="https://duniter.adn.life:443/bma">duniter.adn.life/bma/</option>
            <option value="https://duniter.moul.re:443/bma">duniter.moul.re/bma/</option>
            <!-- <option value="https://g1.trentesaux.fr:443">g1.trentesaux.fr</option> -->
            <!-- <option value="https://g1.mithril.re:443">g1.mithril.re (Ile de la réunion)</option> -->
            <option value="https://duniter.pini.fr:443">duniter.pini.fr</option>
            <option value="https://g1.brussels.ovh:443">g1.brussels.ovh</option>
            <option value="https://g1-lyon.fr:443">g1-lyon.fr</option>
            <option value="https://g1.cuates.net:443">g1.cuates.net</option>
    
          </select>
    
          <label for="node_freetext">Ou entrez l'URL d'un noeud</label>
          <input type="text" name="node_freetext" id="node_freetext">
      
          <button onclick="launch()">Lancer !</button>
        </div>
      
        <div class="part table">
          <table id="endpoints_table">
            <thead id="table_head">
              <tr>
                <th>Adresse</th>
                <th>Bloc</th>
                <th>Type</th>
                <th>Rapidité (ms)</th>
                <th>version</th>
                <th>Membre</th>
              </tr>
            </thead>
          </table>
        </div>
      </main>
    
    
    </body>
    
    <script src="lib.js"></script>
    <script src="endpoint.js"></script>
    <script src="node.js"></script>
    
    <script>
      let protocol_is_https = window.location.protocol == 'https:'
    
      function getPeerings(node_url) {
        let url = node_url + "/network/peers"
        let peers = {}
    
        return fetch(url)
        .then(response => {
          if (response.status == 200) {
            return response.json()
          }
        })
        .then(data => {
          return data.peers
        })
        .catch(error => {
            console.log('error: ', error)
        })
      }
    
      function launch() {
        // let launch_node = select.value
    
        let free_input = document.getElementById('node_freetext');
        let launch_node = free_input.value
    
        let select = document.getElementById('node_select')
        select.addEventListener('change', () => {free_input.value = ''})
    
        if (launch_node == '') {
          launch_node = select.value
        }
    
        console.log(launch_node)
    
        let peering_info = getPeerings(launch_node)
        peering_info.then(peers => {
          let list = new DuniterNodes(peers)
        })
      }
    
      window.onload = launch
    
    </script>
    </html>