π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
π Updates widget request to only apply headers when needed
Alicia Sykes395aea292e25
diff --git a/src/mixins/WidgetMixin.js b/src/mixins/WidgetMixin.jsindex ef35644c..833c8b38 100644--- a/src/mixins/WidgetMixin.js+++ b/src/mixins/WidgetMixin.js@@ -16,6 +16,7 @@ const WidgetMixin = {},data: () => ({progress: new ProgressBar({ color: 'var(--progress-bar)' }),+ overrideProxyChoice: false,}),/* When component mounted, fetch initial data */mounted() {@@ -27,7 +28,7 @@ const WidgetMixin = {return `${baseUrl}${serviceEndpoints.corsProxy}`;},useProxy() {- return this.options.useProxy;+ return this.options.useProxy || this.overrideProxyChoice;},},methods: {@@ -60,15 +61,20 @@ const WidgetMixin = {return { content, trigger: 'hover focus', delay: 250 };},/* Makes data request, returns promise */- makeRequest(endpoint, options = {}) {+ makeRequest(endpoint, options) {// Request Optionsconst method = 'GET';const url = this.useProxy ? this.proxyReqEndpoint : endpoint;- const headers = this.useProxy ? { 'Target-URL': endpoint, ...options } : options;+ const CustomHeaders = options ? { ...JSON.stringify(options) } : null;+ const headers = this.useProxy+ ? { 'Target-URL': endpoint, CustomHeaders } : CustomHeaders;// Make requestreturn new Promise((resolve, reject) => {axios.request({ method, url, headers }).then((response) => {+ if (response.data.success === false) {+ this.error('Proxy returned error from target server', response.data.message);+ }resolve(response.data);}).catch((dataFetchError) => {