forked from NapNeko/NapCatQQ
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
232 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
# v1.5.8 | ||
# v1.5.9 | ||
|
||
QQ Version: Windows 9.9.11-24568 / Linux 3.2.9-24568 | ||
QQ Version: Windows 9.9.11-24815 / Linux 3.2.9-24815 | ||
|
||
## 修复与优化 | ||
* 修复视频文件残留问题 | ||
* 重构 getcookies接口 支持大部分常见域 | ||
* 优化缓存问题 | ||
|
||
## 新增与调整 | ||
* 日志大小限制 | ||
* 支持 QQ音乐 卡片 无签名支持时 启用内置方法(缺点没有封面 限速1min/条) | ||
* 支持Window X86-32机器 | ||
|
||
|
||
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# v1.5.8 | ||
|
||
QQ Version: Windows 9.9.11-24568 / Linux 3.2.9-24568 | ||
|
||
## 修复与优化 | ||
* 修复视频文件残留问题 | ||
* 重构 getcookies接口 支持大部分常见域 | ||
|
||
## 新增与调整 | ||
* 日志大小限制 | ||
* 支持 QQ音乐 卡片 无签名支持时 启用内置方法(缺点没有封面 限速1min/条) | ||
* 支持Window X86-32机器 | ||
|
||
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
import crypto from 'crypto'; | ||
|
||
class LimitedHashTable<K, V> { | ||
private keyToValue: Map<K, V> = new Map(); | ||
private valueToKey: Map<V, K> = new Map(); | ||
private maxSize: number; | ||
private KeyQueneList: K[] = []; | ||
private ValueQueneList: V[] = []; | ||
constructor(maxSize: number) { | ||
this.maxSize = maxSize; | ||
} | ||
set(key: K, value: V): void { | ||
this.keyToValue.set(key, value); | ||
this.valueToKey.set(value, key); | ||
if (this.KeyQueneList.length >= this.maxSize || this.ValueQueneList.length >= this.maxSize) { | ||
this.KeyQueneList.shift(); | ||
this.ValueQueneList.shift(); | ||
} | ||
} | ||
private keyToValue: Map<K, V> = new Map(); | ||
private valueToKey: Map<V, K> = new Map(); | ||
private maxSize: number; | ||
private KeyQueneList: K[] = []; | ||
private ValueQueneList: V[] = []; | ||
constructor(maxSize: number) { | ||
this.maxSize = maxSize; | ||
} | ||
set(key: K, value: V): void { | ||
this.keyToValue.set(key, value); | ||
this.valueToKey.set(value, key); | ||
if (this.KeyQueneList.length >= this.maxSize || this.ValueQueneList.length >= this.maxSize) { | ||
this.KeyQueneList.shift(); | ||
this.ValueQueneList.shift(); | ||
} | ||
} | ||
|
||
getValue(key: K): V | undefined { | ||
return this.keyToValue.get(key); | ||
} | ||
getValue(key: K): V | undefined { | ||
return this.keyToValue.get(key); | ||
} | ||
|
||
getKey(value: V): K | undefined { | ||
return this.valueToKey.get(value); | ||
} | ||
getKey(value: V): K | undefined { | ||
return this.valueToKey.get(value); | ||
} | ||
|
||
delete(key: K): void { | ||
const value = this.keyToValue.get(key); | ||
if (value !== undefined) { | ||
this.keyToValue.delete(key); | ||
this.valueToKey.delete(value); | ||
} | ||
delete(key: K): void { | ||
const value = this.keyToValue.get(key); | ||
if (value !== undefined) { | ||
this.keyToValue.delete(key); | ||
this.valueToKey.delete(value); | ||
} | ||
} | ||
} | ||
|
||
class MessageUniqueWrapper { | ||
private msgIdMap: LimitedHashTable<number, string> = new LimitedHashTable(1000); | ||
createMsg(MsgId: string) { | ||
let ShortId = parseInt(crypto.createHash('sha1').update('2345').digest('hex').slice(0, 8), 16); | ||
this.msgIdMap.set(ShortId, MsgId); | ||
return ShortId; | ||
} | ||
getMsgIdByShortId(ShortId: number) { | ||
return this.msgIdMap.getValue(ShortId); | ||
} | ||
getShortIdByMsgId(MsgId: string) { | ||
return this.msgIdMap.getKey(MsgId); | ||
} | ||
private msgIdMap: LimitedHashTable<number, string> = new LimitedHashTable(1000); | ||
createMsg(MsgId: string) { | ||
const ShortId = parseInt(crypto.createHash('sha1').update('2345').digest('hex').slice(0, 8), 16); | ||
this.msgIdMap.set(ShortId, MsgId); | ||
return ShortId; | ||
} | ||
getMsgIdByShortId(ShortId: number) { | ||
return this.msgIdMap.getValue(ShortId); | ||
} | ||
getShortIdByMsgId(MsgId: string) { | ||
return this.msgIdMap.getKey(MsgId); | ||
} | ||
} | ||
|
||
export const MessageUnique = new MessageUniqueWrapper(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule core
updated
from cd5ac2 to 35be10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
import { rawFriends } from '@/core/data'; | ||
import BaseAction from '../BaseAction'; | ||
import { ActionName } from '../types'; | ||
import { BuddyCategoryType } from '@/core/entities/'; | ||
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; | ||
import { NTQQFriendApi } from '@/core'; | ||
|
||
export class GetFriendWithCategory extends BaseAction<void, Array<BuddyCategoryType>> { | ||
const SchemaData = { | ||
type: 'object', | ||
properties: { | ||
no_cache: { type: ['boolean', 'string'] }, | ||
} | ||
} as const satisfies JSONSchema; | ||
|
||
type Payload = FromSchema<typeof SchemaData>; | ||
|
||
export class GetFriendWithCategory extends BaseAction<Payload, BuddyCategoryType[]> { | ||
actionName = ActionName.GetFriendsWithCategory; | ||
|
||
protected async _handle(payload: void) { | ||
return rawFriends; | ||
protected async _handle(payload: Payload) { | ||
return await NTQQFriendApi.getFriendsRaw(payload?.no_cache?.toString() === 'true'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.