@candriajs/karin-plugin-git 1.1.1 → 1.3.0

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 CHANGED
@@ -1,45 +1,65 @@
1
1
  # 变更日志
2
2
 
3
- ## [1.1.1](https://github.com/CandriaJS/karin-plugin-git/compare/v1.1.0...v1.1.1) (2025-11-09)
3
+ ## [1.3.0](https://github.com/CandriaJS/karin-plugin-git/compare/v1.2.0...v1.3.0) (2025-11-29)
4
4
 
5
5
 
6
- ### 🎡 持续集成
6
+ ### 新功能
7
7
 
8
- * 修正发版 ([35e5a1d](https://github.com/CandriaJS/karin-plugin-git/commit/35e5a1dcc1b4ec7851d6d307d49d8095add13e9f))
8
+ * **git:** 添加议题和提交变更的日志记录功能 ([cb7622b](https://github.com/CandriaJS/karin-plugin-git/commit/cb7622b875d7074137eb9ac52cf0a7ee18fd5121))
9
9
 
10
- ## [1.1.0](https://github.com/CandriaJS/karin-plugin-git/compare/v1.0.0...v1.1.0) (2025-11-09)
10
+
11
+ ### 🐛 错误修复
12
+
13
+ * **admin:** 修正仓库订阅事件处理逻辑 ([3fd76bf](https://github.com/CandriaJS/karin-plugin-git/commit/3fd76bfdcfd52ceb231d829328679b3e33b2e92a))
14
+
15
+ ## [1.2.0](https://github.com/CandriaJS/karin-plugin-git/compare/v1.1.1...v1.2.0) (2025-11-12)
11
16
 
12
17
 
13
18
  ### ✨ 新功能
14
19
 
15
- * **admin:** 添加删除订阅仓库功能 ([76302e5](https://github.com/CandriaJS/karin-plugin-git/commit/76302e5b76c6991e2ddd2859f2fe7da4f77150f3))
16
- * **admin:** 添加设置访问令牌命令 ([624313c](https://github.com/CandriaJS/karin-plugin-git/commit/624313c8693e09a80fb32b0c969d951355b5afdc))
17
- * **platform:** 支持多平台仓库订阅与推送 ([0b07a08](https://github.com/CandriaJS/karin-plugin-git/commit/0b07a08a9217c76039ece11437355bb0c3db0c96))
18
- * **push:** 优化GitHub客户端配置与代理支持 ([8388872](https://github.com/CandriaJS/karin-plugin-git/commit/838887284005661cf37efaca5c46986bedbcd028))
19
- * **push:** 实现订阅仓库推送功能 ([6791730](https://github.com/CandriaJS/karin-plugin-git/commit/6791730cbfb8829a3636fd29e30ffd358ec95530))
20
- * **push:** 支持渲染 Markdown 格式的推送消息 ([dce90a7](https://github.com/CandriaJS/karin-plugin-git/commit/dce90a776ff055ab2dfb23137580ba59b486f2e9))
21
- * 增加github 仓库推送订阅功能 ([30bd417](https://github.com/CandriaJS/karin-plugin-git/commit/30bd41732f554c0723a735b1db4ab383cb99d982))
20
+ * **github:** 添加反向代理配置支持 ([e986b98](https://github.com/CandriaJS/karin-plugin-git/commit/e986b98c108c878f49643c981f6029ae678e1077))
21
+ * **git:** 支持订阅仓库议题变更推送 ([83718de](https://github.com/CandriaJS/karin-plugin-git/commit/83718dec328349a39670503680352a6b91582ea5))
22
22
 
23
23
 
24
- ### 🐛 错误修复
24
+ ### ⚡️ 性能优化
25
25
 
26
- * **admin:** 限制添加仓库命令的权限为管理员 ([ee4fbfb](https://github.com/CandriaJS/karin-plugin-git/commit/ee4fbfb9fde8efa839e758ac875f129f2be450cc))
27
- * **commit:** 修复作者头像参数错误 ([a07509b](https://github.com/CandriaJS/karin-plugin-git/commit/a07509b987f3420d7a09d7727e318edd9065e371))
28
- * **commit:** 修复提交日期显示问题 ([734e76e](https://github.com/CandriaJS/karin-plugin-git/commit/734e76ede05d0246ede6e69bedcf4c36edc472ff))
29
- * **date:** 修复 dayjs 插件和语言包的导入路径 ([bd4b9df](https://github.com/CandriaJS/karin-plugin-git/commit/bd4b9df4684fbca7751ae5a868e345cbbc8dcbc6))
30
- * version ([3c24b09](https://github.com/CandriaJS/karin-plugin-git/commit/3c24b099b1e05d8f1829bfe8989baa7c68b3b32c))
26
+ * **issue:** 优化问题和推送信息渲染逻辑 ([92dfacc](https://github.com/CandriaJS/karin-plugin-git/commit/92dfacca0af955941a9da61e4189eef29a6e74fb))
31
27
 
28
+ ## [1.1.1](https://github.com/CandriaJS/karin-plugin-git/compare/v1.1.0...v1.1.1) (2025-11-09)
32
29
 
33
- ### 🔧 其他更新
30
+ ### 🎡 持续集成
31
+
32
+ - 修正发版 ([35e5a1d](https://github.com/CandriaJS/karin-plugin-git/commit/35e5a1dcc1b4ec7851d6d307d49d8095add13e9f))
33
+
34
+ ## [1.1.0](https://github.com/CandriaJS/karin-plugin-git/compare/v1.0.0...v1.1.0) (2025-11-09)
35
+
36
+ ### ✨ 新功能
34
37
 
35
- * **package:** 移除未使用的 @biomejs/biome 依赖 ([bd4b9df](https://github.com/CandriaJS/karin-plugin-git/commit/bd4b9df4684fbca7751ae5a868e345cbbc8dcbc6))
36
- * 初始化仓库 ([cdd4336](https://github.com/CandriaJS/karin-plugin-git/commit/cdd433659521ae8bddc4dc6c788c0423c269333f))
38
+ - **admin:** 添加删除订阅仓库功能 ([76302e5](https://github.com/CandriaJS/karin-plugin-git/commit/76302e5b76c6991e2ddd2859f2fe7da4f77150f3))
39
+ - **admin:** 添加设置访问令牌命令 ([624313c](https://github.com/CandriaJS/karin-plugin-git/commit/624313c8693e09a80fb32b0c969d951355b5afdc))
40
+ - **platform:** 支持多平台仓库订阅与推送 ([0b07a08](https://github.com/CandriaJS/karin-plugin-git/commit/0b07a08a9217c76039ece11437355bb0c3db0c96))
41
+ - **push:** 优化GitHub客户端配置与代理支持 ([8388872](https://github.com/CandriaJS/karin-plugin-git/commit/838887284005661cf37efaca5c46986bedbcd028))
42
+ - **push:** 实现订阅仓库推送功能 ([6791730](https://github.com/CandriaJS/karin-plugin-git/commit/6791730cbfb8829a3636fd29e30ffd358ec95530))
43
+ - **push:** 支持渲染 Markdown 格式的推送消息 ([dce90a7](https://github.com/CandriaJS/karin-plugin-git/commit/dce90a776ff055ab2dfb23137580ba59b486f2e9))
44
+ - 增加github 仓库推送订阅功能 ([30bd417](https://github.com/CandriaJS/karin-plugin-git/commit/30bd41732f554c0723a735b1db4ab383cb99d982))
45
+
46
+ ### 🐛 错误修复
47
+
48
+ - **admin:** 限制添加仓库命令的权限为管理员 ([ee4fbfb](https://github.com/CandriaJS/karin-plugin-git/commit/ee4fbfb9fde8efa839e758ac875f129f2be450cc))
49
+ - **commit:** 修复作者头像参数错误 ([a07509b](https://github.com/CandriaJS/karin-plugin-git/commit/a07509b987f3420d7a09d7727e318edd9065e371))
50
+ - **commit:** 修复提交日期显示问题 ([734e76e](https://github.com/CandriaJS/karin-plugin-git/commit/734e76ede05d0246ede6e69bedcf4c36edc472ff))
51
+ - **date:** 修复 dayjs 插件和语言包的导入路径 ([bd4b9df](https://github.com/CandriaJS/karin-plugin-git/commit/bd4b9df4684fbca7751ae5a868e345cbbc8dcbc6))
52
+ - version ([3c24b09](https://github.com/CandriaJS/karin-plugin-git/commit/3c24b099b1e05d8f1829bfe8989baa7c68b3b32c))
53
+
54
+ ### 🔧 其他更新
37
55
 
56
+ - **package:** 移除未使用的 @biomejs/biome 依赖 ([bd4b9df](https://github.com/CandriaJS/karin-plugin-git/commit/bd4b9df4684fbca7751ae5a868e345cbbc8dcbc6))
57
+ - 初始化仓库 ([cdd4336](https://github.com/CandriaJS/karin-plugin-git/commit/cdd433659521ae8bddc4dc6c788c0423c269333f))
38
58
 
39
59
  ### ♻️ 代码重构
40
60
 
41
- * **db:** 重构数据库结构以支持多平台推送 ([51dc6f5](https://github.com/CandriaJS/karin-plugin-git/commit/51dc6f5738dc47a419457316399d5f27bc57d500))
42
- * **help:** 重构帮助页面为静态资源渲染 ([f0e6b11](https://github.com/CandriaJS/karin-plugin-git/commit/f0e6b1197203927d7b5f88d7b5df2660e9338088))
43
- * **plugin:** 重构 Markdown 渲染逻辑 ([0980b71](https://github.com/CandriaJS/karin-plugin-git/commit/0980b71666d3845791a8a88eeca7c47de7a2af4f))
44
- * **project:** 重构项目结构并优化样式 ([ef3c54e](https://github.com/CandriaJS/karin-plugin-git/commit/ef3c54e37f35125a41a0ab6f7bf2647e7c3d95a0))
45
- * **push:** 重构仓库推送逻辑 ([4d8b521](https://github.com/CandriaJS/karin-plugin-git/commit/4d8b5215fdccdea1dff19b2a9507db1d28e7b71e))
61
+ - **db:** 重构数据库结构以支持多平台推送 ([51dc6f5](https://github.com/CandriaJS/karin-plugin-git/commit/51dc6f5738dc47a419457316399d5f27bc57d500))
62
+ - **help:** 重构帮助页面为静态资源渲染 ([f0e6b11](https://github.com/CandriaJS/karin-plugin-git/commit/f0e6b1197203927d7b5f88d7b5df2660e9338088))
63
+ - **plugin:** 重构 Markdown 渲染逻辑 ([0980b71](https://github.com/CandriaJS/karin-plugin-git/commit/0980b71666d3845791a8a88eeca7c47de7a2af4f))
64
+ - **project:** 重构项目结构并优化样式 ([ef3c54e](https://github.com/CandriaJS/karin-plugin-git/commit/ef3c54e37f35125a41a0ab6f7bf2647e7c3d95a0))
65
+ - **push:** 重构仓库推送逻辑 ([4d8b521](https://github.com/CandriaJS/karin-plugin-git/commit/4d8b5215fdccdea1dff19b2a9507db1d28e7b71e))
@@ -1,3 +1,4 @@
1
1
  cron: '0 */5 * * * *'
2
2
  proxy: ''
3
+ reverseProxy: ''
3
4
  token: ''
package/lib/apps/admin.js CHANGED
@@ -1 +1 @@
1
- import"../root-C9I_RrRd.js";import{i as e,n as t,o as n,r,s as i}from"../db-D0PoPjmA.js";import{o as a}from"../common-OZlZxDcC.js";import{t as o}from"../types-BuMDb1Mk.js";import s from"node-karin";const c=s.command(/^#?git(?:添加|add)([^\s]+)?订阅仓库([^/\s]+)\/([^:\s]+)(?::([^/\s]+))?$/i,async i=>{let[,a,s,l,u]=i.msg.match(c.reg),d=i.selfId,f=i.groupId,p=o.GitHub;a?.toLowerCase()===`gitcode`?p=o.GitCode:a?.toLowerCase()===`gitee`?p=o.Gitee:a?.toLowerCase()===`cnb`&&(p=o.Cnb);let m=u||`main`,h=await r(d,f,s,l);if(h||=(await t(d,f,s,l),await r(d,f,s,l)),!h)return await i.reply(`添加仓库失败,请重试`);await n(o.GitHub,h.id,m)?await i.reply(`仓库 ${s}/${l} 的推送订阅已存在,平台: ${p}, 分支: ${m}`):(await e(p,h.id,m),await i.reply(`添加订阅仓库成功, 平台: ${p}, 仓库: ${s}/${l}, 分支: ${m}`))},{name:`karin-plugin-git:addRepo`,priority:500,event:`message.group`,permission:`master`}),l=s.command(/^#?git(?:移除|删除|remove)([^\s]+)?订阅仓库([^/\s]+)\/([^:\s]+)(?::([^/\s]+))?$/i,async e=>{let[,t,a,s,c]=e.msg.match(l.reg),u=e.selfId,d=e.groupId,f=o.GitHub;t?.toLowerCase()===`gitcode`?f=o.GitCode:t?.toLowerCase()===`gitee`?f=o.Gitee:t?.toLowerCase()===`cnb`&&(f=o.Cnb);let p=c||`main`,m=await r(u,d,a,s);if(!m)return await e.reply(`仓库不存在,删除失败`);if(!await n(o.GitHub,m.id,p))return await e.reply(`推送订阅不存在,删除失败`);await i(f,m.id,p),await e.reply(`删除订阅仓库成功, 平台: ${f}, 仓库: ${a}/${s}, 分支: ${p}`)},{name:`karin-plugin-git:removeRepo`,priority:500,event:`message.group`,permission:`master`}),u=s.command(/^#?git(?:设置|set)([^\s]+)?(?:token|访问令牌)([\s\S]+)$/i,async e=>{let[,t,n]=e.msg.match(u.reg),r=o.GitHub;t?.toLowerCase()===`gitcode`?r=o.GitCode:t?.toLowerCase()===`gitee`?r=o.Gitee:t?.toLowerCase()===`cnb`&&(r=o.Cnb),a.Modify(r,`token`,n),await e.reply(`设置${r}访问令牌成功`)},{name:`karin-plugin-git:SetToken`,priority:500,event:`message.friend`,permission:`master`});export{c as AddRepo,l as RemoveRepo,u as SetToken};
1
+ import"../root-C9I_RrRd.js";import{a as e,c as t,d as n,f as r,i,m as a,n as o,o as s,p as c,s as l,u}from"../db-DZFBXSmG.js";import{a as d,c as f,i as p,n as m,o as h,r as g}from"../common-Df1uHYOv.js";import{n as _,t as v}from"../types-7HeFLBYV.js";import y from"node-karin";import{isEmpty as b}from"es-toolkit/compat";const x=y.command(/^#?git(?:添加|add)([^\s]+)?订阅仓库([^/\s]+)\/([^:\s]+)(?::([^/\s]+))?(?:\s+([^/\s]+))?$/i,async t=>{let[,a,f,y,S,C]=t.msg.match(x.reg),w=C?C.toLocaleLowerCase().split(`,`).map(e=>e.trim()).filter(e=>e):[v.Push];w.length||w.push(v.Push);let T=t.selfId,E=t.groupId,D=_.GitHub,O;a?.toLowerCase()===`gitcode`?(D=_.GitCode,O=p()):a?.toLowerCase()===`gitee`?(D=_.Gitee,O=d()):a?.toLowerCase()===`cnb`?(D=_.Cnb,O=g()):(D=_.GitHub,O=h());let k=await n(T,E,f,y);if(k||=(await u(T,E,f,y),await n(T,E,f,y)),!k)return await t.reply(`添加订阅仓库失败,请重试`);let A=await i(D,k.id,w);if(A?await e(D,k.id,w):(await o(D,k.id,w),A=await i(D,k.id,w)),!A)return await t.reply(`添加仓库订阅事件失败,请重试`);let j=`添加订阅仓库成功, 平台: ${D}, 仓库: ${f}/${y}, 订阅类型: ${w.join(`,`)}`,M=w.includes(v.Push);if(M){let e=S||(await O.getRepoInfo(f,y)).defaultBranch;await c(A.id,e)?j=`仓库 ${f}/${y} 的推送订阅已存在,平台: ${D}, 分支: ${e}`:(await r(A.id,e),j+=`, 分支: ${e}`)}let N=w.includes(v.Issue);if(N)if((await l(A.id)).length)j=`仓库 ${f}/${y} 的议题订阅已存在, 平台: ${D}`;else{let e=await O.getIssueList(f,y,{perPage:100});if(b(e))return await t.reply(`添加议题订阅失败,请重试`);for(let t of e)await s(A.id,t.number,m(t.title),t.body?m(t.body):null,t.state)}console.log(M,N),await t.reply(j)},{name:`karin-plugin-git:admin:addRepo`,priority:500,event:`message.group`,permission:`master`}),S=y.command(/^#?git(?:移除|删除|remove)([^\s]+)?订阅仓库([^/\s]+)\/([^:\s]+)(?::([^/\s]+))?(?:\s+([^/\s]+))?$/i,async r=>{let[,o,s,u,d,f]=r.msg.match(S.reg),p=r.selfId,m=r.groupId,h=_.GitHub,g=f?f.toLocaleLowerCase().split(`,`).map(e=>e.trim()).filter(e=>e):[v.Push];g.length||g.push(v.Push),o?.toLowerCase()===`gitcode`?h=_.GitCode:o?.toLowerCase()===`gitee`?h=_.Gitee:o?.toLowerCase()===`cnb`&&(h=_.Cnb);let y=await n(p,m,s,u);if(!y)return await r.reply(`未找到该仓库, 删除失败,请重试`);let b=await i(h,y.id,g);if(!b)return await r.reply(`未找到该订阅事件, 删除失败,请重试`);if(g.includes(v.Push)){let t=b.eventType.filter(e=>e!==v.Push);if(await e(h,y.id,t),!await c(b.id,d))return await r.reply(`推送订阅不存在,删除失败`);await a(b.id,d)}if(g.includes(v.Issue)){let n=b.eventType.filter(e=>e!==v.Issue);if(await e(h,y.id,n),!await l(b.id))return await r.reply(`议题订阅不存在,删除失败`);await t(b.id)}await r.reply(`删除订阅仓库成功, 平台: ${h}, 仓库: ${s}/${u}, 订阅类型: ${g.join(`,`)}`)},{name:`karin-plugin-git:admin:removeRepo`,priority:500,event:`message.group`,permission:`master`}),C=y.command(/^#?git(?:设置|set)([^\s]+)?(?:token|访问令牌)([\s\S]+)$/i,async e=>{let[,t,n]=e.msg.match(C.reg),r=_.GitHub;t?.toLowerCase()===`gitcode`?r=_.GitCode:t?.toLowerCase()===`gitee`?r=_.Gitee:t?.toLowerCase()===`cnb`&&(r=_.Cnb),f.Modify(r,`token`,n),await e.reply(`设置${r}访问令牌成功`)},{name:`karin-plugin-git:admin:SetToken`,priority:500,event:`message.friend`,permission:`master`});export{x as AddRepo,S as RemoveRepo,C as SetToken};
package/lib/apps/help.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"../root-C9I_RrRd.js";import{a as t}from"../common-OZlZxDcC.js";import n,{requireFile as r}from"node-karin";import i from"markdown-it";const a=n.command(/^#?(?:(git))(?:命令|帮助|菜单|help|说明|功能|指令|使用说明)$/i,async e=>{let n=e.isMaster?`master`:`member`,r=await t.render(`help/index`,{role:n});return await e.reply(r),!0},{name:`karin-plugin-git:help`,priority:500,event:`message`,permission:`all`}),o=n.command(/^#?(?:(git))(?:版本|版本信息|version|versioninfo)$/i,async n=>{let a=new i({html:!0}).render(await r(`${e.Plugin_Path}/CHANGELOG.md`)),o=await t.render(`help/version-info`,{Markdown:a});return await n.reply(o),!0},{name:`karin-plugin-git:version`,priority:500,event:`message`,permission:`all`});export{a as help,o as version};
1
+ import{t as e}from"../root-C9I_RrRd.js";import{s as t}from"../common-Df1uHYOv.js";import n,{requireFile as r}from"node-karin";import i from"markdown-it";const a=n.command(/^#?(?:(git))(?:命令|帮助|菜单|help|说明|功能|指令|使用说明)$/i,async e=>{let n=e.isMaster?`master`:`member`,r=await t.render(`help/index`,{role:n});return await e.reply(r),!0},{name:`karin-plugin-git:help`,priority:500,event:`message`,permission:`all`}),o=n.command(/^#?(?:(git))(?:版本|版本信息|version|versioninfo)$/i,async n=>{let a=new i({html:!0}).render(await r(`${e.Plugin_Path}/CHANGELOG.md`)),o=await t.render(`help/version-info`,{Markdown:a});return await n.reply(o),!0},{name:`karin-plugin-git:version`,priority:500,event:`message`,permission:`all`});export{a as help,o as version};
@@ -0,0 +1 @@
1
+ import"../root-C9I_RrRd.js";import{d as e,l as t,o as n,r,s as i}from"../db-DZFBXSmG.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"../common-Df1uHYOv.js";import{n as p,t as m}from"../types-7HeFLBYV.js";import h,{common as g,contactGroup as _,getBot as v,logger as y}from"node-karin";import{isEmpty as b}from"es-toolkit/compat";const x=h.task(`karin-plugin-git:issue:github`,o.github.cron||`0 */5 * * * *`,async()=>{let{token:e}=o.github;if(b(e))return y.warn(`未配置GitHub Token, 跳过任务`);try{await T(l(),p.GitHub)}catch(e){y.error(e)}}),S=h.task(`karin-plugin-git:issue:gitee`,o.gitee.cron||`0 */5 * * * *`,async()=>{let{token:e}=o.gitee;if(b(e))return y.warn(`未配置Gitee Token, 跳过任务`);try{await T(a(),p.Gitee)}catch(e){y.error(e)}}),C=h.task(`karin-plugin-git:issue:gitcode`,o.gitcode.cron||`0 */5 * * * *`,async()=>{let{token:e}=o.gitcode;if(b(e))return y.warn(`未配置GitCode Token, 跳过任务`);try{await T(s(),p.GitCode)}catch(e){y.error(e)}}),w=h.task(`karin-plugin-git:issue:cnb`,o.cnb.cron||`0 */5 * * * *`,async()=>{let{token:e}=o.cnb;if(b(e))return y.warn(`未配置CnbCool Token, 跳过任务`);try{await T(u(),p.Cnb)}catch(e){y.error(e)}}),T=async(a,o)=>{let s=await r(o,m.Issue),l=new Map;for(let r of s){let o=await e(r.repoId);if(!o)continue;let s=`${o.groupId}-${o.botId}`,u=await a.getIssueList(o.owner,o.repo,{perPage:100});l.has(s)||l.set(s,[]);for(let e of u){let a=await i(r.id,e.number);if(a||(await n(r.id,e.number,c(e.title),e.body?c(e.body):null,e.state),l.get(s).push({owner:o.owner,repo:o.repo,title:await d.markdown(e.title),body:e.body?await d.markdown(e.body):null,user:e.user,state:e.state,issueDate:f(e.createdAt)}),a=await i(r.id,e.number),y.debug(`[karin-plugin-git] 平台: ${r.platform} 仓库:${o.owner}/${o.repo} 议题变更`)),!a){y.debug(`[karin-plugin-git] 平台: ${r.platform} 仓库:${o.owner}/${o.repo} 议题无变更`);continue}(a.state!==e.state||a.title!==c(e.title)||a.body!==(e.body?c(e.body):null))&&(l.get(s).push({owner:o.owner,repo:o.repo,title:await d.markdown(e.title),body:e.body?await d.markdown(e.body):null,user:e.user,state:e.state,issueDate:f(e.createdAt)}),y.debug(`[karin-plugin-git] 平台: ${r.platform} 仓库:${o.owner}/${o.repo} 议题变更`),await t(r.id,e.number,e.state))}}for(let[e,t]of l){let[n,r]=e.split(`-`),i=t.map(async e=>await d.render(`issue/index`,{issue:e})),a=(await Promise.allSettled(i)).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value);a.length>0&&await E(r,n,a)}l.clear()},E=async(e,t,n)=>{let r=v(e),i=await _(t);if(n.length>3){let t=await g.makeForward(n,e,r?.account.name);await r?.sendForwardMsg(i,t,{source:`议题推送合集`,summary:`查看${t.length}张议题推送消息`,prompt:`议题推送结果`,news:[{text:`点击查看议题推送结果`}]})}else await r?.sendMsg(i,n)};export{w as cnb,C as gitcode,S as gitee,x as github};
package/lib/apps/push.js CHANGED
@@ -1,5 +1,5 @@
1
- import"../root-C9I_RrRd.js";import{a as e,c as t,r as n}from"../db-D0PoPjmA.js";import{a as r,i,n as a,o,r as s,t as c}from"../common-OZlZxDcC.js";import{t as l}from"../types-BuMDb1Mk.js";import u,{common as d,contactGroup as f,getBot as p,logger as m}from"node-karin";import{isEmpty as h}from"es-toolkit/compat";import g from"dayjs";import _ from"dayjs/plugin/relativeTime.js";import"dayjs/locale/zh-cn.js";const v=e=>(g.extend(_),g.locale(`zh-cn`),g(e).fromNow()),y=u.task(`karin-plugin-git:push:github`,o.github.cron||`0 */5 * * * *`,async()=>{let e=o.github.token;if(h(e))return m.warn(`未配置GitHub Token, 跳过任务`);try{await w(i(),l.GitHub)}catch(e){m.error(e)}}),b=u.task(`karin-plugin-git:push:gitee`,o.gitee.cron||`0 */5 * * * *`,async()=>{let e=o.gitee.token;if(h(e))return m.warn(`Gitee Token, 跳过任务`);try{await w(s(),l.Gitee)}catch(e){m.error(e)}}),x=u.task(`karin-plugin-git:push:gitee`,o.gitcode.cron||`0 */5 * * * *`,async()=>{let e=o.gitcode.token;if(h(e))return m.warn(`GitCode Token, 跳过任务`);try{await w(a(),l.GitCode)}catch(e){m.error(e)}}),S=u.task(`karin-plugin-git:push:cnb`,o.cnb.cron||`0 */5 * * * *`,async()=>{let e=o.cnb.token;if(h(e))return m.warn(`未配置CNB Token, 跳过任务`);try{await w(c(),l.Cnb)}catch(e){m.error(e)}}),C=u.command(/^#?git(?:推送|push)订阅仓库$/i,async t=>{try{let u=t.selfId,d=t.groupId,f=await e(),p,g=[];for(let e of f){let f=await n(e.repoId);if(!f||f.botId!=u||f.groupId!=d)continue;if(e.platform==l.Gitee){if(h(o.gitee.token))return await t.reply(`未配置Gitee Token, 请先配置Gitee Token`);p=s()}else if(e.platform==l.GitCode){if(h(o.gitcode.token))return await t.reply(`未配置GitCode Token, 请先配置GitCode Token`);p=a()}else if(e.platform==l.Cnb){if(h(o.cnb.token))return await t.reply(`Cnb Token, 请先配置Cnb Token`);p=c()}else{if(h(o.github.token))return await t.reply(`未配置GitHub Token, 请先配置GitHub Token`);p=i()}let _;try{_=await p.getCommitInfo(f.owner,f.repo,e.branch)}catch(t){m.warn(`获取仓库 ${f.owner}/${f.repo} 分支 ${e.branch} 提交信息失败:`,t);continue}let y=_.commit.message.split(`
2
- `),b={..._,owner:f.owner,repo:f.repo,branch:e.branch,botId:u,groupId:d,title:await r.markdown(y[0]),body:await r.markdown(y.slice(1).join(`
3
- `)),commitDate:v(_.commit.committer.date)},x=await r.render(`commit/index`,{commit:b});g.push(x)}g.length>0&&await T(u,d,g)}catch(e){m.error(e)}},{name:`karin-plugin-git:pushRepo`,priority:500,event:`message.group`,permission:`master`}),w=async(i,a)=>{let o=await e();if(h(o))return;let s=o.filter(e=>e.platform===a),c=new Map;for(let e of s){let t=await n(e.repoId);if(!t)continue;let r=await i.getCommitInfo(t.owner,t.repo,e.branch);if(r.sha===e.commitSha)continue;let a=`${t.botId}-${t.groupId}`;c.has(a)||c.set(a,[]),c.get(a).push({pushRepo:e,pushRepoInfo:t,commitInfo:r})}for(let[e,n]of c.entries()){let[i,o]=e.split(`-`),s=[];for(let e of n){let n=e.commitInfo.commit.message.split(`
4
- `),i={...e.commitInfo,owner:e.pushRepoInfo.owner,repo:e.pushRepoInfo.repo,branch:e.pushRepo.branch,botId:e.pushRepoInfo.botId,groupId:e.pushRepoInfo.groupId,title:await r.markdown(n[0]),body:await r.markdown(n.slice(1).join(`
5
- `)),commitDate:v(e.commitInfo.commit.committer.date)},o=await r.render(`commit/index`,{commit:i});s.push(o),await t(a,e.pushRepo.repoId,e.pushRepo.branch,e.commitInfo.sha)}s.length>0&&await T(i,o,s)}},T=async(e,t,n)=>{let r=p(e),i=await f(t);if(n.length>1){let t=await d.makeForward(n,e,r?.account.name);await r?.sendForwardMsg(i,t,{source:`仓库推送合集`,summary:`查看${t.length}张仓库推送消息`,prompt:`Gitub仓库推送结果`,news:[{text:`点击查看推送结果`}]})}else await r?.sendMsg(i,n)};export{S as cnb,x as gitcode,b as gitee,y as github,C as push};
1
+ import"../root-C9I_RrRd.js";import{d as e,f as t,h as n,p as r,r as i,s as a}from"../db-DZFBXSmG.js";import{a as o,c as s,i as c,o as l,r as u,s as d,t as f}from"../common-Df1uHYOv.js";import{n as p,t as m}from"../types-7HeFLBYV.js";import h,{common as g,contactGroup as _,getBot as v,logger as y}from"node-karin";import{isEmpty as b}from"es-toolkit/compat";const x=h.task(`karin-plugin-git:push:github`,s.github.cron||`0 */5 * * * *`,async()=>{let e=s.github.token;if(b(e))return y.warn(`未配置GitHub Token, 跳过任务`);try{await E(l(),p.GitHub)}catch(e){y.error(e)}}),S=h.task(`karin-plugin-git:push:gitee`,s.gitee.cron||`0 */5 * * * *`,async()=>{let e=s.gitee.token;if(b(e))return y.warn(`Gitee Token, 跳过任务`);try{await E(o(),p.Gitee)}catch(e){y.error(e)}}),C=h.task(`karin-plugin-git:push:gitee`,s.gitcode.cron||`0 */5 * * * *`,async()=>{let e=s.gitcode.token;if(b(e))return y.warn(`GitCode Token, 跳过任务`);try{await E(c(),p.GitCode)}catch(e){y.error(e)}}),w=h.task(`karin-plugin-git:push:cnb`,s.cnb.cron||`0 */5 * * * *`,async()=>{let e=s.cnb.token;if(b(e))return y.warn(`未配置CnbCool Token, 跳过任务`);try{await E(u(),p.Cnb)}catch(e){y.error(e)}}),T=h.command(/^#?git(?:推送|push)订阅仓库$/i,async t=>{try{let n=t.selfId,m=t.groupId,h=await i(),g,_=[];for(let i of h){let h=await e(i.repoId);if(!h)continue;if(i.platform==p.Gitee){if(b(s.gitee.token))return await t.reply(`未配置Gitee Token, 请先配置Gitee Token`);g=o()}else if(i.platform==p.GitCode){if(b(s.gitcode.token))return await t.reply(`未配置GitCode Token, 请先配置GitCode Token`);g=c()}else if(i.platform==p.Cnb){if(b(s.cnb.token))return await t.reply(`Cnb Token, 请先配置Cnb Token`);g=u()}else{if(b(s.github.token))return await t.reply(`未配置GitHub Token, 请先配置GitHub Token`);g=l()}let v=(await r(i.id)).map(async e=>{try{let t=await g.getCommitInfo(h.owner,h.repo,e.branch),r=t.commit.message.split(`
2
+ `),i={...t,owner:h.owner,repo:h.repo,branch:e.branch,botId:n,groupId:m,title:await d.markdown(r[0]),body:await d.markdown(r.slice(1).join(`
3
+ `)),commitDate:f(t.commit.committer.date)};return await d.render(`commit/index`,{commit:i})}catch(t){return y.warn(`获取仓库 ${h.owner}/${h.repo} 分支 ${e.branch} 提交信息失败:`,t),null}}),x=(await Promise.allSettled(v)).filter(e=>e.status===`fulfilled`).map(e=>e.value).filter(e=>e!==null);_.push(...x);let S=(await a(i.id)).map(async e=>{if(b(e))return null;let t=await g.getIssueInfo(h.owner,h.repo,e.issueId),n={owner:h.owner,repo:h.repo,title:await d.markdown(t.title),body:t.body?await d.markdown(t.body):null,user:t.user,state:t.state,issueDate:f(t.createdAt)};return await d.render(`issue/index`,{issue:n})}),C=(await Promise.allSettled(S)).filter(e=>e.status===`fulfilled`).map(e=>e.value).filter(e=>e!==null);_.push(...C)}_.length>0&&await D(n,m,_)}catch(e){y.error(e)}},{name:`karin-plugin-git:pushRepo`,priority:500,event:`message.group`,permission:`master`}),E=async(a,o)=>{let s=await i(o,m.Push);if(b(s))return;let c=new Map;for(let i of s){let o=await e(i.repoId);if(!o)continue;let s=`${o.groupId}-${o.botId}`,l=await r(i.id);if(b(l)){let{defaultBranch:e}=await a.getRepoInfo(o.owner,o.repo);await t(i.id,e),l=await r(i.repoId)}for(let e of l){let t=await a.getCommitInfo(o.owner,o.repo,e.branch);if(!t||t.sha===e.commitSha){y.debug(`[karin-plugin-git] 平台: ${i.platform} 仓库:${o.owner}/${o.repo} 分支: ${e.branch} 提交信息无变更`);continue}c.has(s)||c.set(s,[]),c.get(s).push({pushRepo:e,pushRepoInfo:o,commitInfo:t}),y.debug(`[karin-plugin-git] 平台: ${i.platform} 仓库:${o.owner}/${o.repo} 分支: ${e.branch} 提交信息变更`),await n(e.eventId,e.branch,t.sha)}}for(let[e,t]of c.entries()){let[n,r]=e.split(`-`),i=t.map(async e=>{let t=e.commitInfo.commit.message.split(`
4
+ `),n={...e.commitInfo,owner:e.pushRepoInfo.owner,repo:e.pushRepoInfo.repo,branch:e.pushRepo.branch,botId:e.pushRepoInfo.botId,groupId:e.pushRepoInfo.groupId,title:await d.markdown(t[0]),body:await d.markdown(t.slice(1).join(`
5
+ `)),commitDate:f(e.commitInfo.commit.committer.date)};return await d.render(`commit/index`,{commit:n})}),a=(await Promise.allSettled(i)).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value);a.length>0&&await D(r,n,a)}},D=async(e,t,n)=>{let r=v(e),i=await _(t);if(n.length>3){let t=await g.makeForward(n,e,r?.account.name);await r?.sendForwardMsg(i,t,{source:`仓库推送合集`,summary:`查看${t.length}张仓库推送消息`,prompt:`Gitub仓库推送结果`,news:[{text:`点击查看推送结果`}]})}else await r?.sendMsg(i,n)};export{w as cnb,C as gitcode,S as gitee,x as github,T as push};
@@ -0,0 +1 @@
1
+ import{t as e}from"./root-C9I_RrRd.js";import t,{YamlEditor as n,copyConfigSync as r,filesByExt as i,getFiles as a,karinPathBase as o,requireFileSync as s,segment as c,watch as l}from"node-karin";import u from"node:path";import{full as d}from"markdown-it-emoji";import{tasklist as f}from"@mdit/plugin-tasklist";import p from"markdown-it";import{isEmpty as m}from"es-toolkit/compat";import{CnbClient as h,GitCodeClient as g,GiteeClient as _,GithubClient as v}from"nipaw";import y from"dayjs";import b from"dayjs/plugin/relativeTime.js";import"dayjs/locale/zh-cn.js";import x from"node:crypto";var S=class{dirCfgPath;defCfgPath;constructor(){this.dirCfgPath=`${o}/${e.Plugin_Name}/config/`,this.defCfgPath=`${e.Plugin_Path}/config/defSet/`}initCfg(){r(this.defCfgPath,this.dirCfgPath);let e=i(this.dirCfgPath,`.yaml`,`name`);for(let t of e){let e=new n(`${this.dirCfgPath}/${t}`),r=new n(`${this.defCfgPath}/${t}`),{differences:i,result:a}=this.mergeObjectsWithPriority(e,r);i&&a.save()}return i(this.dirCfgPath,`.yaml`,`abs`).forEach(e=>l(e,(e,t)=>{})),this}getDefOrConfig(e){let t=this.getYaml(`defSet`,e),n=this.getYaml(`config`,e);return{...t,...n}}All(){let e={};return a(this.defCfgPath,[`.yaml`]).forEach(t=>{let n=u.basename(t,`.yaml`);e[n]=this.getDefOrConfig(n)??{}}),e}getYaml(e,t){return s(e===`config`?`${this.dirCfgPath}/${t}.yaml`:`${this.defCfgPath}/${t}.yaml`,{force:!0})}Modify(e,t,r,i=`config`){let a=new n(i===`config`?`${this.dirCfgPath}/${e}.yaml`:`${this.defCfgPath}/${e}.yaml`);a.set(t,r),a.save()}mergeObjectsWithPriority(e,t){let n=!1;return((t,r)=>{let i=r.get(t),a=e.get(t);if(typeof a==`object`&&typeof i==`object`)for(let r in i)r in a||(n=!0,e.set(`${t?`${t}.`:``}${r}`,i[r]))})(``,t),{differences:n,result:e}}};const C=new Proxy(Object.assign(new S().initCfg(),{}),{get(e,t){return t in e?Reflect.get(e,t):e.getDefOrConfig(t)}});function w(e=1){return e*=1.5,`style=transform:scale(${e})`}const T={async render(n,r={}){n=n.replace(/.html$/,``);let i=`${e.Plugin_Path}/resources`,a=await t.render({type:`jpeg`,encoding:`base64`,name:u.basename(n),file:`${i}/${n}.html`,data:{_res_path:`${e.Plugin_Path}/resources`.replace(/\\/g,`/`),defaultLayout:`${e.Plugin_Path}/resources/common/layout/default.html`.replace(/\\/g,`/`),sys:{scale:w(r.scale??1)},copyright:`${e.Bot_Name}<span class="version"> ${e.Bot_Version}</span> & ${e.Plugin_Name}<span class="version"> ${e.Plugin_Version}`,...r},screensEval:`#containter`,multiPage:12e3,pageGotoParams:{waitUntil:`networkidle0`,timeout:6e4}});return c.image(`${a.includes(`base64://`)?a:`base64://${a}`}`)},async markdown(e){let t=new p({html:!0,breaks:!0});return t.use(d),t.use(f),t.renderer.rules.bullet_list_open=()=>`<ul style="list-style: none;">`,Promise.resolve(t.render(e))}},E=()=>{let e=new v;return m(C.github.reverseProxy)?m(C.github.proxy)||e.setProxy(C.github.proxy):e.setReverseProxy(C.github.reverseProxy),m(C.github.token)||e.setToken(C.github.token),e},D=()=>{let e=new _;return m(C.gitee.proxy)||e.setProxy(C.gitee.proxy),m(C.gitee.token)||e.setToken(C.gitee.token),e},O=()=>{let e=new g;return m(C.gitcode.proxy)||e.setProxy(C.gitcode.proxy),m(C.gitcode.token)||e.setToken(C.gitcode.token),e},k=()=>{let e=new h;return m(C.cnb.proxy)||e.setProxy(C.cnb.proxy),m(C.cnb.token)||e.setToken(C.cnb.token),e},A=e=>(y.extend(b),y.locale(`zh-cn`),y().diff(e,`month`)>3?y(e).format(`YYYY-MM-DD HH:mm`):y(e).fromNow()),j=e=>{if(typeof e!=`string`)throw TypeError(`Input must be a string`);return x.createHash(`sha256`).update(e,`utf8`).digest(`hex`)};export{D as a,C as c,O as i,j as n,E as o,k as r,T as s,A as t};
@@ -0,0 +1,44 @@
1
+ import{t as e}from"./root-C9I_RrRd.js";import{karinPathBase as t}from"node-karin";import n from"node-karin/sqlite3";async function r(e,t){await(await v()).run(`INSERT INTO push (eventId, branch) VALUES (?, ?)`,[e,t])}async function i(e,t){let n=await v();return t==null?await new Promise((t,r)=>{n.all(`SELECT * FROM push WHERE eventId = ?`,[e],(e,n)=>{e?r(e):t(n)})}):await new Promise((r,i)=>{n.get(`SELECT * FROM push WHERE eventId = ? AND branch = ?`,[e,t],(e,t)=>{e?i(e):r(t)})})}async function a(e,t){let n=await v();t?await new Promise((r,i)=>{n.run(`DELETE FROM push WHERE eventId = ? AND branch = ?`,[e,t],e=>{e?i(e):r()})}):await new Promise((t,r)=>{n.run(`DELETE FROM push WHERE eventId = ?`,[e],e=>{e?r(e):t()})})}async function o(e,t,n){await(await v()).run(`UPDATE push SET commitSha = ? WHERE eventId = ? AND branch = ?`,[n,e,t])}async function s(e,t,n,r){await(await v()).run(`INSERT INTO repo (owner, repo, botId, groupId) VALUES (?, ?, ?, ?)`,[n,r,e,t])}async function c(...e){let t=await v();if(e.length===1){let[n]=e;return await new Promise((e,r)=>{t.get(`SELECT * FROM repo WHERE id = ?`,[n],(t,n)=>{t?r(t):e(n)})})}else{let[n,r,i,a]=e;return await new Promise((e,o)=>{t.get(`SELECT * FROM repo WHERE owner = ? AND repo = ? AND botId = ? AND groupId = ?`,[i,a,n,r],(t,n)=>{t?o(t):e(n)})})}}async function l(e,t,n,r,i){let a=await v();t!==void 0&&n!==void 0&&r!==void 0&&i!==void 0?await a.run(`INSERT INTO issue (eventId, issueId, title, body, state) VALUES (?, ?, ?, ?, ?)`,[e,t,n,r,i]):await a.run(`INSERT INTO issue (eventId) VALUES (?)`,[e])}async function u(e,t){let n=await v();return t==null?await new Promise((t,r)=>{n.all(`SELECT * FROM issue WHERE eventId = ?`,[e],(e,n)=>{e?r(e):t(n)})}):await new Promise((r,i)=>{n.get(`SELECT * FROM issue WHERE eventId = ? AND issueId = ?`,[e,t],(e,t)=>{e?i(e):r(t)})})}async function d(e,t){let n=await v();t==null?await new Promise((t,r)=>{n.run(`DELETE FROM issue WHERE eventId = ?`,[e],e=>{e?r(e):t()})}):await new Promise((r,i)=>{n.run(`DELETE FROM issue WHERE eventId = ? AND issueId = ?`,[e,t],e=>{e?i(e):r()})})}async function f(e,t,n){let r=await v();await new Promise((i,a)=>{r.run(`UPDATE issue SET state = ? WHERE eventId = ? AND issueId = ?`,[n,e,t],e=>{e?a(e):i()})})}async function p(e,t,n){let r=await v(),i=n.join(`,`);await r.run(`INSERT INTO event (platform,repoId, eventType) VALUES (?, ?, ?)`,[e,t,i])}async function m(e,t){let n=await v(),r=`SELECT * FROM event`,i=[];e===void 0?t!==void 0&&(r+=` WHERE eventType = ?`,i.push(t)):(r+=` WHERE platform = ?`,i.push(e),t!==void 0&&(r+=` AND eventType = ?`,i.push(t)));let a=await new Promise((e,t)=>{n.all(r,i,(n,r)=>{n?t(n):e(r)})});return a.forEach(e=>{e.eventType=e.eventType.split(`,`)}),a}async function h(e,t,n){let r=await v();if(n){let i=await new Promise((n,i)=>{r.all(`SELECT * FROM event WHERE platform = ? AND repoId = ?`,[e,t],(e,t)=>{e?i(e):n(t)})});if(i&&i.length>0){let e=Array.isArray(n)?n:[n],t=i.filter(t=>{let n=t.eventType.split(`,`);return e.some(e=>n.includes(e))});return t.forEach(e=>{e.eventType=e.eventType.split(`,`)}),t.length>0?t[0]:null}return null}else{let n=await new Promise((n,i)=>{r.all(`SELECT * FROM event WHERE platform = ? AND repoId = ?`,[e,t],(e,t)=>{e?i(e):n(t)})});return n&&n.forEach(e=>{e.eventType=e.eventType.split(`,`)}),n}}async function g(e,t,n){let r=await v(),i=n.join(`,`);await new Promise((n,a)=>{r.run(`UPDATE event SET eventType = ? WHERE platform = ? AND repoId = ?`,[i,e,t],e=>{e?a(e):n()})})}let _=null;const v=async()=>{if(!_){let r=`${t}/${e.Plugin_Name}/data`;_=new n.Database(`${r}/data.db`)}return _},y=async()=>{let e=await v();e.exec(`
2
+ CREATE TABLE IF NOT EXISTS repo (
3
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
4
+ owner TEXT NOT NULL,
5
+ repo TEXT NOT NULL,
6
+ botId TEXT NOT NULL,
7
+ groupId TEXT NOT NULL,
8
+ createdAt DATETIME DEFAULT (datetime('now', 'localtime')),
9
+ updatedAt DATETIME DEFAULT (datetime('now', 'localtime')),
10
+ UNIQUE(owner, repo, botId, groupId)
11
+ )
12
+ `),e.exec(`
13
+ CREATE TABLE IF NOT EXISTS event (
14
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
15
+ repoId INTEGER NOT NULL,
16
+ platform TEXT NOT NULL,
17
+ eventType TEXT NOT NULL,
18
+ createdAt DATETIME DEFAULT (datetime('now', 'localtime')),
19
+ updatedAt DATETIME DEFAULT (datetime('now', 'localtime')),
20
+ FOREIGN KEY (repoId) REFERENCES repo(id) ON DELETE CASCADE
21
+ )
22
+ `),e.exec(`
23
+ CREATE TABLE IF NOT EXISTS push (
24
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
25
+ eventId INTEGER NOT NULL,
26
+ branch TEXT NOT NULL,
27
+ commitSha TEXT,
28
+ createdAt DATETIME DEFAULT (datetime('now', 'localtime')),
29
+ updatedAt DATETIME DEFAULT (datetime('now', 'localtime')),
30
+ FOREIGN KEY (eventId) REFERENCES event(id) ON DELETE CASCADE
31
+ )
32
+ `),e.exec(`
33
+ CREATE TABLE IF NOT EXISTS issue (
34
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
35
+ eventId INTEGER NOT NULL,
36
+ issueId TEXT NOT NULL,
37
+ title TEXT,
38
+ body TEXT,
39
+ state TEXT,
40
+ createdAt DATETIME DEFAULT (datetime('now', 'localtime')),
41
+ updatedAt DATETIME DEFAULT (datetime('now', 'localtime')),
42
+ FOREIGN KEY (eventId) REFERENCES event(id) ON DELETE CASCADE
43
+ )
44
+ `),e.exec(`CREATE INDEX IF NOT EXISTS idx_repo_lookup ON repo(botId, groupId)`),e.exec(`CREATE INDEX IF NOT EXISTS idx_push_event ON push(eventId)`),e.exec(`CREATE INDEX IF NOT EXISTS idx_issue_event ON issue(eventId)`),e.exec(`CREATE INDEX IF NOT EXISTS idx_event_repo ON event(repoId)`),e.exec(`CREATE INDEX IF NOT EXISTS idx_event_platform ON event(platform)`),e.exec(`CREATE INDEX IF NOT EXISTS idx_event_type ON event(eventType)`)};export{g as a,d as c,c as d,r as f,o as h,h as i,f as l,a as m,p as n,l as o,i as p,m as r,u as s,y as t,s as u};
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./root-C9I_RrRd.js";import{t}from"./db-D0PoPjmA.js";import{logger as n}from"node-karin";import r from"node-karin/axios";const i=async()=>{let i=`加载失败`;try{i=(await r.get(`https://api.wuliya.cn/api/image/count?name=${e.Plugin_Name}&type=json`,{timeout:500})).data.data.count}catch{n.error(n.chalk.red.bold(`⚠️ 访问统计数据失败,超时或网络错误`))}await t(),n.info(n.chalk.bold.rgb(0,255,0)(`========= 🌟🌟🌟 =========`)),n.info(n.chalk.bold.blue(`🌍 当前运行环境: `)+n.chalk.bold.white(`${e.Bot_Name}`)+n.chalk.gray(` | `)+n.chalk.bold.green(`🏷️ 运行版本: `)+n.chalk.bold.white(`V${e.Bot_Version}`)+n.chalk.gray(` | `)+n.chalk.bold.yellow(`📊 运行插件总访问/运行次数: `)+n.chalk.bold.cyan(i)),n.info(n.chalk.bold.rgb(255,215,0)(`✨ ${e.Plugin_Name} `)+n.chalk.bold.rgb(255,165,0).italic(e.Plugin_Version)+n.chalk.rgb(255,215,0).bold(` 载入成功 ^_^`)),n.info(n.chalk.green.bold(`=========================`))};export{i as KARIN_PLUGIN_INIT};
1
+ import{t as e}from"./root-C9I_RrRd.js";import{t}from"./db-DZFBXSmG.js";import{logger as n}from"node-karin";import r from"node-karin/axios";const i=async()=>{let i=`加载失败`;try{i=(await r.get(`https://api.wuliya.cn/api/image/count?name=${e.Plugin_Name}&type=json`,{timeout:500})).data.data.count}catch{n.error(n.chalk.red.bold(`⚠️ 访问统计数据失败,超时或网络错误`))}await t(),n.info(n.chalk.bold.rgb(0,255,0)(`========= 🌟🌟🌟 =========`)),n.info(n.chalk.bold.blue(`🌍 当前运行环境: `)+n.chalk.bold.white(`${e.Bot_Name}`)+n.chalk.gray(` | `)+n.chalk.bold.green(`🏷️ 运行版本: `)+n.chalk.bold.white(`V${e.Bot_Version}`)+n.chalk.gray(` | `)+n.chalk.bold.yellow(`📊 运行插件总访问/运行次数: `)+n.chalk.bold.cyan(i)),n.info(n.chalk.bold.rgb(255,215,0)(`✨ ${e.Plugin_Name} `)+n.chalk.bold.rgb(255,165,0).italic(e.Plugin_Version)+n.chalk.rgb(255,215,0).bold(` 载入成功 ^_^`)),n.info(n.chalk.green.bold(`=========================`))};export{i as KARIN_PLUGIN_INIT};
@@ -0,0 +1 @@
1
+ let e=function(e){return e.GitHub=`github`,e.Gitee=`gitee`,e.GitCode=`gitcode`,e.Cnb=`cnb`,e}({}),t=function(e){return e.Push=`push`,e.Issue=`issue`,e}({});export{e as n,t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candriajs/karin-plugin-git",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "description": "一个karin的git平台仓库订阅推送",
5
5
  "keywords": [
6
6
  "karin-plugin",
@@ -43,7 +43,7 @@
43
43
  "es-toolkit": "^1.41.0",
44
44
  "markdown-it": "^14.1.0",
45
45
  "markdown-it-emoji": "^3.0.0",
46
- "nipaw": "npm:@puniyu/nipaw@^1.6.1"
46
+ "nipaw": "npm:@puniyu/nipaw@^1.8.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@karinjs/plugin-puppeteer": "^1.0.21",
@@ -84,4 +84,4 @@
84
84
  }
85
85
  },
86
86
  "packageManager": "pnpm@10.14.0"
87
- }
87
+ }
@@ -1,3 +1,4 @@
1
+ <!doctype html>
1
2
  <html>
2
3
  <head>
3
4
  <meta charset="utf-8" />
@@ -46,10 +46,12 @@
46
46
  <img src="{{_res_path}}/icons/subscription.svg" alt="icon" />
47
47
  </div>
48
48
  <h3 class="card-title">
49
- #git添加[platform]订阅仓库owner/repo[:branch]
49
+ #git添加[platform]订阅仓库owner/repo[:branch] [event]
50
50
  </h3>
51
51
  </div>
52
- <span class="card-desc">添加一个订阅仓库</span>
52
+ <span class="card-desc"
53
+ >添加一个订阅仓库, event可选:push,issue</span
54
+ >
53
55
  </div>
54
56
 
55
57
  <div class="card">
@@ -58,7 +60,7 @@
58
60
  <img src="{{_res_path}}/icons/subscription.svg" alt="icon" />
59
61
  </div>
60
62
  <h3 class="card-title">
61
- #git删除[platform]订阅仓库owner/repo[:branch]
63
+ #git删除[platform]订阅仓库owner/repo[:branch] [event]
62
64
  </h3>
63
65
  </div>
64
66
  <span class="card-desc">删除一个订阅仓库</span>
@@ -73,7 +75,6 @@
73
75
  </div>
74
76
  <span class="card-desc">设置一个平台的访问令牌</span>
75
77
  </div>
76
-
77
78
  </div>
78
79
  </div>
79
80
  {{/if}}
@@ -16,7 +16,7 @@
16
16
  }
17
17
 
18
18
  .markdown-body {
19
- font-family: 'Douyin Sans', 'Noto Color Emoji', sans-serif;
19
+ font-family: 'Douyin Sans', 'Noto Color Emoji', sans-serif;
20
20
  box-sizing: border-box;
21
21
  min-width: 200px;
22
22
  width: 100%;
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1762866623315" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2520" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><path d="M514.279 64.175c58.892 0 115.944 11.042 171.155 33.127s103.675 54.598 145.39 97.54 74.229 91.405 97.54 145.39c23.311 53.984 33.74 111.65 31.286 172.995 2.454 90.792-22.085 173.609-73.615 248.451s-119.011 129.44-202.441 163.793c-83.43 34.354-169.315 42.942-257.653 25.765-88.338-17.177-165.02-57.665-230.047-121.465S89.765 689.289 72.588 599.725 64 423.662 98.354 340.232s89.565-150.297 165.634-200.601 159.499-75.456 250.291-75.456z m0 828.169c49.077 0 96.926-9.815 143.549-29.446 46.623-19.631 87.725-47.236 123.305-82.817 35.581-35.581 63.186-76.682 82.817-123.305 19.631-46.623 29.446-94.473 29.446-143.549 0-78.523-21.471-149.684-64.413-213.484S728.989 189.32 657.828 159.874 513.665 123.68 438.823 139.63s-139.255 50.917-193.239 104.901-88.952 118.399-104.902 193.241-9.202 147.843 20.244 219.005 76.069 128.213 139.869 171.155 134.961 64.412 213.484 64.412z m-69.935-379.117c0-19.631 6.748-36.194 20.244-49.69 13.496-13.496 29.446-20.244 47.85-20.244s34.354 6.748 47.85 20.244c13.496 13.496 20.244 29.446 20.244 47.85s-6.748 34.354-20.244 47.85c-13.496 13.496-29.446 20.244-47.85 20.244s-34.354-6.748-47.85-20.244c-13.496-13.497-20.244-28.833-20.244-46.01z" p-id="2521"></path></svg>
@@ -0,0 +1,229 @@
1
+ @font-face {
2
+ font-family: 'Noto Color Emoji';
3
+ src: url('../fonts/NotoColorEmoji-Regular.woff2') format('woff2');
4
+ }
5
+
6
+ @font-face {
7
+ font-family: 'Smiley Sans';
8
+ src: url('../fonts/SmileySans-Oblique.woff2') format('woff2');
9
+ font-display: swap;
10
+ }
11
+
12
+ @font-face {
13
+ font-family: 'Douyin Sans';
14
+ src: url('../fonts/DouyinSansBold.woff2') format('woff2');
15
+ font-display: swap;
16
+ }
17
+
18
+ * {
19
+ margin: 0;
20
+ padding: 0;
21
+ box-sizing: border-box;
22
+ }
23
+
24
+ .container {
25
+ font-family: 'Douyin Sans', 'Smiley Sans', 'Noto Color Emoji', sans-serif;
26
+ display: flex;
27
+ justify-content: center;
28
+ align-items: flex-start;
29
+ min-height: 100vh;
30
+ min-width: 800px;
31
+ width: 100%;
32
+ padding: 20px;
33
+ background: rgba(200, 200, 200, 0.85);
34
+ }
35
+
36
+ .info-section {
37
+ display: flex;
38
+ flex-direction: column;
39
+ width: 100%;
40
+ max-width: 800px;
41
+ padding: 50px;
42
+ margin: 0 auto;
43
+ }
44
+
45
+ .platform-name {
46
+ display: flex;
47
+ align-items: center;
48
+ justify-content: center;
49
+ gap: 12px;
50
+ margin-bottom: 32px;
51
+ color: #4b5563;
52
+ }
53
+
54
+ .header h2 {
55
+ font-size: 32px;
56
+ font-weight: 700;
57
+ letter-spacing: -0.5px;
58
+ }
59
+
60
+ .issue-card {
61
+ width: 100%;
62
+ background: rgba(248, 250, 255, 0.8);
63
+ border: 1px solid rgba(255, 255, 255, 0.4);
64
+ border-radius: 16px;
65
+ padding: 24px;
66
+ margin-bottom: 24px;
67
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
68
+ }
69
+
70
+ .repo-header {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: 16px;
74
+ width: 100%;
75
+ margin-bottom: 20px;
76
+ }
77
+
78
+ .repo-info {
79
+ display: flex;
80
+ flex-direction: column;
81
+ gap: 8px;
82
+ }
83
+
84
+ .platform-icon img {
85
+ width: 50px;
86
+ height: 50px;
87
+ padding-left: 5px;
88
+ }
89
+
90
+ .repo-name {
91
+ font-size: 25px;
92
+ font-weight: 800;
93
+ color: #0f0f23;
94
+ letter-spacing: -0.3px;
95
+ }
96
+
97
+ .issue-info {
98
+ background: rgba(59, 130, 246, 0.1);
99
+ border: 1px solid rgba(59, 130, 246, 0.2);
100
+ border-radius: 12px;
101
+ padding: 16px;
102
+ margin-top: 16px;
103
+ display: flex;
104
+ align-items: flex-start;
105
+ gap: 12px;
106
+ flex-direction: column;
107
+ overflow: hidden;
108
+ backdrop-filter: blur(10px);
109
+ }
110
+
111
+ .avatar-info {
112
+ display: flex;
113
+ align-items: center;
114
+ gap: 8px;
115
+ flex-wrap: wrap;
116
+ width: 100%;
117
+ }
118
+
119
+ .avatar-info img {
120
+ width: 40px;
121
+ height: 40px;
122
+ border-radius: 50%;
123
+ border: 3px solid rgba(255, 255, 255, 0.9);
124
+ object-fit: cover;
125
+ background-color: #fff;
126
+ display: block;
127
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
128
+ }
129
+
130
+ .author-info span {
131
+ white-space: nowrap;
132
+ overflow: hidden;
133
+ text-overflow: ellipsis;
134
+ color: #2d3748;
135
+ font-size: 14px;
136
+ }
137
+
138
+ .status-tag {
139
+ display: inline-block;
140
+ padding: 6px 20px;
141
+ border-radius: 20px;
142
+ font-size: 15px;
143
+ font-weight: 600;
144
+ margin-left: 10px;
145
+ white-space: nowrap;
146
+ }
147
+
148
+ .status-tag.opened {
149
+ background-color: rgba(34, 197, 94, 0.2);
150
+ color: #16a34a;
151
+ border: 1px solid rgba(34, 197, 94, 0.3);
152
+ }
153
+
154
+ .status-tag.closed {
155
+ background-color: rgba(147, 51, 234, 0.2);
156
+ color: #9333ea;
157
+ border: 1px solid rgba(147, 51, 234, 0.3);
158
+ }
159
+
160
+ .time-info {
161
+ color: #718096;
162
+ background: rgba(158, 158, 158, 0.2);
163
+ font-size: 13px;
164
+ margin-left: auto;
165
+ white-space: nowrap;
166
+ flex-shrink: 0;
167
+ padding: 6px 12px;
168
+ border-radius: 15px;
169
+ text-align: right;
170
+ }
171
+
172
+ .issue-icon img {
173
+ width: 24px;
174
+ height: 24px;
175
+ filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
176
+ }
177
+
178
+ .issue-message {
179
+ margin-top: 16px;
180
+ background: rgba(34, 197, 94, 0.08);
181
+ border-left: 4px solid #22c55e;
182
+ border-radius: 12px;
183
+ padding: 18px;
184
+ backdrop-filter: blur(10px);
185
+ border: 1px solid rgba(34, 197, 94, 0.2);
186
+ }
187
+
188
+ .issue-title {
189
+ display: flex;
190
+ align-items: center;
191
+ gap: 12px;
192
+ min-width: 0;
193
+ width: 100%;
194
+ color: #1f2937;
195
+ font-size: 15px;
196
+ font-weight: 600;
197
+ }
198
+
199
+ .commit-title > span:first-child {
200
+ flex: 1 1 auto;
201
+ min-width: 0;
202
+ width: auto;
203
+ text-overflow: ellipsis;
204
+ padding-right: 16px;
205
+ word-break: break-word;
206
+ color: #0f0f23;
207
+ }
208
+
209
+ .issue-icon {
210
+ display: inline-flex;
211
+ flex-shrink: 0;
212
+ }
213
+
214
+ .issue-divider {
215
+ height: 1px;
216
+ background: rgba(0, 0, 0, 0.2);
217
+ width: 100%;
218
+ margin-top: 12px;
219
+ margin-bottom: 12px;
220
+ }
221
+
222
+ .issue-content {
223
+ padding-left: 0;
224
+ padding-top: 8px;
225
+ white-space: pre-line;
226
+ color: #4b5563;
227
+ font-size: 14px;
228
+ line-height: 1.6;
229
+ }
@@ -0,0 +1,79 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width" />
6
+ <link
7
+ href="{{_res_path}}/issue/index.css"
8
+ rel="stylesheet"
9
+ type="text/css"
10
+ />
11
+ </head>
12
+
13
+ <body>
14
+ <div class="container" id="container">
15
+ <div class="info-section">
16
+ <div class="platform-name">
17
+ {{if platform === 'github'}}
18
+ <h2>GitHub 议题变更推送</h2>
19
+ {{else if platform === 'gitee'}}
20
+ <h2>Gitee 议题变更推送</h2>
21
+ {{else if platform === 'gitcode'}}
22
+ <h2>GitCode 议题变更推送</h2>
23
+ {{else if platform === 'cnb'}}
24
+ <h2>Cnb 议题变更推送</h2>
25
+ {{else}}
26
+ <h2>GitHub 议题变更推送</h2>
27
+ {{/if}}
28
+ </div>
29
+
30
+ <div class="issue-card">
31
+ <div class="repo-header">
32
+ <div class="platform-icon">
33
+ {{if platform === 'github'}}
34
+ <img src="{{_res_path}}/icons/github.svg" alt="GitHub Logo" />
35
+ {{else if platform === 'gitee'}}
36
+ <img src="{{_res_path}}/icons/gitee.svg" alt="Gitee Logo" />
37
+ {{else if platform === 'gitcode'}}
38
+ <img src="{{_res_path}}/icons/gitcode.svg" alt="Gitcode Logo" />
39
+ {{else if platform === 'cnb'}}
40
+ <img src="{{_res_path}}/icons/cnb.svg" alt="Cnb Logo" />
41
+ {{else}}
42
+ <img src="{{_res_path}}/icons/github.svg" alt="GitHub Logo" />
43
+ {{/if}}
44
+ </div>
45
+ <div class="repo-info">
46
+ <div class="repo-name">{{issue.owner}}/{{issue.repo}}</div>
47
+ </div>
48
+ </div>
49
+
50
+ <div class="issue-info">
51
+ <div class="avatar-info">
52
+ <img src="{{issue.user.avatarUrl}}" alt="Author Avatar" />
53
+ <span>由 {{issue.user.name}} 创建</span>
54
+ {{if issue.state === 'Opened'}}
55
+ <span class="status-tag opened">已开放</span>
56
+ {{else}}
57
+ <span cla ss="status-tag closed">已关闭</span>
58
+ {{/if}}
59
+ <span class="time-info">{{issue.issueDate}}</span>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="issue-message">
64
+ <div class="issue-title">
65
+ <div class="issue-icon">
66
+ <img src="{{_res_path}}/icons/issue.svg" alt="Issue Icon" />
67
+ </div>
68
+ <span>{{@issue.title}}</span>
69
+ </div>
70
+ <div class="issue-divider"></div>
71
+ {{if issue.body }}
72
+ <div class="issue-content">{{@issue.body}}</div>
73
+ · {{/if}}
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </body>
79
+ </html>
@@ -1 +0,0 @@
1
- import{t as e}from"./root-C9I_RrRd.js";import t,{YamlEditor as n,copyConfigSync as r,filesByExt as i,getFiles as a,karinPathBase as o,requireFileSync as s,segment as c,watch as l}from"node-karin";import u from"node:path";import{full as d}from"markdown-it-emoji";import{tasklist as f}from"@mdit/plugin-tasklist";import p from"markdown-it";import{isEmpty as m}from"es-toolkit/compat";import{CnbClient as h,GitCodeClient as g,GiteeClient as _,GithubClient as v}from"nipaw";var y=class{dirCfgPath;defCfgPath;constructor(){this.dirCfgPath=`${o}/${e.Plugin_Name}/config/`,this.defCfgPath=`${e.Plugin_Path}/config/defSet/`}initCfg(){r(this.defCfgPath,this.dirCfgPath);let e=i(this.dirCfgPath,`.yaml`,`name`);for(let t of e){let e=new n(`${this.dirCfgPath}/${t}`),r=new n(`${this.defCfgPath}/${t}`),{differences:i,result:a}=this.mergeObjectsWithPriority(e,r);i&&a.save()}return i(this.dirCfgPath,`.yaml`,`abs`).forEach(e=>l(e,(e,t)=>{})),this}getDefOrConfig(e){let t=this.getYaml(`defSet`,e),n=this.getYaml(`config`,e);return{...t,...n}}All(){let e={};return a(this.defCfgPath,[`.yaml`]).forEach(t=>{let n=u.basename(t,`.yaml`);e[n]=this.getDefOrConfig(n)??{}}),e}getYaml(e,t){return s(e===`config`?`${this.dirCfgPath}/${t}.yaml`:`${this.defCfgPath}/${t}.yaml`,{force:!0})}Modify(e,t,r,i=`config`){let a=new n(i===`config`?`${this.dirCfgPath}/${e}.yaml`:`${this.defCfgPath}/${e}.yaml`);a.set(t,r),a.save()}mergeObjectsWithPriority(e,t){let n=!1;return((t,r)=>{let i=r.get(t),a=e.get(t);if(typeof a==`object`&&typeof i==`object`)for(let r in i)r in a||(n=!0,e.set(`${t?`${t}.`:``}${r}`,i[r]))})(``,t),{differences:n,result:e}}};const b=new Proxy(Object.assign(new y().initCfg(),{}),{get(e,t){return t in e?Reflect.get(e,t):e.getDefOrConfig(t)}});function x(e=1){return e*=1.5,`style=transform:scale(${e})`}const S={async render(n,r={}){n=n.replace(/.html$/,``);let i=`${e.Plugin_Path}/resources`,a=await t.render({type:`jpeg`,encoding:`base64`,name:u.basename(n),file:`${i}/${n}.html`,data:{_res_path:`${e.Plugin_Path}/resources`.replace(/\\/g,`/`),defaultLayout:`${e.Plugin_Path}/resources/common/layout/default.html`.replace(/\\/g,`/`),sys:{scale:x(r.scale??1)},copyright:`${e.Bot_Name}<span class="version"> ${e.Bot_Version}</span> & ${e.Plugin_Name}<span class="version"> ${e.Plugin_Version}`,...r},screensEval:`#containter`,multiPage:12e3,pageGotoParams:{waitUntil:`networkidle0`,timeout:6e4}});return c.image(`${a.includes(`base64://`)?a:`base64://${a}`}`)},async markdown(e){let t=new p({html:!0,breaks:!0});return t.use(d),t.use(f),t.renderer.rules.bullet_list_open=()=>`<ul style="list-style: none;">`,Promise.resolve(t.render(e))}},C=()=>{let e=new v;return m(b.github.proxy)||e.setProxy(b.github.proxy),m(b.github.token)||e.setToken(b.github.token),e},w=()=>{let e=new _;return m(b.gitee.proxy)||e.setProxy(b.gitee.proxy),m(b.gitee.token)||e.setToken(b.gitee.token),e},T=()=>{let e=new g;return m(b.gitcode.proxy)||e.setProxy(b.gitcode.proxy),m(b.gitcode.token)||e.setToken(b.gitcode.token),e},E=()=>{let e=new h;return m(b.cnb.proxy)||e.setProxy(b.cnb.proxy),m(b.cnb.token)||e.setToken(b.cnb.token),e};export{S as a,C as i,T as n,b as o,w as r,E as t};
@@ -1,23 +0,0 @@
1
- import{t as e}from"./root-C9I_RrRd.js";import{karinPathBase as t}from"node-karin";import n from"node-karin/sqlite3";async function r(e,t,n){await(await d()).run(`INSERT INTO push (platform,repoId, branch) VALUES (?, ?, ?)`,[e,t,n])}async function i(){let e=await d();return await new Promise((t,n)=>{e.all(`SELECT * FROM push`,[],(e,r)=>{e?n(e):t(r)})})}async function a(e,t,n){let r=await d();return await new Promise((i,a)=>{r.get(`SELECT * FROM push WHERE platform = ? AND repoId = ? AND branch = ?`,[e,t,n],(e,t)=>{e?a(e):i(t)})})}async function o(e,t,n){let r=await d();await new Promise((i,a)=>{r.run(`DELETE FROM push WHERE platform = ? AND repoId = ? AND branch = ?`,[e,t,n],e=>{e?a(e):i()})})}async function s(e,t,n,r){await(await d()).run(`UPDATE push SET commitSha = ? WHERE platform = ? AND repoId = ? AND branch = ?`,[r,e,t,n])}async function c(e,t,n,r){await(await d()).run(`INSERT INTO repo (owner, repo, botId, groupId) VALUES (?, ?, ?, ?)`,[n,r,e,t])}async function l(...e){let t=await d();if(e.length===1){let[n]=e;return await new Promise((e,r)=>{t.get(`SELECT * FROM repo WHERE id = ?`,[n],(t,n)=>{t?r(t):e(n)})})}else{let[n,r,i,a]=e;return await new Promise((e,o)=>{t.get(`SELECT * FROM repo WHERE owner = ? AND repo = ? AND botId = ? AND groupId = ?`,[i,a,n,r],(t,n)=>{t?o(t):e(n)})})}}let u=null;const d=async()=>{if(!u){let r=`${t}/${e.Plugin_Name}/data`;u=new n.Database(`${r}/data.db`)}return u},f=async()=>{let e=await d();e.exec(`
2
- CREATE TABLE IF NOT EXISTS repo (
3
- id INTEGER PRIMARY KEY AUTOINCREMENT,
4
- owner TEXT NOT NULL,
5
- repo TEXT NOT NULL,
6
- botId TEXT NOT NULL,
7
- groupId TEXT NOT NULL,
8
- createdAt DATETIME DEFAULT (datetime('now', 'localtime')),
9
- updatedAt DATETIME DEFAULT (datetime('now', 'localtime')),
10
- UNIQUE(owner, repo, botId, groupId)
11
- )
12
- `),e.exec(`
13
- CREATE TABLE IF NOT EXISTS push (
14
- id INTEGER PRIMARY KEY AUTOINCREMENT,
15
- repoId INTEGER NOT NULL,
16
- platform TEXT NOT NULL,
17
- branch TEXT NOT NULL,
18
- commitSha TEXT,
19
- createdAt DATETIME DEFAULT (datetime('now', 'localtime')),
20
- updatedAt DATETIME DEFAULT (datetime('now', 'localtime')),
21
- FOREIGN KEY (repoId) REFERENCES repo(id) ON DELETE CASCADE
22
- )
23
- `),e.exec(`CREATE INDEX IF NOT EXISTS idx_repo_lookup ON repo(botId, groupId)`),e.exec(`CREATE INDEX IF NOT EXISTS idx_push_repo ON push(repoId)`),e.exec(`CREATE INDEX IF NOT EXISTS idx_push_platform ON push(platform)`)};export{i as a,s as c,r as i,c as n,a as o,l as r,o as s,f as t};
@@ -1 +0,0 @@
1
- let e=function(e){return e.GitHub=`github`,e.Gitee=`gitee`,e.GitCode=`gitcode`,e.Cnb=`cnb`,e}({});export{e as t};