';
- echo '
' . htmlspecialchars($brandName) . '
';
- echo '
' . htmlspecialchars($message) . '
';
- echo '
';
- $this->app->close();
+ if (!empty($message))
+ {
+ $this->app->getConfig()->set('offline_message', $message);
+ }
+
+ // Enable Joomla's native offline mode — renders through the template's offline.php
+ $this->app->getConfig()->set('offline', 1);
}
}
@@ -2702,6 +2990,12 @@ class MokoWaaS extends CMSPlugin
{
$doc->setMetaData('robots', $robots);
}
+
+ // Inject canonical URL pointing to the primary domain
+ $primaryHost = $this->getPrimaryHost();
+ $currentUri = Uri::getInstance();
+ $canonical = $currentUri->getScheme() . '://' . $primaryHost . $currentUri->toString(['path', 'query']);
+ $doc->addHeadLink($canonical, 'canonical');
}
// ------------------------------------------------------------------
@@ -2734,8 +3028,39 @@ class MokoWaaS extends CMSPlugin
$siteUrl = rtrim(Uri::root(), '/');
$siteName = Factory::getConfig()->get('sitename', 'Joomla');
- // Register primary domain only — aliases should not get separate datasources
+ // Register primary domain
$this->sendHeartbeat($siteUrl, $siteName, $healthToken, $app);
+
+ // Register alias domains (subform format)
+ $aliases = $params->get('site_aliases', '');
+
+ if (!empty($aliases))
+ {
+ if (is_string($aliases))
+ {
+ $aliases = json_decode($aliases);
+ }
+
+ if (is_object($aliases))
+ {
+ $aliases = (array) $aliases;
+ }
+
+ if (is_array($aliases))
+ {
+ foreach ($aliases as $alias)
+ {
+ $alias = (object) $alias;
+
+ if (!empty($alias->domain))
+ {
+ $domain = rtrim(trim($alias->domain), '/');
+ $aliasUrl = 'https://' . preg_replace('#^https?://#i', '', $domain);
+ $this->sendHeartbeat($aliasUrl, $siteName, $healthToken, $app);
+ }
+ }
+ }
+ }
}
/**
diff --git a/src/packages/plg_system_mokowaas/language/en-GB/plg_system_mokowaas.ini b/src/packages/plg_system_mokowaas/language/en-GB/plg_system_mokowaas.ini
index 415df26..aa455c4 100644
--- a/src/packages/plg_system_mokowaas/language/en-GB/plg_system_mokowaas.ini
+++ b/src/packages/plg_system_mokowaas/language/en-GB/plg_system_mokowaas.ini
@@ -133,6 +133,8 @@ PLG_SYSTEM_MOKOWAAS_UPLOAD_SIZE_DESC="Maximum file upload size in megabytes."
; ===== 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_PRIMARY_DOMAIN_LABEL="Primary Domain"
+PLG_SYSTEM_MOKOWAAS_PRIMARY_DOMAIN_DESC="The primary domain for this site (e.g. waas.dev.mokoconsulting.tech). Used for backend redirect on alias domains. Do not include https:// prefix."
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"
diff --git a/src/packages/plg_system_mokowaas/language/en-US/plg_system_mokowaas.ini b/src/packages/plg_system_mokowaas/language/en-US/plg_system_mokowaas.ini
index 62cfa64..71d1574 100644
--- a/src/packages/plg_system_mokowaas/language/en-US/plg_system_mokowaas.ini
+++ b/src/packages/plg_system_mokowaas/language/en-US/plg_system_mokowaas.ini
@@ -133,6 +133,8 @@ PLG_SYSTEM_MOKOWAAS_UPLOAD_SIZE_DESC="Maximum file upload size in megabytes."
; ===== 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_PRIMARY_DOMAIN_LABEL="Primary Domain"
+PLG_SYSTEM_MOKOWAAS_PRIMARY_DOMAIN_DESC="The primary domain for this site (e.g. waas.dev.mokoconsulting.tech). Used for backend redirect on alias domains. Do not include https:// prefix."
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"
diff --git a/src/packages/plg_system_mokowaas/mokowaas.xml b/src/packages/plg_system_mokowaas/mokowaas.xml
index 6aa8e25..e7f7e1c 100644
--- a/src/packages/plg_system_mokowaas/mokowaas.xml
+++ b/src/packages/plg_system_mokowaas/mokowaas.xml
@@ -30,7 +30,7 @@