added helper to identify domain

added a helper to identify the current domain to enabled or disable features for future implementations

This is an imported pull request from
https://github.com/google/skia-buildbot/pull/50

GitOrigin-RevId: 88d719996d987c628670c9db0deaa80029bcbb03
Change-Id: Icca712accfc6aed628ced5a37bab3e8eb751b4a8
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/373011
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
diff --git a/skottie/modules/helpers/domains.js b/skottie/modules/helpers/domains.js
new file mode 100644
index 0000000..5196947
--- /dev/null
+++ b/skottie/modules/helpers/domains.js
@@ -0,0 +1,17 @@
+// Helper to identify domain and enable or disable features based on them
+
+const currentDomaint = window.location.hostname;
+
+const supportedDomains = {
+  SKOTTIE_INTERNAL: 'skottie-internal.skia.org',
+  SKOTTIE_TENOR: 'skottie-tenor.skia.org',
+  SKOTTIE: 'skottie.skia.org',
+  LOCALHOST: 'localhost',
+};
+
+const isDomain = (domain) => domain === currentDomaint;
+
+export {
+  isDomain,
+  supportedDomains,
+};
diff --git a/skottie/modules/skottie-sk/skottie-sk.js b/skottie/modules/skottie-sk/skottie-sk.js
index f475a91..6dbfda5 100644
--- a/skottie/modules/skottie-sk/skottie-sk.js
+++ b/skottie/modules/skottie-sk/skottie-sk.js
@@ -22,6 +22,7 @@
 import { stateReflector } from 'common-sk/modules/stateReflector'
 import '../skottie-text-editor'
 import { SoundMap, AudioPlayer } from '../audio'
+import { supportedDomains, isDomain } from '../helpers/domains'
 
 const JSONEditor = require('jsoneditor/dist/jsoneditor-minimalist.js');
 const bodymovin = require('lottie-web/build/player/lottie.min.js');
@@ -191,7 +192,7 @@
 };
 
 const redir = (ele) => {
-  if (window.location.hostname !== 'skottie-internal.skia.org') {
+  if (!isDomain(supportedDomains.SKOTTIE_INTERNAL)) {
     return html`
 <div>
   Googlers should use <a href="https://skottie-internal.skia.org">skottie-internal.skia.org</a>.