feat(pluginInstall): enhance repository link display and update cautionary messages for third-party plugins

This commit is contained in:
LTbinglingfeng
2026-06-15 15:23:05 +08:00
parent b5d18d8ab5
commit cc16be4c7b
6 changed files with 64 additions and 10 deletions
@@ -50,6 +50,43 @@
overflow-wrap: anywhere;
}
.repoLink {
display: inline-flex;
max-width: 100%;
align-items: center;
gap: 4px;
margin: 0;
font-family: $font-mono;
font-size: 13px;
color: var(--text-secondary);
text-decoration: none;
span {
min-width: 0;
overflow-wrap: anywhere;
}
svg {
flex-shrink: 0;
color: var(--text-tertiary);
}
&:hover {
color: var(--accent-color);
text-decoration: underline;
svg {
color: currentColor;
}
}
&:focus-visible {
outline: 2px solid var(--focus-ring-color, var(--accent-color));
outline-offset: 3px;
border-radius: $radius-sm;
}
}
.source {
margin: 0;
font-size: 12px;
@@ -3,10 +3,11 @@ import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/Button';
import { Input } from '@/components/ui/Input';
import { Modal } from '@/components/ui/Modal';
import { IconAlertTriangle, IconPlug } from '@/components/ui/icons';
import { IconAlertTriangle, IconExternalLink, IconPlug } from '@/components/ui/icons';
import { useAuthStore } from '@/stores';
import type { PluginStoreEntry } from '@/types';
import {
buildRepositoryURL,
getPluginConfirmToken,
getPluginRepositorySlug,
isDefaultPluginStoreSource,
@@ -60,6 +61,8 @@ export function PluginInstallGateModal({
const title = entry.name || entry.id;
const repoSlug = getPluginRepositorySlug(entry.repository);
const repositoryURL = buildRepositoryURL(entry.repository);
const repoLabel = repoSlug || entry.id;
const token = getPluginConfirmToken(entry);
const logo = resolvePluginAssetURL(entry.logo, apiBase);
const rawSourceText = entry.sourceName || entry.sourceUrl;
@@ -87,7 +90,21 @@ export function PluginInstallGateModal({
<GateLogo src={logo} />
</div>
<h3 className={styles.name}>{title}</h3>
<p className={styles.slug}>{repoSlug || entry.id}</p>
{repositoryURL ? (
<a
className={styles.repoLink}
href={repositoryURL}
target="_blank"
rel="noreferrer"
title={t('plugin_store.open_repository')}
aria-label={t('plugin_store.open_repository')}
>
<span>{repoLabel}</span>
<IconExternalLink size={12} />
</a>
) : (
<p className={styles.slug}>{repoLabel}</p>
)}
{sourceText ? (
<p className={styles.source}>{t('plugin_store.source_name', { source: sourceText })}</p>
) : null}