gitea源码

nodeinfo.go 663B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package web
  4. import (
  5. "net/http"
  6. "code.gitea.io/gitea/modules/setting"
  7. "code.gitea.io/gitea/services/context"
  8. )
  9. type nodeInfoLinks struct {
  10. Links []nodeInfoLink `json:"links"`
  11. }
  12. type nodeInfoLink struct {
  13. Href string `json:"href"`
  14. Rel string `json:"rel"`
  15. }
  16. // NodeInfoLinks returns links to the node info endpoint
  17. func NodeInfoLinks(ctx *context.Context) {
  18. nodeinfolinks := &nodeInfoLinks{
  19. Links: []nodeInfoLink{{
  20. setting.AppURL + "api/v1/nodeinfo",
  21. "http://nodeinfo.diaspora.software/ns/schema/2.1",
  22. }},
  23. }
  24. ctx.JSON(http.StatusOK, nodeinfolinks)
  25. }