| … | … | @@ -39,6 +39,7 @@ export class GitSyncClientManager { |
| 39 | 39 | this.reposDir = opts.reposDir |
| 40 | 40 | this._repoRegistry = opts.repoRegistry || null // For auto-installing hooks on new repos |
| 41 | 41 | this._repos = opts.repos || null // In-memory repos array (server.repos) — updated after sync |
| 42 | this._topicManager = opts.topicManager || null // Announce new repos on DHT at runtime | |
| 42 | 43 | this.linkedRepos = opts.linkedRepos || null // Map<repoName, LinkedRepo> for issue Autobase keys |
| 43 | 44 | this.appDir = opts.appDir || null // Installed app directory (for self-update) |
| 44 | 45 | this.appRepoName = opts.appRepoName || null // This app's repo name (e.g., 'pear-git') |
| … | … | @@ -465,6 +466,11 @@ export class GitSyncClientManager { |
| 465 | 466 | this._repos.push({ name: repoName, path: repoPath, visibility: 'public' }) |
| 466 | 467 | } |
| 467 | 468 | } |
| 469 | ||
| 470 | // Announce on DHT so other peers can fetch via punch:// | |
| 471 | if (this._topicManager) { | |
| 472 | await this._topicManager.announceRepo(repoName) | |
| 473 | } | |
| 468 | 474 | } |
| 469 | 475 | } |
| 470 | 476 |
| … | … | @@ -1029,6 +1029,7 @@ class PearGitServer { |
| 1029 | 1029 | repos: this.repos, |
| 1030 | 1030 | linkedRepos: this.linkedRepos, |
| 1031 | 1031 | serverKey: selfServerKey, |
| 1032 | topicManager: this.topicManager || null, | |
| 1032 | 1033 | appDir: selfUpdateConfig ? selfUpdateConfig.appDir : null, |
| 1033 | 1034 | appRepoName: selfUpdateConfig ? selfUpdateConfig.appRepoName : null, |
| 1034 | 1035 | onIssueKeyReceived: (repoName, remoteKey, peerServerKey) => { |
| … | … | @@ -1173,6 +1174,8 @@ class PearGitServer { |
| 1173 | 1174 | |
| 1174 | 1175 | // Set topicManager on handler (needed for admin create-repo announcements) |
| 1175 | 1176 | this.gitP2PHandler.topicManager = this.topicManager |
| 1177 | // Set topicManager on GitSync client (needed for announcing runtime-created repos) | |
| 1178 | if (this.gitSyncClientManager) this.gitSyncClientManager._topicManager = this.topicManager | |
| 1176 | 1179 | // Set server ref so admin create-repo can update in-memory repos cache |
| 1177 | 1180 | this.gitP2PHandler.server = this |
| 1178 | 1181 |