Skip to content
Snippets Groups Projects
Select Git revision
  • 2777208da3c95085222fc44ce1eab1746588a7f9
  • master default protected
  • dev
  • appimage
  • fix_gitlab
  • fixappveyor
  • gitlab
  • fix_ci
  • fix_dbus_error
  • fix_ci_osx
  • sakia020
  • fix_travis#1105
  • feature/backend
  • check_uniq_node_by_endpoints
  • qt5.7
  • feature/agent_architecture
  • translations
  • pyqt5.6
  • qtwebengine
  • pyinstaller
  • landscape
  • 0.53.2
  • 0.53.1
  • 0.53.0
  • 0.52.0
  • 0.51.1
  • 0.51.0
  • 0.50.5
  • 0.50.4
  • 0.50.3
  • 0.50.2
  • 0.50.1
  • 0.50.0
  • 0.33.0rc7
  • 0.33.0rc6
  • 0.33.0rc5
  • 0.33.0rc4
  • 0.33.0rc3
  • 0.33.0rc2
  • 0.33.0rc1
  • 0.32.10post1
41 results

update_ts.py

Blame
  • index.js 1.70 KiB
    "use strict";
    
    const co = require('co');
    const bodyParser = require('body-parser');
    const http    = require('http');
    const express = require('express');
    const path    = require('path');
    const webminController = require('./server/controller/webmin.js');
    
    // Inject 'webstart' command if no argument was given
    if (process.argv.length === 2) {
      process.argv.push('webstart');
    }
    
    module.exports = {
      duniter: {
    
        'cli': [{
          name: 'webstart',
          desc: 'Do a webstart',
          requires: ['service'],
          promiseCallback: (duniterServer) => co(function*(){
    
            try {
    
              /****************************************
               * SPECIALISATION
               ***************************************/
    
              const app = express();
              const HOTE = 'localhost';
              const PORT = 9220;
    
              /**
               * Sur appel de l'URL /abc
               */
              app.use(express.static(path.join(__dirname, '..', 'duniter-ui', 'public')));
    
              app.use(bodyParser.urlencoded({
                extended: true
              }));
              app.use(bodyParser.json());
    
              const wbmin = webminController(duniterServer);
              const httpServer = http.createServer(app);
              httpServer.listen(PORT, HOTE);
              console.log("Serveur web disponible a l'adresse http://%s:%s", HOTE, PORT);
    
              require('./server/lib/routes').webmin(wbmin, app);
              require('./server/lib/routes').webminWS(wbmin)(httpServer);
    
              yield wbmin.startHTTP();
    
              // Never ending promise
              return new Promise((resolve) => {});
    
              /****************************************/
    
            } catch (e) {
              console.error(e);
              process.exit(1);
            }
          })
        }]
      }
    };