-
-
Notifications
You must be signed in to change notification settings - Fork 786
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for homer-demo-content ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Up this subject :) We need fix 👍 |
There was a problem hiding this 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 🙏
/* 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}`; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
homer/src/components/services/UptimeKuma.vue
Lines 120 to 131 in b168430
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)); | |
}, |
Lines 43 to 47 in b168430
let url = this.endpoint; | |
if (path) { | |
url = `${this.endpoint}/${path}`; | |
} |
@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 🙏 |
Description
Fix the UptimeKuma service infinitely appending the slug argument to the url.
Fixes #526
Type of change
Checklist:
config.yml
file