Show SVN repository auth hints

This commit is contained in:
lwt
2026-06-18 14:41:15 +08:00
parent 4ab3332f34
commit 11b2504ce5
2 changed files with 68 additions and 5 deletions
+10 -5
View File
@@ -152,7 +152,7 @@ function renderRepos() {
els.repoList.innerHTML = visibleRepos.map((repo) => `<button class="svn-repo-item${repo.id === selectedRepoId ? " is-active" : ""}" type="button" data-id="${escapeHtml(repo.id)}">
<span class="repo-name">${escapeHtml(repo.name)}</span>
<span class="repo-url">${escapeHtml(repo.url)}</span>
<span class="repo-meta">${escapeHtml(repo.source === "server" ? "服务器仓库" : "手动配置")} · ${escapeHtml(repo.localPath || repo.checkoutPath || repo.id)} · ${repo.hasPassword ? "已配置凭据" : "无密码"}</span>
<span class="repo-meta">${escapeHtml(repo.source === "server" ? "服务器仓库" : "手动配置")} · ${escapeHtml(repo.localPath || repo.checkoutPath || repo.id)} · ${repo.hasPassword ? "已配置凭据" : (repo.serverAuthRequired ? "需要凭据" : "无密码")}</span>
</button>`).join("") || `<p class="empty-state">${repositories.length ? "没有匹配的仓库。" : "暂无 SVN 仓库,可以先点击“接入旧仓库”。"}</p>`;
const repo = selectedRepo();
@@ -163,7 +163,7 @@ function renderRepos() {
els.selectedRepoUrl.textContent = compactPath(repo?.url);
els.selectedRepoPath.textContent = compactPath(repo?.localPath || repo?.checkoutPath);
els.selectedRepoRevision.textContent = repo?.serverRevision ? `r${repo.serverRevision}` : (repo?.lastAction?.at ? formatDate(repo.lastAction.at) : "--");
els.selectedRepoSource.textContent = repo ? (repo.source === "server" ? "服务器旧仓库" : "手动配置") : "--";
els.selectedRepoSource.textContent = repo ? (repo.source === "server" ? `服务器旧仓库${repo.serverAuthRequired ? " · 需要 SVN 凭据" : ""}` : "手动配置") : "--";
els.deleteRepo.disabled = !repo;
}
@@ -172,13 +172,18 @@ function renderServerRepos() {
els.serverSummary.textContent = serverRepositories.length
? `发现 ${serverRepositories.length} 个,已接入 ${configuredCount}`
: "未发现旧仓库";
els.serverRepoList.innerHTML = serverRepositories.map((repo) => `<button class="svn-server-repo${repo.configured ? " is-linked" : ""}" type="button" data-id="${escapeHtml(repo.id)}" data-configured-id="${escapeHtml(repo.configuredId || "")}">
els.serverRepoList.innerHTML = serverRepositories.map((repo) => {
const authText = repo.authRequired
? `需要凭据${repo.authUsers?.length ? `${repo.authUsers.join(", ")}` : ""}`
: "允许匿名";
return `<button class="svn-server-repo${repo.configured ? " is-linked" : ""}" type="button" data-id="${escapeHtml(repo.id)}" data-configured-id="${escapeHtml(repo.configuredId || "")}">
<span>
<strong>${escapeHtml(repo.name)}</strong>
<small>${escapeHtml(repo.url)}</small>
</span>
<em>${repo.configured ? "已接入" : "待接入"}${repo.revision ? ` · r${escapeHtml(repo.revision)}` : ""}</em>
</button>`).join("") || `<p class="empty-state">没有扫描到服务器 SVN 仓库。</p>`;
<em>${repo.configured ? "已接入" : "待接入"}${repo.revision ? ` · r${escapeHtml(repo.revision)}` : ""}<br>${escapeHtml(authText)}</em>
</button>`;
}).join("") || `<p class="empty-state">没有扫描到服务器 SVN 仓库。</p>`;
}
async function loadRepos() {