mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
16195ca52b | ||
![]() |
d5f492775e |
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "4.1.9",
|
"version": "4.1.11",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "4.1.9",
|
"version": "4.1.11",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:framework": "npm run build:webui && vite build --mode framework",
|
"build:framework": "npm run build:webui && vite build --mode framework",
|
||||||
"build:shell": "npm run build:webui && vite build --mode shell",
|
"build:shell": "npm run build:webui && vite build --mode shell",
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '4.1.9';
|
export const napCatVersion = '4.1.11';
|
||||||
|
@@ -412,15 +412,17 @@ export class NTQQFileApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const url: string = element.originImageUrl ?? '';
|
const url: string = element.originImageUrl ?? '';
|
||||||
|
|
||||||
const md5HexStr = element.md5HexStr;
|
const md5HexStr = element.md5HexStr;
|
||||||
const fileMd5 = element.md5HexStr;
|
const fileMd5 = element.md5HexStr;
|
||||||
|
const parsedUrl = new URL(IMAGE_HTTP_HOST + url);
|
||||||
if (url) {
|
const imageAppid = parsedUrl.searchParams.get('appid');
|
||||||
const parsedUrl = new URL(IMAGE_HTTP_HOST + url);
|
const isNTV2 = imageAppid && ['1406', '1407'].includes(imageAppid);
|
||||||
|
const imageFileId = parsedUrl.searchParams.get('fileid');
|
||||||
|
if (url && isNTV2 && imageFileId) {
|
||||||
const rkeyData = await this.getRkeyData();
|
const rkeyData = await this.getRkeyData();
|
||||||
return this.getImageUrlFromParsedUrl(parsedUrl, rkeyData);
|
return this.getImageUrlFromParsedUrl(imageFileId, imageAppid, rkeyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getImageUrlFromMd5(fileMd5, md5HexStr);
|
return this.getImageUrlFromMd5(fileMd5, md5HexStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,19 +464,12 @@ export class NTQQFileApi {
|
|||||||
return rkeyData;
|
return rkeyData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getImageUrlFromParsedUrl(parsedUrl: URL, rkeyData: any): string {
|
private getImageUrlFromParsedUrl(imageFileId: string, appid: string, rkeyData: any): string {
|
||||||
const imageAppid = parsedUrl.searchParams.get('appid');
|
const rkey = appid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
||||||
const isNTV2 = imageAppid && ['1406', '1407'].includes(imageAppid);
|
if (rkeyData.online_rkey) {
|
||||||
const imageFileId = parsedUrl.searchParams.get('fileid');
|
return IMAGE_HTTP_HOST_NT + `/download?appid=${appid}&fileid=${imageFileId}&rkey=${rkey}`;
|
||||||
if (isNTV2 && rkeyData.online_rkey) {
|
|
||||||
const rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
|
||||||
return IMAGE_HTTP_HOST_NT + `/download?appid=${imageAppid}&fileid=${imageFileId}&rkey=${rkey}`;
|
|
||||||
} else if (isNTV2 && imageFileId) {
|
|
||||||
const rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
|
||||||
return IMAGE_HTTP_HOST + `/download?appid=${imageAppid}&fileid=${imageFileId}&rkey=${rkey}`;
|
|
||||||
}
|
}
|
||||||
|
return IMAGE_HTTP_HOST + `/download?appid=${appid}&fileid=${imageFileId}&rkey=${rkey}`;
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getImageUrlFromMd5(fileMd5: string | undefined, md5HexStr: string | undefined): string {
|
private getImageUrlFromMd5(fileMd5: string | undefined, md5HexStr: string | undefined): string {
|
||||||
|
Reference in New Issue
Block a user