Feat default surface routing (#4)
Some checks failed
CI/CD / detect-changes (push) Successful in 3s
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Failing after 2m17s
CI/CD / test-sqlite (push) Successful in 2m44s
CI/CD / build-and-deploy (push) Has been skipped

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #4.
This commit is contained in:
2026-03-26 19:56:14 +00:00
committed by xcaliber
parent a36be83aaf
commit f4512071db
9 changed files with 169 additions and 40 deletions

View File

@@ -553,6 +553,18 @@ func (h *PackageHandler) InstallPackage(c *gin.Context) {
log.Printf("[packages] %s: %d dependencies recorded", pkgID, len(deps))
}
// v0.2.1: Auto-set default_surface when the first extension surface is installed.
if (pkgType == "surface" || pkgType == "full") && pkgSource != "core" {
if raw, err := h.stores.GlobalConfig.Get(c.Request.Context(), "default_surface"); err != nil || raw == nil {
dflt := models.JSONMap{"id": pkgID}
if setErr := h.stores.GlobalConfig.Set(c.Request.Context(), "default_surface", dflt, ""); setErr != nil {
log.Printf("[packages] failed to auto-set default_surface to %s: %v", pkgID, setErr)
} else {
log.Printf("[packages] Auto-set default_surface to %s (first extension surface)", pkgID)
}
}
}
c.JSON(http.StatusOK, gin.H{
"id": pkgID,
"title": title,