From dc07a42fbc001f9015dc8600c096fcd41fe660ef Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Thu, 25 Jan 2024 17:03:10 +0300 Subject: [PATCH 1/2] feat: warn for defaults --- examples/Angular/main.ts | 11 +++++-- examples/React/src/index.js | 12 ++++++-- examples/Symbolication/src/main.js | 11 +++++-- examples/example_async.html | 6 +++- examples/example_fb.html | 12 ++++++-- examples/example_formdata.html | 14 ++++++--- examples/example_gdpr.html | 11 +++++-- examples/example_helpers.html | 11 +++++-- examples/example_multiple_instances.html | 38 ++++++++++++++++++------ examples/example_opt_out.html | 11 +++++-- examples/example_rating_widgets.html | 11 +++++-- examples/example_remote_config.html | 11 +++++-- examples/example_sync.html | 11 +++++-- examples/examples_feedback_widgets.html | 11 +++++-- examples/worker.js | 12 ++++++-- 15 files changed, 154 insertions(+), 39 deletions(-) diff --git a/examples/Angular/main.ts b/examples/Angular/main.ts index 85da81a..37f2f0c 100644 --- a/examples/Angular/main.ts +++ b/examples/Angular/main.ts @@ -8,9 +8,16 @@ import Countly from 'countly-sdk-web'; window.Countly = Countly; +const COUNTLY_SERVER_KEY = "https://your.server.ly"; +const COUNTLY_APP_KEY = "YOUR_APP_KEY"; + +if(COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly"){ + throw new Error("Please do not use default set of app key and server url") +} +// initializing countly with params Countly.init({ - app_key: "YOUR_APP_KEY", - url: "https://your.domain.count.ly", + app_key: COUNTLY_APP_KEY, + url: COUNTLY_SERVER_KEY, //your server goes here debug: true }); Countly.track_sessions(); diff --git a/examples/React/src/index.js b/examples/React/src/index.js index d5461ab..34f04c9 100644 --- a/examples/React/src/index.js +++ b/examples/React/src/index.js @@ -8,9 +8,17 @@ import Countly from 'countly-sdk-web'; //Exposing Countly to the DOM as a global variable //Usecase - Heatmaps window.Countly = Countly; + +const COUNTLY_SERVER_KEY = "https://your.server.ly"; +const COUNTLY_APP_KEY = "YOUR_APP_KEY"; + +if(COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly"){ + throw new Error("Please do not use default set of app key and server url") +} +// initializing countly with params Countly.init({ - app_key: 'YOUR_APP_KEY', - url: 'YOUR_SERVER_URL', + app_key: COUNTLY_APP_KEY, + url: COUNTLY_SERVER_KEY, //your server goes here debug: true }); diff --git a/examples/Symbolication/src/main.js b/examples/Symbolication/src/main.js index 39d8e79..3c71d56 100644 --- a/examples/Symbolication/src/main.js +++ b/examples/Symbolication/src/main.js @@ -1,9 +1,16 @@ import Countly from "countly-sdk-web"; +const COUNTLY_SERVER_KEY = "https://your.server.ly"; +const COUNTLY_APP_KEY = "YOUR_APP_KEY"; + +if(COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly"){ + throw new Error("Please do not use default set of app key and server url") +} +// initializing countly with params Countly.init({ - app_key: "YOUR_APP_KEY", + app_key: COUNTLY_APP_KEY, + url: COUNTLY_SERVER_KEY, //your server goes here app_version: "1.0", - url: "https://your.domain.count.ly", debug: true }); diff --git a/examples/example_async.html b/examples/example_async.html index ac68a00..f60db3f 100644 --- a/examples/example_async.html +++ b/examples/example_async.html @@ -12,7 +12,11 @@ //provide countly initialization parameters Countly.app_key = "YOUR_APP_KEY"; - Countly.url = "https://your.domain.count.ly"; //your server goes here + Countly.url = "https://your.server.ly"; //your server goes here + + if(Countly.app_key === "YOUR_APP_KEY" || Countly.url === "https://your.server.ly"){ + throw new Error("Please do not use default set of app key and server url") + } Countly.debug = true; //start pushing function calls to queue diff --git a/examples/example_fb.html b/examples/example_fb.html index 9edf033..452ed64 100644 --- a/examples/example_fb.html +++ b/examples/example_fb.html @@ -11,10 +11,16 @@ diff --git a/examples/example_opt_out.html b/examples/example_opt_out.html index 71ad8b2..70e4179 100644 --- a/examples/example_opt_out.html +++ b/examples/example_opt_out.html @@ -9,9 +9,16 @@ import Countly from '../Countly.js'; //initializing countly with params + const COUNTLY_SERVER_KEY = "https://your.server.ly"; + const COUNTLY_APP_KEY = "YOUR_APP_KEY"; + + if(COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly"){ + throw new Error("Please do not use default set of app key and server url") + } + // initializing countly with params Countly.init({ - app_key: "YOUR_APP_KEY", - url: "https://your.domain.count.ly", //your server goes here + app_key: COUNTLY_APP_KEY, + url: COUNTLY_SERVER_KEY, //your server goes here debug: true }) //track sessions automatically diff --git a/examples/example_rating_widgets.html b/examples/example_rating_widgets.html index 955f64b..0a17a61 100644 --- a/examples/example_rating_widgets.html +++ b/examples/example_rating_widgets.html @@ -8,9 +8,16 @@