Skip to content
Snippets Groups Projects
Select Git revision
  • cbb2643ba50f1d335e2ee4f425a7ff064c4885a6
  • dev default protected
  • release/1.9.1 protected
  • pini-1.8-docker
  • pini-sync-onlypeers
  • duniter-v2s-issue-123-industrialize-releases
  • feature/build-aarch64-nodejs16
  • release/1.8 protected
  • pini-docker
  • ci_tags
  • fix/1448/1.8/txs_not_stored
  • feature/node-20
  • fix/1441/node_summary_with_storage
  • fix/1442/improve_bma_tx_history
  • feature/wotwizard-1.8
  • release/1.9 protected
  • 1.7 protected
  • feature/docker-set-latest protected
  • feature/fast-docker-build-1.8.4
  • fast-docker-build protected
  • feature/dump-distance
  • v1.8.7 protected
  • v1.8.7-rc4 protected
  • v1.8.7-rc3 protected
  • v1.8.7-rc2 protected
  • v1.8.7-rc1 protected
  • v1.8.6 protected
  • v1.7.23 protected
  • v1.8.5 protected
  • v1.8.4 protected
  • v1.8.3 protected
  • v1.8.2 protected
  • v1.8.1 protected
  • v1.8.0 protected
  • v1.8.0-rc1 protected
  • v1.8.0-beta5 protected
  • v1.8.0-beta4 protected
  • v1.8.0-beta3 protected
  • v1.8.0-beta2 protected
  • v1.8.0-beta protected
  • v1.7.21 protected
41 results

index.ts

Blame
  • server.ts 26.66 KiB
    // Source file from duniter: Crypto-currency software to manage libre currency such as Ğ1
    // Copyright (C) 2018  Cedric Moreau <cem.moreau@gmail.com>
    //
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU Affero General Public License for more details.
    
    import {IdentityService} from "./app/service/IdentityService"
    import {MembershipService} from "./app/service/MembershipService"
    import {PeeringService} from "./app/service/PeeringService"
    import {BlockchainService} from "./app/service/BlockchainService"
    import {TransactionService} from "./app/service/TransactionsService"
    import {ConfDTO} from "./app/lib/dto/ConfDTO"
    import {FileDAL, FileDALParams} from "./app/lib/dal/fileDAL"
    import * as stream from "stream"
    import {Key, randomKey} from "./app/lib/common-libs/crypto/keyring"
    import {parsers} from "./app/lib/common-libs/parsers/index"
    import {Cloneable} from "./app/lib/dto/Cloneable"
    import {CommonConstants, DuniterDocument, duniterDocument2str} from "./app/lib/common-libs/constants"
    import {GlobalFifoPromise} from "./app/service/GlobalFifoPromise"
    import {BlockchainContext} from "./app/lib/computation/BlockchainContext"
    import {BlockDTO} from "./app/lib/dto/BlockDTO"
    import {DBIdentity} from "./app/lib/dal/sqliteDAL/IdentityDAL"
    import {CertificationDTO} from "./app/lib/dto/CertificationDTO"
    import {MembershipDTO} from "./app/lib/dto/MembershipDTO"
    import {RevocationDTO} from "./app/lib/dto/RevocationDTO"
    import {TransactionDTO} from "./app/lib/dto/TransactionDTO"
    import {PeerDTO} from "./app/lib/dto/PeerDTO"
    import {OtherConstants} from "./app/lib/other_constants"
    import {WS2PCluster} from "./app/modules/ws2p/lib/WS2PCluster"
    import {DBBlock} from "./app/lib/db/DBBlock"
    import {ProxiesConf} from './app/lib/proxy';
    import {Directory, FileSystem} from "./app/lib/system/directory"
    import {DataErrors} from "./app/lib/common-libs/errors"
    import {DBPeer} from "./app/lib/db/DBPeer"
    import {Underscore} from "./app/lib/common-libs/underscore"
    import {SQLiteDriver} from "./app/lib/dal/drivers/SQLiteDriver"
    import {LevelUp} from "levelup";
    import {BMAConstants} from "./app/modules/bma/lib/constants"
    import {HttpMilestonePage} from "./app/modules/bma/lib/dtos"
    import * as toJson from "./app/modules/bma/lib/tojson"
    
    export interface HookableServer {
      generatorGetJoinData: (...args:any[]) => Promise<any>
      generatorComputeNewCerts: (...args:any[]) => Promise<any>
      generatorNewCertsToLinks: (...args:any[]) => Promise<any>
      onPluggedFSHook: (...args:any[]) => Promise<any>
      resetDataHook: (...args:any[]) => Promise<any>
      resetConfigHook: (...args:any[]) => Promise<any>
    }
    
    const path        = require('path');
    const archiver    = require('archiver');
    const fs          = require('fs');
    const es          = require('event-stream');
    const extract = require('extract-zip')
    const daemonize   = require("daemonize2")
    const constants   = require('./app/lib/constants');
    const jsonpckg    = require('./package.json');
    const logger      = require('./app/lib/logger').NewLogger('server');
    
    export class Server extends stream.Duplex implements HookableServer {
    
      private paramsP:Promise<FileDALParams>