選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

nodeinfo.go 683B

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