*re-structure code

This commit is contained in:
Derrick Hammer 2022-09-21 08:59:22 -04:00
parent a1abf09c28
commit 243f350a54
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
13 changed files with 23 additions and 23 deletions

View File

@ -6,7 +6,7 @@ import BConfig from "bcfg";
import * as os from "os"; import * as os from "os";
import path from "path"; import path from "path";
import { errorExit } from "./error.js"; import { errorExit } from "./lib/error.js";
const config = new BConfig("lumeweb-relay"); const config = new BConfig("lumeweb-relay");

View File

@ -1,11 +1,11 @@
import { start as startRpc } from "./rpc.js"; import { start as startRpc } from "./modules/rpc.js";
import { start as startRelay } from "./relay.js"; import { start as startRelay } from "./modules/relay.js";
import { start as startApp } from "./app"; import { start as startApp } from "./modules/app";
import log from "loglevel"; import log from "loglevel";
import config from "./config.js"; import config from "./config.js";
import { loadPlugins } from "./plugin.js"; import { loadPlugins } from "./modules/plugin.js";
import { start as startDns } from "./dns.js"; import { start as startDns } from "./modules/dns.js";
import { start as startSSl } from "./ssl.js"; import { start as startSSl } from "./modules/ssl.js";
log.setDefaultLevel(config.str("log-level")); log.setDefaultLevel(config.str("log-level"));

View File

@ -1,4 +1,4 @@
import config from "./config"; import config from "../config";
import { seedPhraseToSeed } from "libskynet"; import { seedPhraseToSeed } from "libskynet";
export function dynImport(module: string) { export function dynImport(module: string) {

View File

@ -3,8 +3,8 @@
// @ts-ignore // @ts-ignore
import DHT from "@hyperswarm/dht"; import DHT from "@hyperswarm/dht";
import config from "./config.js"; import config from "../config.js";
import { errorExit } from "./error.js"; import { errorExit } from "../lib/error.js";
import { import {
deriveMyskyRootKeypair, deriveMyskyRootKeypair,
seedPhraseToSeed, seedPhraseToSeed,

View File

@ -2,7 +2,7 @@ import cron from "node-cron";
import { get as getDHT } from "./dht.js"; import { get as getDHT } from "./dht.js";
import { Buffer } from "buffer"; import { Buffer } from "buffer";
import { pack } from "msgpackr"; import { pack } from "msgpackr";
import config from "./config.js"; import config from "../config.js";
import log from "loglevel"; import log from "loglevel";
import fetch from "node-fetch"; import fetch from "node-fetch";
import { overwriteRegistryEntry } from "libskynetnode"; import { overwriteRegistryEntry } from "libskynetnode";

View File

@ -1,5 +1,5 @@
import config from "./config.js"; import config from "../config.js";
import { getRpcServer } from "./rpc/server.js"; import { getRpcServer } from "../rpc/server.js";
import type { PluginAPI, RPCMethod, Plugin } from "@lumeweb/relay-types"; import type { PluginAPI, RPCMethod, Plugin } from "@lumeweb/relay-types";
import slugify from "slugify"; import slugify from "slugify";
import * as fs from "fs"; import * as fs from "fs";
@ -14,13 +14,13 @@ import {
setSslContext, setSslContext,
} from "./ssl.js"; } from "./ssl.js";
import log from "loglevel"; import log from "loglevel";
import { getSeed } from "./util.js"; import { getSeed } from "../lib/util.js";
import { getRouter, resetRouter, setRouter } from "./app.js"; import { getRouter, resetRouter, setRouter } from "./app.js";
import { import {
createIndependentFileSmall, createIndependentFileSmall,
openIndependentFileSmall, openIndependentFileSmall,
overwriteIndependentFileSmall, overwriteIndependentFileSmall,
} from "./file"; } from "../lib/file";
import { setDnsProvider } from "./dns"; import { setDnsProvider } from "./dns";
let pluginApi: PluginApiManager; let pluginApi: PluginApiManager;

View File

@ -5,7 +5,7 @@ import { relay } from "@hyperswarm/dht-relay";
// @ts-ignore // @ts-ignore
import Stream from "@hyperswarm/dht-relay/ws"; import Stream from "@hyperswarm/dht-relay/ws";
import express, { Express } from "express"; import express, { Express } from "express";
import config from "./config.js"; import config from "../config.js";
import * as http from "http"; import * as http from "http";
import * as https from "https"; import * as https from "https";
import { get as getDHT } from "./dht.js"; import { get as getDHT } from "./dht.js";

View File

@ -1,11 +1,11 @@
//const require = createRequire(import.meta.url); //const require = createRequire(import.meta.url);
//import { createRequire } from "module"; //import { createRequire } from "module";
import config from "./config.js"; import config from "../config.js";
import { errorExit } from "./error.js"; import { errorExit } from "../lib/error.js";
// @ts-ignore // @ts-ignore
import stringify from "json-stable-stringify"; import stringify from "json-stable-stringify";
import { getRpcServer } from "./rpc/server.js"; import { getRpcServer } from "../rpc/server.js";
export async function start() { export async function start() {
if (!config.str("pocket-app-id") || !config.str("pocket-app-key")) { if (!config.str("pocket-app-id") || !config.str("pocket-app-key")) {

View File

@ -3,12 +3,12 @@ import {
createIndependentFileSmall, createIndependentFileSmall,
openIndependentFileSmall, openIndependentFileSmall,
overwriteIndependentFileSmall, overwriteIndependentFileSmall,
} from "./file.js"; } from "../lib/file.js";
// @ts-ignore // @ts-ignore
import promiseRetry from "promise-retry"; import promiseRetry from "promise-retry";
import config from "./config.js"; import config from "../config.js";
import log from "loglevel"; import log from "loglevel";
import { getSeed } from "./util.js"; import { getSeed } from "../lib/util.js";
import type { import type {
IndependentFileSmall, IndependentFileSmall,
SavedSslData, SavedSslData,

View File

@ -5,7 +5,7 @@ import {
RPCStreamHandler, RPCStreamHandler,
} from "@lumeweb/relay-types"; } from "@lumeweb/relay-types";
import NodeCache from "node-cache"; import NodeCache from "node-cache";
import { get as getDHT } from "../dht.js"; import { get as getDHT } from "../modules/dht.js";
import { Mutex } from "async-mutex"; import { Mutex } from "async-mutex";
import crypto from "crypto"; import crypto from "crypto";