mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5ff6ceec6d | ||
![]() |
17af156451 | ||
![]() |
c3c9e74832 | ||
![]() |
0480208738 | ||
![]() |
62eefbdb69 | ||
![]() |
566537cbe3 | ||
![]() |
ed831ae4cd | ||
![]() |
501031b39b | ||
![]() |
7bfb3f2003 | ||
![]() |
ba8ed36c6a | ||
![]() |
55d046b4f9 |
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"manifest_version": 4,
|
||||
"type": "extension",
|
||||
"name": "LLOneBot v3.13.2",
|
||||
"name": "LLOneBot v3.13.8",
|
||||
"slug": "LLOneBot",
|
||||
"description": "LiteLoaderQQNT的OneBotApi",
|
||||
"version": "3.13.2",
|
||||
"version": "3.13.8",
|
||||
"thumbnail": "./icon.png",
|
||||
"authors": [
|
||||
{
|
||||
|
194
package-lock.json
generated
194
package-lock.json
generated
@@ -986,16 +986,6 @@
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc/node_modules/globals": {
|
||||
"version": "13.24.0",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/globals/-/globals-13.24.0.tgz",
|
||||
@@ -1011,18 +1001,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc/node_modules/type-fest": {
|
||||
"version": "0.20.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/type-fest/-/type-fest-0.20.2.tgz",
|
||||
@@ -1058,28 +1036,6 @@
|
||||
"node": ">=10.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/config-array/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/module-importer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
|
||||
@@ -3225,16 +3181,6 @@
|
||||
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-import/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-import/node_modules/debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/debug/-/debug-3.2.7.tgz",
|
||||
@@ -3256,18 +3202,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-import/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-n": {
|
||||
"version": "16.6.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/eslint-plugin-n/-/eslint-plugin-n-16.6.2.tgz",
|
||||
@@ -3296,16 +3230,6 @@
|
||||
"eslint": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-n/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-n/node_modules/globals": {
|
||||
"version": "13.24.0",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/globals/-/globals-13.24.0.tgz",
|
||||
@@ -3321,18 +3245,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-n/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-n/node_modules/semver": {
|
||||
"version": "7.6.0",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/semver/-/semver-7.6.0.tgz",
|
||||
@@ -3384,16 +3296,6 @@
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/eslint-scope": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/eslint-scope/-/eslint-scope-7.2.2.tgz",
|
||||
@@ -3477,18 +3379,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/p-limit": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/p-limit/-/p-limit-3.1.0.tgz",
|
||||
@@ -4012,6 +3902,26 @@
|
||||
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/glob/-/glob-7.2.3.tgz",
|
||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.1.1",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
@@ -4922,6 +4832,28 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/minimist/-/minimist-1.2.8.tgz",
|
||||
@@ -5509,48 +5441,6 @@
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf/node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/glob/-/glob-7.2.3.tgz",
|
||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.1.1",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://mirrors.cloud.tencent.com/npm/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/roarr": {
|
||||
"version": "2.15.4",
|
||||
"resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",
|
||||
|
@@ -28,21 +28,19 @@ export const llonebotError: LLOneBotError = {
|
||||
otherError: ''
|
||||
}
|
||||
|
||||
export const fileCache = new Map<string, FileCache>()
|
||||
|
||||
|
||||
export async function getFriend(qq: string, uid: string = ""): Promise<Friend | undefined> {
|
||||
let filterKey = uid ? "uid" : "uin"
|
||||
let filterValue = uid ? uid : qq
|
||||
let friend = friends.find(friend => friend[filterKey] === filterValue.toString())
|
||||
if (!friend) {
|
||||
try {
|
||||
friends = (await NTQQApi.getFriends(true))
|
||||
friend = friends.find(friend => friend[filterKey] === filterValue.toString())
|
||||
} catch (e) {
|
||||
// log("刷新好友列表失败", e.stack.toString())
|
||||
}
|
||||
}
|
||||
// if (!friend) {
|
||||
// try {
|
||||
// friends = (await NTQQApi.getFriends(true))
|
||||
// friend = friends.find(friend => friend[filterKey] === filterValue.toString())
|
||||
// } catch (e) {
|
||||
// // log("刷新好友列表失败", e.stack.toString())
|
||||
// }
|
||||
// }
|
||||
return friend
|
||||
}
|
||||
|
||||
|
@@ -1,16 +1,17 @@
|
||||
// import {DATA_DIR} from "./utils";
|
||||
import {Level} from "level";
|
||||
import {RawMessage} from "../ntqqapi/types";
|
||||
import {DATA_DIR, log} from "./utils";
|
||||
import {selfInfo} from "./data";
|
||||
import {FileCache} from "./types";
|
||||
|
||||
|
||||
class DBUtil {
|
||||
private readonly DB_KEY_PREFIX_MSG_ID = "msg_id_";
|
||||
private readonly DB_KEY_PREFIX_MSG_SHORT_ID = "msg_short_id_";
|
||||
private readonly DB_KEY_PREFIX_MSG_SEQ_ID = "msg_seq_id_";
|
||||
private readonly DB_KEY_PREFIX_FILE = "file_";
|
||||
private db: Level;
|
||||
private cache: Record<string, RawMessage> = {} // <msg_id_ | msg_short_id_ | msg_seq_id_><id>: RawMessage
|
||||
private cache: Record<string, RawMessage | string | FileCache> = {} // <msg_id_ | msg_short_id_ | msg_seq_id_><id>: RawMessage
|
||||
private currentShortId: number;
|
||||
|
||||
/*
|
||||
@@ -18,6 +19,7 @@ class DBUtil {
|
||||
* msg_id_101231230999: {} // 长id: RawMessage
|
||||
* msg_short_id_1: 101231230999 // 短id: 长id
|
||||
* msg_seq_id_1: 101231230999 // 序列id: 长id
|
||||
* file_7827DBAFJFW2323.png: {} // 文件名: FileCache
|
||||
* */
|
||||
|
||||
constructor() {
|
||||
@@ -54,13 +56,13 @@ class DBUtil {
|
||||
const longIdKey = this.DB_KEY_PREFIX_MSG_ID + msg.msgId
|
||||
const shortIdKey = this.DB_KEY_PREFIX_MSG_SHORT_ID + msg.msgShortId
|
||||
const seqIdKey = this.DB_KEY_PREFIX_MSG_SEQ_ID + msg.msgSeq
|
||||
this.cache[longIdKey] = this.cache[shortIdKey] = this.cache[seqIdKey] = msg
|
||||
this.cache[longIdKey] = this.cache[shortIdKey] = msg
|
||||
}
|
||||
|
||||
async getMsgByShortId(shortMsgId: number): Promise<RawMessage> {
|
||||
const shortMsgIdKey = this.DB_KEY_PREFIX_MSG_SHORT_ID + shortMsgId;
|
||||
if (this.cache[shortMsgIdKey]) {
|
||||
return this.cache[shortMsgIdKey]
|
||||
return this.cache[shortMsgIdKey] as RawMessage
|
||||
}
|
||||
const longId = await this.db.get(shortMsgIdKey);
|
||||
const msg = await this.getMsgByLongId(longId)
|
||||
@@ -71,7 +73,7 @@ class DBUtil {
|
||||
async getMsgByLongId(longId: string): Promise<RawMessage> {
|
||||
const longIdKey = this.DB_KEY_PREFIX_MSG_ID + longId;
|
||||
if (this.cache[longIdKey]) {
|
||||
return this.cache[longIdKey]
|
||||
return this.cache[longIdKey] as RawMessage
|
||||
}
|
||||
const data = await this.db.get(longIdKey)
|
||||
const msg = JSON.parse(data)
|
||||
@@ -82,7 +84,7 @@ class DBUtil {
|
||||
async getMsgBySeqId(seqId: string): Promise<RawMessage> {
|
||||
const seqIdKey = this.DB_KEY_PREFIX_MSG_SEQ_ID + seqId;
|
||||
if (this.cache[seqIdKey]) {
|
||||
return this.cache[seqIdKey]
|
||||
return this.cache[seqIdKey] as RawMessage
|
||||
}
|
||||
const longId = await this.db.get(seqIdKey);
|
||||
const msg = await this.getMsgByLongId(longId)
|
||||
@@ -92,8 +94,9 @@ class DBUtil {
|
||||
|
||||
async addMsg(msg: RawMessage) {
|
||||
// 有则更新,无则添加
|
||||
// log("addMsg", msg.msgId, msg.msgSeq, msg.msgShortId);
|
||||
const longIdKey = this.DB_KEY_PREFIX_MSG_ID + msg.msgId
|
||||
let existMsg = this.cache[longIdKey]
|
||||
let existMsg = this.cache[longIdKey] as RawMessage
|
||||
if (!existMsg) {
|
||||
try {
|
||||
existMsg = await this.getMsgByLongId(msg.msgId)
|
||||
@@ -102,6 +105,7 @@ class DBUtil {
|
||||
}
|
||||
}
|
||||
if (existMsg) {
|
||||
// log("消息已存在", existMsg.msgSeq, existMsg.msgShortId, existMsg.msgId)
|
||||
this.updateMsg(msg).then()
|
||||
return existMsg.msgShortId
|
||||
}
|
||||
@@ -113,23 +117,31 @@ class DBUtil {
|
||||
try {
|
||||
this.db.put(shortIdKey, msg.msgId).then();
|
||||
this.db.put(longIdKey, JSON.stringify(msg)).then();
|
||||
this.db.put(seqIdKey, msg.msgId).then();
|
||||
log(`消息入库 ${seqIdKey}: ${msg.msgId}, ${shortMsgId}: ${msg.msgId}`);
|
||||
try {
|
||||
await this.db.get(seqIdKey)
|
||||
} catch (e) {
|
||||
// log("新的seqId", seqIdKey)
|
||||
this.db.put(seqIdKey, msg.msgId).then();
|
||||
}
|
||||
this.cache[shortIdKey] = this.cache[longIdKey] = msg;
|
||||
if (!this.cache[seqIdKey]) {
|
||||
this.cache[seqIdKey] = msg;
|
||||
}
|
||||
// log(`消息入库 ${seqIdKey}: ${msg.msgId}, ${shortMsgId}: ${msg.msgId}`);
|
||||
} catch (e) {
|
||||
log("addMsg db error", e.stack.toString());
|
||||
// log("addMsg db error", e.stack.toString());
|
||||
}
|
||||
this.cache[seqIdKey] = this.cache[shortIdKey] = this.cache[longIdKey] = msg;
|
||||
return shortMsgId
|
||||
}
|
||||
|
||||
async updateMsg(msg: RawMessage) {
|
||||
const longIdKey = this.DB_KEY_PREFIX_MSG_ID + msg.msgId
|
||||
let existMsg = this.cache[longIdKey]
|
||||
let existMsg = this.cache[longIdKey] as RawMessage
|
||||
if (!existMsg) {
|
||||
try {
|
||||
existMsg = await this.getMsgByLongId(msg.msgId)
|
||||
} catch (e) {
|
||||
return
|
||||
existMsg = msg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,13 +149,23 @@ class DBUtil {
|
||||
this.db.put(longIdKey, JSON.stringify(existMsg)).then();
|
||||
const shortIdKey = this.DB_KEY_PREFIX_MSG_SHORT_ID + existMsg.msgShortId;
|
||||
const seqIdKey = this.DB_KEY_PREFIX_MSG_SEQ_ID + msg.msgSeq;
|
||||
if (!this.cache[seqIdKey]) {
|
||||
this.cache[seqIdKey] = existMsg;
|
||||
}
|
||||
this.db.put(shortIdKey, msg.msgId).then();
|
||||
this.db.put(seqIdKey, msg.msgId).then();
|
||||
try {
|
||||
await this.db.get(seqIdKey)
|
||||
} catch (e) {
|
||||
this.db.put(seqIdKey, msg.msgId).then();
|
||||
// log("更新seqId error", e.stack, seqIdKey);
|
||||
}
|
||||
// log("更新消息", existMsg.msgSeq, existMsg.msgShortId, existMsg.msgId);
|
||||
}
|
||||
|
||||
|
||||
private async genMsgShortId(): Promise<number> {
|
||||
const key = "msg_current_short_id";
|
||||
if (this.currentShortId === undefined){
|
||||
if (this.currentShortId === undefined) {
|
||||
try {
|
||||
let id: string = await this.db.get(key);
|
||||
this.currentShortId = parseInt(id);
|
||||
@@ -156,6 +178,31 @@ class DBUtil {
|
||||
await this.db.put(key, this.currentShortId.toString());
|
||||
return this.currentShortId;
|
||||
}
|
||||
|
||||
async addFileCache(fileName: string, data: FileCache) {
|
||||
const key = this.DB_KEY_PREFIX_FILE + fileName;
|
||||
if (this.cache[key]) {
|
||||
return
|
||||
}
|
||||
let cacheDBData = {...data}
|
||||
delete cacheDBData['downloadFunc']
|
||||
this.cache[fileName] = data;
|
||||
await this.db.put(key, JSON.stringify(cacheDBData));
|
||||
}
|
||||
|
||||
async getFileCache(fileName: string): Promise<FileCache | undefined> {
|
||||
const key = this.DB_KEY_PREFIX_FILE + fileName;
|
||||
if (this.cache[key]) {
|
||||
return this.cache[key] as FileCache
|
||||
}
|
||||
try {
|
||||
|
||||
let data = await this.db.get(key);
|
||||
return JSON.parse(data);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const dbUtil = new DBUtil();
|
@@ -155,7 +155,7 @@ function onLoad() {
|
||||
async function postReceiveMsg(msgList: RawMessage[]) {
|
||||
const {debug, reportSelfMessage} = getConfigUtil().getConfig();
|
||||
for (let message of msgList) {
|
||||
// log("收到新消息", message)
|
||||
// log("收到新消息", message.msgSeq)
|
||||
message.msgShortId = await dbUtil.addMsg(message)
|
||||
|
||||
OB11Constructor.message(message).then((msg) => {
|
||||
@@ -213,7 +213,7 @@ function onLoad() {
|
||||
// 不让入库覆盖原来消息,不然就获取不到撤回的消息内容了
|
||||
continue
|
||||
}
|
||||
dbUtil.addMsg(message).then();
|
||||
dbUtil.updateMsg(message).then();
|
||||
}
|
||||
})
|
||||
registerReceiveHook<{ msgRecord: RawMessage }>(ReceiveCmd.SELF_SEND_MSG, async (payload) => {
|
||||
|
@@ -89,6 +89,9 @@ export class SendMsgElementConstructor {
|
||||
picWidth = 768;
|
||||
}
|
||||
const {md5, fileName: _fileName, path, fileSize} = await NTQQApi.uploadFile(filePath, ElementType.FILE);
|
||||
if (fileSize === 0){
|
||||
throw "文件异常,大小为0";
|
||||
}
|
||||
let element: SendFileElement = {
|
||||
elementType: ElementType.FILE,
|
||||
elementId: "",
|
||||
|
@@ -233,7 +233,7 @@ registerReceiveHook<{
|
||||
registerReceiveHook<{ msgList: RawMessage[] }>(ReceiveCmd.NEW_MSG, (payload) => {
|
||||
const {autoDeleteFile, autoDeleteFileSecond} = getConfigUtil().getConfig()
|
||||
for (const message of payload.msgList) {
|
||||
// log("收到新消息,push到历史记录", message)
|
||||
// log("收到新消息,push到历史记录", message.msgSeq)
|
||||
dbUtil.addMsg(message).then()
|
||||
// 清理文件
|
||||
if (!autoDeleteFile) {
|
||||
@@ -268,6 +268,8 @@ registerReceiveHook<{ msgRecord: RawMessage }>(ReceiveCmd.SELF_SEND_MSG, ({msgRe
|
||||
const message = msgRecord
|
||||
const peerUid = message.peerUid
|
||||
// log("收到自己发送成功的消息", Object.keys(sendMessagePool), message);
|
||||
// log("收到自己发送成功的消息", message);
|
||||
dbUtil.addMsg(message).then()
|
||||
const sendCallback = sendMessagePool[peerUid]
|
||||
if (sendCallback) {
|
||||
try {
|
||||
|
@@ -422,7 +422,7 @@ export class NTQQApi {
|
||||
})
|
||||
}
|
||||
|
||||
static async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = false, timeout = 10000) {
|
||||
static async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
||||
const peerUid = peer.peerUid
|
||||
|
||||
// 等待上一个相同的peer发送完
|
||||
|
@@ -233,6 +233,7 @@ export interface PicElement {
|
||||
fileSize: number;
|
||||
fileName: string;
|
||||
fileUuid: string;
|
||||
md5HexStr?: string;
|
||||
}
|
||||
|
||||
export interface GrayTipElement {
|
||||
|
@@ -21,7 +21,7 @@ class BaseAction<PayloadType, ReturnDataType> {
|
||||
const resData = await this._handle(payload);
|
||||
return OB11Response.ok(resData);
|
||||
} catch (e) {
|
||||
log("发送错误", e.stack)
|
||||
log("发生错误", e)
|
||||
return OB11Response.error(e.toString(), 200);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class BaseAction<PayloadType, ReturnDataType> {
|
||||
const resData = await this._handle(payload)
|
||||
return OB11Response.ok(resData, echo);
|
||||
} catch (e) {
|
||||
log("发生错误", e.stack.toString())
|
||||
log("发生错误", e)
|
||||
return OB11Response.error(e.toString(), 1200, echo)
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import BaseAction from "./BaseAction";
|
||||
import {fileCache} from "../../common/data";
|
||||
import {getConfigUtil} from "../../common/utils";
|
||||
import fs from "fs/promises";
|
||||
import {dbUtil} from "../../common/db";
|
||||
|
||||
export interface GetFilePayload {
|
||||
file: string // 文件名
|
||||
@@ -18,7 +18,7 @@ export interface GetFileResponse {
|
||||
|
||||
export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
|
||||
protected async _handle(payload: GetFilePayload): Promise<GetFileResponse> {
|
||||
const cache = fileCache.get(payload.file)
|
||||
const cache = await dbUtil.getFileCache(payload.file)
|
||||
const {autoDeleteFile, enableLocalFile2Url, autoDeleteFileSecond} = getConfigUtil().getConfig()
|
||||
if (!cache) {
|
||||
throw new Error('file not found')
|
||||
|
@@ -1,9 +1,17 @@
|
||||
import SendMsg from "./SendMsg";
|
||||
import {ActionName} from "./types";
|
||||
import {ActionName, BaseCheckResult} from "./types";
|
||||
import {OB11PostSendMsg} from "../types";
|
||||
import {log} from "../../common/utils";
|
||||
|
||||
|
||||
class SendGroupMsg extends SendMsg {
|
||||
actionName = ActionName.SendGroupMsg
|
||||
|
||||
protected async check(payload: OB11PostSendMsg): Promise<BaseCheckResult> {
|
||||
delete payload.user_id;
|
||||
payload.message_type = "group"
|
||||
return super.check(payload);
|
||||
}
|
||||
}
|
||||
|
||||
export default SendGroupMsg
|
@@ -1,7 +1,8 @@
|
||||
import BaseAction from "./BaseAction";
|
||||
import {getFriend} from "../../common/data";
|
||||
import {getFriend, getUidByUin, uidMaps} from "../../common/data";
|
||||
import {NTQQApi} from "../../ntqqapi/ntcall";
|
||||
import {ActionName} from "./types";
|
||||
import {log} from "../../common/utils";
|
||||
|
||||
interface Payload {
|
||||
user_id: number,
|
||||
@@ -12,13 +13,17 @@ export default class SendLike extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.SendLike
|
||||
|
||||
protected async _handle(payload: Payload): Promise<null> {
|
||||
const qq = payload.user_id.toString();
|
||||
const friend = await getFriend(qq)
|
||||
if (!friend) {
|
||||
throw (`点赞失败,${qq}不是好友`)
|
||||
}
|
||||
log("点赞参数", payload)
|
||||
try {
|
||||
let result = await NTQQApi.likeFriend(friend.uid, parseInt(payload.times.toString()) || 1);
|
||||
const qq = payload.user_id.toString();
|
||||
const friend = await getFriend(qq)
|
||||
let uid: string;
|
||||
if (!friend) {
|
||||
uid = getUidByUin(qq)
|
||||
} else {
|
||||
uid = friend.uid
|
||||
}
|
||||
let result = await NTQQApi.likeFriend(uid, parseInt(payload.times?.toString()) || 1);
|
||||
if (result.result !== 0) {
|
||||
throw result.errMsg
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ import {log} from "../../common/utils";
|
||||
import {decodeCQCode} from "../cqcode";
|
||||
import {dbUtil} from "../../common/db";
|
||||
import {ALLOW_SEND_TEMP_MSG} from "../../common/config";
|
||||
import {FileCache} from "../../common/types";
|
||||
|
||||
function checkSendMessage(sendMsgList: OB11MessageData[]) {
|
||||
function checkUri(uri: string): boolean {
|
||||
@@ -157,7 +158,8 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
// log("send msg:", peer, sendElements)
|
||||
const {sendElements, deleteAfterSentFiles} = await this.createSendElements(messages, group)
|
||||
try {
|
||||
const returnMsg = await this.send(peer, sendElements, deleteAfterSentFiles, isTempMsg)
|
||||
const returnMsg = await this.send(peer, sendElements, deleteAfterSentFiles)
|
||||
deleteAfterSentFiles.map(f => fs.unlink(f, () => {}));
|
||||
return {message_id: returnMsg.msgShortId}
|
||||
} catch (e) {
|
||||
log("发送消息失败", e.stack.toString())
|
||||
@@ -213,7 +215,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
deleteAfterSentFiles
|
||||
} = await this.createSendElements(this.convertMessage2List(messageNode.data.content), group);
|
||||
log("开始生成转发节点", sendElements);
|
||||
const nodeMsg = await this.send(selfPeer, sendElements, deleteAfterSentFiles, true);
|
||||
const nodeMsg = await this.send(selfPeer, sendElements, deleteAfterSentFiles, false);
|
||||
selfNodeMsgList.push(nodeMsg);
|
||||
log("转发节点生成成功", nodeMsg.msgId);
|
||||
} catch (e) {
|
||||
@@ -287,6 +289,9 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
}
|
||||
break;
|
||||
case OB11MessageDataType.at: {
|
||||
if (!group){
|
||||
continue
|
||||
}
|
||||
let atQQ = sendMsg.data?.qq;
|
||||
if (atQQ) {
|
||||
atQQ = atQQ.toString()
|
||||
@@ -305,7 +310,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
case OB11MessageDataType.reply: {
|
||||
let replyMsgId = sendMsg.data.id;
|
||||
if (replyMsgId) {
|
||||
const replyMsg = await dbUtil.getMsgBySeqId(replyMsgId)
|
||||
const replyMsg = await dbUtil.getMsgByShortId(parseInt(replyMsgId))
|
||||
if (replyMsg) {
|
||||
sendElements.push(SendMsgElementConstructor.reply(replyMsg.msgSeq, replyMsg.msgId, replyMsg.senderUin, replyMsg.senderUin))
|
||||
}
|
||||
@@ -324,10 +329,24 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
case OB11MessageDataType.file:
|
||||
case OB11MessageDataType.video:
|
||||
case OB11MessageDataType.voice: {
|
||||
const file = sendMsg.data?.file
|
||||
let file = sendMsg.data?.file
|
||||
const payloadFileName = sendMsg.data?.name
|
||||
if (file) {
|
||||
const {path, isLocal, fileName} = (await uri2local(file))
|
||||
const cache = await dbUtil.getFileCache(file)
|
||||
if (cache){
|
||||
if (fs.existsSync(cache.filePath)){
|
||||
file = "file://" + cache.filePath
|
||||
}
|
||||
else if (cache.downloadFunc){
|
||||
await cache.downloadFunc()
|
||||
file = cache.filePath;
|
||||
log("找到文件缓存", file);
|
||||
}
|
||||
}
|
||||
const {path, isLocal, fileName, errMsg} = (await uri2local(file))
|
||||
if (errMsg){
|
||||
throw errMsg
|
||||
}
|
||||
if (path) {
|
||||
if (!isLocal) { // 只删除http和base64转过来的文件
|
||||
deleteAfterSentFiles.push(path)
|
||||
@@ -361,7 +380,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
}
|
||||
}
|
||||
|
||||
private async send(peer: Peer, sendElements: SendMessageElement[], deleteAfterSentFiles: string[], waitComplete = false) {
|
||||
private async send(peer: Peer, sendElements: SendMessageElement[], deleteAfterSentFiles: string[], waitComplete = true) {
|
||||
if (!sendElements.length) {
|
||||
throw ("消息体无法解析")
|
||||
}
|
||||
|
@@ -1,8 +1,14 @@
|
||||
import SendMsg from "./SendMsg";
|
||||
import {ActionName} from "./types";
|
||||
import {ActionName, BaseCheckResult} from "./types";
|
||||
import {OB11PostSendMsg} from "../types";
|
||||
|
||||
class SendPrivateMsg extends SendMsg {
|
||||
actionName = ActionName.SendPrivateMsg
|
||||
|
||||
protected async check(payload: OB11PostSendMsg): Promise<BaseCheckResult> {
|
||||
payload.message_type = "private"
|
||||
return super.check(payload);
|
||||
}
|
||||
}
|
||||
|
||||
export default SendPrivateMsg
|
@@ -9,7 +9,7 @@ import {
|
||||
OB11UserSex
|
||||
} from "./types";
|
||||
import {AtType, ChatType, Group, GroupMember, IMAGE_HTTP_HOST, RawMessage, SelfInfo, User} from '../ntqqapi/types';
|
||||
import {fileCache, getFriend, getGroupMember, selfInfo, tempGroupCodeMap} from '../common/data';
|
||||
import {getFriend, getGroupMember, selfInfo, tempGroupCodeMap} from '../common/data';
|
||||
import {getConfigUtil, log} from "../common/utils";
|
||||
import {NTQQApi} from "../ntqqapi/ntcall";
|
||||
import {EventType} from "./event/OB11BaseEvent";
|
||||
@@ -96,16 +96,17 @@ export class OB11Constructor {
|
||||
message_data["data"]["text"] = text
|
||||
} else if (element.replyElement) {
|
||||
message_data["type"] = "reply"
|
||||
log("收到回复消息", element.replyElement.replayMsgSeq)
|
||||
// log("收到回复消息", element.replyElement.replayMsgSeq)
|
||||
try{
|
||||
const replyMsg = await dbUtil.getMsgBySeqId(element.replyElement.replayMsgSeq)
|
||||
// log("找到回复消息", replyMsg.msgShortId, replyMsg.msgId)
|
||||
if (replyMsg) {
|
||||
message_data["data"]["id"] = replyMsg.msgShortId.toString()
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}catch (e) {
|
||||
log("获取不到引用的消息", e.stack)
|
||||
log("获取不到引用的消息", e.stack, element.replyElement.replayMsgSeq)
|
||||
}
|
||||
|
||||
} else if (element.picElement) {
|
||||
@@ -113,19 +114,26 @@ export class OB11Constructor {
|
||||
// message_data["data"]["file"] = element.picElement.sourcePath
|
||||
message_data["data"]["file"] = element.picElement.fileName
|
||||
// message_data["data"]["path"] = element.picElement.sourcePath
|
||||
message_data["data"]["url"] = IMAGE_HTTP_HOST + element.picElement.originImageUrl
|
||||
const url = element.picElement.originImageUrl
|
||||
const fileMd5 = element.picElement.md5HexStr
|
||||
if (url){
|
||||
message_data["data"]["url"] = IMAGE_HTTP_HOST + url
|
||||
}
|
||||
else if (fileMd5 && element.picElement.fileUuid.indexOf("_") === -1){ // fileuuid有下划线的是Linux发送的,这个url是另外的格式,目前尚未得知如何组装
|
||||
message_data["data"]["url"] = `${IMAGE_HTTP_HOST}/gchatpic_new/0/0-0-${fileMd5.toUpperCase()}/0`
|
||||
}
|
||||
// message_data["data"]["file_id"] = element.picElement.fileUuid
|
||||
message_data["data"]["file_size"] = element.picElement.fileSize
|
||||
fileCache.set(element.picElement.fileName, {
|
||||
dbUtil.addFileCache(element.picElement.fileName, {
|
||||
fileName: element.picElement.fileName,
|
||||
filePath: element.picElement.sourcePath,
|
||||
fileSize: element.picElement.fileSize.toString(),
|
||||
url: IMAGE_HTTP_HOST + element.picElement.originImageUrl,
|
||||
url: message_data["data"]["url"],
|
||||
downloadFunc: async () => {
|
||||
await NTQQApi.downloadMedia(msg.msgId, msg.chatType, msg.peerUid,
|
||||
element.elementId, element.picElement.thumbPath.get(0), element.picElement.sourcePath)
|
||||
element.elementId, element.picElement.thumbPath?.get(0) || "", element.picElement.sourcePath)
|
||||
}
|
||||
})
|
||||
}).then()
|
||||
// 不在自动下载图片
|
||||
|
||||
} else if (element.videoElement) {
|
||||
@@ -134,7 +142,7 @@ export class OB11Constructor {
|
||||
message_data["data"]["path"] = element.videoElement.filePath
|
||||
// message_data["data"]["file_id"] = element.videoElement.fileUuid
|
||||
message_data["data"]["file_size"] = element.videoElement.fileSize
|
||||
fileCache.set(element.videoElement.fileName, {
|
||||
dbUtil.addFileCache(element.videoElement.fileName, {
|
||||
fileName: element.videoElement.fileName,
|
||||
filePath: element.videoElement.filePath,
|
||||
fileSize: element.videoElement.fileSize,
|
||||
@@ -142,7 +150,7 @@ export class OB11Constructor {
|
||||
await NTQQApi.downloadMedia(msg.msgId, msg.chatType, msg.peerUid,
|
||||
element.elementId, element.videoElement.thumbPath.get(0), element.videoElement.filePath)
|
||||
}
|
||||
})
|
||||
}).then()
|
||||
// 怎么拿到url呢
|
||||
} else if (element.fileElement) {
|
||||
message_data["type"] = OB11MessageDataType.file;
|
||||
@@ -150,7 +158,7 @@ export class OB11Constructor {
|
||||
// message_data["data"]["path"] = element.fileElement.filePath
|
||||
// message_data["data"]["file_id"] = element.fileElement.fileUuid
|
||||
message_data["data"]["file_size"] = element.fileElement.fileSize
|
||||
fileCache.set(element.fileElement.fileName, {
|
||||
dbUtil.addFileCache(element.fileElement.fileName, {
|
||||
fileName: element.fileElement.fileName,
|
||||
filePath: element.fileElement.filePath,
|
||||
fileSize: element.fileElement.fileSize,
|
||||
@@ -158,7 +166,7 @@ export class OB11Constructor {
|
||||
await NTQQApi.downloadMedia(msg.msgId, msg.chatType, msg.peerUid,
|
||||
element.elementId, null, element.fileElement.filePath)
|
||||
}
|
||||
})
|
||||
}).then()
|
||||
// 怎么拿到url呢
|
||||
} else if (element.pttElement) {
|
||||
message_data["type"] = OB11MessageDataType.voice;
|
||||
@@ -166,11 +174,11 @@ export class OB11Constructor {
|
||||
message_data["data"]["path"] = element.pttElement.filePath
|
||||
// message_data["data"]["file_id"] = element.pttElement.fileUuid
|
||||
message_data["data"]["file_size"] = element.pttElement.fileSize
|
||||
fileCache.set(element.pttElement.fileName, {
|
||||
dbUtil.addFileCache(element.pttElement.fileName, {
|
||||
fileName: element.pttElement.fileName,
|
||||
filePath: element.pttElement.filePath,
|
||||
fileSize: element.pttElement.fileSize,
|
||||
})
|
||||
}).then()
|
||||
|
||||
// log("收到语音消息", msg)
|
||||
// window.LLAPI.Ptt2Text(message.raw.msgId, message.peer, messages).then(text => {
|
||||
|
@@ -28,7 +28,7 @@ class OB11WebsocketServer extends WebsocketServerBase {
|
||||
let handleResult = await action.websocketHandle(params, echo);
|
||||
wsReply(wsClient, handleResult)
|
||||
} catch (e) {
|
||||
wsReply(wsClient, OB11Response.error(`api处理出错:${e}`, 1200, echo))
|
||||
wsReply(wsClient, OB11Response.error(`api处理出错:${e.stack}`, 1200, echo))
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import {DATA_DIR, isGIF, log} from "../common/utils";
|
||||
import {v4 as uuidv4} from "uuid";
|
||||
import * as path from 'node:path';
|
||||
import {fileCache} from "../common/data";
|
||||
import * as fileType from 'file-type';
|
||||
import {dbUtil} from "../common/db";
|
||||
|
||||
const fs = require("fs").promises;
|
||||
|
||||
@@ -33,7 +33,13 @@ export async function uri2local(uri: string, fileName: string = null) {
|
||||
}
|
||||
} else if (url.protocol == "http:" || url.protocol == "https:") {
|
||||
// 下载文件
|
||||
let fetchRes = await fetch(url)
|
||||
let fetchRes: Response;
|
||||
try{
|
||||
fetchRes = await fetch(url)
|
||||
}catch (e) {
|
||||
res.errMsg = `${url}下载失败`
|
||||
return res
|
||||
}
|
||||
if (!fetchRes.ok) {
|
||||
res.errMsg = `${url}下载失败,` + fetchRes.statusText
|
||||
return res
|
||||
@@ -46,7 +52,7 @@ export async function uri2local(uri: string, fileName: string = null) {
|
||||
fileName = pathInfo.name
|
||||
if (pathInfo.ext){
|
||||
fileName += pathInfo.ext
|
||||
res.ext = pathInfo.ext
|
||||
// res.ext = pathInfo.ext
|
||||
}
|
||||
}
|
||||
res.fileName = fileName
|
||||
@@ -67,7 +73,7 @@ export async function uri2local(uri: string, fileName: string = null) {
|
||||
filePath = pathname
|
||||
}
|
||||
} else {
|
||||
const cache = fileCache.get(uri)
|
||||
const cache = await dbUtil.getFileCache(uri);
|
||||
if (cache) {
|
||||
filePath = cache.filePath
|
||||
} else {
|
||||
|
@@ -1 +1 @@
|
||||
export const version = "3.13.3"
|
||||
export const version = "3.13.8"
|
Reference in New Issue
Block a user