wechaty-web-panel 1.6.12 → 1.6.14

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,9 +1,10 @@
1
1
  ## 更新日志
2
2
 
3
- ### V1.6.12(2023-07-23)
3
+ ### V1.6.14(2023-07-23)
4
4
  1、修复自定义对话更新配置问题
5
5
  2、添加rss订阅功能
6
6
  3、优化登录判断
7
+ 4、添加更新提醒
7
8
 
8
9
  ### V1.6.11(2023-06-09)
9
10
  1、修复dify角色设置bug
@@ -6,16 +6,21 @@ const mqtt_js_1 = require("../proxy/mqtt.js");
6
6
  const configDb_js_1 = require("../db/configDb.js");
7
7
  const puppetDb_js_1 = require("../db/puppetDb.js");
8
8
  const puppet_type_js_1 = require("../const/puppet-type.js");
9
+ const package_json_js_1 = require("../package-json.js");
9
10
  /**
10
11
  * 登录成功监听事件
11
12
  * @param {*} user 登录用户
12
13
  */
13
14
  async function onLogin(user) {
14
15
  try {
16
+ const lastVersion = await (0, aibotk_js_1.getPanelVersion)();
15
17
  console.log(`
16
18
  ==========================================================
17
19
  贴心AI助理${user}登录了
18
- 你正在使用的是:${puppet_type_js_1.PUPPET_MAP[this.puppet.constructor.name]}!
20
+ 你正在使用的是: ${puppet_type_js_1.PUPPET_MAP[this.puppet.constructor.name]}!
21
+ 最新插件版本: ${lastVersion}
22
+ 你的插件版本: ${package_json_js_1.packageJson.version}
23
+ ${lastVersion !== package_json_js_1.packageJson.version ? '请及时更新插件,才能体验最新功能' : ''}
19
24
  ==========================================================
20
25
  `);
21
26
  await (0, puppetDb_js_1.updatePuppetConfig)({ puppetType: this.puppet.constructor.name });
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
6
6
  */
7
7
  exports.packageJson = {
8
8
  "name": "wechaty-web-panel",
9
- "version": "1.6.12",
9
+ "version": "1.6.14",
10
10
  "description": "智能微秘书插件",
11
11
  "exports": {
12
12
  ".": {
@@ -20,6 +20,11 @@ export function getGptConfig(): Promise<any>;
20
20
  * @return {Promise<*>}
21
21
  */
22
22
  export function getRssConfig(): Promise<any>;
23
+ /**
24
+ * 更新插件版本信息
25
+ * @param {*} version
26
+ */
27
+ export function getPanelVersion(): Promise<any>;
23
28
  declare namespace _default {
24
29
  export { getConfig };
25
30
  export { getScheduleList };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPromotInfo = exports.updateChatRecord = exports.getFireNews = exports.getMaterial = exports.getOne = exports.getMeiNv = exports.getMqttConfig = exports.updatePanelVersion = exports.asyncData = exports.sendRoom = exports.sendFriend = exports.putqn = exports.sendRobotInfo = exports.sendHeartBeat = exports.setQrCode = exports.updateSchedule = exports.setSchedule = exports.getScheduleList = exports.getConfig = exports.getRssConfig = exports.getGptConfig = exports.getWordCloud = exports.getWordCloudConfig = exports.getWordCloudRoom = void 0;
3
+ exports.getPromotInfo = exports.updateChatRecord = exports.getFireNews = exports.getMaterial = exports.getOne = exports.getMeiNv = exports.getMqttConfig = exports.updatePanelVersion = exports.asyncData = exports.sendRoom = exports.sendFriend = exports.putqn = exports.sendRobotInfo = exports.sendHeartBeat = exports.setQrCode = exports.updateSchedule = exports.setSchedule = exports.getScheduleList = exports.getConfig = exports.getPanelVersion = exports.getRssConfig = exports.getGptConfig = exports.getWordCloud = exports.getWordCloudConfig = exports.getWordCloudRoom = void 0;
4
4
  const superagent_js_1 = require("./superagent.js");
5
5
  const configDb_js_1 = require("../db/configDb.js");
6
6
  const package_json_js_1 = require("../package-json.js");
@@ -531,7 +531,7 @@ async function updatePanelVersion() {
531
531
  let option = {
532
532
  method: 'POST',
533
533
  url: '/webPanel/version',
534
- params: { version: package_json_js_1.packageJson.version || '0.2.11' },
534
+ params: { version: package_json_js_1.packageJson.version || '' },
535
535
  };
536
536
  console.log('更新插件版本号', package_json_js_1.packageJson.version);
537
537
  let content = await (0, superagent_js_1.aiBotReq)(option);
@@ -542,6 +542,24 @@ async function updatePanelVersion() {
542
542
  }
543
543
  }
544
544
  exports.updatePanelVersion = updatePanelVersion;
545
+ /**
546
+ * 更新插件版本信息
547
+ * @param {*} version
548
+ */
549
+ async function getPanelVersion() {
550
+ try {
551
+ let option = {
552
+ method: 'GET',
553
+ url: '/webPanel/version',
554
+ };
555
+ let content = await (0, superagent_js_1.aiBotReq)(option);
556
+ return content.data.version;
557
+ }
558
+ catch (error) {
559
+ console.log('error', error);
560
+ }
561
+ }
562
+ exports.getPanelVersion = getPanelVersion;
545
563
  /**
546
564
  * 获取mqtt信息
547
565
  * @param {*} version
@@ -13,13 +13,8 @@ const puppet_type_js_1 = require("../const/puppet-type.js");
13
13
  const dayjs_1 = __importDefault(require("dayjs"));
14
14
  async function getRssContent(info) {
15
15
  try {
16
- const parser = new rss_parser_1.default({
17
- xml2js: {
18
- strict: false,
19
- trim: true,
20
- normalize: true,
21
- }
22
- });
16
+ const parser = new rss_parser_1.default();
17
+ console.log('订阅源:' + info.rssUrl);
23
18
  const feed = await parser.parseURL(info.rssUrl);
24
19
  const lastItem = await (0, rssHistory_js_1.getRssHistoryById)(info.id);
25
20
  // 当存在文章的时候
@@ -1,19 +1,24 @@
1
- import { getConfig, sendRobotInfo, putqn, setQrCode, updatePanelVersion } from '../proxy/aibotk.js';
1
+ import { getConfig, sendRobotInfo, putqn, setQrCode, updatePanelVersion, getPanelVersion } from '../proxy/aibotk.js';
2
2
  import { addUser } from '../db/userDb.js';
3
3
  import { initMqtt } from '../proxy/mqtt.js';
4
4
  import { allConfig } from '../db/configDb.js';
5
5
  import { updatePuppetConfig } from "../db/puppetDb.js";
6
6
  import { PUPPET_MAP } from '../const/puppet-type.js';
7
+ import { packageJson } from '../package-json.js';
7
8
  /**
8
9
  * 登录成功监听事件
9
10
  * @param {*} user 登录用户
10
11
  */
11
12
  async function onLogin(user) {
12
13
  try {
14
+ const lastVersion = await getPanelVersion();
13
15
  console.log(`
14
16
  ==========================================================
15
17
  贴心AI助理${user}登录了
16
- 你正在使用的是:${PUPPET_MAP[this.puppet.constructor.name]}!
18
+ 你正在使用的是: ${PUPPET_MAP[this.puppet.constructor.name]}!
19
+ 最新插件版本: ${lastVersion}
20
+ 你的插件版本: ${packageJson.version}
21
+ ${lastVersion !== packageJson.version ? '请及时更新插件,才能体验最新功能' : ''}
17
22
  ==========================================================
18
23
  `);
19
24
  await updatePuppetConfig({ puppetType: this.puppet.constructor.name });
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.6.12",
6
+ "version": "1.6.14",
7
7
  "description": "智能微秘书插件",
8
8
  "exports": {
9
9
  ".": {
@@ -20,6 +20,11 @@ export function getGptConfig(): Promise<any>;
20
20
  * @return {Promise<*>}
21
21
  */
22
22
  export function getRssConfig(): Promise<any>;
23
+ /**
24
+ * 更新插件版本信息
25
+ * @param {*} version
26
+ */
27
+ export function getPanelVersion(): Promise<any>;
23
28
  declare namespace _default {
24
29
  export { getConfig };
25
30
  export { getScheduleList };
@@ -507,7 +507,7 @@ async function updatePanelVersion() {
507
507
  let option = {
508
508
  method: 'POST',
509
509
  url: '/webPanel/version',
510
- params: { version: packageJson.version || '0.2.11' },
510
+ params: { version: packageJson.version || '' },
511
511
  };
512
512
  console.log('更新插件版本号', packageJson.version);
513
513
  let content = await aiBotReq(option);
@@ -517,6 +517,23 @@ async function updatePanelVersion() {
517
517
  console.log('error', error);
518
518
  }
519
519
  }
520
+ /**
521
+ * 更新插件版本信息
522
+ * @param {*} version
523
+ */
524
+ export async function getPanelVersion() {
525
+ try {
526
+ let option = {
527
+ method: 'GET',
528
+ url: '/webPanel/version',
529
+ };
530
+ let content = await aiBotReq(option);
531
+ return content.data.version;
532
+ }
533
+ catch (error) {
534
+ console.log('error', error);
535
+ }
536
+ }
520
537
  /**
521
538
  * 获取mqtt信息
522
539
  * @param {*} version
@@ -7,13 +7,8 @@ import { getPuppetEol } from "../const/puppet-type.js";
7
7
  import dayjs from "dayjs";
8
8
  async function getRssContent(info) {
9
9
  try {
10
- const parser = new rssParser({
11
- xml2js: {
12
- strict: false,
13
- trim: true,
14
- normalize: true,
15
- }
16
- });
10
+ const parser = new rssParser();
11
+ console.log('订阅源:' + info.rssUrl);
17
12
  const feed = await parser.parseURL(info.rssUrl);
18
13
  const lastItem = await getRssHistoryById(info.id);
19
14
  // 当存在文章的时候
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.6.12",
3
+ "version": "1.6.14",
4
4
  "description": "智能微秘书插件",
5
5
  "exports": {
6
6
  ".": {