mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { GeneralCallResult } from './common';
|
import { GeneralCallResult } from './common';
|
||||||
enum ProxyType {
|
enum ProxyType {
|
||||||
|
CLOSE = 0,
|
||||||
HTTP = 1,
|
HTTP = 1,
|
||||||
SOCKET = 2
|
SOCKET = 2
|
||||||
}
|
}
|
||||||
@@ -14,6 +15,15 @@ export interface NodeIKernelMSFService {
|
|||||||
domain: string,
|
domain: string,
|
||||||
isSocket: boolean
|
isSocket: boolean
|
||||||
}): Promise<GeneralCallResult>;
|
}): Promise<GeneralCallResult>;
|
||||||
|
getNetworkProxy(): Promise<{
|
||||||
|
userName: string,
|
||||||
|
userPwd: string,
|
||||||
|
address: string,
|
||||||
|
port: number,
|
||||||
|
proxyType: ProxyType,
|
||||||
|
domain: string,
|
||||||
|
isSocket: boolean
|
||||||
|
}>;
|
||||||
//http
|
//http
|
||||||
// userName: '',
|
// userName: '',
|
||||||
// userPwd: '',
|
// userPwd: '',
|
||||||
|
@@ -260,7 +260,30 @@ async function initializeSession(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
async function handleProxy(session: NodeIQQNTWrapperSession, logger: LogWrapper) {
|
||||||
|
if (process.env['NAPCAT_PROXY_PORT']) {
|
||||||
|
session.getMSFService().setNetworkProxy({
|
||||||
|
userName: '',
|
||||||
|
userPwd: '',
|
||||||
|
address: process.env['NAPCAT_PROXY_ADDRESS'] || '127.0.0.1',
|
||||||
|
port: +process.env['NAPCAT_PROXY_PORT'],
|
||||||
|
proxyType: 2,
|
||||||
|
domain: '',
|
||||||
|
isSocket: true
|
||||||
|
});
|
||||||
|
logger.logWarn('已设置代理', process.env['NAPCAT_PROXY_ADDRESS'], process.env['NAPCAT_PROXY_PORT']);
|
||||||
|
} else if (process.env['NAPCAT_PROXY_CLOSE']) {
|
||||||
|
session.getMSFService().setNetworkProxy({
|
||||||
|
userName: '',
|
||||||
|
userPwd: '',
|
||||||
|
address: '',
|
||||||
|
port: 0,
|
||||||
|
proxyType: 0,
|
||||||
|
domain: '',
|
||||||
|
isSocket: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
export async function NCoreInitShell() {
|
export async function NCoreInitShell() {
|
||||||
console.log('NapCat Shell App Loading...');
|
console.log('NapCat Shell App Loading...');
|
||||||
const pathWrapper = new NapCatPathWrapper();
|
const pathWrapper = new NapCatPathWrapper();
|
||||||
@@ -286,7 +309,7 @@ export async function NCoreInitShell() {
|
|||||||
|
|
||||||
await initializeEngine(engine, basicInfoWrapper, dataPathGlobal, systemPlatform, systemVersion);
|
await initializeEngine(engine, basicInfoWrapper, dataPathGlobal, systemPlatform, systemVersion);
|
||||||
await initializeLoginService(loginService, basicInfoWrapper, dataPathGlobal, systemVersion, hostname);
|
await initializeLoginService(loginService, basicInfoWrapper, dataPathGlobal, systemVersion, hostname);
|
||||||
|
handleProxy(session, logger);
|
||||||
program.option('-q, --qq [number]', 'QQ号').parse(process.argv);
|
program.option('-q, --qq [number]', 'QQ号').parse(process.argv);
|
||||||
const cmdOptions = program.opts();
|
const cmdOptions = program.opts();
|
||||||
const quickLoginUin = cmdOptions['qq'];
|
const quickLoginUin = cmdOptions['qq'];
|
||||||
@@ -294,18 +317,7 @@ export async function NCoreInitShell() {
|
|||||||
|
|
||||||
const dataTimestape = new Date().getTime().toString();
|
const dataTimestape = new Date().getTime().toString();
|
||||||
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
|
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
|
||||||
if (process.env['NAPCAT_PROXY_PORT']) {
|
|
||||||
session.getMSFService().setNetworkProxy({
|
|
||||||
userName: '',
|
|
||||||
userPwd: '',
|
|
||||||
address: process.env['NAPCAT_PROXY_ADDRESS'] || '127.0.0.1',
|
|
||||||
port: +process.env['NAPCAT_PROXY_PORT'],
|
|
||||||
proxyType: 2,
|
|
||||||
domain: '',
|
|
||||||
isSocket: true
|
|
||||||
});
|
|
||||||
logger.logWarn('已设置代理', process.env['NAPCAT_PROXY_ADDRESS'], process.env['NAPCAT_PROXY_PORT']);
|
|
||||||
}
|
|
||||||
const selfInfo = await handleLogin(loginService, logger, pathWrapper, quickLoginUin, historyLoginList);
|
const selfInfo = await handleLogin(loginService, logger, pathWrapper, quickLoginUin, historyLoginList);
|
||||||
const amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
|
const amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
|
||||||
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));
|
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));
|
||||||
|
Reference in New Issue
Block a user