@xiguanpm/inkos-web 1.0.6
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.
- package/LICENSE +21 -0
- package/bin/cli.js +124 -0
- package/dist/assets/index-Qa7RFOD5.css +1 -0
- package/dist/assets/index-ReWNfPBN.js +540 -0
- package/dist/index.html +14 -0
- package/dist-server/index.js +104 -0
- package/dist-server/routes/inkos.js +1022 -0
- package/dist-server/utils/cli.js +202 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 InkOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const pkg = require(path.resolve(__dirname, '..', 'package.json'));
|
|
8
|
+
const distDir = path.resolve(__dirname, '..', 'dist');
|
|
9
|
+
const distServerDir = path.resolve(__dirname, '..', 'dist-server');
|
|
10
|
+
|
|
11
|
+
function parseArgs(args) {
|
|
12
|
+
const result = {
|
|
13
|
+
port: 8081,
|
|
14
|
+
command: null,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
for (let i = 0; i < args.length; i++) {
|
|
18
|
+
const arg = args[i];
|
|
19
|
+
switch (arg) {
|
|
20
|
+
case 'start':
|
|
21
|
+
case 'help':
|
|
22
|
+
case 'version':
|
|
23
|
+
result.command = arg;
|
|
24
|
+
break;
|
|
25
|
+
case '-p':
|
|
26
|
+
case '--port':
|
|
27
|
+
result.port = parseInt(args[++i]) || 8081;
|
|
28
|
+
break;
|
|
29
|
+
case '-V':
|
|
30
|
+
case '--version':
|
|
31
|
+
result.command = 'version';
|
|
32
|
+
break;
|
|
33
|
+
case '--help':
|
|
34
|
+
case '-h':
|
|
35
|
+
result.command = 'help';
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function checkBuild() {
|
|
43
|
+
if (!fs.existsSync(distDir)) {
|
|
44
|
+
console.log('Frontend not built. Building...');
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
if (!fs.existsSync(distServerDir)) {
|
|
48
|
+
console.log('Server not built. Building...');
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function startServer(port) {
|
|
55
|
+
const serverPath = path.join(distServerDir, 'index.js');
|
|
56
|
+
if (!fs.existsSync(serverPath)) {
|
|
57
|
+
console.error('Server not found. Please run: npm run build:all');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log(`Starting InkOS Web Server...`);
|
|
62
|
+
console.log(`Server: http://localhost:${port}`);
|
|
63
|
+
|
|
64
|
+
const env = {
|
|
65
|
+
...process.env,
|
|
66
|
+
PORT: port,
|
|
67
|
+
CORS_ORIGIN: `http://localhost:${port}`,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const server = spawn('node', [serverPath], {
|
|
71
|
+
stdio: 'inherit',
|
|
72
|
+
env,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
server.on('close', (code) => {
|
|
76
|
+
process.exit(code);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function showHelp() {
|
|
81
|
+
console.log(`
|
|
82
|
+
InkOS Web 小说写作管理系统
|
|
83
|
+
|
|
84
|
+
用法: inkos-web <command> [options]
|
|
85
|
+
|
|
86
|
+
命令:
|
|
87
|
+
start 启动服务器
|
|
88
|
+
help 显示帮助信息
|
|
89
|
+
|
|
90
|
+
选项:
|
|
91
|
+
-p, --port <port> 设置服务器端口 (默认: 8081)
|
|
92
|
+
-V, --version 显示版本信息
|
|
93
|
+
-h, --help 显示帮助信息
|
|
94
|
+
|
|
95
|
+
示例:
|
|
96
|
+
inkos-web start # 使用默认端口 8081
|
|
97
|
+
inkos-web start -p 9000 # 使用端口 9000
|
|
98
|
+
`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function showVersion() {
|
|
102
|
+
console.log(`@xiguanpm/inkos-web v${pkg.version}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const args = parseArgs(process.argv.slice(2));
|
|
106
|
+
|
|
107
|
+
switch (args.command) {
|
|
108
|
+
case 'start':
|
|
109
|
+
if (checkBuild()) {
|
|
110
|
+
startServer(args.port);
|
|
111
|
+
} else {
|
|
112
|
+
console.log('Please build the project first: npm run build:all');
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case 'version':
|
|
116
|
+
showVersion();
|
|
117
|
+
break;
|
|
118
|
+
case 'help':
|
|
119
|
+
default:
|
|
120
|
+
if (!args.command) {
|
|
121
|
+
console.log('请指定命令。使用 inkos-web help 查看帮助。\n');
|
|
122
|
+
}
|
|
123
|
+
showHelp();
|
|
124
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*{margin:0;padding:0;box-sizing:border-box}html,body,#root{height:100%;width:100%}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#f0f2f5}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#f1f1f1;border-radius:4px}::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.ant-layout{min-height:100vh}.ant-layout-content{padding:24px;background:#f0f2f5}.page-header{margin-bottom:24px}.page-header h1{font-size:24px;font-weight:600;color:#1f1f1f;margin-bottom:8px}.page-header p{color:#666;font-size:14px}.card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}.stat-card{text-align:center}.stat-card .ant-statistic-title{font-size:14px;color:#666}.stat-card .ant-statistic-content{font-size:28px;font-weight:600}.status-tag{display:inline-flex;align-items:center;gap:4px}.chapter-list{max-height:600px;overflow-y:auto}.log-output{background:#1e1e1e;color:#d4d4d4;padding:16px;border-radius:8px;font-family:Consolas,Monaco,Courier New,monospace;font-size:13px;line-height:1.6;max-height:400px;overflow-y:auto;white-space:pre-wrap;word-break:break-all}.log-output .error{color:#f48771}.log-output .success{color:#89d185}.log-output .warning{color:#dcdcaa}.log-output .info{color:#569cd6}
|