π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
:sparkles: Re: #181 Adds option to ignore SSL in ping
Alicia Sykesf343af3b002e
diff --git a/src/components/LinkItems/Item.vue b/src/components/LinkItems/Item.vueindex 1a33a818..0177d886 100644--- a/src/components/LinkItems/Item.vue+++ b/src/components/LinkItems/Item.vue@@ -72,6 +72,7 @@ export default {statusCheckHeaders: Object,statusCheckUrl: String,statusCheckInterval: Number,+ statusCheckAllowInsecure: Boolean,},data() {return {@@ -144,18 +145,33 @@ export default {default: return '"\\f054"';}},- /* Checks if a given service is currently online */- checkWebsiteStatus() {+ /* Pulls together all user options, returns URL + Get params for ping endpoint */+ makeApiUrl() {+ const {+ url, statusCheckUrl, statusCheckHeaders, statusCheckAllowInsecure,+ } = this;+ const encode = (str) => encodeURIComponent(str);this.statusResponse = undefined;+ // Find base URL, where the API is hostedconst baseUrl = process.env.VUE_APP_DOMAIN || window.location.origin;- const urlToCheck = this.statusCheckUrl || this.url;- const headers = this.statusCheckHeaders || {};- const endpoint = `${baseUrl}/ping?url=${urlToCheck}`;- axios.get(endpoint, { headers })+ // Find correct URL to check, and encode+ const urlToCheck = `?&url=${encode(statusCheckUrl || url)}`;+ // Get, stringify and encode any headers+ const headers = statusCheckHeaders+ ? `&headers=${encode(JSON.stringify(statusCheckHeaders))}` : '';+ // Deterimine if user disabled security+ const enableInsecure = statusCheckAllowInsecure ? '&enableInsecure=true' : '';+ // Construct the full API endpoint's URL with GET params+ return `${baseUrl}/ping/${urlToCheck}${headers}${enableInsecure}`;+ },+ /* Checks if a given service is currently online */+ checkWebsiteStatus() {+ const endpoint = this.makeApiUrl();+ axios.get(endpoint).then((response) => {if (response.data) this.statusResponse = response.data;})- .catch(() => {+ .catch(() => { // Something went very wrong.this.statusResponse = {statusText: 'Failed to make request',statusSuccess: false,diff --git a/src/components/LinkItems/Section.vue b/src/components/LinkItems/Section.vueindex f9bc3afa..c88ad459 100644--- a/src/components/LinkItems/Section.vue+++ b/src/components/LinkItems/Section.vue@@ -33,6 +33,7 @@:hotkey="item.hotkey":enableStatusCheck="shouldEnableStatusCheck(item.statusCheck)":statusCheckInterval="getStatusCheckInterval()"+ :statusCheckAllowInsecure="item.statusCheckAllowInsecure"@itemClicked="$emit('itemClicked')"@triggerModal="triggerModal"/>