-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
📑 I have found these related issues/pull requests
I have searched for similar feature requests regarding OS detection or platform metadata exposure and found no exact duplicates.
However, this relates to broader discussions often seen regarding local resource monitoring (CPU, RAM, Disk usage) where the frontend needs to know the underlying host capabilities.
🏷️ Feature Request Type
Other
🔖 Feature description
Currently, the Uptime Kuma frontend is "blind" to the underlying operating system it is running on. The Vue.js application has no standard way to know if the backend is running on Linux, Windows, Docker, or FreeBSD.
This limitation creates several issues for User Experience and Local Monitoring:
-
Cluttered UI for Cross-Platform Tools: For monitors that require system commands (like a "Local Service" monitor or future Shell Script monitors), we are forced to display help text for all platforms simultaneously (e.g., showing both PowerShell and Bash commands). This clutters the interface.
-
Inability to Provide Smart Defaults: We cannot pre-fill default paths (e.g., /var/run/... vs C:\ProgramData...) because the frontend cannot distinguish the host environment.
-
Barrier to "Internal Health" Features: As Uptime Kuma evolves to include more internal health checks (like Filesystem usage, Memory pressure, or Local Service status), the frontend needs context to validate inputs or show relevant options (e.g., hiding "Windows Service" options when running on Linux).
I am proposing this feature to allow for Adaptive UI that reacts to the Host OS, improving clarity and reducing user error.
✔️ Solution
I propose adding a lightweight platform attribute (derived from Node.js process.platform) to the initial socket handshake in server/server.js.
Backend Change: In server/server.js, inside the socket.emit("info", ...) block, we add one line:
socket.emit("info", {
version: version,
latestVersion: latestVersion,
primaryBaseURL: primaryBaseURL,
// New field:
platform: process.platform,
});Frontend Usage: This exposes the platform globally to the Vue frontend via $root.info.platform. We can then use it to conditionally render UI elements:
<div v-if="$root.info.platform === 'linux'">
Run this command: <code>systemctl is-active ...</code>
</div>
<div v-if="$root.info.platform === 'win32'">
Run this command: <code>Get-Service ...</code>
</div>This is a low-risk change (sending one string) with zero breaking changes, but it significantly improves the potential for cleaner, OS-aware monitor forms.
❓ Alternatives
-
User Selection: Asking the user to manually select "Host OS" in settings. This is redundant and prone to user error (e.g., moving a DB from Linux to Windows breaks the setting).
-
Frontend detection: Trying to guess the backend OS via browser headers is unreliable and incorrect (the browser OS != server OS).

