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