mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-20 02:25:56 +00:00
Compare commits
7 commits
85967ed746
...
24e63ed1df
Author | SHA1 | Date | |
---|---|---|---|
|
24e63ed1df | ||
|
d2f71d11d6 | ||
|
4e667c9adb | ||
|
617634f2af | ||
|
124f5a471a | ||
|
a87b833a5a | ||
|
caa8dd8ec2 |
2 changed files with 18 additions and 3 deletions
|
@ -228,6 +228,20 @@ async function testRemoteBrowser(remoteBrowserURL) {
|
||||||
throw new Error(e.message);
|
throw new Error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup function to terminate all browser processes and clear cache after each monitoring check.
|
||||||
|
* @param {import ("playwright-core").Page} page The page to close
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function cleanupBrowser(page) {
|
||||||
|
if (page) {
|
||||||
|
await page.context().clearCookies();
|
||||||
|
await page.context().clearPermissions();
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class RealBrowserMonitorType extends MonitorType {
|
class RealBrowserMonitorType extends MonitorType {
|
||||||
|
|
||||||
name = "real-browser";
|
name = "real-browser";
|
||||||
|
@ -251,7 +265,7 @@ class RealBrowserMonitorType extends MonitorType {
|
||||||
path: path.join(Database.screenshotDir, filename),
|
path: path.join(Database.screenshotDir, filename),
|
||||||
});
|
});
|
||||||
|
|
||||||
await context.close();
|
await cleanupBrowser(page); // Ensure cleanup is called after each monitoring check
|
||||||
|
|
||||||
if (res.status() >= 200 && res.status() < 400) {
|
if (res.status() >= 200 && res.status() < 400) {
|
||||||
heartbeat.status = UP;
|
heartbeat.status = UP;
|
||||||
|
|
|
@ -12,8 +12,9 @@ class ServerChan extends NotificationProvider {
|
||||||
const okMsg = "Sent Successfully.";
|
const okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
// serverchan3 requires sending via ft07.com
|
// serverchan3 requires sending via ft07.com
|
||||||
const url = String(notification.serverChanSendKey).startsWith("sctp")
|
const matchResult = String(notification.serverChanSendKey).match(/^sctp(\d+)t/i);
|
||||||
? `https://${notification.serverChanSendKey}.push.ft07.com/send`
|
const url = matchResult && matchResult[1]
|
||||||
|
? `https://${matchResult[1]}.push.ft07.com/send/${notification.serverChanSendKey}.send`
|
||||||
: `https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`;
|
: `https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue