feat: publish v1.0.0-rc.36-custom.1
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
This commit is contained in:
commit
bb7968b612
2381 files changed
+551494
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/QuantumNous/new-api/controller"
|
||||
"github.com/QuantumNous/new-api/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// SetTaskRouter registers the generic task-plugin API surface.
|
||||
//
|
||||
// Gin requires every route sharing a path position to use the same wildcard
|
||||
// name, so the first segment is uniformly ":key"; it carries the plugin key
|
||||
// on submit routes and the task id on read routes.
|
||||
func SetTaskRouter(router *gin.Engine) {
|
||||
taskSubmitRouter := router.Group("/v1/tasks")
|
||||
taskSubmitRouter.Use(middleware.RouteTag("relay"), middleware.TokenAuth())
|
||||
{
|
||||
taskSubmitRouter.POST("/:key", middleware.PrepareTaskPluginSubmit(), middleware.Distribute(), controller.RelayTask)
|
||||
}
|
||||
|
||||
taskReadRouter := router.Group("/v1/tasks")
|
||||
taskReadRouter.Use(middleware.RouteTag("relay"), middleware.TokenAuth())
|
||||
{
|
||||
taskReadRouter.GET("/:key", controller.GetTask)
|
||||
taskReadRouter.GET("/:key/artifacts", controller.GetTaskArtifacts)
|
||||
}
|
||||
|
||||
taskContentRouter := router.Group("/v1/tasks")
|
||||
taskContentRouter.Use(
|
||||
middleware.RouteTag("relay"),
|
||||
middleware.TokenOrTaskArtifactAccessAuth("key", "artifact_key"),
|
||||
)
|
||||
{
|
||||
taskContentRouter.GET("/:key/artifacts/:artifact_key/content", controller.TaskArtifactContent)
|
||||
taskContentRouter.HEAD("/:key/artifacts/:artifact_key/content", controller.TaskArtifactContent)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user