<commit_before>"use strict";
import {NetworkConfDTO} from "../../lib/dto/ConfDTO"
import {Server} from "../../../server"
import * as stream from "stream"
import {BmaApi, Network} from "./lib/network"
import {UpnpApi} from "./lib/upnp"
import {BMAConstants} from "./lib/constants"
import {BMALimitation} from "./lib/limiter"
import {PeerDTO} from "../../lib/dto/PeerDTO"

const Q = require('q');
const os = require('os');
const rp = require('request-promise');
const async = require('async');
const _ = require('underscore');
const upnp = require('./lib/upnp').Upnp
const bma = require('./lib/bma').bma
const dtos = require('./lib/dtos')
const http2raw = require('./lib/http2raw');
const inquirer = require('inquirer');

let networkWizardDone = false;

export const BmaDependency = {
  duniter: {

    cliOptions: [
      { value: '--upnp', desc: 'Use UPnP to open remote port.' },
      { value: '--noupnp', desc: 'Do not use UPnP to open remote port.' },
      { value: '--bma',   desc: 'Enables BMA API and its crawlers.' },
      { value: '--nobma', desc: 'Disables BMA API and its crawlers.' },
      { value: '--bma-with-crawler',   desc: 'Enables BMA Crawler.' },
      { value: '--bma-without-crawler', desc: 'Disable BMA Crawler.' },
      { value: '-p, --port <port>', desc: 'Port to listen for requests', parser: (val:string) => parseInt(val) },
      { value: '--ipv4 <address>', desc: 'IPv4 interface to listen for requests' },
      { value: '--ipv6 <address>', desc: 'IPv6 interface to listen for requests' },
      { value: '--remoteh <host>', desc: 'Remote interface others may use to contact this node' },
      { value: '--remote4 <host>', desc: 'Remote interface for IPv4 access' },
      { value: '--remote6 <host>', desc: 'Remote interface for IPv6 access' },
      { value: '--remotep <port>', desc: 'Remote port others may use to contact this node' },
    ],

    wizard: {

      'network': async (conf:NetworkConfDTO, program:any, logger:any) => {
        await Q.nbind(networkConfiguration, null, conf, logger)()
        networkWizardDone = true;
      },

      'network-reconfigure': async (conf:NetworkConfDTO, program:any, logger:any) => {
        if (!networkWizardDone) {
          // This step can only be launched lonely<commit_msg>[fix] command wizard network enable bma<commit_after>"use strict";
import {NetworkConfDTO} from "../../lib/dto/ConfDTO"
import {Server} from "../../../server"
import * as stream from "stream"
import {BmaApi, Network} from "./lib/network"
import {UpnpApi} from "./lib/upnp"
import {BMAConstants} from "./lib/constants"
import {BMALimitation} from "./lib/limiter"
import {PeerDTO} from "../../lib/dto/PeerDTO"

const Q = require('q');
const os = require('os');
const rp = require('request-promise');
const async = require('async');
const _ = require('underscore');
const upnp = require('./lib/upnp').Upnp
const bma = require('./lib/bma').bma
const dtos = require('./lib/dtos')
const http2raw = require('./lib/http2raw');
const inquirer = require('inquirer');

let networkWizardDone = false;

export const BmaDependency = {
  duniter: {

    cliOptions: [
      { value: '--upnp', desc: 'Use UPnP to open remote port.' },
      { value: '--noupnp', desc: 'Do not use UPnP to open remote port.' },
      { value: '--bma',   desc: 'Enables BMA API and its crawlers.' },
      { value: '--nobma', desc: 'Disables BMA API and its crawlers.' },
      { value: '--bma-with-crawler',   desc: 'Enables BMA Crawler.' },
      { value: '--bma-without-crawler', desc: 'Disable BMA Crawler.' },
      { value: '-p, --port <port>', desc: 'Port to listen for requests', parser: (val:string) => parseInt(val) },
      { value: '--ipv4 <address>', desc: 'IPv4 interface to listen for requests' },
      { value: '--ipv6 <address>', desc: 'IPv6 interface to listen for requests' },
      { value: '--remoteh <host>', desc: 'Remote interface others may use to contact this node' },
      { value: '--remote4 <host>', desc: 'Remote interface for IPv4 access' },
      { value: '--remote6 <host>', desc: 'Remote interface for IPv6 access' },
      { value: '--remotep <port>', desc: 'Remote port others may use to contact this node' },
    ],

    wizard: {

      'network': async (conf:NetworkConfDTO, program:any, logger:any) => {
        await Q.nbind(networkConfiguration, null, conf, logger)()
        conf.nobma = false
        networkWizardDone = true;
      },

      'network-reconfigure': async (conf:NetworkConfDTO, program:any, logger:any) => {
        if (!networkWizardDone) {
          // This step can only be launched lonely
{'fraction_non_alphanumeric': 0.17317339149400218, 'fraction_numerical': 0.004362050163576881, 'mean_word_length': 3.270018621973929, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5414448', 'n_tokens_mistral': 1448, 'n_tokens_neox': 1471, 'n_words': 460}