Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

feat: let platforms disable we are using cookies prompt

Andrew Bastin663134839fdd
diff --git a/packages/hoppscotch-common/src/layouts/default.vue b/packages/hoppscotch-common/src/layouts/default.vue
index 4d15b19a6..012a92fe6 100644
--- a/packages/hoppscotch-common/src/layouts/default.vue
+++ b/packages/hoppscotch-common/src/layouts/default.vue
@@ -73,6 +73,7 @@ import { applySetting } from "~/newstore/settings"
import { getLocalConfig, setLocalConfig } from "~/newstore/localpersistence"
import { useToast } from "~/composables/toast"
import { useI18n } from "~/composables/i18n"
+import { platform } from "~/platform"
const router = useRouter()
@@ -98,7 +99,10 @@ onBeforeMount(() => {
onMounted(() => {
const cookiesAllowed = getLocalConfig("cookiesAllowed") === "yes"
- if (!cookiesAllowed) {
+ const platformAllowsCookiePrompts =
+ platform.platformFeatureFlags.promptAsUsingCookies ?? true
+
+ if (!cookiesAllowed && platformAllowsCookiePrompts) {
toast.show(`${t("app.we_use_cookies")}`, {
duration: 0,
action: [
diff --git a/packages/hoppscotch-common/src/platform/index.ts b/packages/hoppscotch-common/src/platform/index.ts
index e527d6174..23dccff1f 100644
--- a/packages/hoppscotch-common/src/platform/index.ts
+++ b/packages/hoppscotch-common/src/platform/index.ts
@@ -35,6 +35,14 @@ export type PlatformDef = {
* If a value is not given, then the value is assumed to be false
*/
cookiesEnabled?: boolean
+
+ /**
+ * Whether the platform should prompt the user that cookies are being used.
+ * This will result in the user being notified a cookies advisory and is meant for web apps.
+ *
+ * If a value is not given, then the value is assumed to be true
+ */
+ promptAsUsingCookies?: boolean
}
}
diff --git a/packages/hoppscotch-selfhost-desktop/src/main.ts b/packages/hoppscotch-selfhost-desktop/src/main.ts
index c150e3d3a..c608b47c7 100644
--- a/packages/hoppscotch-selfhost-desktop/src/main.ts
+++ b/packages/hoppscotch-selfhost-desktop/src/main.ts
@@ -53,6 +53,7 @@ createHoppApp("#app", {
exportAsGIST: false,
hasTelemetry: false,
cookiesEnabled: true,
+ promptAsUsingCookies: false,
},
})