@candriajs/karin-plugin-git 1.4.0 → 1.8.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 +159 -0
- package/README.md +3 -3
- package/lib/apps/admin.js +1 -1
- package/lib/apps/commit.js +3 -3
- package/lib/apps/help.js +1 -1
- package/lib/apps/push.js +1 -1
- package/lib/apps/release.js +1 -0
- package/lib/common-DKsRuZTK.js +235 -0
- package/lib/{db-DhpZxiAN.js → db-DRx0_etZ.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/models-ovIphdkj.js +3 -0
- package/lib/web.config.js +1 -1
- package/package.json +2 -2
- package/lib/common-DJ-f21cV.js +0 -250
- package/lib/models-qDLDUVt0.js +0 -3
- /package/resources/{background.webp → images/background.webp} +0 -0
- /package/resources/{repo.svg → images/repo.svg} +0 -0
- /package/resources/{icons → images}/subscription.svg +0 -0
- /package/resources/{icons → images}/token.svg +0 -0
package/lib/models-qDLDUVt0.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,p as n,r,u as i}from"./db-DhpZxiAN.js";import{i as a,n as o,r as s,t as c}from"./common-DJ-f21cV.js";import{components as l,contactGroup as u,getBot as d,logger as f}from"node-karin";import{isEmpty as p}from"es-toolkit/compat";import{CnbClient as m,GitCodeClient as h,GiteeClient as g,GithubClient as _}from"nipaw";const v=()=>{let e=new _;return p(a.proxy.reverseProxy)?p(a.proxy.proxy)||e.setProxy(a.proxy.proxy):e.setReverseProxy(a.proxy.reverseProxy),p(a.token.github)||e.setToken(a.token.github),e},y=()=>{let e=new g;return p(a.proxy.proxy)||e.setProxy(a.proxy.proxy),p(a.token.gitee)||e.setToken(a.token.gitee),e},b=()=>{let e=new h;return p(a.proxy.proxy)||e.setProxy(a.proxy.proxy),p(a.token.gitcode)||e.setToken(a.token.gitcode),e},x=()=>{let e=new m;return p(a.proxy.proxy)||e.setProxy(a.proxy.proxy),p(a.token.cnbcool)||e.setToken(a.token.cnbcool),e};var S=class{platform;client;constructor(e,t){this.platform=e,this.client=t}async action(){let[a,o]=await Promise.all([r(),i()]),s=a.filter(e=>e.platform===this.platform).map(e=>e.id),l=o.filter(e=>s.includes(e.repoId)),p=this.client.commit();l.forEach(async r=>{let i=await t(r.id);f.debug(`开始处理 ${this.platform} ${i.owner}/${i.repo} ${r.branch}}`);let a=await e(r.sessionId),o=await p.info({owner:i.owner,repo:i.repo},r.branch);if(o.sha===r.commitSha)return;let s=d(a.botId);if(!s)throw Error(`Bot ${a.botId} not found`);let l=o.commit.message.split(`
|
|
2
|
-
`),m={owner:i.owner,repo:i.repo,branch:r.branch,sha:o.sha,author:o.commit.author,committer:o.commit.committer,title:l[0],content:l.slice(1).join(`
|
|
3
|
-
`),stats:o.stats,files:o.files},h=await c.commit(this.platform,m),g=u(a.groupId);await s.sendMsg(g,[h]),await n(r.repoId,r.sessionId,r.branch,o.sha)})}},C=class extends S{constructor(){super(s.GitHub,v())}};const w=e=>[l.accordion.create(`github`,{label:`Github 相关`,children:[l.accordion.createItem(`config:github`,{title:`Github 相关`,subtitle:`Github 相关配置`,children:[l.input.string(`cron`,{label:`推送任务执行时间`,description:`推送任务执行时间`,placeholder:`请输入推送任务Cron 表达式`,defaultValue:a.github.cron})]})]}),l.accordionPro.create(`pushlist:github`,e.map(e=>({title:`${e.owner}/${e.repo}:${e.branch}`,subtitle:`${e.botId}:${e.groupId}`,...e})),{label:`Github 推送仓库列表`,children:l.accordion.createItem(`accordion-item-github`,{children:[l.input.string(`owner`,{label:`仓库所有者`,placeholder:`请输入 Github 仓库所有者`}),l.input.string(`repo`,{label:`仓库名称`,placeholder:`请输入 Github 仓库名称`}),l.input.string(`branch`,{label:`仓库分支`,placeholder:`请输入 Github 仓库分支`}),l.input.string(`botId`,{label:`推送机器人`,placeholder:`请输入 推送机器人账号`}),l.input.string(`groupId`,{label:`推送群组`,placeholder:`请输入 推送群组ID`}),l.checkbox.group(`event`,{label:`推送事件`,checkbox:[l.checkbox.create(`event:push`,{label:`push`,value:o.Push}),l.checkbox.create(`event:release`,{label:`release`,value:o.Release,isDisabled:!0})]})]})})];var T=class extends S{constructor(){super(s.Gitee,y())}};const E=e=>[l.accordion.create(`gitee`,{label:`Gitee 相关`,children:[l.accordion.createItem(`config:gitee`,{title:`Gitee 相关`,subtitle:`Gitee 相关配置`,children:[l.input.string(`cron`,{label:`推送任务执行时间`,description:`推送任务执行时间`,placeholder:`请输入推送任务Cron 表达式`,defaultValue:a.gitee.cron})]})]}),l.accordionPro.create(`pushlist:gitee`,e.map(e=>({title:`${e.owner}/${e.repo}:${e.branch}`,...e})),{label:`Gitee 推送仓库列表`,children:l.accordion.createItem(`accordion-item-gitee`,{subtitle:`Gitee 仓库`,children:[l.input.string(`owner`,{label:`仓库所有者`,placeholder:`请输入 Gitee 仓库所有者`}),l.input.string(`repo`,{label:`仓库名称`,placeholder:`请输入 Gitee 仓库名称`}),l.input.string(`branch`,{label:`仓库分支`,placeholder:`请输入 Gitee 仓库分支`,isRequired:!0}),l.checkbox.group(`event`,{label:`推送事件`,checkbox:[l.checkbox.create(`event:push`,{label:`push`,value:o.Push}),l.checkbox.create(`event:release`,{label:`release`,value:o.Release,isDisabled:!0})]})]})})];var D=class extends S{constructor(){super(s.GitCode,b())}};const O=e=>[l.accordion.create(`gitcode`,{label:`GitCode 相关`,children:[l.accordion.createItem(`config:gitcode`,{title:`GitCode 相关`,subtitle:`GitCode 相关配置`,children:[l.input.string(`cron`,{label:`推送任务执行时间`,description:`推送任务执行时间`,placeholder:`请输入推送任务Cron 表达式`,defaultValue:a.gitcode.cron})]})]}),l.accordionPro.create(`pushlist:gitcode`,e.map(e=>({title:`${e.owner}/${e.repo}:${e.branch}`,...e})),{label:`GitCode 推送仓库列表`,children:l.accordion.createItem(`accordion-item-gitcode`,{subtitle:`GitCode 仓库`,children:[l.input.string(`owner`,{label:`仓库所有者`,placeholder:`请输入 GitCode 仓库所有者`}),l.input.string(`repo`,{label:`仓库名称`,placeholder:`请输入 GitCode 仓库名称`}),l.input.string(`branch`,{label:`仓库分支`,placeholder:`请输入 GitCode 仓库分支`}),l.checkbox.group(`event`,{label:`推送事件`,checkbox:[l.checkbox.create(`event:push`,{label:`push`,value:o.Push}),l.checkbox.create(`event:release`,{label:`release`,value:o.Release,isDisabled:!0})]})]})})];var k=class extends S{constructor(){super(s.CnbCool,x())}};const A=e=>[l.accordion.create(`cnbcool`,{label:`CnbCool 相关`,children:[l.accordion.createItem(`config:gitcode`,{title:`CnbCool 相关`,subtitle:`CnbCool 相关配置`,children:[l.input.string(`cron`,{label:`推送任务执行时间`,description:`推送任务执行时间`,placeholder:`请输入推送任务Cron 表达式`,defaultValue:a.cnbcool.cron})]})]}),l.accordionPro.create(`pushlist:cnbcool`,e.map(e=>({title:`${e.owner}/${e.repo}:${e.branch}`,...e})),{label:`CnbCool 推送仓库列表`,children:l.accordion.createItem(`accordion-item-cnbcoool`,{subtitle:`CnbCool 仓库`,children:[l.input.string(`owner`,{label:`仓库所有者`,placeholder:`请输入 CnbCool 仓库所有者`}),l.input.string(`repo`,{label:`仓库名称`,placeholder:`请输入 CnbCool 仓库名称`}),l.input.string(`branch`,{label:`仓库分支`,placeholder:`请输入 CnbCool 仓库分支`}),l.checkbox.group(`event`,{label:`推送事件`,checkbox:[l.checkbox.create(`event:push`,{label:`push`,value:o.Push}),l.checkbox.create(`event:release`,{label:`release`,value:o.Release,isDisabled:!0})]})]})})];export{E as a,C as c,y as d,v as f,D as i,x as l,k as n,T as o,O as r,w as s,A as t,b as u};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|