From f7c3c80b338f47fcb76628e49fff1407a1bed22c Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Thu, 10 Feb 2022 13:23:30 +0000 Subject: [PATCH] :card_file_box: Adds option for global useProxy (#486) --- docs/configuring.md | 1 + src/components/Widgets/WidgetBase.vue | 5 ++++- src/utils/ConfigSchema.json | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/configuring.md b/docs/configuring.md index 64b5028b..eeb6657e 100644 --- a/docs/configuring.md +++ b/docs/configuring.md @@ -99,6 +99,7 @@ Tips: **`enableMultiTasking`** | `boolean` | _Optional_ | If set to true, will keep apps open in the background when in the workspace view. Useful for quickly switching between multiple sites, and preserving their state, but comes at the cost of performance. **`workspaceLandingUrl`** | `string` | _Optional_ | The URL or an app, service or website to launch when the workspace view is opened, before another service has been launched **`allowConfigEdit`** | `boolean` | _Optional_ | Should prevent / allow the user to write configuration changes to the conf.yml from the UI. When set to `false`, the user can only apply changes locally using the config editor within the app, whereas if set to `true` then changes can be written to disk directly through the UI. Defaults to `true`. Note that if authentication is enabled, the user must be of type `admin` in order to apply changes globally. +**`widgetsAlwaysUseProxy`** | `boolean` | _Optional_ | If set to `true`, requests made by widgets will always be proxied, same as setting `useProxy: true` on each widget. Note that this may break some widgets. **`showSplashScreen`** | `boolean` | _Optional_ | If set to `true`, a loading screen will be shown. Defaults to `false`. **`enableErrorReporting`** | `boolean` | _Optional_ | Enable reporting of unexpected errors and crashes. This is off by default, and **no data will ever be captured unless you explicitly enable it**. Turning on error reporting helps previously unknown bugs get discovered and fixed. Dashy uses [Sentry](https://github.com/getsentry/sentry) for error reporting. Defaults to `false`. **`sentryDsn`** | `boolean` | _Optional_ | If you need to monitor errors in your instance, then you can use Sentry to collect and process bug reports. Sentry can be self-hosted, or used as SaaS, once your instance is setup, then all you need to do is pass in the DSN here, and enable error reporting. You can learn more on the [Sentry DSN Docs](https://docs.sentry.io/product/sentry-basics/dsn-explainer/). Note that this will only ever be used if `enableErrorReporting` is explicitly enabled. diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index b03967f4..07b246dd 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -446,6 +446,9 @@ export default { errorMsg: null, }), computed: { + appConfig() { + return this.$store.getters.appConfig; + }, /* Returns the widget type, shows error if not specified */ widgetType() { if (!this.widget.type) { @@ -457,7 +460,7 @@ export default { /* Returns users specified widget options, or empty object */ widgetOptions() { const options = this.widget.options || {}; - const useProxy = !!this.widget.useProxy; + const useProxy = this.appConfig.widgetsAlwaysUseProxy || !!this.widget.useProxy; const updateInterval = this.widget.updateInterval !== undefined ? this.widget.updateInterval : null; return { useProxy, updateInterval, ...options }; diff --git a/src/utils/ConfigSchema.json b/src/utils/ConfigSchema.json index 7b1ca073..32c24759 100644 --- a/src/utils/ConfigSchema.json +++ b/src/utils/ConfigSchema.json @@ -209,6 +209,12 @@ "default": false, "description": "If set to true, will keep apps opened in the workspace open in the background. Useful for switching between sites, but comes at the cost of performance" }, + "widgetsAlwaysUseProxy": { + "title": "Widgets always use proxy", + "type": "boolean", + "default": false, + "description": "If set to true, the useProxy option for widgets will always be applied without having to specify it for each widget" + }, "webSearch": { "title": "Web Search", "type": "object",