diff --git a/.gitignore b/.gitignore index e52b43c8..7d221557 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,4 @@ docs/PLAN_AGENT_FLEET.md /.claude /.github/skills /.playwright-mcp +docs/UI_CONSISTENCY_AUDIT.md diff --git a/backend/app/api/wordpress.py b/backend/app/api/wordpress.py index a9915f0d..de7d0e21 100644 --- a/backend/app/api/wordpress.py +++ b/backend/app/api/wordpress.py @@ -16,6 +16,18 @@ def _resolve_app(site_or_app_id): return Application.query.get(site_or_app_id) +def _is_wp_app(app): + """True if `app` is a WordPress-managed site. Containerized WP sites are + stored with app_type 'docker' (see WordPressService), so app_type alone is + not a reliable signal — a linked WordPressSite record is the source of truth. + """ + if not app: + return False + if app.app_type == 'wordpress': + return True + return WordPressSite.query.filter_by(application_id=app.id).first() is not None + + # ==================== WORDPRESS SITES HUB ENDPOINTS ==================== @wordpress_bp.route('/sites', methods=['GET']) @@ -786,7 +798,7 @@ def get_wordpress_info(app_id): if user.role != 'admin' and app.user_id != current_user_id: return jsonify({'error': 'Access denied'}), 403 - if app.app_type != 'wordpress': + if not _is_wp_app(app): return jsonify({'error': 'Application is not a WordPress site'}), 400 info = WordPressService.get_wordpress_info(app.root_path) @@ -806,7 +818,7 @@ def update_wordpress(app_id): if not app: return jsonify({'error': 'Application not found'}), 404 - if app.app_type != 'wordpress': + if not _is_wp_app(app): return jsonify({'error': 'Application is not a WordPress site'}), 400 result = WordPressService.update_wordpress(app.root_path) @@ -1293,7 +1305,7 @@ def wp_auto_login(site_id): app = wp_site.application if wp_site else _resolve_app(site_id) if not app or not app.root_path: return jsonify({'error': 'Application not found'}), 404 - if app.app_type != 'wordpress': + if not _is_wp_app(app): return jsonify({'error': 'Application is not a WordPress site'}), 400 # Resolve a managed admin tied to the operator's panel email. Prefer the diff --git a/backend/app/services/wordpress_service.py b/backend/app/services/wordpress_service.py index 03db2406..902ee8e0 100644 --- a/backend/app/services/wordpress_service.py +++ b/backend/app/services/wordpress_service.py @@ -1223,8 +1223,11 @@ RewriteRule ^wp-content/uploads/.*\\.php$ - [F] inst = cls.wp_cli(path, ['package', 'install', 'aaemnnosttv/wp-cli-login-command']) if not inst.get('success'): return {'success': False, 'error': 'Failed to install wp-cli-login package: ' + (inst.get('error') or '')} - # Ensure the companion launcher mu-plugin is present (idempotent). - cls.wp_cli(path, ['login', 'install', '--yes']) + # Ensure the companion launcher plugin is present AND active (idempotent). + # Without --activate the plugin installs but stays inactive, and the + # subsequent `wp login create` fails with "requires the companion plugin + # to be installed and active". + cls.wp_cli(path, ['login', 'install', '--activate', '--yes']) return {'success': True} @classmethod diff --git a/frontend/src/components/git/GitProviders.jsx b/frontend/src/components/git/GitProviders.jsx new file mode 100644 index 00000000..cd329786 --- /dev/null +++ b/frontend/src/components/git/GitProviders.jsx @@ -0,0 +1,68 @@ +// Brand-authentic Git provider identities — the single source of truth for how a +// repository host is recognized and presented across ServerKit's "connect a +// repository" surfaces (New Service page, the service connect modal, and the +// WordPress Git tab). Mirrors components/icons/DatabaseBrands.jsx: we wrap Simple +// Icons (via react-icons) so GitHub / GitLab / Bitbucket / Gitea are instantly +// recognizable instead of sharing one generic git glyph. +// +// Simple Icons render with `fill="currentColor"`, so the surrounding SCSS controls +// the color with no inline styles. +import { SiGithub, SiGitlab, SiBitbucket, SiGitea } from 'react-icons/si'; +import { GitBranch } from 'lucide-react'; + +// Ordered list rendered in the provider strip. `match` recognizes a clone URL's +// host; the trailing "other" entry is the catch-all (self-hosted, SSH, anything +// unrecognized). +export const GIT_PROVIDERS = [ + { key: 'github', label: 'GitHub', Icon: SiGithub, hint: 'HTTPS or SSH', match: /github\.com/i }, + { key: 'gitlab', label: 'GitLab', Icon: SiGitlab, hint: 'Cloud or self-managed', match: /gitlab\./i }, + { key: 'bitbucket', label: 'Bitbucket', Icon: SiBitbucket, hint: 'bitbucket.org', match: /bitbucket\.org/i }, + { key: 'gitea', label: 'Gitea', Icon: SiGitea, hint: 'Self-hosted', match: /gitea/i }, + { key: 'other', label: 'SSH / Other', Icon: GitBranch, hint: 'Any Git remote', match: null }, +]; + +const OTHER_PROVIDER = GIT_PROVIDERS[GIT_PROVIDERS.length - 1]; + +// Resolve a clone URL to a provider. Returns null for an empty field (so callers +// can render a neutral, nothing-detected state) and the "other" catch-all when a +// non-empty URL matches no known host. +export function detectProvider(url) { + const trimmed = (url || '').trim(); + if (!trimmed) return null; + return GIT_PROVIDERS.find((p) => p.match && p.match.test(trimmed)) || OTHER_PROVIDER; +} + +// The "explains the others" strip: every supported host as a chip with its brand +// mark, label, and a one-liner. The detected provider gets the accent highlight. +export function RepoProviderStrip({ detected }) { + return ( +