code.gitea.io/gitea@v1.21.7/routers/web/nodeinfo.go (about)

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