Simplify node imports

a0e6030836d18bd17c66d302cbb0af43c453988c

Cohee <18619528+Cohee1207@users.noreply.github.com>

38 files changed, +83 -84Ignore whitespace
plugins.js+2 -2
@@ -3,8 +3,8 @@
3// 1. node plugins.js update3// 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.
6import * as fs from 'node:fs';6import fs from 'node:fs';
7import * as path from 'node:path';7import path from 'node:path';
8import { fileURLToPath } from 'node:url';8import { fileURLToPath } from 'node:url';
99
10import { default as git } from 'simple-git';10import { default as git } from 'simple-git';
post-install.js+4 -4
@@ -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 */
4import * as fs from 'node:fs';4import fs from 'node:fs';
5import * as path from 'node:path';5import path from 'node:path';
6import * as crypto from 'node:crypto';6import crypto from 'node:crypto';
7import * as yaml from 'yaml';7import yaml from 'yaml';
8import _ from 'lodash';8import _ from 'lodash';
9import { createRequire } from 'node:module';9import { createRequire } from 'node:module';
1010
recover.js+1 -1
@@ -1,4 +1,4 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import yaml from 'yaml';2import yaml from 'yaml';
3import storage from 'node-persist';3import storage from 'node-persist';
4import * as users from './src/users.js';4import * as users from './src/users.js';
server.js+7 -8
@@ -1,13 +1,13 @@
1#!/usr/bin/env node1#!/usr/bin/env node
22
3// native node modules3// native node modules
4import * as fs from 'node:fs';4import fs from 'node:fs';
5import * as http from 'node:http';5import http from 'node:http';
6import * as https from 'node:https';6import https from 'node:https';
7import * as path from 'node:path';7import path from 'node:path';
8import * as util from 'node:util';8import util from 'node:util';
9import * as net from 'node:net';9import net from 'node:net';
10import * as dns from 'node:dns';10import dns from 'node:dns';
11import { fileURLToPath } from 'node:url';11import { fileURLToPath } from 'node:url';
1212
13// cli/fs related library imports13// cli/fs related library imports
@@ -440,7 +440,6 @@ app.use(multerMonkeyPatch);
440// User data mount440// User data mount
441app.use('/', userModule.router);441app.use('/', userModule.router);
442// Private endpoints442// Private endpoints
443
444app.use('/api/users', usersPrivateRouter);443app.use('/api/users', usersPrivateRouter);
445// Admin endpoints444// Admin endpoints
446app.use('/api/users', usersAdminRouter);445app.use('/api/users', usersAdminRouter);
src/endpoints/assets.js+2 -2
@@ -1,5 +1,5 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
3import { finished } from 'node:stream/promises';3import { finished } from 'node:stream/promises';
44
5import mime from 'mime-types';5import mime from 'mime-types';
src/endpoints/avatars.js+2 -2
@@ -1,5 +1,5 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/endpoints/backends/kobold.js+1 -1
@@ -1,4 +1,4 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import express from 'express';2import express from 'express';
3import fetch from 'node-fetch';3import fetch from 'node-fetch';
44
src/endpoints/backgrounds.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/endpoints/characters.js+3 -3
@@ -1,7 +1,7 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
3import { promises as fsPromises } from 'node:fs';3import { promises as fsPromises } from 'node:fs';
4import * as readline from 'node:readline';4import readline from 'node:readline';
5import { Buffer } from 'node:buffer';5import { Buffer } from 'node:buffer';
66
7import express from 'express';7import express from 'express';
src/endpoints/chats.js+3 -3
@@ -1,6 +1,6 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
3import * as readline from 'node:readline';3import readline from 'node:readline';
44
5import express from 'express';5import express from 'express';
6import sanitize from 'sanitize-filename';6import sanitize from 'sanitize-filename';
src/endpoints/content-manager.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
3import { Buffer } from 'node:buffer';3import { Buffer } from 'node:buffer';
44
5import express from 'express';5import express from 'express';
src/endpoints/extensions.js+2 -2
@@ -1,5 +1,5 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/endpoints/files.js+2 -2
@@ -1,5 +1,5 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/endpoints/groups.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/endpoints/images.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
3import { Buffer } from 'node:buffer';3import { Buffer } from 'node:buffer';
44
5import express from 'express';5import express from 'express';
src/endpoints/moving-ui.js+1 -1
@@ -1,4 +1,4 @@
1import * as path from 'node:path';1import path from 'node:path';
2import express from 'express';2import express from 'express';
3import sanitize from 'sanitize-filename';3import sanitize from 'sanitize-filename';
4import { sync as writeFileAtomicSync } from 'write-file-atomic';4import { sync as writeFileAtomicSync } from 'write-file-atomic';
src/endpoints/novelai.js+1 -1
@@ -1,4 +1,4 @@
1import * as util from 'node:util';1import util from 'node:util';
2import { Buffer } from 'node:buffer';2import { Buffer } from 'node:buffer';
33
4import fetch from 'node-fetch';4import fetch from 'node-fetch';
src/endpoints/openai.js+1 -1
@@ -1,4 +1,4 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import { Buffer } from 'node:buffer';2import { Buffer } from 'node:buffer';
33
4import fetch from 'node-fetch';4import fetch from 'node-fetch';
src/endpoints/presets.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/endpoints/quick-replies.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/endpoints/secrets.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import { sync as writeFileAtomicSync } from 'write-file-atomic';5import { sync as writeFileAtomicSync } from 'write-file-atomic';
src/endpoints/settings.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import _ from 'lodash';5import _ from 'lodash';
src/endpoints/sprites.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import mime from 'mime-types';5import mime from 'mime-types';
src/endpoints/stable-diffusion.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import fetch from 'node-fetch';5import fetch from 'node-fetch';
src/endpoints/stats.js+3 -3
@@ -1,6 +1,6 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
3import * as crypto from 'node:crypto';3import crypto from 'node:crypto';
44
5import express from 'express';5import express from 'express';
6import writeFileAtomic from 'write-file-atomic';6import writeFileAtomic from 'write-file-atomic';
src/endpoints/themes.js+2 -2
@@ -1,5 +1,5 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/endpoints/thumbnails.js+3 -3
@@ -1,6 +1,6 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as fsPromises from 'node:fs/promises';2import { promises as fsPromises } from 'node:fs';
3import * as path from 'node:path';3import path from 'node:path';
44
5import mime from 'mime-types';5import mime from 'mime-types';
6import express from 'express';6import express from 'express';
src/endpoints/tokenizers.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
3import { Buffer } from 'node:buffer';3import { Buffer } from 'node:buffer';
44
5import express from 'express';5import express from 'express';
src/endpoints/translate.js+1 -1
@@ -1,4 +1,4 @@
1import * as https from 'node:https';1import https from 'node:https';
2import { createRequire } from 'node:module';2import { createRequire } from 'node:module';
3import { Buffer } from 'node:buffer';3import { Buffer } from 'node:buffer';
44
src/endpoints/users-private.js+2 -2
@@ -1,6 +1,6 @@
1import * as path from 'node:path';1import path from 'node:path';
2import { promises as fsPromises } from 'node:fs';2import { promises as fsPromises } from 'node:fs';
3import * as crypto from 'node:crypto';3import crypto from 'node:crypto';
44
5import storage from 'node-persist';5import storage from 'node-persist';
6import express from 'express';6import express from 'express';
src/endpoints/users-public.js+1 -1
@@ -1,4 +1,4 @@
1import * as crypto from 'node:crypto';1import crypto from 'node:crypto';
22
3import storage from 'node-persist';3import storage from 'node-persist';
4import express from 'express';4import express from 'express';
src/endpoints/vectors.js+2 -2
@@ -1,5 +1,5 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
33
4import vectra from 'vectra';4import vectra from 'vectra';
5import express from 'express';5import express from 'express';
src/endpoints/worldinfo.js+2 -2
@@ -1,5 +1,5 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
33
4import express from 'express';4import express from 'express';
5import sanitize from 'sanitize-filename';5import sanitize from 'sanitize-filename';
src/middleware/whitelist.js+2 -2
@@ -1,5 +1,5 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
3import ipMatching from 'ip-matching';3import ipMatching from 'ip-matching';
44
5import { getIpFromRequest } from '../express-common.js';5import { getIpFromRequest } from '../express-common.js';
src/plugin-loader.js+3 -3
@@ -1,6 +1,6 @@
1import * as fs from 'node:fs';1import fs from 'node:fs';
2import * as path from 'node:path';2import path from 'node:path';
3import * as url from 'node:url';3import url from 'node:url';
44
5import express from 'express';5import express from 'express';
6import { getConfigValue } from './util.js';6import { getConfigValue } from './util.js';
src/prompt-converters.js+1 -1
@@ -1,4 +1,4 @@
1import * as crypto from 'node:crypto';1import crypto from 'node:crypto';
2import polyfill from './polyfill.js';2import polyfill from './polyfill.js';
3import { getConfigValue } from './util.js';3import { getConfigValue } from './util.js';
44
src/users.js+4 -4
@@ -1,8 +1,8 @@
1// Native Node Modules1// Native Node Modules
2import * as path from 'node:path';2import path from 'node:path';
3import * as fs from 'node:fs';3import fs from 'node:fs';
4import * as crypto from 'node:crypto';4import crypto from 'node:crypto';
5import * as os from 'node:os';5import os from 'node:os';
6import { Buffer } from 'node:buffer';6import { Buffer } from 'node:buffer';
77
8// Express and other dependencies8// Express and other dependencies
src/util.js+3 -3
@@ -1,6 +1,6 @@
1import * as path from 'node:path';1import path from 'node:path';
2import * as fs from 'node:fs';2import fs from 'node:fs';
3import * as http2 from 'node:http2';3import http2 from 'node:http2';
4import { Readable } from 'node:stream';4import { Readable } from 'node:stream';
5import { createRequire } from 'node:module';5import { createRequire } from 'node:module';
6import { Buffer } from 'node:buffer';6import { Buffer } from 'node:buffer';