mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
refactor: scipt and request
This commit is contained in:
parent
00a8715e58
commit
93cb662282
@ -2,7 +2,6 @@ function Get-QQpath {
|
||||
try {
|
||||
$key = Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ"
|
||||
$uninstallString = $key.UninstallString
|
||||
throw "get QQ path error:"
|
||||
return [System.IO.Path]::GetDirectoryName($uninstallString) + "\QQ.exe"
|
||||
} catch {
|
||||
throw "get QQ path error: $_"
|
||||
|
@ -2,7 +2,6 @@ function Get-QQpath {
|
||||
try {
|
||||
$key = Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ"
|
||||
$uninstallString = $key.UninstallString
|
||||
throw "get QQ path error:"
|
||||
return [System.IO.Path]::GetDirectoryName($uninstallString) + "\QQ.exe"
|
||||
} catch {
|
||||
throw "get QQ path error: $_"
|
||||
|
@ -63,9 +63,10 @@ export class RequestUtil {
|
||||
try {
|
||||
let response;
|
||||
if (method.toUpperCase() === 'POST') {
|
||||
response = await fetch(url, { ...requestInit, body: data });
|
||||
//console.log({ method: 'POST', ...requestInit, body: data });
|
||||
response = await fetch(url, { method: 'POST', ...requestInit, body: data });
|
||||
} else {
|
||||
response = await fetch(url, { ...requestInit });
|
||||
response = await fetch(url, { method: method, ...requestInit });
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
|
@ -14,12 +14,16 @@ export async function postLoginStatus() {
|
||||
'referrer': 'https://napcat.demo.cn/login?type=onebot11'
|
||||
}
|
||||
};
|
||||
await RequestUtil.HttpGetText('https://napcat.wumiao.wang/api/send',
|
||||
'POST',
|
||||
StatesData, {
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0'
|
||||
});
|
||||
resolve(true);
|
||||
try {
|
||||
await RequestUtil.HttpGetText('https://napcat.wumiao.wang/api/send',
|
||||
'POST',
|
||||
JSON.stringify(StatesData), {
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0'
|
||||
});
|
||||
resolve(true);
|
||||
} catch {
|
||||
reject('umami post failed')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user