Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(wordpress): surface the live site URL on create (closes roadmap #21)

Juan Denis45ba40a7ad01
diff --git a/docs/WORDPRESS_ROADMAP.md b/docs/WORDPRESS_ROADMAP.md
index 6b23f2ac..3a734727 100644
--- a/docs/WORDPRESS_ROADMAP.md
+++ b/docs/WORDPRESS_ROADMAP.md
@@ -200,7 +200,7 @@ These are the features that make a user say "this is a managed platform, not a f
- **Reuse:** `WordPressSite.to_dict`, `WordPressSiteCard.jsx`.
- **Done when:** Sites can be tagged and filtered.
-### #21 — Temporary preview URL before DNS is pointed `[M]` ❌ — ⏸️ Deferred (BLOCKED: a genuinely public, TLS-valid preview URL needs a pre-configured public base domain + wildcard DNS; managed sites are localhost:port only. Revisit after a public base-domain setting exists.)
+### #21 — Temporary preview URL before DNS is pointed `[M]` ❌ — ✅ Done (unblocked by the base-domain + wildcard-cert stack: once `sites_base_domain` is set and Phase-5 wildcard HTTPS is enabled, every new site is reachable at `<slug>.<base>` with a valid `*.<base>` cert the moment it is created — no per-site DNS, no localhost:port. The create flow now surfaces the live link — and, when no base domain is configured, nudges the operator to set one. A user pointing a custom domain keeps this base subdomain as the working preview until DNS propagates. The distinct `*.preview.<panel-domain>` scheme is unnecessary given the wildcard base domain.)
- **Today:** `EnvironmentDomainService.generate_domain` only emits real subdomains or a `.localhost` fallback; the env nginx template listens on `:80` only. No preview hostname scheme.
- **Do:** Add a wildcard/preview hostname (e.g. `<site>.preview.<panel-domain>` or a `*.sslip.io`-style scheme) with auto TLS so a site is reachable and verifiable pre-DNS.
- **Reuse:** `environment_domain_service`, wildcard SSL (#8).
diff --git a/frontend/src/pages/WordPress.jsx b/frontend/src/pages/WordPress.jsx
index 99826c45..89dd9d4c 100644
--- a/frontend/src/pages/WordPress.jsx
+++ b/frontend/src/pages/WordPress.jsx
@@ -27,6 +27,11 @@ function WordPress() {
name: '', domain: '', adminEmail: '', phpVersion: '', enablePageCache: false, enableObjectCache: false,
});
const [createdCreds, setCreatedCreds] = useState(null);
+ // Where a freshly-created site is reachable, so we can tell the user it is
+ // already live (at <slug>.<base>, HTTPS when the wildcard cert is set up)
+ // rather than leaving them to wonder — or nudge them to set a base domain
+ // when the site only came up on localhost.
+ const [createdSite, setCreatedSite] = useState(null);
const [showImportModal, setShowImportModal] = useState(false);
const [importLoading, setImportLoading] = useState(false);
const [importForm, setImportForm] = useState({ name: '', adminEmail: '', oldUrl: '' });
@@ -70,6 +75,9 @@ function WordPress() {
// The generated admin password is returned once — surface it.
setCreatedCreds({ user: result.admin_user || 'admin', password: result.admin_password });
}
+ if (result.url) {
+ setCreatedSite({ url: result.url, domain: result.domain || null });
+ }
if (result.warning) {
toast.info(result.warning, { duration: 8000 });
}
@@ -301,14 +309,31 @@ function WordPress() {
keyField="id"
onRowClick={(site) => navigate(`/wordpress/${site.id}`)}
rowClassName={(site) => (selectedIds.has(site.id) ? 'is-selected' : '')}
- header={createdCreds && (
+ header={(createdCreds || createdSite) && (
<div className="wp-creds-banner">
<div className="wp-creds-banner-text">
- <strong>Save these admin credentials — they are shown only once.</strong>
- <span>Username: <code>{createdCreds.user}</code></span>
- <span>Password: <code>{createdCreds.password}</code></span>
+ {createdSite && (createdSite.domain ? (
+ <span>
+ Your site is live at{' '}
+ <a href={createdSite.url} target="_blank" rel="noopener noreferrer"><code>{createdSite.domain}</code></a>
+ {createdSite.url?.startsWith('https') ? ' — HTTPS is ready.' : '.'}
+ </span>
+ ) : (
+ <span>
+ Your site is running at{' '}
+ <a href={createdSite.url} target="_blank" rel="noopener noreferrer"><code>{createdSite.url}</code></a>.
+ {' '}Set a managed-sites base domain in Settings to publish it at a public URL.
+ </span>
+ ))}
+ {createdCreds && (
+ <>
+ <strong>Save these admin credentials — they are shown only once.</strong>
+ <span>Username: <code>{createdCreds.user}</code></span>
+ <span>Password: <code>{createdCreds.password}</code></span>
+ </>
+ )}
</div>
- <Button variant="ghost" onClick={() => setCreatedCreds(null)}>Dismiss</Button>
+ <Button variant="ghost" onClick={() => { setCreatedCreds(null); setCreatedSite(null); }}>Dismiss</Button>
</div>
)}
filters={[