From d302795512e859db1ede72db8d8d65640562b046 Mon Sep 17 00:00:00 2001 From: Jai A Date: Wed, 9 Oct 2024 14:04:33 -0700 Subject: [PATCH] Fix ad init not working on no tauri invoke --- apps/frontend/src/public/promo-frame.html | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/frontend/src/public/promo-frame.html b/apps/frontend/src/public/promo-frame.html index 9cf4f9ef8..0b72fc3be 100644 --- a/apps/frontend/src/public/promo-frame.html +++ b/apps/frontend/src/public/promo-frame.html @@ -73,17 +73,26 @@ }); const hash = getCookie("modrinth-app-token"); - console.log(hash) + console.log(hash); tude.setIdProfile({ e: hash, }); }); } - window.__TAURI_INTERNALS__ - .invoke("plugin:ads|get_ads_personalization", {}) - .then(initAds) - .catch(() => initAds(true)); + try { + if (window.__TAURI_INTERNALS__) { + window.__TAURI_INTERNALS__ + .invoke("plugin:ads|get_ads_personalization", {}) + .then(initAds) + .catch(() => initAds(true)); + } else { + initAds(true); + } + } catch (err) { + initAds(true); + console.error(err); + } window.addEventListener( "message",