diff --git a/package.json b/package.json index 338e586a..a45fee11 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "start:admin": "cd server/admin && pnpm start", "build": "concurrently npm:build:web npm:build:server npm:build:admin && cp -r client/web/dist/* server/dist/public && cp -r client/web/dist/* server/dist/public", "build:web": "cd client/web && pnpm build", - "build:server": "cd server && pnpm build && echo \"Install server side plugin:\" && pnpm run plugin:install com.msgbyte.tasks com.msgbyte.linkmeta com.msgbyte.github com.msgbyte.simplenotify com.msgbyte.topic com.msgbyte.agora && mkdir -p ./dist/public && cp -r ./public/plugins ./dist/public && cp ./public/registry-be.json ./dist/public", + "build:server": "cd server && pnpm build && echo \"Install server side plugin:\" && pnpm run plugin:install com.msgbyte.tasks com.msgbyte.linkmeta com.msgbyte.github com.msgbyte.simplenotify com.msgbyte.topic com.msgbyte.agora com.msgbyte.wxpusher && mkdir -p ./dist/public && cp -r ./public/plugins ./dist/public && cp ./public/registry-be.json ./dist/public", "build:admin": "cd server/admin && pnpm build", "check:type": "concurrently npm:check:type:client npm:check:type:server", "check:type:client": "cd client/web && tsc --noEmit", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74a1ab7d..0d972639 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1942,6 +1942,12 @@ importers: mini-star: specifier: '*' version: 1.3.1 + normalize-path: + specifier: ^3.0.0 + version: 3.0.0 + rollup-plugin-copy: + specifier: ^3.4.0 + version: 3.4.0 server/plugins/com.msgbyte.wxpusher/web/plugins/com.msgbyte.wxpusher: devDependencies: @@ -13506,7 +13512,7 @@ packages: /@types/connect@3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 15.14.9 + '@types/node': 18.15.12 /@types/content-disposition@0.5.5: resolution: {integrity: sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA==} @@ -22079,7 +22085,7 @@ packages: peerDependencies: glob: '*' dependencies: - '@types/glob': 8.0.0 + '@types/glob': 8.1.0 glob: 7.2.3 dev: true @@ -22226,7 +22232,7 @@ packages: dir-glob: 3.0.1 fast-glob: 3.2.12 glob: 7.2.3 - ignore: 5.2.1 + ignore: 5.2.4 merge2: 1.4.1 slash: 3.0.0 dev: true @@ -23305,11 +23311,6 @@ packages: engines: {node: '>= 4'} dev: true - /ignore@5.2.1: - resolution: {integrity: sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA==} - engines: {node: '>= 4'} - dev: true - /ignore@5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} diff --git a/server/plugins/com.msgbyte.wxpusher/.ministarrc.js b/server/plugins/com.msgbyte.wxpusher/.ministarrc.js index 3c4db179..f7b2da78 100644 --- a/server/plugins/com.msgbyte.wxpusher/.ministarrc.js +++ b/server/plugins/com.msgbyte.wxpusher/.ministarrc.js @@ -1,4 +1,9 @@ const path = require('path'); +const copy = require('rollup-plugin-copy'); +const normalize = require('normalize-path'); + +const pluginRoot = path.resolve(__dirname, './web'); +const outDir = path.resolve(__dirname, '../../public'); module.exports = { externalDeps: [ @@ -9,6 +14,24 @@ module.exports = { 'zustand', 'zustand/middleware/immer', ], - pluginRoot: path.resolve(__dirname, './web'), - outDir: path.resolve(__dirname, '../../public'), + pluginRoot, + outDir, + rollupPlugins: ({ pluginName }) => [ + copy({ + targets: [ + { + src: path.resolve( + pluginRoot, + `./plugins/${pluginName}`, + './assets/**/*' + ), + dest: path.resolve(outDir, `./plugins/${pluginName}/assets/`), + }, + ].map((item) => ({ + // For windows + src: normalize(item.src), + dest: normalize(item.dest, false), + })), + }), + ], }; diff --git a/server/plugins/com.msgbyte.wxpusher/package.json b/server/plugins/com.msgbyte.wxpusher/package.json index f4f905c4..fc2717e6 100644 --- a/server/plugins/com.msgbyte.wxpusher/package.json +++ b/server/plugins/com.msgbyte.wxpusher/package.json @@ -12,7 +12,9 @@ }, "devDependencies": { "@types/react": "18.0.20", - "mini-star": "*" + "mini-star": "*", + "normalize-path": "^3.0.0", + "rollup-plugin-copy": "^3.4.0" }, "dependencies": { "got": "^11.8.3", diff --git a/server/plugins/com.msgbyte.wxpusher/services/wxpusher.service.ts b/server/plugins/com.msgbyte.wxpusher/services/wxpusher.service.ts index b5416f6f..2d29e69b 100644 --- a/server/plugins/com.msgbyte.wxpusher/services/wxpusher.service.ts +++ b/server/plugins/com.msgbyte.wxpusher/services/wxpusher.service.ts @@ -51,7 +51,7 @@ class WxpusherService extends TcService { let title = 'new'; if (message.groupId) { const groupInfo = await call(ctx).getGroupInfo(message.groupId); - title = groupInfo.name; + title = `来自群组: ${groupInfo.name}`; // 因为wxpusher插件仅适用于中国大陆,因此仅需要中文即可 } const content = message.messagePlainContent ?? message.messageSnippet; // 优先使用去节点的内容 diff --git a/server/plugins/com.msgbyte.wxpusher/web/plugins/com.msgbyte.wxpusher/assets/icon.png b/server/plugins/com.msgbyte.wxpusher/web/plugins/com.msgbyte.wxpusher/assets/icon.png new file mode 100644 index 00000000..2ad6ec33 Binary files /dev/null and b/server/plugins/com.msgbyte.wxpusher/web/plugins/com.msgbyte.wxpusher/assets/icon.png differ diff --git a/server/plugins/com.msgbyte.wxpusher/web/plugins/com.msgbyte.wxpusher/manifest.json b/server/plugins/com.msgbyte.wxpusher/web/plugins/com.msgbyte.wxpusher/manifest.json index 01e31414..14d04b8b 100644 --- a/server/plugins/com.msgbyte.wxpusher/web/plugins/com.msgbyte.wxpusher/manifest.json +++ b/server/plugins/com.msgbyte.wxpusher/web/plugins/com.msgbyte.wxpusher/manifest.json @@ -2,6 +2,7 @@ "label": "wxpusher", "name": "com.msgbyte.wxpusher", "url": "{BACKEND}/plugins/com.msgbyte.wxpusher/index.js", + "icon": "{BACKEND}/plugins/com.msgbyte.wxpusher/assets/icon.png", "version": "0.0.0", "author": "moonrailgun", "description": "Add support for wxpusher to notify user",