Simplify node imports

a0e6030836d18bd17c66d302cbb0af43c453988c

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

38 files changed, +83 -84Showing whitespace changes
plugins.js+2 -2
@@ -3,8 +3,8 @@
33// 1. node plugins.js update
44// 2. node plugins.js install <plugin-git-url>
55// More operations coming soon.
66import * as fs from 'node:fs';
77import * as path from 'node:path';
88import { fileURLToPath } from 'node:url';
99
1010import { default as git } from 'simple-git';
post-install.js+4 -4
@@ -1,10 +1,10 @@
11/**
22 * Scripts to be done before starting the server for the first time.
33 */
44import * as fs from 'node:fs';
55import * as path from 'node:path';
66import * as crypto from 'node:crypto';
77import * as yaml from 'yaml';
88import _ from 'lodash';
99import { createRequire } from 'node:module';
1010
recover.js+1 -1
@@ -1,4 +1,4 @@
11import * as fs from 'node:fs';
22import yaml from 'yaml';
33import storage from 'node-persist';
44import * as users from './src/users.js';
server.js+7 -8
@@ -1,13 +1,13 @@
11#!/usr/bin/env node
22
33// native node modules
44import * as fs from 'node:fs';
55import * as http from 'node:http';
66import * as https from 'node:https';
77import * as path from 'node:path';
88import * as util from 'node:util';
99import * as net from 'node:net';
1010import * as dns from 'node:dns';
1111import { fileURLToPath } from 'node:url';
1212
1313// cli/fs related library imports
@@ -440,7 +440,6 @@ app.use(multerMonkeyPatch);
440440// User data mount
441441app.use('/', userModule.router);
442442// Private endpoints
443-
444443app.use('/api/users', usersPrivateRouter);
445444// Admin endpoints
446445app.use('/api/users', usersAdminRouter);
src/endpoints/assets.js+2 -2
@@ -1,5 +1,5 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33import { finished } from 'node:stream/promises';
44
55import mime from 'mime-types';
src/endpoints/avatars.js+2 -2
@@ -1,5 +1,5 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/endpoints/backends/kobold.js+1 -1
@@ -1,4 +1,4 @@
11import * as fs from 'node:fs';
22import express from 'express';
33import fetch from 'node-fetch';
44
src/endpoints/backgrounds.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/endpoints/characters.js+3 -3
@@ -1,7 +1,7 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33import { promises as fsPromises } from 'node:fs';
44import * as readline from 'node:readline';
55import { Buffer } from 'node:buffer';
66
77import express from 'express';
src/endpoints/chats.js+3 -3
@@ -1,6 +1,6 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33import * as readline from 'node:readline';
44
55import express from 'express';
66import sanitize from 'sanitize-filename';
src/endpoints/content-manager.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33import { Buffer } from 'node:buffer';
44
55import express from 'express';
src/endpoints/extensions.js+2 -2
@@ -1,5 +1,5 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/endpoints/files.js+2 -2
@@ -1,5 +1,5 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/endpoints/groups.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/endpoints/images.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33import { Buffer } from 'node:buffer';
44
55import express from 'express';
src/endpoints/moving-ui.js+1 -1
@@ -1,4 +1,4 @@
11import * as path from 'node:path';
22import express from 'express';
33import sanitize from 'sanitize-filename';
44import { sync as writeFileAtomicSync } from 'write-file-atomic';
src/endpoints/novelai.js+1 -1
@@ -1,4 +1,4 @@
11import * as util from 'node:util';
22import { Buffer } from 'node:buffer';
33
44import fetch from 'node-fetch';
src/endpoints/openai.js+1 -1
@@ -1,4 +1,4 @@
11import * as fs from 'node:fs';
22import { Buffer } from 'node:buffer';
33
44import fetch from 'node-fetch';
src/endpoints/presets.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/endpoints/quick-replies.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/endpoints/secrets.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import { sync as writeFileAtomicSync } from 'write-file-atomic';
src/endpoints/settings.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import _ from 'lodash';
src/endpoints/sprites.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import mime from 'mime-types';
src/endpoints/stable-diffusion.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import fetch from 'node-fetch';
src/endpoints/stats.js+3 -3
@@ -1,6 +1,6 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33import * as crypto from 'node:crypto';
44
55import express from 'express';
66import writeFileAtomic from 'write-file-atomic';
src/endpoints/themes.js+2 -2
@@ -1,5 +1,5 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/endpoints/thumbnails.js+3 -3
@@ -1,6 +1,6 @@
11import * as fs from 'node:fs';
22import *{ promises as fsPromises } from 'node:fs/promises';
33import * as path from 'node:path';
44
55import mime from 'mime-types';
66import express from 'express';
src/endpoints/tokenizers.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33import { Buffer } from 'node:buffer';
44
55import express from 'express';
src/endpoints/translate.js+1 -1
@@ -1,4 +1,4 @@
11import * as https from 'node:https';
22import { createRequire } from 'node:module';
33import { Buffer } from 'node:buffer';
44
src/endpoints/users-private.js+2 -2
@@ -1,6 +1,6 @@
11import * as path from 'node:path';
22import { promises as fsPromises } from 'node:fs';
33import * as crypto from 'node:crypto';
44
55import storage from 'node-persist';
66import express from 'express';
src/endpoints/users-public.js+1 -1
@@ -1,4 +1,4 @@
11import * as crypto from 'node:crypto';
22
33import storage from 'node-persist';
44import express from 'express';
src/endpoints/vectors.js+2 -2
@@ -1,5 +1,5 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33
44import vectra from 'vectra';
55import express from 'express';
src/endpoints/worldinfo.js+2 -2
@@ -1,5 +1,5 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33
44import express from 'express';
55import sanitize from 'sanitize-filename';
src/middleware/whitelist.js+2 -2
@@ -1,5 +1,5 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33import ipMatching from 'ip-matching';
44
55import { getIpFromRequest } from '../express-common.js';
src/plugin-loader.js+3 -3
@@ -1,6 +1,6 @@
11import * as fs from 'node:fs';
22import * as path from 'node:path';
33import * as url from 'node:url';
44
55import express from 'express';
66import { getConfigValue } from './util.js';
src/prompt-converters.js+1 -1
@@ -1,4 +1,4 @@
11import * as crypto from 'node:crypto';
22import polyfill from './polyfill.js';
33import { getConfigValue } from './util.js';
44
src/users.js+4 -4
@@ -1,8 +1,8 @@
11// Native Node Modules
22import * as path from 'node:path';
33import * as fs from 'node:fs';
44import * as crypto from 'node:crypto';
55import * as os from 'node:os';
66import { Buffer } from 'node:buffer';
77
88// Express and other dependencies
src/util.js+3 -3
@@ -1,6 +1,6 @@
11import * as path from 'node:path';
22import * as fs from 'node:fs';
33import * as http2 from 'node:http2';
44import { Readable } from 'node:stream';
55import { createRequire } from 'node:module';
66import { Buffer } from 'node:buffer';