2025-03-15 16:07:45 +08:00
|
|
|
package web
|
|
|
|
|
|
2025-03-18 10:13:57 +08:00
|
|
|
import (
|
2025-11-17 18:38:10 +08:00
|
|
|
auth2 "platform/web/auth"
|
2025-03-18 17:57:07 +08:00
|
|
|
"platform/web/handlers"
|
|
|
|
|
|
2025-03-18 10:13:57 +08:00
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
|
)
|
2025-03-15 16:07:45 +08:00
|
|
|
|
2025-03-18 17:57:07 +08:00
|
|
|
func ApplyRouters(app *fiber.App) {
|
|
|
|
|
api := app.Group("/api")
|
|
|
|
|
|
2025-03-26 14:57:44 +08:00
|
|
|
// 认证
|
2025-03-18 17:57:07 +08:00
|
|
|
auth := api.Group("/auth")
|
2025-11-17 18:38:10 +08:00
|
|
|
auth.Post("/token", auth2.Token)
|
2025-04-24 10:52:13 +08:00
|
|
|
auth.Post("/revoke", handlers.Revoke)
|
2025-04-26 17:59:34 +08:00
|
|
|
auth.Post("/introspect", handlers.Introspect)
|
2025-04-24 10:52:13 +08:00
|
|
|
auth.Post("/verify/sms", handlers.SmsCode)
|
2025-03-15 16:07:45 +08:00
|
|
|
|
2025-04-26 17:59:34 +08:00
|
|
|
// 用户
|
|
|
|
|
user := api.Group("/user")
|
2025-04-29 18:48:14 +08:00
|
|
|
user.Post("/update", handlers.UpdateUser)
|
|
|
|
|
user.Post("/update/account", handlers.UpdateAccount)
|
|
|
|
|
user.Post("/update/password", handlers.UpdatePassword)
|
2025-04-26 17:59:34 +08:00
|
|
|
user.Post("/identify", handlers.Identify)
|
|
|
|
|
user.Post("/identify/callback", handlers.IdentifyCallback)
|
|
|
|
|
|
2025-04-08 09:35:19 +08:00
|
|
|
// 白名单
|
|
|
|
|
whitelist := api.Group("/whitelist")
|
|
|
|
|
whitelist.Post("/list", handlers.ListWhitelist)
|
|
|
|
|
whitelist.Post("/create", handlers.CreateWhitelist)
|
|
|
|
|
whitelist.Post("/update", handlers.UpdateWhitelist)
|
|
|
|
|
whitelist.Post("/remove", handlers.RemoveWhitelist)
|
2025-04-01 10:51:32 +08:00
|
|
|
|
2025-04-12 18:03:44 +08:00
|
|
|
// 套餐
|
2025-04-09 16:34:41 +08:00
|
|
|
resource := api.Group("/resource")
|
2025-06-20 15:17:15 +08:00
|
|
|
resource.Post("/all", handlers.AllActiveResource)
|
2025-05-17 15:54:42 +08:00
|
|
|
resource.Post("/list/short", handlers.ListResourceShort)
|
2025-05-22 14:55:04 +08:00
|
|
|
resource.Post("/list/long", handlers.ListResourceLong)
|
2025-06-20 15:17:15 +08:00
|
|
|
resource.Post("/statistics/free", handlers.StatisticResourceFree)
|
|
|
|
|
resource.Post("/statistics/usage", handlers.StatisticResourceUsage)
|
2025-05-20 17:14:07 +08:00
|
|
|
resource.Post("/create", handlers.CreateResource)
|
|
|
|
|
resource.Post("/price", handlers.ResourcePrice)
|
2025-04-09 16:34:41 +08:00
|
|
|
|
2025-05-20 17:14:07 +08:00
|
|
|
// 通道
|
|
|
|
|
channel := api.Group("/channel")
|
|
|
|
|
channel.Post("/list", handlers.ListChannels)
|
|
|
|
|
channel.Post("/create", handlers.CreateChannel)
|
|
|
|
|
channel.Post("/remove", handlers.RemoveChannels)
|
2025-04-11 17:36:34 +08:00
|
|
|
|
2025-04-17 18:29:44 +08:00
|
|
|
// 交易
|
|
|
|
|
trade := api.Group("/trade")
|
2025-06-26 09:28:42 +08:00
|
|
|
trade.Post("/create", handlers.TradeCreate)
|
|
|
|
|
trade.Post("/complete", handlers.TradeComplete)
|
2025-08-15 18:11:35 +08:00
|
|
|
trade.Post("/cancel", handlers.TradeCancel)
|
2025-05-07 16:48:02 +08:00
|
|
|
|
2025-05-20 17:14:07 +08:00
|
|
|
// 账单
|
|
|
|
|
bill := api.Group("/bill")
|
|
|
|
|
bill.Post("/list", handlers.ListBill)
|
|
|
|
|
|
2025-05-07 16:48:02 +08:00
|
|
|
// 公告
|
|
|
|
|
announcement := api.Group("/announcement")
|
|
|
|
|
announcement.Post("/list", handlers.ListAnnouncements)
|
2025-05-13 09:29:13 +08:00
|
|
|
|
|
|
|
|
// 网关
|
|
|
|
|
proxy := api.Group("/proxy")
|
2025-05-27 15:08:18 +08:00
|
|
|
proxy.Post("/online", handlers.ProxyReportOnline)
|
|
|
|
|
proxy.Post("/offline", handlers.ProxyReportOffline)
|
|
|
|
|
proxy.Post("/update", handlers.ProxyReportUpdate)
|
2025-05-13 09:29:13 +08:00
|
|
|
|
|
|
|
|
// 节点
|
|
|
|
|
edge := api.Group("/edge")
|
2025-05-27 15:08:18 +08:00
|
|
|
edge.Post("/assign", handlers.AssignEdge)
|
2025-05-23 18:58:03 +08:00
|
|
|
edge.Post("/all", handlers.AllEdgesAvailable)
|
2025-05-13 18:47:30 +08:00
|
|
|
|
|
|
|
|
// 临时
|
2025-11-17 18:38:10 +08:00
|
|
|
debug := app.Group("/debug")
|
|
|
|
|
debug.Get("/sms/:phone", handlers.DebugGetSmsCode)
|
2025-03-15 16:07:45 +08:00
|
|
|
}
|