';
+ $this->app->close();
+ }
+ }
+
+ /**
+ * Inject robots meta tag for alias domains.
+ *
+ * @param \Joomla\CMS\Document\HtmlDocument $doc Document object
+ *
+ * @return void
+ *
+ * @since 02.01.43
+ */
+ protected function injectAliasRobots($doc)
+ {
+ $alias = $this->getCurrentAlias();
+
+ if ($alias === null)
+ {
+ return;
+ }
+
+ $robots = $alias->robots ?? 'index, follow';
+
+ if ($robots !== 'index, follow')
+ {
+ $doc->setMetaData('robots', $robots);
+ }
+ }
+
// ------------------------------------------------------------------
// Heartbeat (called from onExtensionAfterSave)
// ------------------------------------------------------------------
@@ -2566,8 +2711,9 @@ class MokoWaaS extends CMSPlugin
/**
* Send heartbeat to the MokoWaaS monitoring receiver.
*
- * Registers this site (and any aliases) with the Grafana provisioning system.
+ * Registers this site's primary domain with the Grafana provisioning system.
* The receiver writes a datasource YAML file and restarts Grafana.
+ * Alias domains are not registered to avoid duplicate datasource UIDs.
*
* @param \Joomla\Registry\Registry $params Plugin params
* @param \Joomla\CMS\Application\CMSApplication $app Application
@@ -2588,21 +2734,8 @@ class MokoWaaS extends CMSPlugin
$siteUrl = rtrim(Uri::root(), '/');
$siteName = Factory::getConfig()->get('sitename', 'Joomla');
- // Register primary domain
+ // Register primary domain only — aliases should not get separate datasources
$this->sendHeartbeat($siteUrl, $siteName, $healthToken, $app);
-
- // Register any alias domains
- $aliases = $params->get('site_aliases', '');
-
- if (!empty($aliases))
- {
- foreach (array_filter(array_map('trim', explode(',', $aliases))) as $alias)
- {
- $aliasUrl = 'https://' . ltrim($alias, 'https://');
- $aliasUrl = rtrim($aliasUrl, '/');
- $this->sendHeartbeat($aliasUrl, $siteName . ' (' . $alias . ')', $healthToken, $app);
- }
- }
}
/**
@@ -2650,16 +2783,18 @@ class MokoWaaS extends CMSPlugin
$app->enqueueMessage('Grafana heartbeat failed (' . $siteUrl . '): ' . $error, 'warning');
Log::add('Heartbeat failed: ' . $error, Log::WARNING, 'mokowaas');
}
- elseif ($code === 200 && ($body['status'] ?? '') === 'registered')
+ elseif ($code === 200)
{
+ $status = $body['status'] ?? 'ok';
$app->enqueueMessage(
- 'Grafana heartbeat: ' . $siteUrl . ' registered (' . ($body['ds_uid'] ?? '') . ')',
+ 'Grafana heartbeat: ' . $siteUrl . ' ' . $status . ' (' . ($body['ds_uid'] ?? '') . ')',
'message'
);
}
else
{
- $msg = sprintf('Grafana heartbeat failed (%s): HTTP %d', $siteUrl, $code);
+ $msg = sprintf('Grafana heartbeat failed (%s): HTTP %d — %s',
+ $siteUrl, $code, $body['error'] ?? $body['message'] ?? 'Unknown');
$app->enqueueMessage($msg, 'warning');
Log::add($msg, Log::WARNING, 'mokowaas');
}
diff --git a/src/forms/alias_entry.xml b/src/forms/alias_entry.xml
new file mode 100644
index 0000000..1613b71
--- /dev/null
+++ b/src/forms/alias_entry.xml
@@ -0,0 +1,55 @@
+
+
diff --git a/src/language/en-GB/plg_system_mokowaas.ini b/src/language/en-GB/plg_system_mokowaas.ini
index 348613a..415df26 100644
--- a/src/language/en-GB/plg_system_mokowaas.ini
+++ b/src/language/en-GB/plg_system_mokowaas.ini
@@ -130,5 +130,18 @@ PLG_SYSTEM_MOKOWAAS_UPLOAD_TYPES_DESC="Comma-separated list of allowed file exte
PLG_SYSTEM_MOKOWAAS_UPLOAD_SIZE_LABEL="Max Upload Size (MB)"
PLG_SYSTEM_MOKOWAAS_UPLOAD_SIZE_DESC="Maximum file upload size in megabytes."
-PLG_SYSTEM_MOKOWAAS_SITE_ALIASES_LABEL="Site Aliases"
-PLG_SYSTEM_MOKOWAAS_SITE_ALIASES_DESC="Comma-separated list of additional domains this site is accessible on (e.g. www.example.com,alias.example.com). Each alias gets its own Grafana datasource for health monitoring."
+; ===== Site Aliases fieldset =====
+PLG_SYSTEM_MOKOWAAS_FIELDSET_ALIASES_LABEL="Site Aliases"
+PLG_SYSTEM_MOKOWAAS_FIELDSET_ALIASES_DESC="Configure additional domains that mirror this site. Each alias can have its own offline status, robots directive, and backend redirect behavior."
+PLG_SYSTEM_MOKOWAAS_SITE_ALIASES_LABEL="Domain Aliases"
+PLG_SYSTEM_MOKOWAAS_SITE_ALIASES_DESC="Add domain aliases that serve as mirrors of this site. Each alias gets its own Grafana monitoring datasource."
+PLG_SYSTEM_MOKOWAAS_ALIAS_DOMAIN_LABEL="Domain"
+PLG_SYSTEM_MOKOWAAS_ALIAS_DOMAIN_DESC="The alias domain name (e.g. www.example.com). Do not include https:// prefix."
+PLG_SYSTEM_MOKOWAAS_ALIAS_OFFLINE_LABEL="Offline"
+PLG_SYSTEM_MOKOWAAS_ALIAS_OFFLINE_DESC="Show an offline maintenance page when visitors access the site through this alias domain."
+PLG_SYSTEM_MOKOWAAS_ALIAS_OFFLINE_MSG_LABEL="Offline Message"
+PLG_SYSTEM_MOKOWAAS_ALIAS_OFFLINE_MSG_DESC="Custom message to display when this alias is set to offline."
+PLG_SYSTEM_MOKOWAAS_ALIAS_ROBOTS_LABEL="Robots"
+PLG_SYSTEM_MOKOWAAS_ALIAS_ROBOTS_DESC="Meta robots directive for this alias domain. Use 'noindex, nofollow' to prevent search engines from indexing the alias."
+PLG_SYSTEM_MOKOWAAS_ALIAS_REDIRECT_BACKEND_LABEL="Redirect Backend"
+PLG_SYSTEM_MOKOWAAS_ALIAS_REDIRECT_BACKEND_DESC="Redirect admin panel requests on this alias to the primary domain. Frontend stays on the alias domain."
diff --git a/src/language/en-US/plg_system_mokowaas.ini b/src/language/en-US/plg_system_mokowaas.ini
index 28eafa4..62cfa64 100644
--- a/src/language/en-US/plg_system_mokowaas.ini
+++ b/src/language/en-US/plg_system_mokowaas.ini
@@ -130,5 +130,18 @@ PLG_SYSTEM_MOKOWAAS_UPLOAD_TYPES_DESC="Comma-separated list of allowed file exte
PLG_SYSTEM_MOKOWAAS_UPLOAD_SIZE_LABEL="Max Upload Size (MB)"
PLG_SYSTEM_MOKOWAAS_UPLOAD_SIZE_DESC="Maximum file upload size in megabytes."
-PLG_SYSTEM_MOKOWAAS_SITE_ALIASES_LABEL="Site Aliases"
-PLG_SYSTEM_MOKOWAAS_SITE_ALIASES_DESC="Comma-separated list of additional domains this site is accessible on (e.g. www.example.com,alias.example.com). Each alias gets its own Grafana datasource for health monitoring."
+; ===== Site Aliases fieldset =====
+PLG_SYSTEM_MOKOWAAS_FIELDSET_ALIASES_LABEL="Site Aliases"
+PLG_SYSTEM_MOKOWAAS_FIELDSET_ALIASES_DESC="Configure additional domains that mirror this site. Each alias can have its own offline status, robots directive, and backend redirect behavior."
+PLG_SYSTEM_MOKOWAAS_SITE_ALIASES_LABEL="Domain Aliases"
+PLG_SYSTEM_MOKOWAAS_SITE_ALIASES_DESC="Add domain aliases that serve as mirrors of this site. Each alias gets its own Grafana monitoring datasource."
+PLG_SYSTEM_MOKOWAAS_ALIAS_DOMAIN_LABEL="Domain"
+PLG_SYSTEM_MOKOWAAS_ALIAS_DOMAIN_DESC="The alias domain name (e.g. www.example.com). Do not include https:// prefix."
+PLG_SYSTEM_MOKOWAAS_ALIAS_OFFLINE_LABEL="Offline"
+PLG_SYSTEM_MOKOWAAS_ALIAS_OFFLINE_DESC="Show an offline maintenance page when visitors access the site through this alias domain."
+PLG_SYSTEM_MOKOWAAS_ALIAS_OFFLINE_MSG_LABEL="Offline Message"
+PLG_SYSTEM_MOKOWAAS_ALIAS_OFFLINE_MSG_DESC="Custom message to display when this alias is set to offline."
+PLG_SYSTEM_MOKOWAAS_ALIAS_ROBOTS_LABEL="Robots"
+PLG_SYSTEM_MOKOWAAS_ALIAS_ROBOTS_DESC="Meta robots directive for this alias domain. Use 'noindex, nofollow' to prevent search engines from indexing the alias."
+PLG_SYSTEM_MOKOWAAS_ALIAS_REDIRECT_BACKEND_LABEL="Redirect Backend"
+PLG_SYSTEM_MOKOWAAS_ALIAS_REDIRECT_BACKEND_DESC="Redirect admin panel requests on this alias to the primary domain. Frontend stays on the alias domain."
diff --git a/src/mokowaas.xml b/src/mokowaas.xml
index 0e00fa9..fe19a47 100644
--- a/src/mokowaas.xml
+++ b/src/mokowaas.xml
@@ -30,7 +30,7 @@
GNU General Public License version 3 or later; see LICENSE.mdhello@mokoconsulting.techhttps://mokoconsulting.tech
- 02.01.42
+ 02.01.43This plugin rebrands the Joomla system interface with MokoWaaS identity. It applies language overrides and ensures consistent branding across the platform.Moko\Plugin\System\MokoWaaSscript.php
@@ -44,6 +44,7 @@
script.phpExtensionField
+ formspayloadserviceslanguage
@@ -268,6 +269,22 @@
description="PLG_SYSTEM_MOKOWAAS_HIDDEN_MENUS_DESC"
rows="5" filter="raw" />
+
-