Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:sparkles: UI implementation of custom response code (#456)

Alicia Sykese6ba3243c3d2
diff --git a/src/components/LinkItems/Item.vue b/src/components/LinkItems/Item.vue
index 024de6f2..c242d1df 100644
--- a/src/components/LinkItems/Item.vue
+++ b/src/components/LinkItems/Item.vue
@@ -95,6 +95,7 @@ export default {
statusCheckUrl: String, // Custom URL for status check endpoint
statusCheckInterval: Number, // Num seconds beteween repeating checks
statusCheckAllowInsecure: Boolean, // Status check ignore SSL certs
+ statusCheckAcceptCodes: String, // Allow status checks to pass with a code other than 200
parentSectionTitle: String, // Title of parent section (for add new)
isAddNew: Boolean, // Only set if 'fake' item used as Add New button
},
@@ -236,7 +237,7 @@ export default {
/* Pulls together all user options, returns URL + Get params for ping endpoint */
makeApiUrl() {
const {
- url, statusCheckUrl, statusCheckHeaders, statusCheckAllowInsecure,
+ url, statusCheckUrl, statusCheckHeaders, statusCheckAllowInsecure, statusCheckAcceptCodes,
} = this;
const encode = (str) => encodeURIComponent(str);
this.statusResponse = undefined;
@@ -249,8 +250,10 @@ export default {
? `&headers=${encode(JSON.stringify(statusCheckHeaders))}` : '';
// Deterimine if user disabled security
const enableInsecure = statusCheckAllowInsecure ? '&enableInsecure=true' : '';
+ const acceptCodes = statusCheckAcceptCodes ? `&acceptCodes=${statusCheckAcceptCodes}` : '';
// Construct the full API endpoint's URL with GET params
- return `${baseUrl}${serviceEndpoints.statusCheck}/${urlToCheck}${headers}${enableInsecure}`;
+ return `${baseUrl}${serviceEndpoints.statusCheck}/${urlToCheck}`
+ + `${headers}${enableInsecure}${acceptCodes}`;
},
/* Checks if a given service is currently online */
checkWebsiteStatus() {
diff --git a/src/components/LinkItems/Section.vue b/src/components/LinkItems/Section.vue
index cdb8bf21..56d1f067 100644
--- a/src/components/LinkItems/Section.vue
+++ b/src/components/LinkItems/Section.vue
@@ -41,6 +41,7 @@
:enableStatusCheck="item.statusCheck !== undefined ? item.statusCheck : enableStatusCheck"
:statusCheckInterval="statusCheckInterval"
:statusCheckAllowInsecure="item.statusCheckAllowInsecure"
+ :statusCheckAcceptCodes="item.statusCheckAcceptCodes"
@itemClicked="$emit('itemClicked')"
@triggerModal="triggerModal"
:isAddNew="false"
diff --git a/src/components/MinimalView/MinimalSection.vue b/src/components/MinimalView/MinimalSection.vue
index 6eb09341..d561f3ca 100644
--- a/src/components/MinimalView/MinimalSection.vue
+++ b/src/components/MinimalView/MinimalSection.vue
@@ -17,6 +17,8 @@
:itemSize="itemSize"
:hotkey="item.hotkey"
:enableStatusCheck="shouldEnableStatusCheck(item.statusCheck)"
+ :statusCheckAllowInsecure="item.statusCheckAllowInsecure"
+ :statusCheckAcceptCodes="item.statusCheckAcceptCodes"
:statusCheckInterval="getStatusCheckInterval()"
@itemClicked="$emit('itemClicked')"
@triggerModal="triggerModal"