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:
@@ -29,6 +29,7 @@
|
||||
{ "separator": true },
|
||||
{ "title": "Add Gitea Instance…", "command": "gitea.addInstance" },
|
||||
{ "title": "Remove Gitea Instance…", "command": "gitea.removeInstance" },
|
||||
{ "title": "Add Host Alias…", "command": "gitea.addHostAlias" },
|
||||
{ "title": "Open Gitea Preferences", "command": "gitea.openPreferences" },
|
||||
{ "separator": true },
|
||||
{ "title": "Change Branch Filter…", "command": "gitea.switchBranchFilter" },
|
||||
@@ -63,6 +64,7 @@
|
||||
{ "title": "Branch Filter", "image": "branch", "tooltip": "Change branch filter", "command": "gitea.switchBranchFilter" }
|
||||
],
|
||||
"contextCommands": [
|
||||
{ "title": "Add Host Alias…", "command": "gitea.addHostAlias", "when": "viewItem == 'unmatchedHost'" },
|
||||
{ "title": "Open in Browser", "command": "gitea.openInBrowser", "when": "viewItem == 'run' || viewItem == 'job' || viewItem == 'pr' || viewItem == 'artifact' || viewItem == 'repo' || viewItem == 'review' || viewItem == 'comment'" },
|
||||
{ "title": "Copy URL", "command": "gitea.copyUrl", "when": "viewItem == 'run' || viewItem == 'job' || viewItem == 'pr' || viewItem == 'artifact' || viewItem == 'repo' || viewItem == 'review' || viewItem == 'comment'" },
|
||||
{ "separator": true },
|
||||
@@ -96,6 +98,7 @@
|
||||
{ "title": "Refresh", "image": "refresh", "tooltip": "Refresh workflow runs", "command": "gitea.refreshRuns" }
|
||||
],
|
||||
"contextCommands": [
|
||||
{ "title": "Add Host Alias…", "command": "gitea.addHostAlias", "when": "viewItem == 'unmatchedHost'" },
|
||||
{ "title": "Open in Browser", "command": "gitea.openInBrowser", "when": "viewItem == 'run' || viewItem == 'job' || viewItem == 'artifact' || viewItem == 'repo' || viewItem == 'workflow'" },
|
||||
{ "title": "Copy URL", "command": "gitea.copyUrl", "when": "viewItem == 'run' || viewItem == 'job' || viewItem == 'artifact' || viewItem == 'repo' || viewItem == 'workflow'" },
|
||||
{ "separator": true },
|
||||
@@ -121,6 +124,7 @@
|
||||
{ "title": "Create", "image": "__builtin.add", "tooltip": "Create a pull request", "command": "gitea.createPullRequest" }
|
||||
],
|
||||
"contextCommands": [
|
||||
{ "title": "Add Host Alias…", "command": "gitea.addHostAlias", "when": "viewItem == 'unmatchedHost'" },
|
||||
{ "title": "Open Pull Request Overview", "command": "gitea.openPullRequestOverview", "when": "viewItem == 'pr'" },
|
||||
{ "title": "Open Pull Request Diff", "command": "gitea.openPullRequestDiff", "when": "viewItem == 'pr'" },
|
||||
{ "title": "Open Changed File", "command": "gitea.openChangedFile", "when": "viewItem == 'prFile'" },
|
||||
@@ -150,6 +154,7 @@
|
||||
{ "title": "Add Instance", "image": "__builtin.add", "tooltip": "Add a Gitea instance", "command": "gitea.addInstance" }
|
||||
],
|
||||
"contextCommands": [
|
||||
{ "title": "Add Host Alias…", "command": "gitea.addHostAlias", "when": "viewItem == 'unmatchedHost'" },
|
||||
{ "title": "Set Token…", "command": "gitea.setToken", "when": "viewItem == 'instance'" },
|
||||
{ "title": "Sign Out…", "command": "gitea.clearToken", "when": "viewItem == 'instance'" },
|
||||
{ "title": "Test Connection", "command": "gitea.testConnection", "when": "viewItem == 'instance'" },
|
||||
@@ -193,6 +198,19 @@
|
||||
"description": "Extra Gitea instance URLs. Repositories are routed to an instance by matching their git remote host. Tokens are stored per instance in the macOS Keychain.",
|
||||
"type": "stringArray"
|
||||
},
|
||||
{
|
||||
"key": "gitea.hostAliases",
|
||||
"title": "Host Aliases",
|
||||
"description": "Map alternate git remote hosts onto a configured instance, one entry per line, as \"remote-host = instance URL\". Use this when your server answers SSH on a different hostname than its web UI, for example \"ssh.example.com = https://git.example.com\".",
|
||||
"type": "stringArray"
|
||||
},
|
||||
{
|
||||
"key": "gitea.addHostAlias",
|
||||
"title": "Add Host Alias",
|
||||
"description": "Map a git remote host onto one of the configured instances.",
|
||||
"type": "command",
|
||||
"command": "gitea.addHostAlias"
|
||||
},
|
||||
{
|
||||
"key": "gitea.setToken",
|
||||
"title": "Sign In",
|
||||
|
||||
Reference in New Issue
Block a user