22 lines
584 B
Go
22 lines
584 B
Go
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"code.gitea.io/gitea/services/appstore"
|
|
"code.gitea.io/gitea/services/context"
|
|
)
|
|
|
|
// AppStorePublicApps 返回公开的应用列表(供外部同步/拉取)
|
|
func AppStorePublicApps(ctx *context.APIContext) {
|
|
// 将 APIContext 转换为 Context
|
|
webCtx := &context.Context{Base: ctx.Base}
|
|
manager := appstore.NewManager(webCtx)
|
|
apps, err := manager.ListApps()
|
|
if err != nil {
|
|
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{"error": err.Error()})
|
|
return
|
|
}
|
|
ctx.JSON(http.StatusOK, map[string]interface{}{"apps": apps})
|
|
}
|