mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-09-17 08:56:57 +08:00
Rollback "command-exists-promise" as it is not working
This commit is contained in:
@@ -2,13 +2,13 @@ const { MonitorType } = require("./monitor-type");
|
||||
const { chromium } = require("playwright-core");
|
||||
const { UP, log } = require("../../src/util");
|
||||
const { Settings } = require("../settings");
|
||||
const commandExists = require("command-exists-promise");
|
||||
const childProcess = require("child_process");
|
||||
const path = require("path");
|
||||
const Database = require("../database");
|
||||
const jwt = require("jsonwebtoken");
|
||||
const config = require("../config");
|
||||
const { RemoteBrowser } = require("../remote-browser");
|
||||
const { commandExists } = require("../util-server");
|
||||
|
||||
/**
|
||||
* Cached instance of a browser
|
||||
|
@@ -77,6 +77,7 @@ const SendGrid = require("./notification-providers/send-grid");
|
||||
const YZJ = require("./notification-providers/yzj");
|
||||
const SMSPlanet = require("./notification-providers/sms-planet");
|
||||
const SpugPush = require("./notification-providers/spugpush");
|
||||
const { commandExists } = require("./util-server");
|
||||
|
||||
class Notification {
|
||||
|
||||
@@ -262,7 +263,6 @@ class Notification {
|
||||
* @returns {Promise<boolean>} Does the command apprise exist?
|
||||
*/
|
||||
static async checkApprise() {
|
||||
const commandExists = require("command-exists-promise");
|
||||
return await commandExists("apprise");
|
||||
}
|
||||
|
||||
|
@@ -1096,3 +1096,19 @@ module.exports.axiosAbortSignal = (timeoutMs) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* By default, command-exists will throw a null error if the command does not exist, which is ugly. The function makes it better.
|
||||
* Read more: https://github.com/mathisonian/command-exists/issues/22
|
||||
* @param {string} command Command to check
|
||||
* @returns {Promise<boolean>} True if command exists, false otherwise
|
||||
*/
|
||||
async function commandExists(command) {
|
||||
try {
|
||||
await require("command-exists")(command);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
module.exports.commandExists = commandExists;
|
||||
|
Reference in New Issue
Block a user