Support instances that serve SSH from another hostname
Discovery matched a git remote's host against the instance URL's host, so a server answering SSH on a different name than its web UI resolved to nothing — and said so only in a debug log. Resolution now runs in three stages. A remote host is matched directly, then against configured aliases, and failing both the instances are asked for the repository: Gitea publishes its SSH hostname in a repository's ssh_url, so the right instance identifies itself. What that turns up is saved as a host alias, so later repositories on the same host resolve with no lookup at all, and the mapping is visible and editable rather than hidden. Each unknown host is probed at most once per session. When nothing resolves the sidebar now names the unmatched host and offers Add Host Alias, instead of showing an empty section. Aliases can also be written by hand as "remote-host = instance URL", accepting =, -> and =>, ignoring ports, and skipping # comments. List preferences now merge workspace entries onto global ones rather than letting an empty global array mask them. Adds Tests/host-aliases.test.js covering both directions: unmatched hosts reported and nothing persisted, a hand-written alias, detection from ssh_url, and a later repository resolving from the stored alias without a probe. 131 checks across three suites. Also adds CLAUDE.md, and .gitea/workflows/ci.yml running the suites, script syntax checks, manifest validation, and a generated-image check. Tools/make-icons.py gains --check, which compares decompressed pixels so a differing zlib version cannot fail it spuriously. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MQuusXgZC2dzwpJJ1qhtti
This commit is contained in:
@@ -270,6 +270,30 @@ function pullRequestNode(store, repo, pull, { showRepo = false } = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Rows for remote hosts that matched no configured instance. This is what an
|
||||
* instance serving SSH from a different hostname than the web UI looks like,
|
||||
* so the row offers the fix directly.
|
||||
*/
|
||||
function unmatchedHostNodes(store) {
|
||||
return store.unmatchedHosts.map((entry) =>
|
||||
node("unmatchedHost", `\u26A0 No Gitea instance for ${entry.host}`, {
|
||||
identifier: `unmatched-${entry.host}`,
|
||||
description: "add a host alias",
|
||||
tooltip: [
|
||||
entry.remoteUrl,
|
||||
"",
|
||||
"This remote's host matches no configured Gitea instance.",
|
||||
"If your server answers SSH on a different hostname than its web",
|
||||
"UI, map one onto the other with an SSH host alias.",
|
||||
].join("\n"),
|
||||
contextValue: "unmatchedHost",
|
||||
command: "gitea.addHostAlias",
|
||||
data: { host: entry.host, remoteUrl: entry.remoteUrl },
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
function firstLine(text) {
|
||||
const line = String(text || "").split("\n").find((entry) => entry.trim());
|
||||
if (!line) return "(empty comment)";
|
||||
@@ -282,5 +306,6 @@ exports.artifactNode = artifactNode;
|
||||
exports.pullRequestNode = pullRequestNode;
|
||||
exports.reviewCommentNode = reviewCommentNode;
|
||||
exports.changedFileNode = changedFileNode;
|
||||
exports.unmatchedHostNodes = unmatchedHostNodes;
|
||||
exports.formatBytes = formatBytes;
|
||||
exports.firstLine = firstLine;
|
||||
|
||||
Reference in New Issue
Block a user