From f55350bebc13035e8ca54a54d84e7d8c40aec2a0 Mon Sep 17 00:00:00 2001 From: Calum Bird Date: Tue, 9 Nov 2021 21:24:31 -0800 Subject: [PATCH 01/44] Generated documentation :) --- extra/download-dist.js | 6 +++ extra/update-version.js | 19 ++++++++ server/auth.js | 7 +++ server/client.js | 12 +++++ server/image-data-uri.js | 20 +++++++++ server/modules/apicache/apicache.js | 70 +++++++++++++++++++++++++++++ server/notification.js | 7 +++ server/ping-lite.js | 12 +++++ server/server.js | 53 ++++++++++++++++++++++ src/util-frontend.js | 15 ++++++- src/util.js | 14 ++++++ 11 files changed, 234 insertions(+), 1 deletion(-) diff --git a/extra/download-dist.js b/extra/download-dist.js index dc64166c..a9c63023 100644 --- a/extra/download-dist.js +++ b/extra/download-dist.js @@ -11,6 +11,12 @@ const filename = "dist.tar.gz"; const url = `https://github.com/louislam/uptime-kuma/releases/download/${version}/${filename}`; download(url); +/** + * Downloads the latest version of the dist from a GitHub release. + * @param {string} url The URL to download from. + * + * Generated by Trelent + */ function download(url) { console.log(url); diff --git a/extra/update-version.js b/extra/update-version.js index 2e3b42da..34b46281 100644 --- a/extra/update-version.js +++ b/extra/update-version.js @@ -37,6 +37,12 @@ if (! exists) { console.log("version exists"); } +/** + * Updates the version number in package.json and commits it to git + * @param {string} version - The new version number + * + * Generated by Trelent + */ function commit(version) { let msg = "update to " + version; @@ -54,6 +60,12 @@ function tag(version) { console.log(res.stdout.toString().trim()); } +/** + * Checks if a given version is already tagged in the git repository. + * @param {string} version - The version to check for. + * + * Generated by Trelent + */ function tagExists(version) { if (! version) { throw new Error("invalid version"); @@ -64,6 +76,13 @@ function tagExists(version) { return res.stdout.toString().trim() === version; } +/** + * Update the How-to-Update.md file in the wiki to reflect a new version of Kuma. + * @param {string} oldVersion The previous version of Kuma that was released. + * @param {string} newVersion The current version of Kuma that is being released. + * + * Generated by Trelent + */ function updateWiki(oldVersion, newVersion) { const wikiDir = "./tmp/wiki"; const howToUpdateFilename = "./tmp/wiki/🆙-How-to-Update.md"; diff --git a/server/auth.js b/server/auth.js index c476ea1e..2cb71e93 100644 --- a/server/auth.js +++ b/server/auth.js @@ -30,6 +30,13 @@ exports.login = async function (username, password) { return null; }; +/** + * A function that checks if a user is logged in. + * @param {string} username The username of the user to check for. + * @param {function} callback The callback to call when done, with an error and result parameter. + * + * Generated by Trelent + */ function myAuthorizer(username, password, callback) { setting("disableAuth").then((result) => { if (result) { diff --git a/server/client.js b/server/client.js index c7b3bc16..04a6abcd 100644 --- a/server/client.js +++ b/server/client.js @@ -7,6 +7,12 @@ const { io } = require("./server"); const { setting } = require("./util-server"); const checkVersion = require("./check-version"); +/** + * Send a list of notifications to the user. + * @param {Socket} socket The socket object that is connected to the client. + * + * Generated by Trelent + */ async function sendNotificationList(socket) { const timeLogger = new TimeLogger(); @@ -83,6 +89,12 @@ async function sendImportantHeartbeatList(socket, monitorID, toUser = false, ove } +/** + * Emits the version information to the client. + * @param {Socket} socket The socket object that is connected to the client. + * + * Generated by Trelent + */ async function sendInfo(socket) { socket.emit("info", { version: checkVersion.version, diff --git a/server/image-data-uri.js b/server/image-data-uri.js index 3ccaab7d..1ab499c1 100644 --- a/server/image-data-uri.js +++ b/server/image-data-uri.js @@ -6,6 +6,12 @@ let fs = require("fs"); let ImageDataURI = (() => { + /** + * @param {string} dataURI - A string that is a valid Data URI. + * @returns {?Object} An object with properties "imageType" and "dataBase64". The former is the image type, e.g., "png", and the latter is a base64 encoded string of the image's binary data. If it fails to parse, returns null instead of an object. + * + * Generated by Trelent + */ function decode(dataURI) { if (!/data:image\//.test(dataURI)) { console.log("ImageDataURI :: Error :: It seems that it is not an Image Data URI. Couldn't match \"data:image/\""); @@ -20,6 +26,13 @@ let ImageDataURI = (() => { }; } + /** + * @param {Buffer} data - The image data to be encoded. + * @param {String} mediaType - The type of the image, e.g., "image/png". + * @returns {String|null} A string representing the base64-encoded version of the given Buffer object or null if an error occurred. + * + * Generated by Trelent + */ function encode(data, mediaType) { if (!data || !mediaType) { console.log("ImageDataURI :: Error :: Missing some of the required params: data, mediaType "); @@ -33,6 +46,13 @@ let ImageDataURI = (() => { return dataImgBase64; } + /** + * Converts a data URI to a file path. + * @param {string} dataURI The Data URI of the image. + * @param {string} [filePath] The path where the image will be saved, defaults to "./". + * + * Generated by Trelent + */ function outputFile(dataURI, filePath) { filePath = filePath || "./"; return new Promise((resolve, reject) => { diff --git a/server/modules/apicache/apicache.js b/server/modules/apicache/apicache.js index 22d1fed7..25f0a54f 100644 --- a/server/modules/apicache/apicache.js +++ b/server/modules/apicache/apicache.js @@ -68,6 +68,15 @@ function ApiCache() { instances.push(this); this.id = instances.length; + /** + * Logs a message to the console if the `DEBUG` environment variable is set. + * @param {string} a - The first argument to log. + * @param {string} b - The second argument to log. + * @param {string} c - The third argument to log. + * @param {string} d - The fourth argument to log, and so on... (optional) + * + * Generated by Trelent + */ function debug(a, b, c, d) { let arr = ["\x1b[36m[apicache]\x1b[0m", a, b, c, d].filter(function (arg) { return arg !== undefined; @@ -77,6 +86,13 @@ function ApiCache() { return (globalOptions.debug || debugEnv) && console.log.apply(null, arr); } + /** + * Returns true if the given request and response should be logged. + * @param {Object} request The HTTP request object. + * @param {Object} response The HTTP response object. + * + * Generated by Trelent + */ function shouldCacheResponse(request, response, toggle) { let opt = globalOptions; let codes = opt.statusCodes; @@ -99,6 +115,12 @@ function ApiCache() { return true; } + /** + * Adds a key to the index. + * @param {string} key The key to add. + * + * Generated by Trelent + */ function addIndexEntries(key, req) { let groupName = req.apicacheGroup; @@ -111,6 +133,13 @@ function ApiCache() { index.all.unshift(key); } + /** + * Returns a new object containing only the whitelisted headers. + * @param {Object} headers The original object of header names and values. + * @param {Array.} globalOptions.headerWhitelist An array of strings representing the whitelisted header names to keep in the output object. + * + * Generated by Trelent + */ function filterBlacklistedHeaders(headers) { return Object.keys(headers) .filter(function (key) { @@ -122,6 +151,12 @@ function ApiCache() { }, {}); } + /** + * @param {Object} headers The response headers to filter. + * @returns {Object} A new object containing only the whitelisted response headers. + * + * Generated by Trelent + */ function createCacheObject(status, headers, data, encoding) { return { status: status, @@ -132,6 +167,14 @@ function ApiCache() { }; } + /** + * Sets a cache value for the given key. + * @param {string} key The cache key to set. + * @param {*} value The cache value to set. + * @param {number} duration How long in milliseconds the cached response should be valid for (defaults to 1 hour). + * + * Generated by Trelent + */ function cacheResponse(key, value, duration) { let redis = globalOptions.redisClient; let expireCallback = globalOptions.events.expire; @@ -154,6 +197,12 @@ function ApiCache() { }, Math.min(duration, 2147483647)); } + /** + * Appends content to the response. + * @param {string|Buffer} content The content to append. + * + * Generated by Trelent + */ function accumulateContent(res, content) { if (content) { if (typeof content == "string") { @@ -179,6 +228,13 @@ function ApiCache() { } } + /** + * Monkeypatches the response object to add cache control headers and create a cache object. + * @param {Object} req - The request object. + * @param {Object} res - The response object. + * + * Generated by Trelent + */ function makeResponseCacheable(req, res, next, key, duration, strDuration, toggle) { // monkeypatch res.end to create cache object res._apicache = { @@ -245,6 +301,13 @@ function ApiCache() { next(); } + /** + * @param {Request} request + * @param {Response} response + * @returns {boolean|undefined} true if the request should be cached, false otherwise. If undefined, defaults to true. + * + * Generated by Trelent + */ function sendCachedResponse(request, response, cacheObject, toggle, next, duration) { if (toggle && !toggle(request, response)) { return next(); @@ -365,6 +428,13 @@ function ApiCache() { return this.getIndex(); }; + /** + * Converts a duration string to an integer number of milliseconds. + * @param {string} duration - The string to convert. + * @returns {number} The converted value in milliseconds, or the defaultDuration if it can't be parsed. + * + * Generated by Trelent + */ function parseDuration(duration, defaultDuration) { if (typeof duration === "number") { return duration; diff --git a/server/notification.js b/server/notification.js index 18c823b2..136c9553 100644 --- a/server/notification.js +++ b/server/notification.js @@ -140,6 +140,13 @@ class Notification { } +/** + * Adds a new monitor to the database. + * @param {number} userID The ID of the user that owns this monitor. + * @param {string} name The name of this monitor. + * + * Generated by Trelent + */ async function applyNotificationEveryMonitor(notificationID, userID) { let monitors = await R.getAll("SELECT id FROM monitor WHERE user_id = ?", [ userID diff --git a/server/ping-lite.js b/server/ping-lite.js index b2d6405a..ea3f67ed 100644 --- a/server/ping-lite.js +++ b/server/ping-lite.js @@ -8,6 +8,13 @@ const util = require("./util-server"); module.exports = Ping; +/** + * @param {string} host - The host to ping + * @param {object} [options] - Options for the ping command + * @param {array|string} [options.args] - Arguments to pass to the ping command + * + * Generated by Trelent + */ function Ping(host, options) { if (!host) { throw new Error("You must specify a host to ping!"); @@ -125,6 +132,11 @@ Ping.prototype.send = function (callback) { } }); + /** + * @param {Function} callback + * + * Generated by Trelent + */ function onEnd() { let stdout = this.stdout._stdout; let stderr = this.stderr._stderr; diff --git a/server/server.js b/server/server.js index d1fd7ff2..536d0926 100644 --- a/server/server.js +++ b/server/server.js @@ -1349,6 +1349,13 @@ exports.entryPage = "dashboard"; })(); +/** + * Adds or removes notifications from a monitor. + * @param {number} monitorID The ID of the monitor to add/remove notifications from. + * @param {Array.} notificationIDList An array of IDs for the notifications to add/remove. + * + * Generated by Trelent + */ async function updateMonitorNotification(monitorID, notificationIDList) { await R.exec("DELETE FROM monitor_notification WHERE monitor_id = ? ", [ monitorID, @@ -1364,6 +1371,13 @@ async function updateMonitorNotification(monitorID, notificationIDList) { } } +/** + * This function checks if the user owns a monitor with the given ID. + * @param {number} monitorID - The ID of the monitor to check ownership for. + * @param {number} userID - The ID of the user who is trying to access this data. + * + * Generated by Trelent + */ async function checkOwner(userID, monitorID) { let row = await R.getRow("SELECT id FROM monitor WHERE id = ? AND user_id = ? ", [ monitorID, @@ -1381,6 +1395,13 @@ async function sendMonitorList(socket) { return list; } +/** + * This function is used to send the heartbeat list of a monitor. + * @param {Socket} socket - The socket object that will be used to send the data. + * @param {String} monitorID - The ID of the monitor that will have its heartbeat list sent. + * + * Generated by Trelent + */ async function afterLogin(socket, user) { socket.userID = user.id; socket.join(user.id); @@ -1403,6 +1424,13 @@ async function afterLogin(socket, user) { } } +/** + * Get a list of monitors for the given user. + * @param {string} userID - The ID of the user to get monitors for. + * @returns {Promise} A promise that resolves to an object with monitor IDs as keys and monitor objects as values. + * + * Generated by Trelent + */ async function getMonitorJSONList(userID) { let result = {}; @@ -1417,6 +1445,11 @@ async function getMonitorJSONList(userID) { return result; } +/** + * Connect to the database and patch it if necessary. + * + * Generated by Trelent + */ async function initDatabase() { if (! fs.existsSync(Database.path)) { console.log("Copying Database"); @@ -1451,6 +1484,13 @@ async function initDatabase() { jwtSecret = jwtSecretBean.value; } +/** + * Resume a monitor. + * @param {string} userID - The ID of the user who owns the monitor. + * @param {string} monitorID - The ID of the monitor to resume. + * + * Generated by Trelent + */ async function startMonitor(userID, monitorID) { await checkOwner(userID, monitorID); @@ -1477,6 +1517,13 @@ async function restartMonitor(userID, monitorID) { return await startMonitor(userID, monitorID); } +/** + * Pause a monitor. + * @param {string} userID - The ID of the user who owns the monitor. + * @param {string} monitorID - The ID of the monitor to pause. + * + * Generated by Trelent + */ async function pauseMonitor(userID, monitorID) { await checkOwner(userID, monitorID); @@ -1509,6 +1556,12 @@ async function startMonitors() { } } +/** + * Stops all monitors and closes the database connection. + * @param {string} signal The signal that triggered this function to be called. + * + * Generated by Trelent + */ async function shutdownFunction(signal) { console.log("Shutdown requested"); console.log("Called signal: " + signal); diff --git a/src/util-frontend.js b/src/util-frontend.js index 9094dda4..dff6d679 100644 --- a/src/util-frontend.js +++ b/src/util-frontend.js @@ -7,6 +7,12 @@ import { localeDirection, currentLocale } from "./i18n"; dayjs.extend(utc); dayjs.extend(timezone); +/** + * Returns the offset from UTC in hours for the current locale. + * @returns {number} The offset from UTC in hours. + * + * Generated by Trelent + */ function getTimezoneOffset(timeZone) { const now = new Date(); const tzString = now.toLocaleString("en-US", { @@ -18,7 +24,14 @@ function getTimezoneOffset(timeZone) { return -offset; } -export function timezoneList() { +export /** + * Returns a list of timezones sorted by their offset from UTC. + * @param {Array} timezones - An array of timezone objects. + * @returns {Array} A list of the given timezones sorted by their offset from UTC. + * + * Generated by Trelent + */ +function timezoneList() { let result = []; for (let timezone of timezones) { diff --git a/src/util.js b/src/util.js index b2df7ac7..9945d7cf 100644 --- a/src/util.js +++ b/src/util.js @@ -121,6 +121,13 @@ let getRandomBytes = ((typeof window !== 'undefined' && window.crypto) : function () { return require("crypto").randomBytes; })(); +/** + * Returns a random integer between min (inclusive) and max (exclusive). + * @param {number} min The minimum value. + * @param {number} max The maximum value. + * + * Generated by Trelent + */ function getCryptoRandomInt(min, max) { // synchronous version of: https://github.com/joepie91/node-random-number-csprng const range = max - min; @@ -151,6 +158,13 @@ function getCryptoRandomInt(min, max) { } } exports.getCryptoRandomInt = getCryptoRandomInt; +/** + * Generates a random string of length `length` from the characters in `chars`. + * @param {number} length The number of characters to generate. + * @param {string} chars A string containing all the possible characters to use for generating the random string. + * + * Generated by Trelent + */ function genSecret(length = 64) { let secret = ""; const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; From a2de9e4e361a141f2fd6b1271218a6b1bbd55095 Mon Sep 17 00:00:00 2001 From: Fluency <93673101+fluencydoc@users.noreply.github.com> Date: Wed, 17 Nov 2021 16:02:31 -0800 Subject: [PATCH 02/44] Fixed export-function signature being scrambled. --- src/util-frontend.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util-frontend.js b/src/util-frontend.js index dff6d679..87cde3c4 100644 --- a/src/util-frontend.js +++ b/src/util-frontend.js @@ -24,14 +24,14 @@ function getTimezoneOffset(timeZone) { return -offset; } -export /** - * Returns a list of timezones sorted by their offset from UTC. - * @param {Array} timezones - An array of timezone objects. - * @returns {Array} A list of the given timezones sorted by their offset from UTC. - * - * Generated by Trelent - */ -function timezoneList() { +/** +* Returns a list of timezones sorted by their offset from UTC. +* @param {Array} timezones - An array of timezone objects. +* @returns {Array} A list of the given timezones sorted by their offset from UTC. +* +* Generated by Trelent +*/ +export function timezoneList() { let result = []; for (let timezone of timezones) { From 7179c6cc4c4a8c33177e4d3210e5bf8542806627 Mon Sep 17 00:00:00 2001 From: Fluency <93673101+fluencydoc@users.noreply.github.com> Date: Fri, 19 Nov 2021 10:30:31 -0800 Subject: [PATCH 03/44] Fix punctuation in extra/update-version.js Co-authored-by: Adam Stachowicz --- extra/update-version.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/update-version.js b/extra/update-version.js index 34b46281..34404f4e 100644 --- a/extra/update-version.js +++ b/extra/update-version.js @@ -38,7 +38,7 @@ if (! exists) { } /** - * Updates the version number in package.json and commits it to git + * Updates the version number in package.json and commits it to git. * @param {string} version - The new version number * * Generated by Trelent From 2c8d5d28e972693af13de11bb9be5a2023eb2a8a Mon Sep 17 00:00:00 2001 From: Marc Harnos Date: Fri, 7 Jan 2022 23:13:38 +0100 Subject: [PATCH 04/44] simplify host fallback logic move decision logic for freeBSD HOST environment var into temp var --- server/server.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/server/server.js b/server/server.js index 868bbd5e..48a4c084 100644 --- a/server/server.js +++ b/server/server.js @@ -63,12 +63,9 @@ console.info("Version: " + checkVersion.version); // If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise. // Dual-stack support for (::) -let hostname = process.env.UPTIME_KUMA_HOST || args.host; - // Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD -if (!hostname && !FBSD) { - hostname = process.env.HOST; -} +let hostEnv = FBSD ? null : process.env.HOST; +let hostname = process.env.UPTIME_KUMA_HOST || args.host || hostEnv; if (hostname) { console.log("Custom hostname: " + hostname); From 0053a29d103d803c22a278a861e417933241fb97 Mon Sep 17 00:00:00 2001 From: Marc Harnos Date: Fri, 7 Jan 2022 23:16:26 +0100 Subject: [PATCH 05/44] add validation to port value parsing only port configurations that are valid (not isNaN) after parseInt are considered to be used in port variable --- server/server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/server.js b/server/server.js index 48a4c084..6b822a3d 100644 --- a/server/server.js +++ b/server/server.js @@ -71,7 +71,9 @@ if (hostname) { console.log("Custom hostname: " + hostname); } -const port = parseInt(process.env.UPTIME_KUMA_PORT || process.env.PORT || args.port || 3001); +const port = [process.env.UPTIME_KUMA_PORT, process.env.PORT, args.port, 3001] + .map(portValue => parseInt(portValue)) + .find(portValue => !isNaN(portValue)); // SSL const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || args["ssl-key"] || undefined; From 0bbe157099996db930294893207bad3f71ea3fae Mon Sep 17 00:00:00 2001 From: Marc Harnos Date: Sat, 8 Jan 2022 14:36:33 +0100 Subject: [PATCH 06/44] change parsing priority for all passed arguments update all passed args in server.js to prioritize command line, then use env.UPTIME_KUMA_ environment variables, then use the generic environment variable versions env.HOST, env.PORT, env.SSL_KEY, env.SSL_CERT and fall back to default values where applicable --- server/server.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/server.js b/server/server.js index 6b822a3d..d3f2b20a 100644 --- a/server/server.js +++ b/server/server.js @@ -65,20 +65,20 @@ console.info("Version: " + checkVersion.version); // Dual-stack support for (::) // Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD let hostEnv = FBSD ? null : process.env.HOST; -let hostname = process.env.UPTIME_KUMA_HOST || args.host || hostEnv; +let hostname = args.host || process.env.UPTIME_KUMA_HOST || hostEnv; if (hostname) { console.log("Custom hostname: " + hostname); } -const port = [process.env.UPTIME_KUMA_PORT, process.env.PORT, args.port, 3001] +const port = [args.port, process.env.UPTIME_KUMA_PORT, process.env.PORT, 3001] .map(portValue => parseInt(portValue)) .find(portValue => !isNaN(portValue)); // SSL -const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || args["ssl-key"] || undefined; -const sslCert = process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || args["ssl-cert"] || undefined; -const disableFrameSameOrigin = !!process.env.UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN || args["disable-frame-sameorigin"] || false; +const sslKey = args["ssl-key"] || process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || undefined; +const sslCert = args["ssl-cert"] || process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || undefined; +const disableFrameSameOrigin = args["disable-frame-sameorigin"] || !!process.env.UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN || false; // 2FA / notp verification defaults const twofa_verification_opts = { From 1ecd2e45d058ada5c4bffedfcaa34216b09e157e Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Fri, 25 Mar 2022 18:59:06 +0800 Subject: [PATCH 07/44] [Status Page] Plan to support domain names for status pages --- src/pages/Entry.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/Entry.vue b/src/pages/Entry.vue index 6148ec56..90f03916 100644 --- a/src/pages/Entry.vue +++ b/src/pages/Entry.vue @@ -1,5 +1,9 @@ @@ -733,6 +770,7 @@ h1 { .sidebar-footer { border-top: 1px solid #ededed; + border-right: 1px solid #ededed; padding: 10px; width: 300px; height: 70px; @@ -740,6 +778,8 @@ h1 { left: 0; bottom: 0; background-color: white; + display: flex; + align-items: center; } } @@ -826,10 +866,31 @@ footer { } .sidebar-footer { + border-right-color: $dark-border-color; border-top-color: $dark-border-color; background-color: $dark-header-bg; } } } +.domain-name-list { + li { + display: flex; + align-items: center; + padding: 10px 0 10px 10px; + + .domain-input { + flex-grow: 1; + background-color: transparent; + border: none; + color: $dark-font-color; + outline: none; + + &::placeholder { + color: #1d2634; + } + } + } +} + From 316e65d35a9ed7fa45aeaa8d638196875416d5dc Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sun, 10 Apr 2022 00:46:34 +0800 Subject: [PATCH 39/44] Update to 1.14.0-beta.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31eea945..27edc25e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uptime-kuma", - "version": "1.14.0-beta.1", + "version": "1.14.0-beta.2", "license": "MIT", "repository": { "type": "git", From f030487f7d3bab7cf859ba21d0bfca3f437f9a2a Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sun, 10 Apr 2022 13:46:00 +0800 Subject: [PATCH 40/44] Fix theme color that do not apply to status page with a custom domain --- src/mixins/theme.js | 5 +++++ src/pages/Entry.vue | 1 + 2 files changed, 6 insertions(+) diff --git a/src/mixins/theme.js b/src/mixins/theme.js index fc593eb0..21ebd091 100644 --- a/src/mixins/theme.js +++ b/src/mixins/theme.js @@ -6,6 +6,7 @@ export default { userTheme: localStorage.theme, userHeartbeatBar: localStorage.heartbeatBarTheme, statusPageTheme: "light", + forceStatusPageTheme: false, path: "", }; }, @@ -27,6 +28,10 @@ export default { computed: { theme() { + // As entry can be status page now, set forceStatusPageTheme to true to use status page theme + if (this.forceStatusPageTheme) { + return this.statusPageTheme; + } // Entry no need dark if (this.path === "") { diff --git a/src/pages/Entry.vue b/src/pages/Entry.vue index 40aeb0b2..30e314b2 100644 --- a/src/pages/Entry.vue +++ b/src/pages/Entry.vue @@ -26,6 +26,7 @@ export default { if (res.type === "statusPageMatchedDomain") { this.statusPageSlug = res.statusPageSlug; + this.$root.forceStatusPageTheme = true; } else if (res.type === "entryPage") { // Dev only. For production, the logic is in the server side const entryPage = res.entryPage; From a0d1ae2cce19aaa3e2f69a4f2029c34b937f0af4 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 11 Apr 2022 18:02:18 +0800 Subject: [PATCH 41/44] Better alignment of monitor list item --- src/components/MonitorList.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index 6171c0b3..325245a6 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -36,7 +36,7 @@
-
+
@@ -203,9 +203,16 @@ export default { } .tags { - padding-left: 62px; + margin-top: 4px; + padding-left: 67px; display: flex; flex-wrap: wrap; gap: 0; } + +.bottom-style { + padding-left: 67px; + margin-top: 5px; +} + From 45ca3085b2e2e79f8a937576dc49083c3db0e6c3 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Tue, 12 Apr 2022 13:53:52 +0800 Subject: [PATCH 42/44] Update CONTRIBUTING.md --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff47b90b..1e6f7dfa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,6 +44,8 @@ My long story here: https://www.reddit.com/r/UptimeKuma/comments/t1t6or/comment/ ### Recommended Pull Request Guideline +Before deep into coding, disscussion first is preferred. Creating an empty pull request for disscussion would be recommended. + 1. Fork the project 1. Clone your fork repo to local 1. Create a new branch @@ -53,6 +55,7 @@ My long story here: https://www.reddit.com/r/UptimeKuma/comments/t1t6or/comment/ 1. Create a pull request: https://github.com/louislam/uptime-kuma/compare 1. Write a proper description 1. Click "Change to draft" +1. Discussion #### ❌ Won't Merge From 1ba92d803e8113374b46f729958c2d2824936162 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Tue, 12 Apr 2022 14:17:13 +0800 Subject: [PATCH 43/44] Update to 1.14.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 27edc25e..28db266a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uptime-kuma", - "version": "1.14.0-beta.2", + "version": "1.14.0", "license": "MIT", "repository": { "type": "git", @@ -36,7 +36,7 @@ "build-docker-nightly-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly-alpine --target nightly . --push", "build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain", "upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain", - "setup": "git checkout 1.13.2 && npm ci --production && npm run download-dist", + "setup": "git checkout 1.14.0 && npm ci --production && npm run download-dist", "download-dist": "node extra/download-dist.js", "mark-as-nightly": "node extra/mark-as-nightly.js", "reset-password": "node extra/reset-password.js", From 27861f0d146b84d381fe8d0f3b5f6986c30e3a0f Mon Sep 17 00:00:00 2001 From: Alexandre Gliganic <59738710+Alexandre-Gliganic@users.noreply.github.com> Date: Tue, 12 Apr 2022 16:09:01 +0200 Subject: [PATCH 44/44] Add automatic restart docker-compose.yml --- docker/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e58ee679..a6499ef9 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,3 +11,4 @@ services: - ./uptime-kuma:/app/data ports: - 3001:3001 + restart: always