Skip to content

Commit

Permalink
Follow upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
h5mcbox committed Jun 27, 2024
2 parents bb77257 + bf10ce9 commit 2b29538
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build"
name: "Build Action"
on:
workflow_dispatch:
push:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "release"
name: "Build Release"

on:
push:
Expand Down Expand Up @@ -130,6 +130,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
body_path: CHANGELOG.md
files: |
NapCat.win32.ia32.zip
NapCat.win32.x64.zip
NapCat.linux.x64.zip
NapCat.linux.arm64.zip
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "Build Test"
on:
workflow_dispatch:

permissions: write-all

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target_platform: [linux]
target_arch: [x64, arm64]
steps:
- name: Clone Main Repository
uses: actions/checkout@v4
with:
repository: 'NapNeko/NapCatQQ'
submodules: true
ref: main
token: ${{ secrets.NAPCAT_BUILD }}
- name: Use Node.js 20.X
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Build NuCat Linux
run: |
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
npm run build:prod
cd dist
npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
cd ..
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
path: dist
build-win32:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target_platform: [win32]
target_arch: [x64,ia32]
steps:
- name: Clone Main Repository
uses: actions/checkout@v4
with:
repository: 'NapNeko/NapCatQQ'
submodules: true
ref: main
token: ${{ secrets.NAPCAT_BUILD }}
- name: Use Node.js 20.X
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Build NuCat Linux
run: |
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
npm run build:prod
cd dist
npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
cd ..
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
path: dist
13 changes: 13 additions & 0 deletions docs/changelogs/CHANGELOG.v1.6.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# v1.6.2

QQ Version: Windows 9.9.11-24815 / Linux 3.2.9-24815

## 修复与优化
* 修复获取Cookies异常崩溃问题
* 尝试修复成员退群缓存问题
* 修复自身退群后群缓存清理问题

## 新增与调整


新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "1.6.1",
"version": "1.6.2",
"scripts": {
"watch:dev": "vite --mode development",
"watch:prod": "vite --mode production",
Expand Down
16 changes: 9 additions & 7 deletions src/common/utils/request.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import https from 'node:https';
import http from 'node:http';
import fs, { readFileSync } from 'node:fs';
import { readFileSync } from 'node:fs';
import { NTQQUserApi } from '@/core';
import path from 'node:path';
import { request } from 'node:http';
export class RequestUtil {
// 适用于获取服务器下发cookies时获取,仅GET
static async HttpsGetCookies(url: string): Promise<{ [key: string]: string }> {
const client = url.startsWith('https') ? https : http;
return new Promise((resolve, reject) => {
client.get(url, (res) => {
let req = client.get(url, (res) => {
let cookies: { [key: string]: string } = {};
const handleRedirect = (res: http.IncomingMessage) => {
//console.log(res.headers.location);
Expand All @@ -20,6 +18,8 @@ export class RequestUtil {
// 合并重定向过程中的cookies
cookies = { ...cookies, ...redirectCookies };
resolve(cookies);
}).catch((err) => {
reject(err);
});
} else {
resolve(cookies);
Expand All @@ -43,9 +43,10 @@ export class RequestUtil {
}
});
}
}).on('error', (err) => {
reject(err);
});
req.on('error', (error: any) => {
reject(error);
});
});
}

Expand Down Expand Up @@ -173,6 +174,7 @@ export class RequestUtil {
});

req.on('error', (error) => {
reject(error);
console.error('Error during upload:', error);
});

Expand All @@ -188,4 +190,4 @@ export class RequestUtil {
return undefined;
});
}
}
}
2 changes: 1 addition & 1 deletion src/core
Submodule core updated from 88dc74 to 33aeed
2 changes: 1 addition & 1 deletion src/onebot11/action/group/GetGroupMemberList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { OB11GroupMember } from '../../types';
import { OB11Constructor } from '../../constructor';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { napCatCore, NTQQGroupApi, NTQQUserApi, SignMiniApp } from '@/core';
import { napCatCore, NTQQGroupApi, NTQQUserApi } from '@/core';
import { WebApi } from '@/core/apis/webapi';
import { logDebug } from '@/common/utils/log';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
Expand Down
2 changes: 2 additions & 0 deletions src/onebot11/action/group/SetGroupLeave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ActionName } from '../types';
import { NTQQGroupApi } from '@/core/apis/group';
import { log, logError } from '@/common/utils/log';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { deleteGroup } from '@/core/data';
const SchemaData = {
type: 'object',
properties: {
Expand All @@ -19,6 +20,7 @@ export default class SetGroupLeave extends BaseAction<Payload, any> {
protected async _handle(payload: Payload): Promise<any> {
try {
await NTQQGroupApi.quitGroup(payload.group_id.toString());
deleteGroup(payload.group_id.toString());
} catch (e) {
logError('退群失败', e);
throw e;
Expand Down
2 changes: 0 additions & 2 deletions src/onebot11/action/user/GetCookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ export class GetCookies extends BaseAction<Payload, Response> {
// throw new Error('缺少参数 domain');
// }
// if (payload.domain.endsWith('qzone.qq.com')) {
// const _Skey = await NTQQUserApi.getSkey() as string;
// // 兼容整个 *.qzone.qq.com
// const data = (await NTQQUserApi.getQzoneCookies());
// const Bkn = WebApi.genBkn(data.p_skey);
// const CookieValue = 'p_skey=' + data.p_skey + '; skey=' + data.skey + '; p_uin=o' + selfInfo.uin + '; uin=o' + selfInfo.uin;
// return { cookies: CookieValue };
// }
// const _Skey = await NTQQUserApi.getSkey();
// // 取Skey
// // 先NodeIKernelTicketService.forceFetchClientKey('')
// // 返回值
Expand Down
2 changes: 1 addition & 1 deletion src/onebot11/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class NapCatOnebot11 {
const isPrivilege = role === 3 || role === 4;
for (const member of members.values()) {
//console.log(member?.isDelete, role, isPrivilege);
if (member?.isDelete && !isPrivilege /*&& selfInfo.uin !== member.uin*/) {
if (member?.isDelete && !isPrivilege && selfInfo.uin !== member.uin) {
log('[群聊] 群组 ', groupCode, ' 成员' + member.uin + '退出');
const groupDecreaseEvent = new OB11GroupDecreaseEvent(parseInt(groupCode), parseInt(member.uin), 0, 'leave');// 不知道怎么出去的
postOB11Event(groupDecreaseEvent, true);
Expand Down
2 changes: 1 addition & 1 deletion src/onebot11/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '1.6.1';
export const version = '1.6.2';
2 changes: 1 addition & 1 deletion src/webui/ui/NapCat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function onSettingWindowCreated(view: Element) {
SettingItem(
'<span id="napcat-update-title">Napcat</span>',
undefined,
SettingButton('V1.6.1', 'napcat-update-button', 'secondary')
SettingButton('V1.6.2', 'napcat-update-button', 'secondary')
),
]),
SettingList([
Expand Down
2 changes: 1 addition & 1 deletion static/assets/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async function onSettingWindowCreated(view) {
SettingItem(
'<span id="napcat-update-title">Napcat</span>',
void 0,
SettingButton("V1.6.1", "napcat-update-button", "secondary")
SettingButton("V1.6.2", "napcat-update-button", "secondary")
)
]),
SettingList([
Expand Down

0 comments on commit 2b29538

Please sign in to comment.