|
8 | 8 | // Backend uses the compiled file util.js
|
9 | 9 | // Frontend uses util.ts
|
10 | 10 | */
|
11 |
| -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { |
12 |
| - if (k2 === undefined) k2 = k; |
13 |
| - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); |
14 |
| -}) : (function(o, m, k, k2) { |
15 |
| - if (k2 === undefined) k2 = k; |
16 |
| - o[k2] = m[k]; |
17 |
| -})); |
18 |
| -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { |
19 |
| - Object.defineProperty(o, "default", { enumerable: true, value: v }); |
20 |
| -}) : function(o, v) { |
21 |
| - o["default"] = v; |
22 |
| -}); |
23 |
| -var __importStar = (this && this.__importStar) || function (mod) { |
24 |
| - if (mod && mod.__esModule) return mod; |
25 |
| - var result = {}; |
26 |
| - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); |
27 |
| - __setModuleDefault(result, mod); |
28 |
| - return result; |
29 |
| -}; |
30 |
| -var __importDefault = (this && this.__importDefault) || function (mod) { |
31 |
| - return (mod && mod.__esModule) ? mod : { "default": mod }; |
32 |
| -}; |
33 | 11 | var _a;
|
34 | 12 | Object.defineProperty(exports, "__esModule", { value: true });
|
35 | 13 | exports.CONSOLE_STYLE_FgPink = exports.CONSOLE_STYLE_FgBrown = exports.CONSOLE_STYLE_FgViolet = exports.CONSOLE_STYLE_FgLightBlue = exports.CONSOLE_STYLE_FgLightGreen = exports.CONSOLE_STYLE_FgOrange = exports.CONSOLE_STYLE_FgGray = exports.CONSOLE_STYLE_FgWhite = exports.CONSOLE_STYLE_FgCyan = exports.CONSOLE_STYLE_FgMagenta = exports.CONSOLE_STYLE_FgBlue = exports.CONSOLE_STYLE_FgYellow = exports.CONSOLE_STYLE_FgGreen = exports.CONSOLE_STYLE_FgRed = exports.CONSOLE_STYLE_FgBlack = exports.CONSOLE_STYLE_Hidden = exports.CONSOLE_STYLE_Reverse = exports.CONSOLE_STYLE_Blink = exports.CONSOLE_STYLE_Underscore = exports.CONSOLE_STYLE_Dim = exports.CONSOLE_STYLE_Bright = exports.CONSOLE_STYLE_Reset = exports.PING_PER_REQUEST_TIMEOUT_DEFAULT = exports.PING_PER_REQUEST_TIMEOUT_MAX = exports.PING_PER_REQUEST_TIMEOUT_MIN = exports.PING_COUNT_DEFAULT = exports.PING_COUNT_MAX = exports.PING_COUNT_MIN = exports.PING_GLOBAL_TIMEOUT_DEFAULT = exports.PING_GLOBAL_TIMEOUT_MAX = exports.PING_GLOBAL_TIMEOUT_MIN = exports.PING_PACKET_SIZE_DEFAULT = exports.PING_PACKET_SIZE_MAX = exports.PING_PACKET_SIZE_MIN = exports.MIN_INTERVAL_SECOND = exports.MAX_INTERVAL_SECOND = exports.SQL_DATETIME_FORMAT_WITHOUT_SECOND = exports.SQL_DATETIME_FORMAT = exports.SQL_DATE_FORMAT = exports.STATUS_PAGE_MAINTENANCE = exports.STATUS_PAGE_PARTIAL_DOWN = exports.STATUS_PAGE_ALL_UP = exports.STATUS_PAGE_ALL_DOWN = exports.MAINTENANCE = exports.PENDING = exports.UP = exports.DOWN = exports.appName = exports.isNode = exports.isDev = void 0;
|
36 | 14 | exports.evaluateJsonQuery = exports.intHash = exports.localToUTC = exports.utcToLocal = exports.utcToISODateTime = exports.isoToUTCDateTime = exports.parseTimeFromTimeObject = exports.parseTimeObject = exports.getMaintenanceRelativeURL = exports.getMonitorRelativeURL = exports.genSecret = exports.getCryptoRandomInt = exports.getRandomInt = exports.getRandomArbitrary = exports.TimeLogger = exports.polyfill = exports.log = exports.debug = exports.ucfirst = exports.sleep = exports.flipStatus = exports.badgeConstants = exports.CONSOLE_STYLE_BgGray = exports.CONSOLE_STYLE_BgWhite = exports.CONSOLE_STYLE_BgCyan = exports.CONSOLE_STYLE_BgMagenta = exports.CONSOLE_STYLE_BgBlue = exports.CONSOLE_STYLE_BgYellow = exports.CONSOLE_STYLE_BgGreen = exports.CONSOLE_STYLE_BgRed = exports.CONSOLE_STYLE_BgBlack = void 0;
|
37 |
| -const dayjs_1 = __importDefault(require("dayjs")); |
38 |
| -const jsonata = __importStar(require("jsonata")); |
| 15 | +const dayjs = require("dayjs"); |
| 16 | +const jsonata = require("jsonata"); |
39 | 17 | exports.isDev = process.env.NODE_ENV === "development";
|
40 | 18 | exports.isNode = typeof process !== "undefined" && ((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
41 | 19 | exports.appName = "Uptime Kuma";
|
@@ -187,11 +165,11 @@ class Logger {
|
187 | 165 | module = module.toUpperCase();
|
188 | 166 | level = level.toUpperCase();
|
189 | 167 | let now;
|
190 |
| - if (dayjs_1.default.tz) { |
191 |
| - now = dayjs_1.default.tz(new Date()).format(); |
| 168 | + if (dayjs.tz) { |
| 169 | + now = dayjs.tz(new Date()).format(); |
192 | 170 | }
|
193 | 171 | else {
|
194 |
| - now = (0, dayjs_1.default)().format(); |
| 172 | + now = dayjs().format(); |
195 | 173 | }
|
196 | 174 | const levelColor = consoleLevelColors[level];
|
197 | 175 | const moduleColor = consoleModuleColors[intHash(module, consoleModuleColors.length)];
|
@@ -292,11 +270,11 @@ function polyfill() {
|
292 | 270 | exports.polyfill = polyfill;
|
293 | 271 | class TimeLogger {
|
294 | 272 | constructor() {
|
295 |
| - this.startTime = (0, dayjs_1.default)().valueOf(); |
| 273 | + this.startTime = dayjs().valueOf(); |
296 | 274 | }
|
297 | 275 | print(name) {
|
298 | 276 | if (exports.isDev && process.env.TIMELOGGER === "1") {
|
299 |
| - console.log(name + ": " + ((0, dayjs_1.default)().valueOf() - this.startTime) + "ms"); |
| 277 | + console.log(name + ": " + (dayjs().valueOf() - this.startTime) + "ms"); |
300 | 278 | }
|
301 | 279 | }
|
302 | 280 | }
|
@@ -408,19 +386,19 @@ function parseTimeFromTimeObject(obj) {
|
408 | 386 | }
|
409 | 387 | exports.parseTimeFromTimeObject = parseTimeFromTimeObject;
|
410 | 388 | function isoToUTCDateTime(input) {
|
411 |
| - return (0, dayjs_1.default)(input).utc().format(exports.SQL_DATETIME_FORMAT); |
| 389 | + return dayjs(input).utc().format(exports.SQL_DATETIME_FORMAT); |
412 | 390 | }
|
413 | 391 | exports.isoToUTCDateTime = isoToUTCDateTime;
|
414 | 392 | function utcToISODateTime(input) {
|
415 |
| - return dayjs_1.default.utc(input).toISOString(); |
| 393 | + return dayjs.utc(input).toISOString(); |
416 | 394 | }
|
417 | 395 | exports.utcToISODateTime = utcToISODateTime;
|
418 | 396 | function utcToLocal(input, format = exports.SQL_DATETIME_FORMAT) {
|
419 |
| - return dayjs_1.default.utc(input).local().format(format); |
| 397 | + return dayjs.utc(input).local().format(format); |
420 | 398 | }
|
421 | 399 | exports.utcToLocal = utcToLocal;
|
422 | 400 | function localToUTC(input, format = exports.SQL_DATETIME_FORMAT) {
|
423 |
| - return (0, dayjs_1.default)(input).utc().format(format); |
| 401 | + return dayjs(input).utc().format(format); |
424 | 402 | }
|
425 | 403 | exports.localToUTC = localToUTC;
|
426 | 404 | function intHash(str, length = 10) {
|
|
0 commit comments