Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UptimeKuma url breaking (#526) #603

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dukeofsussex
Copy link

Description

Fix the UptimeKuma service infinitely appending the slug argument to the url.

Fixes #526

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I've read & comply with the contributing guidelines
  • I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • I have made corresponding changes to the documentation (README.md).
  • I've checked my modifications for any breaking changes, especially in the config.yml file

@netlify
Copy link

netlify bot commented Feb 15, 2023

Deploy Preview for homer-demo-content ready!

Name Link
🔨 Latest commit 0e2abd7
🔍 Latest deploy log https://app.netlify.com/sites/homer-demo-content/deploys/63ecfafbff95db0008a97fca
😎 Deploy Preview https://deploy-preview-603--homer-demo-content.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@jplanckeel-ep
Copy link

Up this subject :) We need fix 👍

Copy link
Owner

@bastienwirtz bastienwirtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the very very late review, thanks for spotting this and fixing it 🙏

Comment on lines -115 to +118
/* eslint-disable */
this.item.url = `${this.item.url}/status/${this.dashboard}`;
// eslint-disable-next-line vue/no-mutating-props
this.item.url = this.item.url.endsWith(this.dashboard)
? this.item.url
: `${this.item.url}/status/${this.dashboard}`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid mutating props, I would suggest to remove all this, remove the slug property (need documentation update too), to use the common endpoint property. If you remove those line and configure the service this way:

- name: "Uptime Kuma"
  url: "http://192.168.0.151:3001"
  endpoint: "http://192.168.0.151:3001/status/default" # Replace default by your dashboard name if any
  type: "UptimeKuma"

instead of

- name: "Uptime Kuma"
  url: "http://192.168.0.151:3001"
  slug: "myCustomDashboard" # Defaults to "default" if not provided.
  type: "UptimeKuma"

It should works fine.

Copy link
Author

@dukeofsussex dukeofsussex Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree mutating props isn't great, however your suggestion doesn't seem feasible, as endpoint is required to be a base path for the status queries to work

fetchStatus: function () {
const now = Date.now()
this.fetch(`/api/status-page/${this.dashboard}?cachebust=${now}`)
.catch((e) => console.error(e))
.then((resp) => (this.incident = resp));
this.fetch(
`/api/status-page/heartbeat/${this.dashboard}?cachebust=${now}`
)
.catch((e) => console.error(e))
.then((resp) => (this.heartbeat = resp));
},

let url = this.endpoint;
if (path) {
url = `${this.endpoint}/${path}`;
}

@bastienwirtz
Copy link
Owner

@jplanckeel-ep You can try to set the endpoint property in the configuration, it should work even without any code change. Something like

- name: "Uptime Kuma"
  url: "http://192.168.0.151:3001"
  endpoint: "http://192.168.0.151:3001/status/default" # Replace default by your dashboard name if any
  type: "UptimeKuma"

Can you confirm if it works§ Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Uptime Kuma URL
3 participants