feat: add git pull to update cached repositories from remote
Deploy PR-Helper / deploy (push) Successful in 34s

- Replace dead FetchRemote with PullRepo (fetch + merge) in services/git.go
- Add POST /api/repos/:id/pull endpoint with DB size/last_used update
- Add '更新' button next to each cached repo in the index page
This commit is contained in:
2026-06-21 14:31:33 +08:00
parent 25291a81a3
commit 20be99b287
4 changed files with 85 additions and 11 deletions
+9 -3
View File
@@ -52,9 +52,15 @@
<a href="/repo/{{.ID}}" class="text-sm font-medium text-indigo-600 hover:text-indigo-800">{{.URL}}</a>
<p class="text-xs text-gray-400 mt-1">最后使用: {{.LastUsed}}</p>
</div>
<button hx-delete="/api/repos/{{.ID}}" hx-confirm="确定删除此仓库缓存?"
hx-swap="none" hx-on::after-request="window.location.reload()"
class="text-xs text-red-500 hover:text-red-700">删除</button>
<div class="flex gap-2">
<button hx-post="/api/repos/{{.ID}}/pull" hx-swap="none"
hx-on::before-request="this.disabled=true;this.textContent='更新中...'"
hx-on::after-request="window.location.reload()"
class="text-xs text-indigo-500 hover:text-indigo-700">更新</button>
<button hx-delete="/api/repos/{{.ID}}" hx-confirm="确定删除此仓库缓存?"
hx-swap="none" hx-on::after-request="window.location.reload()"
class="text-xs text-red-500 hover:text-red-700">删除</button>
</div>
</div>
{{end}}
</div>