Browse Source

增加路由

2023
ychao_1983 2 years ago
parent
commit
6ca271f30c
2 changed files with 37 additions and 0 deletions
  1. +10
    -0
      routers/routes/routes.go
  2. +27
    -0
      routers/tech/tech.go

+ 10
- 0
routers/routes/routes.go View File

@@ -12,6 +12,8 @@ import (
"text/template"
"time"

"code.gitea.io/gitea/routers/tech"

"code.gitea.io/gitea/routers/badge"
"code.gitea.io/gitea/routers/reward/point"
"code.gitea.io/gitea/routers/task"
@@ -896,6 +898,14 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/check_name", repo.CheckName)
}, reqSignIn)

m.Group("/tech", func() {
m.Get("/new", tech.Create)
m.Get("/tech_view", tech.TechView)
m.Get("/repo_view", tech.RepoView)
m.Get("/admin_view", tech.AdminView)

}, reqSignIn)

// ***** Release Attachment Download without Signin
m.Get("/:username/:reponame/releases/download/:vTag/:fileName", ignSignIn, context.RepoAssignment(), repo.MustBeNotEmpty, repo.RedirectDownload)



+ 27
- 0
routers/tech/tech.go View File

@@ -0,0 +1,27 @@
package tech

import (
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
)

const (
tplCreate base.TplName = "tech/create"
tplTech base.TplName = "tech/tech_view"
tplRepo base.TplName = "tech/repo_view"
tplAdmin base.TplName = "tech/admin_view"
)

func Create(ctx *context.Context) {
ctx.HTML(200, tplCreate)
}

func TechView(ctx *context.Context) {
ctx.HTML(200, tplTech)
}
func RepoView(ctx *context.Context) {
ctx.HTML(200, tplRepo)
}
func AdminView(ctx *context.Context) {
ctx.HTML(200, tplAdmin)
}

Loading…
Cancel
Save