Simplify node imports
| @@ -3,8 +3,8 @@ | |||
| 3 | // 1. node plugins.js update | 3 | // 1. node plugins.js update |
| 4 | // 2. node plugins.js install <plugin-git-url> | 4 | // 2. node plugins.js install <plugin-git-url> |
| 5 | // More operations coming soon. | 5 | // More operations coming soon. |
| 6 | import * as fs from 'node:fs'; | 6 | import fs from 'node:fs'; |
| 7 | import * as path from 'node:path'; | 7 | import path from 'node:path'; |
| 8 | import { fileURLToPath } from 'node:url'; | 8 | import { fileURLToPath } from 'node:url'; |
| 9 | 9 | ||
| 10 | import { default as git } from 'simple-git'; | 10 | import { default as git } from 'simple-git'; |
| @@ -1,10 +1,10 @@ | |||
| 1 | /** | 1 | /** |
| 2 | * Scripts to be done before starting the server for the first time. | 2 | * Scripts to be done before starting the server for the first time. |
| 3 | */ | 3 | */ |
| 4 | import * as fs from 'node:fs'; | 4 | import fs from 'node:fs'; |
| 5 | import * as path from 'node:path'; | 5 | import path from 'node:path'; |
| 6 | import * as crypto from 'node:crypto'; | 6 | import crypto from 'node:crypto'; |
| 7 | import * as yaml from 'yaml'; | 7 | import yaml from 'yaml'; |
| 8 | import _ from 'lodash'; | 8 | import _ from 'lodash'; |
| 9 | import { createRequire } from 'node:module'; | 9 | import { createRequire } from 'node:module'; |
| 10 | 10 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import yaml from 'yaml'; | 2 | import yaml from 'yaml'; |
| 3 | import storage from 'node-persist'; | 3 | import storage from 'node-persist'; |
| 4 | import * as users from './src/users.js'; | 4 | import * as users from './src/users.js'; |
| @@ -1,13 +1,13 @@ | |||
| 1 | #!/usr/bin/env node | 1 | #!/usr/bin/env node |
| 2 | 2 | ||
| 3 | // native node modules | 3 | // native node modules |
| 4 | import * as fs from 'node:fs'; | 4 | import fs from 'node:fs'; |
| 5 | import * as http from 'node:http'; | 5 | import http from 'node:http'; |
| 6 | import * as https from 'node:https'; | 6 | import https from 'node:https'; |
| 7 | import * as path from 'node:path'; | 7 | import path from 'node:path'; |
| 8 | import * as util from 'node:util'; | 8 | import util from 'node:util'; |
| 9 | import * as net from 'node:net'; | 9 | import net from 'node:net'; |
| 10 | import * as dns from 'node:dns'; | 10 | import dns from 'node:dns'; |
| 11 | import { fileURLToPath } from 'node:url'; | 11 | import { fileURLToPath } from 'node:url'; |
| 12 | 12 | ||
| 13 | // cli/fs related library imports | 13 | // cli/fs related library imports |
| @@ -440,7 +440,6 @@ app.use(multerMonkeyPatch); | |||
| 440 | // User data mount | 440 | // User data mount |
| 441 | app.use('/', userModule.router); | 441 | app.use('/', userModule.router); |
| 442 | // Private endpoints | 442 | // Private endpoints |
| 443 | |||
| 444 | app.use('/api/users', usersPrivateRouter); | 443 | app.use('/api/users', usersPrivateRouter); |
| 445 | // Admin endpoints | 444 | // Admin endpoints |
| 446 | app.use('/api/users', usersAdminRouter); | 445 | app.use('/api/users', usersAdminRouter); |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | import { finished } from 'node:stream/promises'; | 3 | import { finished } from 'node:stream/promises'; |
| 4 | 4 | ||
| 5 | import mime from 'mime-types'; | 5 | import mime from 'mime-types'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import express from 'express'; | 2 | import express from 'express'; |
| 3 | import fetch from 'node-fetch'; | 3 | import fetch from 'node-fetch'; |
| 4 | 4 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,7 +1,7 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | import { promises as fsPromises } from 'node:fs'; | 3 | import { promises as fsPromises } from 'node:fs'; |
| 4 | import * as readline from 'node:readline'; | 4 | import readline from 'node:readline'; |
| 5 | import { Buffer } from 'node:buffer'; | 5 | import { Buffer } from 'node:buffer'; |
| 6 | 6 | ||
| 7 | import express from 'express'; | 7 | import express from 'express'; |
| @@ -1,6 +1,6 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | import * as readline from 'node:readline'; | 3 | import readline from 'node:readline'; |
| 4 | 4 | ||
| 5 | import express from 'express'; | 5 | import express from 'express'; |
| 6 | import sanitize from 'sanitize-filename'; | 6 | import sanitize from 'sanitize-filename'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | import { Buffer } from 'node:buffer'; | 3 | import { Buffer } from 'node:buffer'; |
| 4 | 4 | ||
| 5 | import express from 'express'; | 5 | import express from 'express'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | import { Buffer } from 'node:buffer'; | 3 | import { Buffer } from 'node:buffer'; |
| 4 | 4 | ||
| 5 | import express from 'express'; | 5 | import express from 'express'; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import express from 'express'; | 2 | import express from 'express'; |
| 3 | import sanitize from 'sanitize-filename'; | 3 | import sanitize from 'sanitize-filename'; |
| 4 | import { sync as writeFileAtomicSync } from 'write-file-atomic'; | 4 | import { sync as writeFileAtomicSync } from 'write-file-atomic'; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import * as util from 'node:util'; | 1 | import util from 'node:util'; |
| 2 | import { Buffer } from 'node:buffer'; | 2 | import { Buffer } from 'node:buffer'; |
| 3 | 3 | ||
| 4 | import fetch from 'node-fetch'; | 4 | import fetch from 'node-fetch'; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import { Buffer } from 'node:buffer'; | 2 | import { Buffer } from 'node:buffer'; |
| 3 | 3 | ||
| 4 | import fetch from 'node-fetch'; | 4 | import fetch from 'node-fetch'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import { sync as writeFileAtomicSync } from 'write-file-atomic'; | 5 | import { sync as writeFileAtomicSync } from 'write-file-atomic'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import _ from 'lodash'; | 5 | import _ from 'lodash'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import mime from 'mime-types'; | 5 | import mime from 'mime-types'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import fetch from 'node-fetch'; | 5 | import fetch from 'node-fetch'; |
| @@ -1,6 +1,6 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | import * as crypto from 'node:crypto'; | 3 | import crypto from 'node:crypto'; |
| 4 | 4 | ||
| 5 | import express from 'express'; | 5 | import express from 'express'; |
| 6 | import writeFileAtomic from 'write-file-atomic'; | 6 | import writeFileAtomic from 'write-file-atomic'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,6 +1,6 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as fsPromises from 'node:fs/promises'; | 2 | import { promises as fsPromises } from 'node:fs'; |
| 3 | import * as path from 'node:path'; | 3 | import path from 'node:path'; |
| 4 | 4 | ||
| 5 | import mime from 'mime-types'; | 5 | import mime from 'mime-types'; |
| 6 | import express from 'express'; | 6 | import express from 'express'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | import { Buffer } from 'node:buffer'; | 3 | import { Buffer } from 'node:buffer'; |
| 4 | 4 | ||
| 5 | import express from 'express'; | 5 | import express from 'express'; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import * as https from 'node:https'; | 1 | import https from 'node:https'; |
| 2 | import { createRequire } from 'node:module'; | 2 | import { createRequire } from 'node:module'; |
| 3 | import { Buffer } from 'node:buffer'; | 3 | import { Buffer } from 'node:buffer'; |
| 4 | 4 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import { promises as fsPromises } from 'node:fs'; | 2 | import { promises as fsPromises } from 'node:fs'; |
| 3 | import * as crypto from 'node:crypto'; | 3 | import crypto from 'node:crypto'; |
| 4 | 4 | ||
| 5 | import storage from 'node-persist'; | 5 | import storage from 'node-persist'; |
| 6 | import express from 'express'; | 6 | import express from 'express'; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import * as crypto from 'node:crypto'; | 1 | import crypto from 'node:crypto'; |
| 2 | 2 | ||
| 3 | import storage from 'node-persist'; | 3 | import storage from 'node-persist'; |
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | 3 | ||
| 4 | import vectra from 'vectra'; | 4 | import vectra from 'vectra'; |
| 5 | import express from 'express'; | 5 | import express from 'express'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | 3 | ||
| 4 | import express from 'express'; | 4 | import express from 'express'; |
| 5 | import sanitize from 'sanitize-filename'; | 5 | import sanitize from 'sanitize-filename'; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | import ipMatching from 'ip-matching'; | 3 | import ipMatching from 'ip-matching'; |
| 4 | 4 | ||
| 5 | import { getIpFromRequest } from '../express-common.js'; | 5 | import { getIpFromRequest } from '../express-common.js'; |
| @@ -1,6 +1,6 @@ | |||
| 1 | import * as fs from 'node:fs'; | 1 | import fs from 'node:fs'; |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | import * as url from 'node:url'; | 3 | import url from 'node:url'; |
| 4 | 4 | ||
| 5 | import express from 'express'; | 5 | import express from 'express'; |
| 6 | import { getConfigValue } from './util.js'; | 6 | import { getConfigValue } from './util.js'; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import * as crypto from 'node:crypto'; | 1 | import crypto from 'node:crypto'; |
| 2 | import polyfill from './polyfill.js'; | 2 | import polyfill from './polyfill.js'; |
| 3 | import { getConfigValue } from './util.js'; | 3 | import { getConfigValue } from './util.js'; |
| 4 | 4 | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | // Native Node Modules | 1 | // Native Node Modules |
| 2 | import * as path from 'node:path'; | 2 | import path from 'node:path'; |
| 3 | import * as fs from 'node:fs'; | 3 | import fs from 'node:fs'; |
| 4 | import * as crypto from 'node:crypto'; | 4 | import crypto from 'node:crypto'; |
| 5 | import * as os from 'node:os'; | 5 | import os from 'node:os'; |
| 6 | import { Buffer } from 'node:buffer'; | 6 | import { Buffer } from 'node:buffer'; |
| 7 | 7 | ||
| 8 | // Express and other dependencies | 8 | // Express and other dependencies |
| @@ -1,6 +1,6 @@ | |||
| 1 | import * as path from 'node:path'; | 1 | import path from 'node:path'; |
| 2 | import * as fs from 'node:fs'; | 2 | import fs from 'node:fs'; |
| 3 | import * as http2 from 'node:http2'; | 3 | import http2 from 'node:http2'; |
| 4 | import { Readable } from 'node:stream'; | 4 | import { Readable } from 'node:stream'; |
| 5 | import { createRequire } from 'node:module'; | 5 | import { createRequire } from 'node:module'; |
| 6 | import { Buffer } from 'node:buffer'; | 6 | import { Buffer } from 'node:buffer'; |