Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordizzy <diosmosis@users.noreply.github.com>2021-04-15 04:25:53 +0300
committerGitHub <noreply@github.com>2021-04-15 04:25:53 +0300
commit7e091d1a32af18ed506fe113e22bb2a3d8053385 (patch)
tree52c679206547ab4895c5369b9b647542ef6aac8d /plugins/Overlay
parent34f331bfb5521b232f24b4b7aa08201f7ea55a50 (diff)
Workaround error in Overlay when site has no URLs (#17457)
* Set setting value even if set to NULL so it will still be validated. * Make sure when creating a site that the urls options is set. * workaround in Overlay for instances that have an invalid site URL set for some reason * Add integration tests for changes to SitesManager API. * revert non-overlay changes * Add warning if site has no URLs when viewing Overlay.
Diffstat (limited to 'plugins/Overlay')
-rw-r--r--plugins/Overlay/javascripts/Piwik_Overlay.js16
-rw-r--r--plugins/Overlay/lang/en.json3
-rw-r--r--plugins/Overlay/stylesheets/overlay.css7
-rw-r--r--plugins/Overlay/templates/index.twig4
4 files changed, 28 insertions, 2 deletions
diff --git a/plugins/Overlay/javascripts/Piwik_Overlay.js b/plugins/Overlay/javascripts/Piwik_Overlay.js
index 3c9a0b4551..bccdd2aec5 100644
--- a/plugins/Overlay/javascripts/Piwik_Overlay.js
+++ b/plugins/Overlay/javascripts/Piwik_Overlay.js
@@ -149,11 +149,25 @@ var Piwik_Overlay = (function () {
var m = location.match(ORIGIN_PARSE_REGEX);
iframeOrigin = m ? m[0] : null;
+ var foundValidSiteUrl = false;
+
// unset iframe origin if it is not one of the site URLs
var validSiteOrigins = Piwik_Overlay.siteUrls.map(function (url) {
- return url.match(ORIGIN_PARSE_REGEX)[0].toLowerCase();
+ if (typeof url === 'string' && url !== "") {
+ foundValidSiteUrl = true;
+ }
+
+ var siteUrlMatch = url.match(ORIGIN_PARSE_REGEX);
+ if (!siteUrlMatch) {
+ return null;
+ }
+ return siteUrlMatch[0].toLowerCase();
});
+ if (!foundValidSiteUrl) {
+ $('#overlayErrorNoSiteUrls').show();
+ }
+
if (iframeOrigin && validSiteOrigins.indexOf(iframeOrigin.toLowerCase()) === -1) {
try {
console.log('Found invalid iframe origin in hash URL: ' + iframeOrigin);
diff --git a/plugins/Overlay/lang/en.json b/plugins/Overlay/lang/en.json
index c66e89ee10..383b6013c3 100644
--- a/plugins/Overlay/lang/en.json
+++ b/plugins/Overlay/lang/en.json
@@ -16,6 +16,7 @@
"PluginDescription": "See your analytics data as an Overlay on your actual website. View how many times your users have clicked on each link. Note: Requires the Transitions plugin enabled.",
"RedirectUrlError": "You are attempting to open Page Overlay for the URL \"%1$s\". %2$s None of the domains from the Matomo settings matches the link.",
"RedirectUrlErrorAdmin": "You can add the domain as an additional URL %1$sin the settings%2$s.",
- "RedirectUrlErrorUser": "Ask your administrator to add the domain as an additional URL."
+ "RedirectUrlErrorUser": "Ask your administrator to add the domain as an additional URL.",
+ "ErrorNoSiteUrls": "WARNING: This website has no Site URLs defined in Matomo. This might cause Overlay and other features to break or behave strangely. To fix this, add a URL in the settings for this website in the Matomo Administration section."
}
} \ No newline at end of file
diff --git a/plugins/Overlay/stylesheets/overlay.css b/plugins/Overlay/stylesheets/overlay.css
index 42585250b3..028fba76a8 100644
--- a/plugins/Overlay/stylesheets/overlay.css
+++ b/plugins/Overlay/stylesheets/overlay.css
@@ -150,6 +150,13 @@ body .ui-tooltip.overlayTooltip {
padding: 3px 5px 3px 6px;
}
+#overlayErrorNoSiteUrls {
+ width: 190px;
+ margin: 20px 0 20px 5px;
+ font-size: 14px;
+ font-weight: bold;
+}
+
#overlayNoFrame {
padding: 20px 0 40px 2px;
}
diff --git a/plugins/Overlay/templates/index.twig b/plugins/Overlay/templates/index.twig
index 42294e2ae4..e4a4c77441 100644
--- a/plugins/Overlay/templates/index.twig
+++ b/plugins/Overlay/templates/index.twig
@@ -25,6 +25,10 @@
</select>
</div>
+ <div id="overlayErrorNoSiteUrls" style="display:none;">
+ {{ 'Overlay_ErrorNoSiteUrls'|translate }}
+ </div>
+
<div id="overlayErrorNotLoading">
<p>
<span>{{ 'Overlay_ErrorNotLoading'|translate }}</span>