koishi-plugin-kkk 1.0.3 → 1.0.5
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/CHANGELOG.md +11 -0
- package/assets/web/assets/ThemeSwitch-DFohhwd9.js +1 -1
- package/lib/webui.js +5 -5
- package/package.json +1 -1
- package/scripts/patch-webui.mjs +2 -0
- package/src/webui.ts +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## 1.0.5
|
|
4
|
+
|
|
5
|
+
### 修复
|
|
6
|
+
- 「关于插件」页的大标题漏改,仍显示 `karin-plugin-kkk`,现在改为 `koishi-plugin-kkk`。
|
|
7
|
+
|
|
8
|
+
## 1.0.4
|
|
9
|
+
|
|
10
|
+
### 修复
|
|
11
|
+
- 1.0.3 里注入版本号那段把中间件里的 `const` 又赋了一次值,导致 `/kkk/assets/*.js`(主题/布局那几个包)返回 500、面板打不开;
|
|
12
|
+
现在改成用新变量承接,已回归正常。
|
|
13
|
+
|
|
3
14
|
## 1.0.3
|
|
4
15
|
|
|
5
16
|
### 变更
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,m as t,r as n,t as r,u as i,w as a,yt as o}from"./index-BRROK0vh.js";var s=n(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c=n(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),l=n(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),u=n(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),d=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),f=n(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),p=n(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),m=n(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),h=n(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),g=o(),_=()=>{let t=e=>{window.open(e,`_blank`)};return(0,g.jsxs)(e,{className:`mx-auto max-w-3xl`,children:[(0,g.jsxs)(e.Header,{className:`items-center text-center gap-4 pt-8 pb-6`,children:[(0,g.jsx)(p,{size:64,"aria-hidden":`true`}),(0,g.jsx)(e.Title,{children:`
|
|
1
|
+
import{C as e,m as t,r as n,t as r,u as i,w as a,yt as o}from"./index-BRROK0vh.js";var s=n(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c=n(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),l=n(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),u=n(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),d=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),f=n(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),p=n(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),m=n(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),h=n(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),g=o(),_=()=>{let t=e=>{window.open(e,`_blank`)};return(0,g.jsxs)(e,{className:`mx-auto max-w-3xl`,children:[(0,g.jsxs)(e.Header,{className:`items-center text-center gap-4 pt-8 pb-6`,children:[(0,g.jsx)(p,{size:64,"aria-hidden":`true`}),(0,g.jsx)(e.Title,{children:`koishi-plugin-kkk`}),(0,g.jsx)(e.Description,{children:`版本 __KKK_VERSION__`})]}),(0,g.jsxs)(e.Content,{className:`flex flex-col gap-6 pb-8`,children:[(0,g.jsxs)(`section`,{children:[(0,g.jsx)(`h3`,{className:`mb-3 text-base font-semibold`,children:`插件简介`}),(0,g.jsx)(i,{children:`Koishi 的「抖音」「B站」视频解析/动态推送插件。 支持视频解析、动态推送、扫码登录等功能。`})]}),(0,g.jsxs)(`section`,{children:[(0,g.jsx)(`h3`,{className:`mb-3 text-base font-semibold`,children:`开发者`}),(0,g.jsx)(i,{children:`maimai993(Koishi 移植版;上游 karin-plugin-kkk by ikenxuan, sj817)`})]}),(0,g.jsxs)(`section`,{children:[(0,g.jsx)(`h3`,{className:`mb-3 text-base font-semibold`,children:`相关链接`}),(0,g.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:[(0,g.jsxs)(a,{variant:`outline`,onPress:()=>t(`https://github.com/maimai993/koishi-plugin-kkk`),children:[(0,g.jsx)(c,{size:18,"aria-hidden":`true`}),(0,g.jsx)(`span`,{children:`GitHub 仓库`})]}),(0,g.jsxs)(a,{variant:`outline`,onPress:()=>t(`https://github.com/maimai993/koishi-plugin-kkk/issues`),children:[(0,g.jsx)(c,{size:18,"aria-hidden":`true`}),(0,g.jsx)(`span`,{children:`反馈问题`})]})]})]})]})]})},v=`https://github.com/maimai993.png`,y=({className:e})=>{let{isDark:n,toggleTheme:i}=r();return(0,g.jsxs)(t,{delay:1,closeDelay:1,children:[(0,g.jsx)(a,{isIconOnly:!0,"aria-label":n?`切换到浅色模式`:`切换到深色模式`,className:e,variant:`ghost`,onPress:i,children:n?(0,g.jsx)(h,{size:20,"aria-hidden":`true`}):(0,g.jsx)(f,{size:20,"aria-hidden":`true`})}),(0,g.jsx)(t.Content,{children:n?`浅色模式`:`深色模式`})]})};export{p as a,l as c,m as i,s as l,v as n,d as o,_ as r,u as s,y as t};
|
package/lib/webui.js
CHANGED
|
@@ -319,8 +319,8 @@ function registerWebUi({ ctx, config, rawConfig, logger, pluginRoot }) {
|
|
|
319
319
|
if (await pageDenied(response))
|
|
320
320
|
return;
|
|
321
321
|
const relative = decodeURIComponent(requestPath.slice('/kkk/assets/'.length));
|
|
322
|
-
const
|
|
323
|
-
if (!
|
|
322
|
+
const raw = relative ? readWebFile(relative) : null;
|
|
323
|
+
if (!raw) {
|
|
324
324
|
// SPA 自己的前端路由(/kkk/assets/config、/kkk/assets/about 等)→ 回 index.html
|
|
325
325
|
response.type = 'text/html; charset=utf-8';
|
|
326
326
|
response.body = indexHtml();
|
|
@@ -328,9 +328,9 @@ function registerWebUi({ ctx, config, rawConfig, logger, pluginRoot }) {
|
|
|
328
328
|
}
|
|
329
329
|
response.type = MIME[node_path_1.default.extname(relative).toLowerCase()] ?? 'application/octet-stream';
|
|
330
330
|
// 前端包里带 __KKK_VERSION__ 占位符的文件,按真实版本号替换后再发
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
const file = pluginVersion && relative.endsWith('.js') && raw.includes('__KKK_VERSION__')
|
|
332
|
+
? Buffer.from(raw.toString('utf-8').replace(/__KKK_VERSION__/g, pluginVersion))
|
|
333
|
+
: raw;
|
|
334
334
|
// 不缓存:面板的前端包会被我们改动(接口路径等),浏览器缓存旧包会直接导致「打不开/接口报错」
|
|
335
335
|
response.set('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0');
|
|
336
336
|
response.body = file;
|
package/package.json
CHANGED
package/scripts/patch-webui.mjs
CHANGED
|
@@ -163,6 +163,8 @@ const TEXT_REPLACERS = [
|
|
|
163
163
|
[/https:\/\/github\.com\/ikenxuan\/karin-plugin-kkk/g, 'https://github.com/maimai993/koishi-plugin-kkk'],
|
|
164
164
|
[/https:\/\/github\.com\/ikenxuan\.png/g, 'https://github.com/maimai993.png'],
|
|
165
165
|
[/ikenxuan, sj817/g, 'maimai993(Koishi 移植版;上游 karin-plugin-kkk by ikenxuan, sj817)'],
|
|
166
|
+
// 「关于插件」页的大标题(JSX 里是反引号字符串)
|
|
167
|
+
[/`karin-plugin-kkk`/g, '`koishi-plugin-kkk`'],
|
|
166
168
|
[/版本 2\.33\.0/g, '版本 __KKK_VERSION__'],
|
|
167
169
|
[/Karin 插件配置管理面板/g, 'koishi-plugin-kkk 配置面板'],
|
|
168
170
|
[/\bKarin\b/g, 'Koishi'],
|
package/src/webui.ts
CHANGED
|
@@ -328,8 +328,8 @@ export function registerWebUi ({ ctx, config, rawConfig, logger, pluginRoot }: W
|
|
|
328
328
|
if (!requestPath.startsWith('/kkk/assets/')) return next()
|
|
329
329
|
if (await pageDenied(response)) return
|
|
330
330
|
const relative = decodeURIComponent(requestPath.slice('/kkk/assets/'.length))
|
|
331
|
-
const
|
|
332
|
-
if (!
|
|
331
|
+
const raw = relative ? readWebFile(relative) : null
|
|
332
|
+
if (!raw) {
|
|
333
333
|
// SPA 自己的前端路由(/kkk/assets/config、/kkk/assets/about 等)→ 回 index.html
|
|
334
334
|
response.type = 'text/html; charset=utf-8'
|
|
335
335
|
response.body = indexHtml()
|
|
@@ -337,9 +337,9 @@ export function registerWebUi ({ ctx, config, rawConfig, logger, pluginRoot }: W
|
|
|
337
337
|
}
|
|
338
338
|
response.type = MIME[path.extname(relative).toLowerCase()] ?? 'application/octet-stream'
|
|
339
339
|
// 前端包里带 __KKK_VERSION__ 占位符的文件,按真实版本号替换后再发
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
const file = pluginVersion && relative.endsWith('.js') && raw.includes('__KKK_VERSION__')
|
|
341
|
+
? Buffer.from(raw.toString('utf-8').replace(/__KKK_VERSION__/g, pluginVersion))
|
|
342
|
+
: raw
|
|
343
343
|
// 不缓存:面板的前端包会被我们改动(接口路径等),浏览器缓存旧包会直接导致「打不开/接口报错」
|
|
344
344
|
response.set('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
|
|
345
345
|
response.body = file
|