@lzwme/sserver 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.decodeUploadName = decodeUploadName;
7
+ exports.repairLocalsendNames = repairLocalsendNames;
8
+ exports.initLocalsend = initLocalsend;
9
+ /*
10
+ * LocalSend 局域网文件传输服务端模块
11
+ * 路由:
12
+ * - GET /localsend 页面
13
+ * - GET /localsend/api/list 文件列表(支持 ?sort=time|size&order=asc|desc)
14
+ * - POST /localsend/api/upload 多文件上传(multipart,字段名 files)
15
+ * - GET /localsend/api/download/:name 下载(attachment)
16
+ * - GET /localsend/api/preview/:name 预览(inline)
17
+ * - DELETE /localsend/api/delete/:name 删除
18
+ */
19
+ const node_fs_1 = require("node:fs");
20
+ const node_path_1 = require("node:path");
21
+ const console_log_colors_1 = require("console-log-colors");
22
+ const multer_1 = __importDefault(require("multer"));
23
+ const config_1 = require("./config");
24
+ const get_logger_1 = require("./get-logger");
25
+ const utils_1 = require("./lib/utils");
26
+ /**
27
+ * 前端页面单文件路径(相对本模块)。
28
+ * 构建后页面位于 dist/localsend/index.html;dev(ts-node)运行时位于 src/localsend/index.html。
29
+ */
30
+ const PAGE_REL_PATH = './localsend/index.html';
31
+ /** 去除文件名中的路径分隔符,防止目录穿越。非法返回空串 */
32
+ function safeName(name) {
33
+ const n = (0, node_path_1.basename)(String(name || '').trim());
34
+ if (!n || n === '.' || n === '..' || n.includes('/') || n.includes('\\'))
35
+ return '';
36
+ return n;
37
+ }
38
+ /** 严格解码字节,编码不匹配时返回 null */
39
+ function decodeStrict(bytes, encoding) {
40
+ try {
41
+ return new TextDecoder(encoding, { fatal: true }).decode(bytes);
42
+ }
43
+ catch {
44
+ return null;
45
+ }
46
+ }
47
+ /**
48
+ * 修复 multipart 上传的文件名乱码。
49
+ *
50
+ * 浏览器(WHATWG 规范)会把文件名的 UTF-8 原始字节直接写进 Content-Disposition 的 filename 参数,
51
+ * 而 busboy 默认按 latin1(defParamCharset='latin1')解码该参数,中文文件名就会变成乱码
52
+ * (如 `中文.txt` → `中文.txt`)。
53
+ *
54
+ * 这里保留原始字节(latin1 与字节一一对应,可无损还原),再按 utf-8 / gb18030 依次尝试严格解码:
55
+ * - UTF-8 是浏览器的标准行为;
56
+ * - gb18030 兼容部分国产客户端 / 老程序用 GBK 发送文件名的情况。
57
+ */
58
+ function decodeUploadName(raw) {
59
+ const name = String(raw || '');
60
+ if (!name)
61
+ return '';
62
+ // 含有 latin1 之外的字符,说明文件名已被正确解码过(如 RFC2231 的 filename*),直接使用
63
+ if ([...name].some((c) => c.charCodeAt(0) > 255))
64
+ return name;
65
+ const bytes = Buffer.from(name, 'latin1');
66
+ for (const encoding of ['utf-8', 'gb18030']) {
67
+ const decoded = decodeStrict(bytes, encoding);
68
+ if (decoded !== null && decoded !== name)
69
+ return decoded;
70
+ }
71
+ return name;
72
+ }
73
+ /**
74
+ * 修复历史上已上传的乱码文件名(把 UTF-8 字节误存成 latin1 字符导致的乱码)。
75
+ * 返回被重命名的 [旧名, 新名] 列表。
76
+ */
77
+ function repairLocalsendNames(dir) {
78
+ const renamed = [];
79
+ if (!(0, node_fs_1.existsSync)(dir))
80
+ return renamed;
81
+ for (const name of (0, node_fs_1.readdirSync)(dir)) {
82
+ const full = (0, node_path_1.join)(dir, name);
83
+ if (!(0, node_fs_1.statSync)(full).isFile())
84
+ continue;
85
+ if ([...name].some((c) => c.charCodeAt(0) > 255))
86
+ continue; // 已是正常文件名
87
+ const decoded = decodeStrict(Buffer.from(name, 'latin1'), 'utf-8');
88
+ if (decoded === null || decoded === name)
89
+ continue; // 非乱码
90
+ // 目标名已存在时按 _1/_2 追加后缀,避免覆盖同名文件
91
+ const target = uniqueName(dir, decoded);
92
+ try {
93
+ (0, node_fs_1.renameSync)(full, (0, node_path_1.join)(dir, target));
94
+ renamed.push([name, target]);
95
+ }
96
+ catch (err) {
97
+ get_logger_1.logger.error('[localsend 修复文件名]', err);
98
+ }
99
+ }
100
+ return renamed;
101
+ }
102
+ /** 同名文件自动追加 _1/_2 后缀 */
103
+ function uniqueName(targetDir, name) {
104
+ const ext = (0, node_path_1.extname)(name);
105
+ const base = name.slice(0, name.length - ext.length);
106
+ let finalName = name;
107
+ let i = 1;
108
+ while ((0, node_fs_1.existsSync)((0, node_path_1.join)(targetDir, finalName))) {
109
+ finalName = `${base}_${i}${ext}`;
110
+ i += 1;
111
+ }
112
+ return finalName;
113
+ }
114
+ async function initLocalsend(app) {
115
+ const config = await (0, config_1.getConfig)();
116
+ const raw = config.localsend;
117
+ if (!raw)
118
+ return;
119
+ const ls = typeof raw === 'boolean' ? { enabled: raw } : raw;
120
+ if (!ls.enabled)
121
+ return;
122
+ const dir = ls.dir || '';
123
+ const maxSize = ls.maxSize || 1024 * 1024 * 1024;
124
+ if (!(0, node_fs_1.existsSync)(dir))
125
+ (0, node_fs_1.mkdirSync)(dir, { recursive: true });
126
+ const port = config.port || 80;
127
+ const ipUrl = `http://${(0, utils_1.getIp)() || 'localhost'}:${port}`;
128
+ get_logger_1.logger.log(console_log_colors_1.color.green('LocalSend : '.padStart(15, ' ')), console_log_colors_1.color.greenBright('局域网文件传输功能已开启'));
129
+ get_logger_1.logger.log(console_log_colors_1.color.green('LocalSend DIR : '.padStart(15, ' ')), console_log_colors_1.color.cyanBright(dir));
130
+ get_logger_1.logger.log(console_log_colors_1.color.green('LocalSend URL : '.padStart(15, ' ')), console_log_colors_1.color.cyanBright(`${ipUrl}/localsend`));
131
+ // 页面:初始化时读入独立 html 单文件
132
+ const pageHtml = (0, node_fs_1.readFileSync)((0, node_path_1.resolve)(__dirname, PAGE_REL_PATH), 'utf8');
133
+ app.get('/localsend', (_req, res) => {
134
+ res.type('html').send(pageHtml);
135
+ });
136
+ // 文件列表
137
+ app.get('/localsend/api/list', (req, res) => {
138
+ const sort = String(req.query.sort || 'time');
139
+ const asc = String(req.query.order || 'desc') !== 'desc';
140
+ const list = (0, node_fs_1.readdirSync)(dir)
141
+ .map((name) => {
142
+ const full = (0, node_path_1.join)(dir, name);
143
+ const stat = (0, node_fs_1.statSync)(full);
144
+ return {
145
+ name,
146
+ size: stat.size,
147
+ mtime: stat.mtimeMs,
148
+ ext: (0, node_path_1.extname)(name).slice(1),
149
+ isDir: stat.isDirectory(),
150
+ };
151
+ })
152
+ .filter((item) => !item.isDir);
153
+ list.sort((a, b) => (sort === 'size' ? (asc ? a.size - b.size : b.size - a.size) : asc ? a.mtime - b.mtime : b.mtime - a.mtime));
154
+ res.json({ code: 0, data: list });
155
+ });
156
+ // 多文件上传
157
+ const upload = (0, multer_1.default)({
158
+ dest: dir,
159
+ limits: { fileSize: maxSize, files: 200 },
160
+ // 显式声明按 latin1 读取 Content-Disposition 参数,保留文件名的原始字节,
161
+ // 再由 decodeUploadName 按 utf-8 / gb18030 解码,避免中文文件名乱码
162
+ defParamCharset: 'latin1',
163
+ });
164
+ app.post('/localsend/api/upload', upload.array('files'), (req, res) => {
165
+ const files = (req.files || []);
166
+ const results = [];
167
+ const errors = [];
168
+ for (const f of files) {
169
+ try {
170
+ const name = uniqueName(dir, safeName(decodeUploadName(f.originalname)) || `file_${Date.now()}`);
171
+ (0, node_fs_1.renameSync)(f.path, (0, node_path_1.join)(dir, name));
172
+ results.push({ name, size: f.size });
173
+ }
174
+ catch (err) {
175
+ get_logger_1.logger.error('[localsend upload]', err);
176
+ errors.push(f.originalname || '');
177
+ }
178
+ }
179
+ res.json({ code: 0, data: { results, errors } });
180
+ });
181
+ // 下载。dotfiles: 'allow' 以兼容 ~/.static-server 这类隐藏目录作为存储目录
182
+ app.get('/localsend/api/download/:name', (req, res) => {
183
+ const name = safeName(req.params.name);
184
+ if (!name)
185
+ return void res.status(400).json({ code: 1, msg: '非法的文件名' });
186
+ const filePath = (0, node_path_1.resolve)(dir, name);
187
+ if (!(0, node_fs_1.existsSync)(filePath) || !(0, node_fs_1.statSync)(filePath).isFile()) {
188
+ return void res.status(404).json({ code: 1, msg: '文件不存在' });
189
+ }
190
+ res.download(filePath, name, { dotfiles: 'allow' });
191
+ });
192
+ // 预览(inline 方式返回,浏览器可直读图片/文本等)
193
+ app.get('/localsend/api/preview/:name', (req, res) => {
194
+ const name = safeName(req.params.name);
195
+ if (!name)
196
+ return void res.status(400).json({ code: 1, msg: '非法的文件名' });
197
+ const filePath = (0, node_path_1.resolve)(dir, name);
198
+ if (!(0, node_fs_1.existsSync)(filePath) || !(0, node_fs_1.statSync)(filePath).isFile()) {
199
+ return void res.status(404).json({ code: 1, msg: '文件不存在' });
200
+ }
201
+ res.sendFile(filePath, {
202
+ dotfiles: 'allow',
203
+ headers: { 'Content-Disposition': `inline; filename*=UTF-8''${encodeURIComponent(name)}` },
204
+ });
205
+ });
206
+ // 删除
207
+ app.delete('/localsend/api/delete/:name', (req, res) => {
208
+ const name = safeName(req.params.name);
209
+ if (!name)
210
+ return void res.status(400).json({ code: 1, msg: '非法的文件名' });
211
+ const filePath = (0, node_path_1.resolve)(dir, name);
212
+ if (!(0, node_fs_1.existsSync)(filePath))
213
+ return void res.status(404).json({ code: 1, msg: '文件不存在' });
214
+ (0, node_fs_1.rmSync)(filePath);
215
+ res.json({ code: 0 });
216
+ });
217
+ }
@@ -1,2 +1,2 @@
1
- import { type Express } from 'express';
1
+ import type { Express } from 'express';
2
2
  export declare function proxyByExpress(app: Express): Promise<void>;
