first-commit
This commit is contained in:
21
routers/api/v1/appstore_app.go
Normal file
21
routers/api/v1/appstore_app.go
Normal file
@@ -0,0 +1,21 @@
|
||||
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})
|
||||
}
|
Reference in New Issue
Block a user