@karinjs/plugin-basic 1.2.1 → 1.3.2

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,210 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Microsoft YaHei';
9
+ background: radial-gradient(circle at 20% 50%, rgba(120, 200, 255, 0.3) 0%, transparent 50%),
10
+ radial-gradient(circle at 80% 80%, rgba(180, 220, 255, 0.3) 0%, transparent 50%),
11
+ radial-gradient(circle at 40% 20%, rgba(200, 230, 255, 0.2) 0%, transparent 50%),
12
+ linear-gradient(135deg, #e3f2fd 0%, #ffffff 50%, #f0f7ff 100%);
13
+ padding: 16px;
14
+ }
15
+
16
+ .container {
17
+ max-width: 1400px;
18
+ margin: 0 auto;
19
+ background: rgba(255, 255, 255, 0.96);
20
+ border-radius: 18px;
21
+ box-shadow: 0 18px 45px rgba(100, 150, 200, 0.35);
22
+ overflow: hidden;
23
+ }
24
+
25
+ .header {
26
+ position: relative;
27
+ padding: 30px;
28
+ color: #fff;
29
+ background: url('../img/plugin.png') center/cover no-repeat,
30
+ linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
31
+ border-bottom: 1px solid rgba(255, 255, 255, 0.2);
32
+ }
33
+
34
+ .header h1 {
35
+ font-size: 32px;
36
+ margin-bottom: 15px;
37
+ font-weight: 600;
38
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
39
+ }
40
+
41
+ .info {
42
+ display: flex;
43
+ gap: 20px;
44
+ font-size: 14px;
45
+ opacity: 0.95;
46
+ }
47
+
48
+ .info span {
49
+ background: rgba(255, 255, 255, 0.2);
50
+ padding: 6px 12px;
51
+ border-radius: 6px;
52
+ backdrop-filter: blur(10px);
53
+ }
54
+
55
+ .plugins-container {
56
+ padding: 20px;
57
+ display: grid;
58
+ grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
59
+ gap: 20px;
60
+ }
61
+
62
+ .plugin-card {
63
+ background: #fff;
64
+ border-radius: 12px;
65
+ padding: 20px;
66
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
67
+ border: 2px solid #e3f2fd;
68
+ display: flex;
69
+ flex-direction: column;
70
+ position: relative;
71
+ }
72
+
73
+ .plugin-header {
74
+ margin-bottom: 15px;
75
+ }
76
+
77
+ .plugin-name-row {
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: space-between;
81
+ gap: 10px;
82
+ margin-bottom: 8px;
83
+ }
84
+
85
+ .plugin-name {
86
+ font-size: 18px;
87
+ font-weight: 600;
88
+ color: #1a202c;
89
+ word-break: break-word;
90
+ flex: 1;
91
+ line-height: 1.4;
92
+ }
93
+
94
+ .platform-badge {
95
+ display: inline-flex;
96
+ align-items: center;
97
+ gap: 4px;
98
+ padding: 4px 10px;
99
+ border-radius: 6px;
100
+ font-size: 11px;
101
+ font-weight: 600;
102
+ text-transform: uppercase;
103
+ white-space: nowrap;
104
+ flex-shrink: 0;
105
+ }
106
+
107
+ .platform-icon {
108
+ font-size: 14px;
109
+ }
110
+
111
+ .platform-npm {
112
+ background: linear-gradient(135deg, #cb3837 0%, #d63031 100%);
113
+ color: white;
114
+ }
115
+
116
+ .platform-git {
117
+ background: linear-gradient(135deg, #f05032 0%, #ff6b35 100%);
118
+ color: white;
119
+ }
120
+
121
+ .platform-app {
122
+ background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
123
+ color: white;
124
+ }
125
+
126
+ .plugin-version {
127
+ display: inline-block;
128
+ padding: 3px 8px;
129
+ background: #e2e8f0;
130
+ color: #4a5568;
131
+ border-radius: 4px;
132
+ font-size: 12px;
133
+ font-weight: 500;
134
+ }
135
+
136
+ .plugin-body {
137
+ flex: 1;
138
+ display: flex;
139
+ flex-direction: column;
140
+ gap: 12px;
141
+ }
142
+
143
+ .plugin-description {
144
+ font-size: 14px;
145
+ line-height: 1.6;
146
+ color: #4a5568;
147
+ word-break: break-word;
148
+ flex: 1;
149
+ }
150
+
151
+ .no-description {
152
+ color: #a0aec0;
153
+ font-style: italic;
154
+ }
155
+
156
+ .plugin-meta {
157
+ display: flex;
158
+ flex-direction: column;
159
+ gap: 8px;
160
+ padding-top: 10px;
161
+ border-top: 1px solid #e2e8f0;
162
+ }
163
+
164
+ .meta-item {
165
+ display: flex;
166
+ align-items: flex-start;
167
+ gap: 8px;
168
+ font-size: 13px;
169
+ }
170
+
171
+ .meta-label {
172
+ color: #718096;
173
+ font-weight: 500;
174
+ white-space: nowrap;
175
+ }
176
+
177
+ .meta-value {
178
+ color: #2d3748;
179
+ word-break: break-all;
180
+ flex: 1;
181
+ }
182
+
183
+ .plugin-path {
184
+ font-family: 'Consolas', 'Monaco', monospace;
185
+ font-size: 11px;
186
+ color: #42a5f5;
187
+ }
188
+
189
+ .plugin-footer {
190
+ margin-top: 12px;
191
+ padding-top: 12px;
192
+ border-top: 1px solid #e2e8f0;
193
+ display: flex;
194
+ justify-content: flex-end;
195
+ }
196
+
197
+ .plugin-index {
198
+ font-size: 12px;
199
+ color: #a0aec0;
200
+ font-weight: 600;
201
+ }
202
+
203
+ .footer {
204
+ background: #f8f9fa;
205
+ padding: 15px 30px;
206
+ text-align: center;
207
+ color: #6c757d;
208
+ font-size: 12px;
209
+ border-top: 1px solid #dee2e6;
210
+ }
@@ -0,0 +1,71 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>插件列表</title>
8
+ <link rel="stylesheet" href="{{pluResPath}}plugins/index.css">
9
+ </head>
10
+
11
+ <body>
12
+ <div class="container">
13
+ <div class="header">
14
+ <h1>🔌 插件列表</h1>
15
+ <div class="info">
16
+ <span class="date">{{date}}</span>
17
+ <span class="count">共 {{total}} 个插件</span>
18
+ </div>
19
+ </div>
20
+
21
+ <div class="plugins-container">
22
+ {{each plugins}}
23
+ <div class="plugin-card">
24
+ <div class="plugin-header">
25
+ <div class="plugin-name-row">
26
+ <h3 class="plugin-name">{{$value.name}}</h3>
27
+ <span class="platform-badge platform-{{$value.type}}">
28
+ <span class="platform-icon">{{$value.typeIcon}}</span>
29
+ {{$value.type}}
30
+ </span>
31
+ </div>
32
+ {{if $value.version}}
33
+ <span class="plugin-version">v{{$value.version}}</span>
34
+ {{/if}}
35
+ </div>
36
+
37
+ <div class="plugin-body">
38
+ {{if $value.description}}
39
+ <p class="plugin-description">{{$value.description}}</p>
40
+ {{else}}
41
+ <p class="plugin-description no-description">暂无描述</p>
42
+ {{/if}}
43
+
44
+ <div class="plugin-meta">
45
+ {{if $value.author}}
46
+ <div class="meta-item">
47
+ <span class="meta-label">👤 作者:</span>
48
+ <span class="meta-value">{{$value.author}}</span>
49
+ </div>
50
+ {{/if}}
51
+ <div class="meta-item">
52
+ <span class="meta-label">📁 路径:</span>
53
+ <span class="meta-value plugin-path">{{$value.dir}}</span>
54
+ </div>
55
+ </div>
56
+ </div>
57
+
58
+ <div class="plugin-footer">
59
+ <span class="plugin-index">#{{$value.index}}</span>
60
+ </div>
61
+ </div>
62
+ {{/each}}
63
+ </div>
64
+
65
+ <div class="footer">
66
+ <p>{{sys.copyright}}</p>
67
+ </div>
68
+ </div>
69
+ </body>
70
+
71
+ </html>
@@ -1,7 +0,0 @@
1
- {
2
- "status": true,
3
- "forward": true,
4
- "restartMode": true,
5
- "restart": true,
6
- "domain": ""
7
- }
@@ -1,129 +0,0 @@
1
- // src/root.ts
2
- import path from "path";
3
-
4
- // package.json
5
- var package_default = {
6
- name: "@karinjs/plugin-basic",
7
- version: "1.2.1",
8
- description: "karin plugin for basic functions",
9
- homepage: "https://github.com/KarinJS/karin-plugin-basic",
10
- bugs: {
11
- url: "https://github.com/KarinJS/karin-plugin-basic/issues"
12
- },
13
- repository: {
14
- type: "git",
15
- url: "git+https://github.com/KarinJS/karin-plugin-basic.git"
16
- },
17
- author: "shijin",
18
- type: "module",
19
- main: "dist/index.js",
20
- files: [
21
- "dist",
22
- "config",
23
- "resources",
24
- "LICENSE",
25
- "package.json",
26
- "README.md"
27
- ],
28
- scripts: {
29
- build: "tsc && tsup",
30
- pub: "npm publish --access public",
31
- sort: "npx sort-package-json",
32
- dev: "tsx src/app.ts",
33
- watch: "tsx watch src/index.ts",
34
- karin: "karin"
35
- },
36
- devDependencies: {
37
- "@types/node": "^24.0.1",
38
- eslint: "^9.29.0",
39
- neostandard: "^0.12.1",
40
- "node-karin": "^1.10.16",
41
- tsup: "^8.5.0",
42
- tsx: "^4.20.3",
43
- typescript: "^5.8.3"
44
- },
45
- publishConfig: {
46
- access: "public",
47
- registry: "https://registry.npmjs.org"
48
- },
49
- karin: {
50
- main: "src/index.ts",
51
- apps: [
52
- "dist/apps"
53
- ],
54
- "ts-apps": [
55
- "src/apps"
56
- ],
57
- static: [
58
- "resources"
59
- ],
60
- files: [
61
- "config"
62
- ],
63
- "ts-web": "src/web.config.ts",
64
- web: "dist/web.config.js"
65
- },
66
- dependencies: {
67
- "internal-ip": "^8.0.0"
68
- }
69
- };
70
-
71
- // src/root.ts
72
- import { fileURLToPath } from "url";
73
- var __filename = fileURLToPath(import.meta.url);
74
- var __dirname = path.dirname(__filename);
75
- var __pluginDir = path.resolve(__dirname, "../");
76
- var info = {
77
- /** 插件目录 */
78
- dir: __pluginDir,
79
- /** 插件名称 */
80
- name: package_default.name.replace(/\//g, "-"),
81
- /** 插件版本 */
82
- version: package_default.version,
83
- /** package.json */
84
- pkg: package_default
85
- };
86
-
87
- // src/utils/config.ts
88
- import fs from "fs";
89
- import path2 from "path";
90
- import {
91
- watch,
92
- basePath,
93
- filesByExt,
94
- copyConfigSync,
95
- requireFileSync
96
- } from "node-karin";
97
- var cache;
98
- var dir = path2.join(basePath, info.name, "config");
99
- var defConfig = path2.join(info.dir, "config");
100
- var main = () => {
101
- copyConfigSync(defConfig, dir, [".json"]);
102
- setTimeout(() => {
103
- const list = filesByExt(dir, ".json", "abs");
104
- list.forEach((file) => watch(file, (old, now) => {
105
- cache = void 0;
106
- }));
107
- }, 2e3);
108
- };
109
- var config = () => {
110
- if (cache) return cache;
111
- const user = requireFileSync(`${dir}/config.json`);
112
- const def = requireFileSync(`${defConfig}/config.json`);
113
- const result = { ...def, ...user };
114
- cache = result;
115
- return result;
116
- };
117
- var writeConfig = (config2) => {
118
- const def = requireFileSync(`${defConfig}/config.json`);
119
- const result = { ...def, ...config2 };
120
- cache = result;
121
- fs.writeFileSync(`${dir}/config.json`, JSON.stringify(result, null, 2));
122
- };
123
- main();
124
-
125
- export {
126
- info,
127
- config,
128
- writeConfig
129
- };