@@ -10,13 +10,13 @@ async function proxyByExpress(app) {
10
10
  if (!proxyConfig?.length)
11
11
  return;
12
12
  proxyConfig.forEach(({ api, config }) => {
13
- // @ts-ignore 兼容 2.0 api
13
+ // @ts-expect-error 兼容 2.0 api
14
14
  const onProxyReq = config.on?.proxyReq || config.onProxyReq;
15
15
  config.on = {
16
16
  ...(config.on || {}),
17
17
  proxyReq: (pReq, req, res, options) => {
18
18
  const now = new Date();
19
- get_logger_1.logger.log(now.toTimeString().slice(0, 8) + '.' + String(now.getMilliseconds()).padStart(3, '0'), console_log_colors_1.color.gray('[proxyReq]'), console_log_colors_1.color.cyan(req.url), '=>', console_log_colors_1.color.cyanBright(`${pReq.protocol}${pReq.host}${pReq.path}`));
19
+ get_logger_1.logger.log(`${now.toTimeString().slice(0, 8)}.${String(now.getMilliseconds()).padStart(3, '0')}`, console_log_colors_1.color.gray('[proxyReq]'), console_log_colors_1.color.cyan(req.url), '=>', console_log_colors_1.color.cyanBright(`${pReq.protocol}${pReq.host}${pReq.path}`));
20
20
  if (onProxyReq)
21
21
  onProxyReq(pReq, req, res, options);
22
22
  },
@@ -1,3 +1,3 @@
1
1
  import type { Express } from 'express';
2
- import { type SSConfig } from '../config';
2
+ import type { SSConfig } from '../config';
3
3
  export declare function phpProxy(app: Express, config: SSConfig): Promise<Express>;
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.phpProxy = phpProxy;
5
5
  const node_child_process_1 = require("node:child_process");
6
- const node_url_1 = require("node:url");
7
6
  const node_fs_1 = require("node:fs");
8
7
  const node_path_1 = require("node:path");
8
+ const node_url_1 = require("node:url");
9
9
  const fe_utils_1 = require("@lzwme/fe-utils");
10
10
  const get_logger_1 = require("../get-logger");
11
11
  async function phpProxy(app, config) {
@@ -23,7 +23,7 @@ async function findPhpFile(pathname, rootDir) {
23
23
  let filepath = (0, node_path_1.join)(rootDir, pathname);
24
24
  if (!filepath.includes(rootDir) || !(0, node_fs_1.existsSync)(filepath))
25
25
  return false;
26
- let stat = await node_fs_1.promises.stat(filepath);
26
+ const stat = await node_fs_1.promises.stat(filepath);
27
27
  if (stat.isDirectory()) {
28
28
  filepath = (0, node_path_1.join)(filepath, 'index.php');
29
29
  if (!(0, node_fs_1.existsSync)(filepath))
@@ -34,9 +34,31 @@ async function findPhpFile(pathname, rootDir) {
34
34
  function formatArgs(args) {
35
35
  return Object.entries(args).map(([key, value]) => `${key.startsWith('-') ? key : `-${key}`} ${value}`);
36
36
  }
37
+ /**
38
+ * 解析请求地址。
39
+ *
40
+ * 使用 WHATWG URL API 替代已弃用的 `url.parse()`(Node 22+ 会打印 DEP0169 弃用警告,
41
+ * 而该中间件挂在 '/' 上,每个请求都会经过一次)。
42
+ *
43
+ * 返回解码后的路径与原始查询串:
44
+ * - 路径解码后可直接用于文件系统查找(与 express 静态资源的行为一致);
45
+ * - 查询串保留原始形态(不做 '+' 转换),与 CGI 的 QUERY_STRING 语义一致。
46
+ */
47
+ function parseRequestUrl(req) {
48
+ const base = `http://${req.headers.host || 'localhost'}`;
49
+ const parsed = new node_url_1.URL(req.url, base);
50
+ let pathname = parsed.pathname;
51
+ try {
52
+ pathname = decodeURIComponent(pathname);
53
+ }
54
+ catch {
55
+ // 非法的百分号编码(如文件名中本身含有 '%')时保持原值,避免解析失败
56
+ }
57
+ return { pathname, query: parsed.search ? parsed.search.slice(1) : '' };
58
+ }
37
59
  function runPhpCgi(req, response, url, filepath, phpConfig, rootDir) {
38
60
  const pathname = url.pathname || req.url;
39
- const pathinfo = pathname.includes('.php') ? pathname.split('.php')[0] + '.php' : pathname;
61
+ const pathinfo = pathname.includes('.php') ? `${pathname.split('.php')[0]}.php` : pathname;
40
62
  if (!phpConfig)
41
63
  return;
42
64
  const env = {
@@ -73,11 +95,11 @@ function runPhpCgi(req, response, url, filepath, phpConfig, rootDir) {
73
95
  // All HTTP headers sent by the client. Headers are separated by carriage return characters (ASCII 13 - \n) and each header name is prefixed by HTTP_, transformed to upper cases, and - characters it contains are replaced by _ characters.
74
96
  ALL_HTTP: Object.entries(req.headers)
75
97
  .map(([key, value]) => `HTTP__${key.toUpperCase().replace('-', '_')}: ${value}`)
76
- .reduce((a, b) => a + b + '\n', ''),
98
+ .reduce((a, b) => `${a + b}\n`, ''),
77
99
  // All HTTP headers as sent by the client in raw form. No transformation on the header names is applied.
78
100
  ALL_RAW: Object.entries(req.headers)
79
- .map(([key, value]) => `${key}: value`)
80
- .reduce((a, b) => a + b + '\n', ''),
101
+ .map(([key, value]) => `${key}: ${value}`)
102
+ .reduce((a, b) => `${a + b}\n`, ''),
81
103
  // The web server's software identity.
82
104
  SERVER_SOFTWARE: 'NodeJS SServer',
83
105
  // The host name or the IP address of the computer running the web server as given in the requested URL.
@@ -106,13 +128,13 @@ function runPhpCgi(req, response, url, filepath, phpConfig, rootDir) {
106
128
  IS_SUBREQ: '',
107
129
  REDIRECT_STATUS: '1',
108
130
  };
109
- Object.entries(req.headers).forEach(function ([key, value]) {
110
- env['HTTP_' + key.toUpperCase().replace('-', '_')] = value;
131
+ Object.entries(req.headers).forEach(([key, value]) => {
132
+ env[`HTTP_${key.toUpperCase().replace('-', '_')}`] = value;
111
133
  });
112
134
  if (filepath.endsWith('.php')) {
113
135
  let childProc;
114
136
  const cgiArgs = formatArgs(phpConfig.args);
115
- let cgipath = phpConfig.cgiPath || getPhpCgi();
137
+ const cgipath = phpConfig.cgiPath || getPhpCgi();
116
138
  let res = '';
117
139
  let err = '';
118
140
  if (!cgipath || !(0, node_fs_1.existsSync)(cgipath))
@@ -147,10 +169,10 @@ function runPhpCgi(req, response, url, filepath, phpConfig, rootDir) {
147
169
  const m = lines[line].split(': ');
148
170
  if (m[0] === '')
149
171
  break;
150
- if (m[0] == 'Status') {
151
- response.statusCode = parseInt(m[1]);
172
+ if (m[0] === 'Status') {
173
+ response.statusCode = parseInt(m[1], 10);
152
174
  }
153
- if (m.length == 2) {
175
+ if (m.length === 2) {
154
176
  response.setHeader(m[0], m[1]);
155
177
  }
156
178
  line++;
@@ -172,7 +194,7 @@ function createPhpMiddleware(rootDir, phpConfig = {}) {
172
194
  return async function phpMiddleware(req, res, next) {
173
195
  // stop stream until child-process is opened
174
196
  req.pause();
175
- const url = (0, node_url_1.parse)(req.url);
197
+ const url = parseRequestUrl(req);
176
198
  const filepath = await findPhpFile(url.pathname || req.path, rootDir);
177
199
  if (filepath && (filepath.includes('.php') || phpConfig.onlyPhpFile === false)) {
178
200
  get_logger_1.logger.info('[php][exec]', fe_utils_1.color.green(req.path), '=>', fe_utils_1.color.yellow(filepath));
@@ -15,9 +15,9 @@ function socketProxy(config = {
15
15
  remoteHost: '127.0.0.1',
16
16
  }) {
17
17
  const server = node_net_1.default
18
- .createServer(socket => {
18
+ .createServer((socket) => {
19
19
  console_log_colors_1.log.green('proxy for address', socket.address());
20
- let to = node_net_1.default.createConnection({
20
+ const to = node_net_1.default.createConnection({
21
21
  host: config.remoteHost,
22
22
  port: config.remotePort,
23
23
  });
@@ -44,16 +44,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.initServer = initServer;
47
- const node_https_1 = require("node:https");
48
47
  const node_child_process_1 = require("node:child_process");
48
+ const node_https_1 = require("node:https");
49
+ const fe_utils_1 = require("@lzwme/fe-utils");
49
50
  const console_log_colors_1 = require("console-log-colors");
50
51
  const express_1 = __importDefault(require("express"));
51
- const fe_utils_1 = require("@lzwme/fe-utils");
52
52
  const config_1 = require("./config");
53
53
  const get_logger_1 = require("./get-logger");
54
+ const utils_js_1 = require("./lib/utils.js");
55
+ const localsend_1 = require("./localsend");
54
56
  const express_proxy_1 = require("./proxy/express-proxy");
55
57
  const php_proxy_1 = require("./proxy/php-proxy");
56
- const utils_js_1 = require("./lib/utils.js");
57
58
  async function initServer(c) {
58
59
  const app = (0, express_1.default)();
59
60
  const config = await (0, config_1.getConfig)(!c, c);
@@ -71,6 +72,10 @@ async function initServer(c) {
71
72
  }
72
73
  await (0, php_proxy_1.phpProxy)(app, config);
73
74
  await (0, express_proxy_1.proxyByExpress)(app);
75
+ // localsend 局域网文件传输
76
+ if (config.localsend) {
77
+ await (0, localsend_1.initLocalsend)(app);
78
+ }
74
79
  // @see https://www.expressjs.com.cn/4x/api.html#express.static
75
80
  app.use(express_1.default.static(rootDir, {
76
81
  extensions: ['html', 'htm'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lzwme/sserver",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "一个基于 Node.js 的简易静态服务器,用于辅助开发调试随启随用",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -34,34 +34,38 @@
34
34
  "ss.config.sample.js"
35
35
  ],
36
36
  "scripts": {
37
- "prepare": "husky install",
38
37
  "ss": "node bin/sserver.js",
39
38
  "start": "npm run stop && pm2 start dist/index.js --name sserver",
40
39
  "stop": "pm2 stop sserver",
41
40
  "watch": "tsc -w",
41
+ "lint": "biome check",
42
+ "fix": "biome check --fix",
42
43
  "dev": "ts-node -T src/cli.ts",
43
- "build": "npm run clean && tsc",
44
+ "build": "npm run clean && tsc && node scripts/copy-assets.js",
44
45
  "clean": "flh rm -f dist",
45
46
  "version": "standard-version",
46
47
  "release": "npm run build"
47
48
  },
48
49
  "dependencies": {
49
50
  "@lzwme/fe-utils": "^1.9.2",
50
- "commander": "^14.0.2",
51
+ "commander": "^15.1.0",
51
52
  "console-log-colors": "^0.5.0",
52
- "express": "^5.1.0",
53
- "http-proxy-middleware": "^3.0.5",
54
- "node-forge": "^1.3.1",
55
- "serve-index": "^1.9.1"
53
+ "express": "^5.3.0",
54
+ "http-proxy-middleware": "^4.2.2",
55
+ "multer": "^2.5.0",
56
+ "node-forge": "^1.4.3",
57
+ "serve-index": "^1.9.2"
56
58
  },
57
59
  "devDependencies": {
60
+ "@biomejs/biome": "^2.6.8",
58
61
  "@lzwme/fed-lint-helper": "^2.6.6",
59
- "@types/express": "^5.0.5",
60
- "@types/node": "^24.10.0",
62
+ "@types/express": "^5.0.6",
63
+ "@types/multer": "^2.3.0",
64
+ "@types/node": "^26.6.6",
61
65
  "@types/node-forge": "^1.3.14",
62
66
  "husky": "^9.1.7",
63
67
  "standard-version": "^9.5.0",
64
68
  "ts-node": "^10.9.2",
65
- "typescript": "^5.9.3"
69
+ "typescript": "^7.0.2"
66
70
  }
67
71
  }
@@ -4,6 +4,14 @@ module.exports = {
4
4
  https: false,
5
5
  sslCache: '',
6
6
  rootDir: '.',
7
+ // localsend 局域网文件传输。可设为 true 开启,或传入对象配置
8
+ // localsend: {
9
+ // enabled: true,
10
+ // // 文件存储目录。默认 ~/.static-server/localsend,可用环境变量 SS_LOCALSEND_DIR 覆盖
11
+ // dir: '~/localsend',
12
+ // // 单个文件上传大小限制(字节),默认 1GB
13
+ // maxSize: 1024 * 1024 * 1024,
14
+ // },
7
15
  proxyConfig: [
8
16
  // 内网代理企业微信机器人接口示例
9
17
  {