Files
hi-server/internal/handler/routes.go
T
2026-05-27 23:51:25 -07:00

2343 lines
61 KiB
Go

// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
package handler
import (
"net/http"
adminads "github.com/perfect-panel/server/internal/handler/admin/ads"
adminannouncement "github.com/perfect-panel/server/internal/handler/admin/announcement"
adminapplication "github.com/perfect-panel/server/internal/handler/admin/application"
adminauthMethod "github.com/perfect-panel/server/internal/handler/admin/authMethod"
adminconsole "github.com/perfect-panel/server/internal/handler/admin/console"
admincoupon "github.com/perfect-panel/server/internal/handler/admin/coupon"
admindocument "github.com/perfect-panel/server/internal/handler/admin/document"
admingroup "github.com/perfect-panel/server/internal/handler/admin/group"
admininvite "github.com/perfect-panel/server/internal/handler/admin/invite"
adminlog "github.com/perfect-panel/server/internal/handler/admin/log"
adminmarketing "github.com/perfect-panel/server/internal/handler/admin/marketing"
adminorder "github.com/perfect-panel/server/internal/handler/admin/order"
adminpayment "github.com/perfect-panel/server/internal/handler/admin/payment"
adminpromo "github.com/perfect-panel/server/internal/handler/admin/promo"
adminredemption "github.com/perfect-panel/server/internal/handler/admin/redemption"
adminserver "github.com/perfect-panel/server/internal/handler/admin/server"
adminsubscribe "github.com/perfect-panel/server/internal/handler/admin/subscribe"
adminsystem "github.com/perfect-panel/server/internal/handler/admin/system"
adminticket "github.com/perfect-panel/server/internal/handler/admin/ticket"
admintool "github.com/perfect-panel/server/internal/handler/admin/tool"
adminuser "github.com/perfect-panel/server/internal/handler/admin/user"
auth "github.com/perfect-panel/server/internal/handler/auth"
authadmin "github.com/perfect-panel/server/internal/handler/auth/admin"
authoauth "github.com/perfect-panel/server/internal/handler/auth/oauth"
common "github.com/perfect-panel/server/internal/handler/common"
nodeserver "github.com/perfect-panel/server/internal/handler/node/server"
publicannouncement "github.com/perfect-panel/server/internal/handler/public/announcement"
publicdocument "github.com/perfect-panel/server/internal/handler/public/document"
publicfile "github.com/perfect-panel/server/internal/handler/public/file"
publiciapapple "github.com/perfect-panel/server/internal/handler/public/iap/apple"
publicorder "github.com/perfect-panel/server/internal/handler/public/order"
publicpayment "github.com/perfect-panel/server/internal/handler/public/payment"
publicportal "github.com/perfect-panel/server/internal/handler/public/portal"
publicrecovery "github.com/perfect-panel/server/internal/handler/public/recovery"
publicredemption "github.com/perfect-panel/server/internal/handler/public/redemption"
publicsubscribe "github.com/perfect-panel/server/internal/handler/public/subscribe"
publicticket "github.com/perfect-panel/server/internal/handler/public/ticket"
publicuser "github.com/perfect-panel/server/internal/handler/public/user"
publicuserws "github.com/perfect-panel/server/internal/handler/public/user/ws"
"github.com/perfect-panel/server/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create Ads
Method: http.MethodPost,
Path: "/",
Handler: adminads.CreateAdsHandler(serverCtx),
},
{
// Update Ads
Method: http.MethodPut,
Path: "/",
Handler: adminads.UpdateAdsHandler(serverCtx),
},
{
// Delete Ads
Method: http.MethodDelete,
Path: "/",
Handler: adminads.DeleteAdsHandler(serverCtx),
},
{
// Get Ads Detail
Method: http.MethodGet,
Path: "/detail",
Handler: adminads.GetAdsDetailHandler(serverCtx),
},
{
// Get Ads List
Method: http.MethodGet,
Path: "/list",
Handler: adminads.GetAdsListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/ads"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create announcement
Method: http.MethodPost,
Path: "/",
Handler: adminannouncement.CreateAnnouncementHandler(serverCtx),
},
{
// Update announcement
Method: http.MethodPut,
Path: "/",
Handler: adminannouncement.UpdateAnnouncementHandler(serverCtx),
},
{
// Delete announcement
Method: http.MethodDelete,
Path: "/",
Handler: adminannouncement.DeleteAnnouncementHandler(serverCtx),
},
{
// Get announcement
Method: http.MethodGet,
Path: "/detail",
Handler: adminannouncement.GetAnnouncementHandler(serverCtx),
},
{
// Get announcement list
Method: http.MethodGet,
Path: "/list",
Handler: adminannouncement.GetAnnouncementListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/announcement"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create subscribe application
Method: http.MethodPost,
Path: "/",
Handler: adminapplication.CreateSubscribeApplicationHandler(serverCtx),
},
{
// Preview Template
Method: http.MethodGet,
Path: "/preview",
Handler: adminapplication.PreviewSubscribeTemplateHandler(serverCtx),
},
{
// Update subscribe application
Method: http.MethodPut,
Path: "/subscribe_application",
Handler: adminapplication.UpdateSubscribeApplicationHandler(serverCtx),
},
{
// Delete subscribe application
Method: http.MethodDelete,
Path: "/subscribe_application",
Handler: adminapplication.DeleteSubscribeApplicationHandler(serverCtx),
},
{
// Get subscribe application list
Method: http.MethodGet,
Path: "/subscribe_application_list",
Handler: adminapplication.GetSubscribeApplicationListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/application"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Get auth method config
Method: http.MethodGet,
Path: "/config",
Handler: adminauthMethod.GetAuthMethodConfigHandler(serverCtx),
},
{
// Update auth method config
Method: http.MethodPut,
Path: "/config",
Handler: adminauthMethod.UpdateAuthMethodConfigHandler(serverCtx),
},
{
// Get email support platform
Method: http.MethodGet,
Path: "/email_platform",
Handler: adminauthMethod.GetEmailPlatformHandler(serverCtx),
},
{
// Get auth method list
Method: http.MethodGet,
Path: "/list",
Handler: adminauthMethod.GetAuthMethodListHandler(serverCtx),
},
{
// Get sms support platform
Method: http.MethodGet,
Path: "/sms_platform",
Handler: adminauthMethod.GetSmsPlatformHandler(serverCtx),
},
{
// Test email send
Method: http.MethodPost,
Path: "/test_email_send",
Handler: adminauthMethod.TestEmailSendHandler(serverCtx),
},
{
// Test sms send
Method: http.MethodPost,
Path: "/test_sms_send",
Handler: adminauthMethod.TestSmsSendHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/auth-method"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Query revenue statistics
Method: http.MethodGet,
Path: "/revenue",
Handler: adminconsole.QueryRevenueStatisticsHandler(serverCtx),
},
{
// Query server total data
Method: http.MethodGet,
Path: "/server",
Handler: adminconsole.QueryServerTotalDataHandler(serverCtx),
},
{
// Query ticket wait reply
Method: http.MethodGet,
Path: "/ticket",
Handler: adminconsole.QueryTicketWaitReplyHandler(serverCtx),
},
{
// Query user statistics
Method: http.MethodGet,
Path: "/user",
Handler: adminconsole.QueryUserStatisticsHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/console"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create coupon
Method: http.MethodPost,
Path: "/",
Handler: admincoupon.CreateCouponHandler(serverCtx),
},
{
// Update coupon
Method: http.MethodPut,
Path: "/",
Handler: admincoupon.UpdateCouponHandler(serverCtx),
},
{
// Delete coupon
Method: http.MethodDelete,
Path: "/",
Handler: admincoupon.DeleteCouponHandler(serverCtx),
},
{
// Batch delete coupon
Method: http.MethodDelete,
Path: "/batch",
Handler: admincoupon.BatchDeleteCouponHandler(serverCtx),
},
{
// Get coupon list
Method: http.MethodGet,
Path: "/list",
Handler: admincoupon.GetCouponListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/coupon"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create document
Method: http.MethodPost,
Path: "/",
Handler: admindocument.CreateDocumentHandler(serverCtx),
},
{
// Update document
Method: http.MethodPut,
Path: "/",
Handler: admindocument.UpdateDocumentHandler(serverCtx),
},
{
// Delete document
Method: http.MethodDelete,
Path: "/",
Handler: admindocument.DeleteDocumentHandler(serverCtx),
},
{
// Batch delete document
Method: http.MethodDelete,
Path: "/batch",
Handler: admindocument.BatchDeleteDocumentHandler(serverCtx),
},
{
// Get document detail
Method: http.MethodGet,
Path: "/detail",
Handler: admindocument.GetDocumentDetailHandler(serverCtx),
},
{
// Get document list
Method: http.MethodGet,
Path: "/list",
Handler: admindocument.GetDocumentListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/document"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Get group config
Method: http.MethodGet,
Path: "/config",
Handler: admingroup.GetGroupConfigHandler(serverCtx),
},
{
// Update group config
Method: http.MethodPut,
Path: "/config",
Handler: admingroup.UpdateGroupConfigHandler(serverCtx),
},
{
// Export group result
Method: http.MethodGet,
Path: "/export",
Handler: admingroup.ExportGroupResultHandler(serverCtx),
},
{
// Get group history
Method: http.MethodGet,
Path: "/history",
Handler: admingroup.GetGroupHistoryHandler(serverCtx),
},
{
// Get group history detail
Method: http.MethodGet,
Path: "/history/detail",
Handler: admingroup.GetGroupHistoryDetailHandler(serverCtx),
},
{
// Create node group
Method: http.MethodPost,
Path: "/node",
Handler: admingroup.CreateNodeGroupHandler(serverCtx),
},
{
// Update node group
Method: http.MethodPut,
Path: "/node",
Handler: admingroup.UpdateNodeGroupHandler(serverCtx),
},
{
// Delete node group
Method: http.MethodDelete,
Path: "/node",
Handler: admingroup.DeleteNodeGroupHandler(serverCtx),
},
{
// Get node group list
Method: http.MethodGet,
Path: "/node/list",
Handler: admingroup.GetNodeGroupListHandler(serverCtx),
},
{
// Preview user nodes
Method: http.MethodGet,
Path: "/preview",
Handler: admingroup.PreviewUserNodesHandler(serverCtx),
},
{
// Recalculate group
Method: http.MethodPost,
Path: "/recalculate",
Handler: admingroup.RecalculateGroupHandler(serverCtx),
},
{
// Get recalculation status
Method: http.MethodGet,
Path: "/recalculation/status",
Handler: admingroup.GetRecalculationStatusHandler(serverCtx),
},
{
// Reset all groups
Method: http.MethodPost,
Path: "/reset",
Handler: admingroup.ResetGroupsHandler(serverCtx),
},
{
// Get subscribe group mapping
Method: http.MethodGet,
Path: "/subscribe/mapping",
Handler: admingroup.GetSubscribeGroupMappingHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/v1/admin/group"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Get invite manage list
Method: http.MethodGet,
Path: "/list",
Handler: admininvite.GetInviteManageListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/invite"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Filter balance log
Method: http.MethodGet,
Path: "/balance/list",
Handler: adminlog.FilterBalanceLogHandler(serverCtx),
},
{
// Filter commission log
Method: http.MethodGet,
Path: "/commission/list",
Handler: adminlog.FilterCommissionLogHandler(serverCtx),
},
{
// Filter email log
Method: http.MethodGet,
Path: "/email/list",
Handler: adminlog.FilterEmailLogHandler(serverCtx),
},
{
// Get error log message detail
Method: http.MethodGet,
Path: "/error_message/detail",
Handler: adminlog.GetErrorLogMessageDetailHandler(serverCtx),
},
{
// Get error log message list
Method: http.MethodGet,
Path: "/error_message/list",
Handler: adminlog.GetErrorLogMessageListHandler(serverCtx),
},
{
// Filter gift log
Method: http.MethodGet,
Path: "/gift/list",
Handler: adminlog.FilterGiftLogHandler(serverCtx),
},
{
// Filter login log
Method: http.MethodGet,
Path: "/login/list",
Handler: adminlog.FilterLoginLogHandler(serverCtx),
},
{
// Get log message raw detail (temporary)
Method: http.MethodGet,
Path: "/message/detail",
Handler: adminlog.GetLogMessageRawHandler(serverCtx),
},
{
// Get message log list
Method: http.MethodGet,
Path: "/message/list",
Handler: adminlog.GetMessageLogListHandler(serverCtx),
},
{
// Filter mobile log
Method: http.MethodGet,
Path: "/mobile/list",
Handler: adminlog.FilterMobileLogHandler(serverCtx),
},
{
// Filter order refund log
Method: http.MethodGet,
Path: "/order/refund/list",
Handler: adminlog.FilterOrderRefundLogHandler(serverCtx),
},
{
// Filter register log
Method: http.MethodGet,
Path: "/register/list",
Handler: adminlog.FilterRegisterLogHandler(serverCtx),
},
{
// Filter server traffic log
Method: http.MethodGet,
Path: "/server/traffic/list",
Handler: adminlog.FilterServerTrafficLogHandler(serverCtx),
},
{
// Get log setting
Method: http.MethodGet,
Path: "/setting",
Handler: adminlog.GetLogSettingHandler(serverCtx),
},
{
// Update log setting
Method: http.MethodPost,
Path: "/setting",
Handler: adminlog.UpdateLogSettingHandler(serverCtx),
},
{
// Filter subscribe log
Method: http.MethodGet,
Path: "/subscribe/list",
Handler: adminlog.FilterSubscribeLogHandler(serverCtx),
},
{
// Filter reset subscribe log
Method: http.MethodGet,
Path: "/subscribe/reset/list",
Handler: adminlog.FilterResetSubscribeLogHandler(serverCtx),
},
{
// Filter user subscribe traffic log
Method: http.MethodGet,
Path: "/subscribe/traffic/list",
Handler: adminlog.FilterUserSubscribeTrafficLogHandler(serverCtx),
},
{
// Filter traffic log details
Method: http.MethodGet,
Path: "/traffic/details",
Handler: adminlog.FilterTrafficLogDetailsHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/log"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Get batch send email task list
Method: http.MethodGet,
Path: "/email/batch/list",
Handler: adminmarketing.GetBatchSendEmailTaskListHandler(serverCtx),
},
{
// Get pre-send email count
Method: http.MethodPost,
Path: "/email/batch/pre-send-count",
Handler: adminmarketing.GetPreSendEmailCountHandler(serverCtx),
},
{
// Create a batch send email task
Method: http.MethodPost,
Path: "/email/batch/send",
Handler: adminmarketing.CreateBatchSendEmailTaskHandler(serverCtx),
},
{
// Get batch send email task status
Method: http.MethodPost,
Path: "/email/batch/status",
Handler: adminmarketing.GetBatchSendEmailTaskStatusHandler(serverCtx),
},
{
// Stop a batch send email task
Method: http.MethodPost,
Path: "/email/batch/stop",
Handler: adminmarketing.StopBatchSendEmailTaskHandler(serverCtx),
},
{
// Create a quota task
Method: http.MethodPost,
Path: "/quota/create",
Handler: adminmarketing.CreateQuotaTaskHandler(serverCtx),
},
{
// Query quota task list
Method: http.MethodGet,
Path: "/quota/list",
Handler: adminmarketing.QueryQuotaTaskListHandler(serverCtx),
},
{
// Query quota task pre-count
Method: http.MethodPost,
Path: "/quota/pre-count",
Handler: adminmarketing.QueryQuotaTaskPreCountHandler(serverCtx),
},
{
// Query quota task status
Method: http.MethodPost,
Path: "/quota/status",
Handler: adminmarketing.QueryQuotaTaskStatusHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/marketing"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create order
Method: http.MethodPost,
Path: "/",
Handler: adminorder.CreateOrderHandler(serverCtx),
},
{
// Manually activate order
Method: http.MethodPost,
Path: "/activate",
Handler: adminorder.ActivateOrderHandler(serverCtx),
},
{
// Get order list
Method: http.MethodGet,
Path: "/list",
Handler: adminorder.GetOrderListHandler(serverCtx),
},
{
// Refund order
Method: http.MethodPost,
Path: "/refund",
Handler: adminorder.RefundOrderHandler(serverCtx),
},
{
// Update order status
Method: http.MethodPut,
Path: "/status",
Handler: adminorder.UpdateOrderStatusHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/order"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create Payment Method
Method: http.MethodPost,
Path: "/",
Handler: adminpayment.CreatePaymentMethodHandler(serverCtx),
},
{
// Update Payment Method
Method: http.MethodPut,
Path: "/",
Handler: adminpayment.UpdatePaymentMethodHandler(serverCtx),
},
{
// Delete Payment Method
Method: http.MethodDelete,
Path: "/",
Handler: adminpayment.DeletePaymentMethodHandler(serverCtx),
},
{
// Get Payment Method List
Method: http.MethodGet,
Path: "/list",
Handler: adminpayment.GetPaymentMethodListHandler(serverCtx),
},
{
// Get supported payment platform
Method: http.MethodGet,
Path: "/platform",
Handler: adminpayment.GetPaymentPlatformHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/payment"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Set promo prices
Method: http.MethodPost,
Path: "/price",
Handler: adminpromo.SetPriceHandler(serverCtx),
},
{
// Delete promo price
Method: http.MethodDelete,
Path: "/price/:id",
Handler: adminpromo.DeletePriceHandler(serverCtx),
},
{
// Get promo price list
Method: http.MethodGet,
Path: "/price/list",
Handler: adminpromo.GetPriceListHandler(serverCtx),
},
{
// Create promo rule
Method: http.MethodPost,
Path: "/rule",
Handler: adminpromo.CreateRuleHandler(serverCtx),
},
{
// Get promo rule detail
Method: http.MethodGet,
Path: "/rule/:id",
Handler: adminpromo.GetRuleDetailHandler(serverCtx),
},
{
// Update promo rule
Method: http.MethodPut,
Path: "/rule/:id",
Handler: adminpromo.UpdateRuleHandler(serverCtx),
},
{
// Delete promo rule
Method: http.MethodDelete,
Path: "/rule/:id",
Handler: adminpromo.DeleteRuleHandler(serverCtx),
},
{
// Get promo rule list
Method: http.MethodGet,
Path: "/rule/list",
Handler: adminpromo.GetRuleListHandler(serverCtx),
},
{
// Get promo usage list
Method: http.MethodGet,
Path: "/usage/list",
Handler: adminpromo.GetUsageListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/promo"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create redemption code
Method: http.MethodPost,
Path: "/code",
Handler: adminredemption.CreateRedemptionCodeHandler(serverCtx),
},
{
// Update redemption code
Method: http.MethodPut,
Path: "/code",
Handler: adminredemption.UpdateRedemptionCodeHandler(serverCtx),
},
{
// Delete redemption code
Method: http.MethodDelete,
Path: "/code",
Handler: adminredemption.DeleteRedemptionCodeHandler(serverCtx),
},
{
// Batch delete redemption code
Method: http.MethodDelete,
Path: "/code/batch",
Handler: adminredemption.BatchDeleteRedemptionCodeHandler(serverCtx),
},
{
// Get redemption code list
Method: http.MethodGet,
Path: "/code/list",
Handler: adminredemption.GetRedemptionCodeListHandler(serverCtx),
},
{
// Toggle redemption code status
Method: http.MethodPut,
Path: "/code/status",
Handler: adminredemption.ToggleRedemptionCodeStatusHandler(serverCtx),
},
{
// Get redemption record list
Method: http.MethodGet,
Path: "/record/list",
Handler: adminredemption.GetRedemptionRecordListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/redemption"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create Server
Method: http.MethodPost,
Path: "/create",
Handler: adminserver.CreateServerHandler(serverCtx),
},
{
// Delete Server
Method: http.MethodPost,
Path: "/delete",
Handler: adminserver.DeleteServerHandler(serverCtx),
},
{
// Filter Server List
Method: http.MethodGet,
Path: "/list",
Handler: adminserver.FilterServerListHandler(serverCtx),
},
{
// Create Node
Method: http.MethodPost,
Path: "/node/create",
Handler: adminserver.CreateNodeHandler(serverCtx),
},
{
// Delete Node
Method: http.MethodPost,
Path: "/node/delete",
Handler: adminserver.DeleteNodeHandler(serverCtx),
},
{
// Filter Node List
Method: http.MethodGet,
Path: "/node/list",
Handler: adminserver.FilterNodeListHandler(serverCtx),
},
{
// Reset node sort
Method: http.MethodPost,
Path: "/node/sort",
Handler: adminserver.ResetSortWithNodeHandler(serverCtx),
},
{
// Toggle Node Status
Method: http.MethodPost,
Path: "/node/status/toggle",
Handler: adminserver.ToggleNodeStatusHandler(serverCtx),
},
{
// Query all node tags
Method: http.MethodGet,
Path: "/node/tags",
Handler: adminserver.QueryNodeTagHandler(serverCtx),
},
{
// Update Node
Method: http.MethodPost,
Path: "/node/update",
Handler: adminserver.UpdateNodeHandler(serverCtx),
},
{
// Get Server Protocols
Method: http.MethodGet,
Path: "/protocols",
Handler: adminserver.GetServerProtocolsHandler(serverCtx),
},
{
// Reset server sort
Method: http.MethodPost,
Path: "/server/sort",
Handler: adminserver.ResetSortWithServerHandler(serverCtx),
},
{
// Update Server
Method: http.MethodPost,
Path: "/update",
Handler: adminserver.UpdateServerHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/server"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Create subscribe
Method: http.MethodPost,
Path: "/",
Handler: adminsubscribe.CreateSubscribeHandler(serverCtx),
},
{
// Update subscribe
Method: http.MethodPut,
Path: "/",
Handler: adminsubscribe.UpdateSubscribeHandler(serverCtx),
},
{
// Delete subscribe
Method: http.MethodDelete,
Path: "/",
Handler: adminsubscribe.DeleteSubscribeHandler(serverCtx),
},
{
// Batch delete subscribe
Method: http.MethodDelete,
Path: "/batch",
Handler: adminsubscribe.BatchDeleteSubscribeHandler(serverCtx),
},
{
// Get subscribe details
Method: http.MethodGet,
Path: "/details",
Handler: adminsubscribe.GetSubscribeDetailsHandler(serverCtx),
},
{
// Create subscribe group
Method: http.MethodPost,
Path: "/group",
Handler: adminsubscribe.CreateSubscribeGroupHandler(serverCtx),
},
{
// Update subscribe group
Method: http.MethodPut,
Path: "/group",
Handler: adminsubscribe.UpdateSubscribeGroupHandler(serverCtx),
},
{
// Delete subscribe group
Method: http.MethodDelete,
Path: "/group",
Handler: adminsubscribe.DeleteSubscribeGroupHandler(serverCtx),
},
{
// Batch delete subscribe group
Method: http.MethodDelete,
Path: "/group/batch",
Handler: adminsubscribe.BatchDeleteSubscribeGroupHandler(serverCtx),
},
{
// Get subscribe group list
Method: http.MethodGet,
Path: "/group/list",
Handler: adminsubscribe.GetSubscribeGroupListHandler(serverCtx),
},
{
// Get subscribe list
Method: http.MethodGet,
Path: "/list",
Handler: adminsubscribe.GetSubscribeListHandler(serverCtx),
},
{
// Reset all subscribe tokens
Method: http.MethodPost,
Path: "/reset_all_token",
Handler: adminsubscribe.ResetAllSubscribeTokenHandler(serverCtx),
},
{
// Subscribe sort
Method: http.MethodPost,
Path: "/sort",
Handler: adminsubscribe.SubscribeSortHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/subscribe"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Get Currency Config
Method: http.MethodGet,
Path: "/currency_config",
Handler: adminsystem.GetCurrencyConfigHandler(serverCtx),
},
{
// Update Currency Config
Method: http.MethodPut,
Path: "/currency_config",
Handler: adminsystem.UpdateCurrencyConfigHandler(serverCtx),
},
{
// Get Node Multiplier
Method: http.MethodGet,
Path: "/get_node_multiplier",
Handler: adminsystem.GetNodeMultiplierHandler(serverCtx),
},
{
// Get invite config
Method: http.MethodGet,
Path: "/invite_config",
Handler: adminsystem.GetInviteConfigHandler(serverCtx),
},
{
// Update invite config
Method: http.MethodPut,
Path: "/invite_config",
Handler: adminsystem.UpdateInviteConfigHandler(serverCtx),
},
{
// Get Module Config
Method: http.MethodGet,
Path: "/module",
Handler: adminsystem.GetModuleConfigHandler(serverCtx),
},
{
// Get node config
Method: http.MethodGet,
Path: "/node_config",
Handler: adminsystem.GetNodeConfigHandler(serverCtx),
},
{
// Update node config
Method: http.MethodPut,
Path: "/node_config",
Handler: adminsystem.UpdateNodeConfigHandler(serverCtx),
},
{
// PreView Node Multiplier
Method: http.MethodGet,
Path: "/node_multiplier/preview",
Handler: adminsystem.PreViewNodeMultiplierHandler(serverCtx),
},
{
// get Privacy Policy Config
Method: http.MethodGet,
Path: "/privacy",
Handler: adminsystem.GetPrivacyPolicyConfigHandler(serverCtx),
},
{
// Update Privacy Policy Config
Method: http.MethodPut,
Path: "/privacy",
Handler: adminsystem.UpdatePrivacyPolicyConfigHandler(serverCtx),
},
{
// Get register config
Method: http.MethodGet,
Path: "/register_config",
Handler: adminsystem.GetRegisterConfigHandler(serverCtx),
},
{
// Update register config
Method: http.MethodPut,
Path: "/register_config",
Handler: adminsystem.UpdateRegisterConfigHandler(serverCtx),
},
{
// Set Node Multiplier
Method: http.MethodPost,
Path: "/set_node_multiplier",
Handler: adminsystem.SetNodeMultiplierHandler(serverCtx),
},
{
// setting telegram bot
Method: http.MethodPost,
Path: "/setting_telegram_bot",
Handler: adminsystem.SettingTelegramBotHandler(serverCtx),
},
{
// Get Signature Config
Method: http.MethodGet,
Path: "/signature_config",
Handler: adminsystem.GetSignatureConfigHandler(serverCtx),
},
{
// Update Signature Config
Method: http.MethodPut,
Path: "/signature_config",
Handler: adminsystem.UpdateSignatureConfigHandler(serverCtx),
},
{
// Get site config
Method: http.MethodGet,
Path: "/site_config",
Handler: adminsystem.GetSiteConfigHandler(serverCtx),
},
{
// Update site config
Method: http.MethodPut,
Path: "/site_config",
Handler: adminsystem.UpdateSiteConfigHandler(serverCtx),
},
{
// Get subscribe config
Method: http.MethodGet,
Path: "/subscribe_config",
Handler: adminsystem.GetSubscribeConfigHandler(serverCtx),
},
{
// Update subscribe config
Method: http.MethodPut,
Path: "/subscribe_config",
Handler: adminsystem.UpdateSubscribeConfigHandler(serverCtx),
},
{
// Get Team of Service Config
Method: http.MethodGet,
Path: "/tos_config",
Handler: adminsystem.GetTosConfigHandler(serverCtx),
},
{
// Update Team of Service Config
Method: http.MethodPut,
Path: "/tos_config",
Handler: adminsystem.UpdateTosConfigHandler(serverCtx),
},
{
// Get Verify Code Config
Method: http.MethodGet,
Path: "/verify_code_config",
Handler: adminsystem.GetVerifyCodeConfigHandler(serverCtx),
},
{
// Update Verify Code Config
Method: http.MethodPut,
Path: "/verify_code_config",
Handler: adminsystem.UpdateVerifyCodeConfigHandler(serverCtx),
},
{
// Get verify config
Method: http.MethodGet,
Path: "/verify_config",
Handler: adminsystem.GetVerifyConfigHandler(serverCtx),
},
{
// Update verify config
Method: http.MethodPut,
Path: "/verify_config",
Handler: adminsystem.UpdateVerifyConfigHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/system"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Update ticket status
Method: http.MethodPut,
Path: "/",
Handler: adminticket.UpdateTicketStatusHandler(serverCtx),
},
{
// Get ticket detail
Method: http.MethodGet,
Path: "/detail",
Handler: adminticket.GetTicketHandler(serverCtx),
},
{
// Create ticket follow
Method: http.MethodPost,
Path: "/follow",
Handler: adminticket.CreateTicketFollowHandler(serverCtx),
},
{
// Get ticket list
Method: http.MethodGet,
Path: "/list",
Handler: adminticket.GetTicketListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/ticket"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Query IP Location
Method: http.MethodGet,
Path: "/ip/location",
Handler: admintool.QueryIPLocationHandler(serverCtx),
},
{
// Get System Log
Method: http.MethodGet,
Path: "/log",
Handler: admintool.GetSystemLogHandler(serverCtx),
},
{
// Restart System
Method: http.MethodGet,
Path: "/restart",
Handler: admintool.RestartSystemHandler(serverCtx),
},
{
// Get Version
Method: http.MethodGet,
Path: "/version",
Handler: admintool.GetVersionHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/admin/tool"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Delete user
Method: http.MethodDelete,
Path: "/",
Handler: adminuser.DeleteUserHandler(serverCtx),
},
{
// Create user
Method: http.MethodPost,
Path: "/",
Handler: adminuser.CreateUserHandler(serverCtx),
},
{
// Create user auth method
Method: http.MethodPost,
Path: "/auth_method",
Handler: adminuser.CreateUserAuthMethodHandler(serverCtx),
},
{
// Delete user auth method
Method: http.MethodDelete,
Path: "/auth_method",
Handler: adminuser.DeleteUserAuthMethodHandler(serverCtx),
},
{
// Update user auth method
Method: http.MethodPut,
Path: "/auth_method",
Handler: adminuser.UpdateUserAuthMethodHandler(serverCtx),
},
{
// Get user auth method
Method: http.MethodGet,
Path: "/auth_method",
Handler: adminuser.GetUserAuthMethodHandler(serverCtx),
},
{
// Update user basic info
Method: http.MethodPut,
Path: "/basic",
Handler: adminuser.UpdateUserBasicInfoHandler(serverCtx),
},
{
// Batch delete user
Method: http.MethodDelete,
Path: "/batch",
Handler: adminuser.BatchDeleteUserHandler(serverCtx),
},
{
// Current user
Method: http.MethodGet,
Path: "/current",
Handler: adminuser.CurrentUserHandler(serverCtx),
},
{
// Get user detail
Method: http.MethodGet,
Path: "/detail",
Handler: adminuser.GetUserDetailHandler(serverCtx),
},
{
// User device
Method: http.MethodPut,
Path: "/device",
Handler: adminuser.UpdateUserDeviceHandler(serverCtx),
},
{
// Delete user device
Method: http.MethodDelete,
Path: "/device",
Handler: adminuser.DeleteUserDeviceHandler(serverCtx),
},
{
// kick offline user device
Method: http.MethodPut,
Path: "/device/kick_offline",
Handler: adminuser.KickOfflineByUserDeviceHandler(serverCtx),
},
{
// Get family detail
Method: http.MethodGet,
Path: "/family/detail",
Handler: adminuser.GetFamilyDetailHandler(serverCtx),
},
{
// Dissolve family
Method: http.MethodPut,
Path: "/family/dissolve",
Handler: adminuser.DissolveFamilyHandler(serverCtx),
},
{
// Get family list
Method: http.MethodGet,
Path: "/family/list",
Handler: adminuser.GetFamilyListHandler(serverCtx),
},
{
// Update family max members
Method: http.MethodPut,
Path: "/family/max_members",
Handler: adminuser.UpdateFamilyMaxMembersHandler(serverCtx),
},
{
// Remove family member
Method: http.MethodPut,
Path: "/family/member/remove",
Handler: adminuser.RemoveFamilyMemberHandler(serverCtx),
},
{
// Get admin user invite list
Method: http.MethodGet,
Path: "/invite/list",
Handler: adminuser.GetAdminUserInviteListHandler(serverCtx),
},
{
// Get admin user invite stats
Method: http.MethodGet,
Path: "/invite/stats",
Handler: adminuser.GetAdminUserInviteStatsHandler(serverCtx),
},
{
// Get user list
Method: http.MethodGet,
Path: "/list",
Handler: adminuser.GetUserListHandler(serverCtx),
},
{
// Get user login logs
Method: http.MethodGet,
Path: "/login/logs",
Handler: adminuser.GetUserLoginLogsHandler(serverCtx),
},
{
// Update user notify setting
Method: http.MethodPut,
Path: "/notify",
Handler: adminuser.UpdateUserNotifySettingHandler(serverCtx),
},
{
// Get user subcribe
Method: http.MethodGet,
Path: "/subscribe",
Handler: adminuser.GetUserSubscribeHandler(serverCtx),
},
{
// Create user subcribe
Method: http.MethodPost,
Path: "/subscribe",
Handler: adminuser.CreateUserSubscribeHandler(serverCtx),
},
{
// Update user subcribe
Method: http.MethodPut,
Path: "/subscribe",
Handler: adminuser.UpdateUserSubscribeHandler(serverCtx),
},
{
// Delete user subcribe
Method: http.MethodDelete,
Path: "/subscribe",
Handler: adminuser.DeleteUserSubscribeHandler(serverCtx),
},
{
// Get user subcribe by id
Method: http.MethodGet,
Path: "/subscribe/detail",
Handler: adminuser.GetUserSubscribeByIdHandler(serverCtx),
},
{
// Get user subcribe devices
Method: http.MethodGet,
Path: "/subscribe/device",
Handler: adminuser.GetUserSubscribeDevicesHandler(serverCtx),
},
{
// Get user subcribe logs
Method: http.MethodGet,
Path: "/subscribe/logs",
Handler: adminuser.GetUserSubscribeLogsHandler(serverCtx),
},
{
// Get user subcribe reset traffic logs
Method: http.MethodGet,
Path: "/subscribe/reset/logs",
Handler: adminuser.GetUserSubscribeResetTrafficLogsHandler(serverCtx),
},
{
// Reset user subscribe token
Method: http.MethodPost,
Path: "/subscribe/reset/token",
Handler: adminuser.ResetUserSubscribeTokenHandler(serverCtx),
},
{
// Reset user subscribe traffic
Method: http.MethodPost,
Path: "/subscribe/reset/traffic",
Handler: adminuser.ResetUserSubscribeTrafficHandler(serverCtx),
},
{
// Stop user subscribe
Method: http.MethodPost,
Path: "/subscribe/toggle",
Handler: adminuser.ToggleUserSubscribeStatusHandler(serverCtx),
},
{
// Get user subcribe traffic logs
Method: http.MethodGet,
Path: "/subscribe/traffic_logs",
Handler: adminuser.GetUserSubscribeTrafficLogsHandler(serverCtx),
},
{
// Approve withdrawal
Method: http.MethodPost,
Path: "/withdrawal/approve",
Handler: adminuser.ApproveWithdrawalHandler(serverCtx),
},
{
// Get withdrawal list
Method: http.MethodGet,
Path: "/withdrawal/list",
Handler: adminuser.GetWithdrawalListHandler(serverCtx),
},
{
// Reject withdrawal
Method: http.MethodPost,
Path: "/withdrawal/reject",
Handler: adminuser.RejectWithdrawalHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/v1/admin/user"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Generate captcha
Method: http.MethodPost,
Path: "/captcha/generate",
Handler: auth.GenerateCaptchaHandler(serverCtx),
},
{
// Verify slider captcha
Method: http.MethodPost,
Path: "/captcha/slider/verify",
Handler: auth.SliderVerifyCaptchaHandler(serverCtx),
},
{
// Check user is exist
Method: http.MethodGet,
Path: "/check",
Handler: auth.CheckUserHandler(serverCtx),
},
{
// Check user telephone is exist
Method: http.MethodGet,
Path: "/check/telephone",
Handler: auth.CheckUserTelephoneHandler(serverCtx),
},
{
// User login
Method: http.MethodPost,
Path: "/login",
Handler: auth.UserLoginHandler(serverCtx),
},
{
// Device Login
Method: http.MethodPost,
Path: "/login/device",
Handler: auth.DeviceLoginHandler(serverCtx),
},
{
// Email Login
Method: http.MethodPost,
Path: "/login/email",
Handler: auth.EmailLoginHandler(serverCtx),
},
{
// User Telephone login
Method: http.MethodPost,
Path: "/login/telephone",
Handler: auth.TelephoneLoginHandler(serverCtx),
},
{
// User register
Method: http.MethodPost,
Path: "/register",
Handler: auth.UserRegisterHandler(serverCtx),
},
{
// User Telephone register
Method: http.MethodPost,
Path: "/register/telephone",
Handler: auth.TelephoneRegisterHandler(serverCtx),
},
{
// Reset password
Method: http.MethodPost,
Path: "/reset",
Handler: auth.ResetPasswordHandler(serverCtx),
},
{
// Reset password by telephone
Method: http.MethodPost,
Path: "/reset/telephone",
Handler: auth.TelephoneResetPasswordHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/auth"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Generate captcha
Method: http.MethodPost,
Path: "/captcha/generate",
Handler: authadmin.AdminGenerateCaptchaHandler(serverCtx),
},
{
// Verify slider captcha
Method: http.MethodPost,
Path: "/captcha/slider/verify",
Handler: authadmin.AdminSliderVerifyCaptchaHandler(serverCtx),
},
{
// Admin login
Method: http.MethodPost,
Path: "/login",
Handler: authadmin.AdminLoginHandler(serverCtx),
},
{
// Admin reset password
Method: http.MethodPost,
Path: "/reset",
Handler: authadmin.AdminResetPasswordHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/auth/admin"),
)
server.AddRoutes(
[]rest.Route{
{
// Apple Login Callback
Method: http.MethodPost,
Path: "/callback/apple",
Handler: authoauth.AppleLoginCallbackHandler(serverCtx),
},
{
// OAuth login
Method: http.MethodPost,
Path: "/login",
Handler: authoauth.OAuthLoginHandler(serverCtx),
},
{
// OAuth login get token
Method: http.MethodPost,
Path: "/login/token",
Handler: authoauth.OAuthLoginGetTokenHandler(serverCtx),
},
},
rest.WithPrefix("/v1/auth/oauth"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Get Ads
Method: http.MethodGet,
Path: "/ads",
Handler: common.GetAdsHandler(serverCtx),
},
{
// Check verification code (legacy v1)
Method: http.MethodPost,
Path: "/check_code",
Handler: common.CheckCodeLegacyHandler(serverCtx),
},
{
// Check verification code (legacy v2, consume code)
Method: http.MethodPost,
Path: "/check_code/v2",
Handler: common.CheckCodeLegacyV2Handler(serverCtx),
},
{
// Check verification code
Method: http.MethodPost,
Path: "/check_verification_code",
Handler: common.CheckVerificationCodeHandler(serverCtx),
},
{
// Get Client
Method: http.MethodGet,
Path: "/client",
Handler: common.GetClientHandler(serverCtx),
},
{
// Get Download Link
Method: http.MethodGet,
Path: "/client/download",
Handler: common.GetDownloadLinkHandler(serverCtx),
},
{
// Submit Contact
Method: http.MethodPost,
Path: "/contact",
Handler: common.SubmitContactHandler(serverCtx),
},
{
// Heartbeat
Method: http.MethodGet,
Path: "/heartbeat",
Handler: common.HeartbeatHandler(serverCtx),
},
{
// Report log message
Method: http.MethodPost,
Path: "/log/report",
Handler: common.ReportLogMessageHandler(serverCtx),
},
{
// Get verification code
Method: http.MethodPost,
Path: "/send_code",
Handler: common.SendEmailCodeHandler(serverCtx),
},
{
// Get sms verification code
Method: http.MethodPost,
Path: "/send_sms_code",
Handler: common.SendSmsCodeHandler(serverCtx),
},
{
// Get global config
Method: http.MethodGet,
Path: "/site/config",
Handler: common.GetGlobalConfigHandler(serverCtx),
},
{
// Get Privacy Policy
Method: http.MethodGet,
Path: "/site/privacy",
Handler: common.GetPrivacyPolicyHandler(serverCtx),
},
{
// Get stat
Method: http.MethodGet,
Path: "/site/stat",
Handler: common.GetStatHandler(serverCtx),
},
{
// Get Tos Content
Method: http.MethodGet,
Path: "/site/tos",
Handler: common.GetTosHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/common"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.ServerMiddleware},
[]rest.Route{
{
// Get server config
Method: http.MethodGet,
Path: "/config",
Handler: nodeserver.GetServerConfigHandler(serverCtx),
},
{
// Push online users
Method: http.MethodPost,
Path: "/online",
Handler: nodeserver.PushOnlineUsersHandler(serverCtx),
},
{
// Push user Traffic
Method: http.MethodPost,
Path: "/push",
Handler: nodeserver.ServerPushUserTrafficHandler(serverCtx),
},
{
// Push server status
Method: http.MethodPost,
Path: "/status",
Handler: nodeserver.ServerPushStatusHandler(serverCtx),
},
{
// Get user list
Method: http.MethodGet,
Path: "/user",
Handler: nodeserver.GetServerUserListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/server"),
)
server.AddRoutes(
[]rest.Route{
{
// Get Server Protocol Config
Method: http.MethodGet,
Path: "/:server_id",
Handler: nodeserver.QueryServerProtocolConfigHandler(serverCtx),
},
},
rest.WithPrefix("/v2/server"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Query announcement
Method: http.MethodGet,
Path: "/list",
Handler: publicannouncement.QueryAnnouncementHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/announcement"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Get document detail
Method: http.MethodGet,
Path: "/detail",
Handler: publicdocument.QueryDocumentDetailHandler(serverCtx),
},
{
// Get document list
Method: http.MethodGet,
Path: "/list",
Handler: publicdocument.QueryDocumentListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/document"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Upload file to RustFS
Method: http.MethodPost,
Path: "/upload",
Handler: publicfile.FileUploadHandler(serverCtx),
},
{
// Complete file upload
Method: http.MethodPost,
Path: "/upload/complete",
Handler: publicfile.FileUploadCompleteHandler(serverCtx),
},
{
// Init file upload
Method: http.MethodPost,
Path: "/upload/init",
Handler: publicfile.FileUploadInitHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/file"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Get Apple IAP Status
Method: http.MethodGet,
Path: "/status",
Handler: publiciapapple.GetAppleStatusHandler(serverCtx),
},
{
// Attach Apple Transaction
Method: http.MethodPost,
Path: "/transactions/attach",
Handler: publiciapapple.AttachAppleTransactionHandler(serverCtx),
},
{
// Attach Apple Transaction By Id
Method: http.MethodPost,
Path: "/transactions/attach/id",
Handler: publiciapapple.AttachAppleTransactionByIdHandler(serverCtx),
},
{
// Restore Apple Transactions
Method: http.MethodPost,
Path: "/transactions/restore",
Handler: publiciapapple.RestoreAppleTransactionsHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/iap/apple"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Close order
Method: http.MethodPost,
Path: "/close",
Handler: publicorder.CloseOrderHandler(serverCtx),
},
{
// Get order
Method: http.MethodGet,
Path: "/detail",
Handler: publicorder.QueryOrderDetailHandler(serverCtx),
},
{
// Get order list
Method: http.MethodGet,
Path: "/list",
Handler: publicorder.QueryOrderListHandler(serverCtx),
},
{
// Pre create order
Method: http.MethodPost,
Path: "/pre",
Handler: publicorder.PreCreateOrderHandler(serverCtx),
},
{
// purchase Subscription
Method: http.MethodPost,
Path: "/purchase",
Handler: publicorder.PurchaseHandler(serverCtx),
},
{
// Recharge
Method: http.MethodPost,
Path: "/recharge",
Handler: publicorder.RechargeHandler(serverCtx),
},
{
// Renewal Subscription
Method: http.MethodPost,
Path: "/renewal",
Handler: publicorder.RenewalHandler(serverCtx),
},
{
// Reset traffic
Method: http.MethodPost,
Path: "/reset",
Handler: publicorder.ResetTrafficHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/order"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Get available payment methods
Method: http.MethodGet,
Path: "/methods",
Handler: publicpayment.GetAvailablePaymentMethodsHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/payment"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Purchase Checkout
Method: http.MethodPost,
Path: "/order/checkout",
Handler: publicportal.PurchaseCheckoutHandler(serverCtx),
},
{
// Query Purchase Order
Method: http.MethodGet,
Path: "/order/status",
Handler: publicportal.QueryPurchaseOrderHandler(serverCtx),
},
{
// Get available payment methods
Method: http.MethodGet,
Path: "/payment-method",
Handler: publicportal.GetAvailablePaymentMethodsHandler(serverCtx),
},
{
// Pre Purchase Order
Method: http.MethodPost,
Path: "/pre",
Handler: publicportal.PrePurchaseOrderHandler(serverCtx),
},
{
// Purchase subscription
Method: http.MethodPost,
Path: "/purchase",
Handler: publicportal.PurchaseHandler(serverCtx),
},
{
// Get Subscription
Method: http.MethodGet,
Path: "/subscribe",
Handler: publicportal.GetSubscriptionHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/portal"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Recover order subscription
Method: http.MethodPost,
Path: "/order",
Handler: publicrecovery.RecoverOrderHandler(serverCtx),
},
{
// Send recovery verification code
Method: http.MethodPost,
Path: "/send_code",
Handler: publicrecovery.SendCodeHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/recovery"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Redeem code
Method: http.MethodPost,
Path: "/",
Handler: publicredemption.RedeemCodeHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/v1/public/redemption"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Get subscribe group list
Method: http.MethodGet,
Path: "/group/list",
Handler: publicsubscribe.QuerySubscribeGroupListHandler(serverCtx),
},
{
// Get subscribe list
Method: http.MethodGet,
Path: "/list",
Handler: publicsubscribe.QuerySubscribeListHandler(serverCtx),
},
{
// Get user subscribe node info
Method: http.MethodGet,
Path: "/node/list",
Handler: publicsubscribe.QueryUserSubscribeNodeListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/subscribe"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Update ticket status
Method: http.MethodPut,
Path: "/",
Handler: publicticket.UpdateUserTicketStatusHandler(serverCtx),
},
{
// Create ticket
Method: http.MethodPost,
Path: "/",
Handler: publicticket.CreateUserTicketHandler(serverCtx),
},
{
// Get ticket detail
Method: http.MethodGet,
Path: "/detail",
Handler: publicticket.GetUserTicketDetailsHandler(serverCtx),
},
{
// Create ticket follow
Method: http.MethodPost,
Path: "/follow",
Handler: publicticket.CreateUserTicketFollowHandler(serverCtx),
},
{
// Get ticket list
Method: http.MethodGet,
Path: "/list",
Handler: publicticket.GetUserTicketListHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/ticket"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware, serverCtx.DeviceMiddleware},
[]rest.Route{
{
// Query User Affiliate Count
Method: http.MethodGet,
Path: "/affiliate/count",
Handler: publicuser.QueryUserAffiliateHandler(serverCtx),
},
{
// Query User Affiliate List
Method: http.MethodGet,
Path: "/affiliate/list",
Handler: publicuser.QueryUserAffiliateListHandler(serverCtx),
},
{
// Get Agent Downloads
Method: http.MethodGet,
Path: "/agent_downloads",
Handler: publicuser.GetAgentDownloadsHandler(serverCtx),
},
{
// Get Agent Realtime
Method: http.MethodGet,
Path: "/agent_realtime",
Handler: publicuser.GetAgentRealtimeHandler(serverCtx),
},
{
// Query User Balance Log
Method: http.MethodGet,
Path: "/balance_log",
Handler: publicuser.QueryUserBalanceLogHandler(serverCtx),
},
{
// Update Bind Email
Method: http.MethodPut,
Path: "/bind_email",
Handler: publicuser.UpdateBindEmailHandler(serverCtx),
},
{
// Bind Email With Verification
Method: http.MethodPost,
Path: "/bind_email_with_verification",
Handler: publicuser.BindEmailWithVerificationHandler(serverCtx),
},
{
// Bind Invite Code
Method: http.MethodPost,
Path: "/bind_invite_code",
Handler: publicuser.BindInviteCodeHandler(serverCtx),
},
{
// Update Bind Mobile
Method: http.MethodPut,
Path: "/bind_mobile",
Handler: publicuser.UpdateBindMobileHandler(serverCtx),
},
{
// Bind OAuth
Method: http.MethodPost,
Path: "/bind_oauth",
Handler: publicuser.BindOAuthHandler(serverCtx),
},
{
// Bind OAuth Callback
Method: http.MethodPost,
Path: "/bind_oauth/callback",
Handler: publicuser.BindOAuthCallbackHandler(serverCtx),
},
{
// Bind Telegram
Method: http.MethodGet,
Path: "/bind_telegram",
Handler: publicuser.BindTelegramHandler(serverCtx),
},
{
// Query User Commission Log
Method: http.MethodGet,
Path: "/commission_log",
Handler: publicuser.QueryUserCommissionLogHandler(serverCtx),
},
{
// Commission Withdraw
Method: http.MethodPost,
Path: "/commission_withdraw",
Handler: publicuser.CommissionWithdrawHandler(serverCtx),
},
{
// Delete Current User Account
Method: http.MethodDelete,
Path: "/current_user_account",
Handler: publicuser.DeleteCurrentUserAccountHandler(serverCtx),
},
{
// Delete Account
Method: http.MethodPost,
Path: "/delete_account",
Handler: publicuser.DeleteAccountHandler(serverCtx),
},
{
// Device Online Statistics
Method: http.MethodGet,
Path: "/device_online_statistics",
Handler: publicuser.DeviceOnlineStatisticsHandler(serverCtx),
},
{
// Get Device List
Method: http.MethodGet,
Path: "/devices",
Handler: publicuser.GetDeviceListHandler(serverCtx),
},
{
// Query User Info
Method: http.MethodGet,
Path: "/info",
Handler: publicuser.QueryUserInfoHandler(serverCtx),
},
{
// Get Invite Records
Method: http.MethodGet,
Path: "/invite_records",
Handler: publicuser.GetInviteRecordsHandler(serverCtx),
},
{
// Get User Invite Stats
Method: http.MethodGet,
Path: "/invite_stats",
Handler: publicuser.GetUserInviteStatsHandler(serverCtx),
},
{
// Get Login Log
Method: http.MethodGet,
Path: "/login_log",
Handler: publicuser.GetLoginLogHandler(serverCtx),
},
{
// Update User Notify
Method: http.MethodPut,
Path: "/notify",
Handler: publicuser.UpdateUserNotifyHandler(serverCtx),
},
{
// Get OAuth Methods
Method: http.MethodGet,
Path: "/oauth_methods",
Handler: publicuser.GetOAuthMethodsHandler(serverCtx),
},
{
// Update User Password
Method: http.MethodPut,
Path: "/password",
Handler: publicuser.UpdateUserPasswordHandler(serverCtx),
},
{
// Update User Rules
Method: http.MethodPut,
Path: "/rules",
Handler: publicuser.UpdateUserRulesHandler(serverCtx),
},
{
// Query User Subscribe
Method: http.MethodGet,
Path: "/subscribe",
Handler: publicuser.QueryUserSubscribeHandler(serverCtx),
},
{
// Get Subscribe Log
Method: http.MethodGet,
Path: "/subscribe_log",
Handler: publicuser.GetSubscribeLogHandler(serverCtx),
},
{
// Update User Subscribe Note
Method: http.MethodPut,
Path: "/subscribe_note",
Handler: publicuser.UpdateUserSubscribeNoteHandler(serverCtx),
},
{
// Get Subscribe Status
Method: http.MethodPost,
Path: "/subscribe_status",
Handler: publicuser.GetSubscribeStatusHandler(serverCtx),
},
{
// Reset User Subscribe Token
Method: http.MethodPut,
Path: "/subscribe_token",
Handler: publicuser.ResetUserSubscribeTokenHandler(serverCtx),
},
{
// Get User Traffic Statistics
Method: http.MethodGet,
Path: "/traffic_stats",
Handler: publicuser.GetUserTrafficStatsHandler(serverCtx),
},
{
// Unbind Device
Method: http.MethodPut,
Path: "/unbind_device",
Handler: publicuser.UnbindDeviceHandler(serverCtx),
},
{
// Unbind OAuth
Method: http.MethodPost,
Path: "/unbind_oauth",
Handler: publicuser.UnbindOAuthHandler(serverCtx),
},
{
// Unbind Telegram
Method: http.MethodPost,
Path: "/unbind_telegram",
Handler: publicuser.UnbindTelegramHandler(serverCtx),
},
{
// Unsubscribe
Method: http.MethodPost,
Path: "/unsubscribe",
Handler: publicuser.UnsubscribeHandler(serverCtx),
},
{
// Pre Unsubscribe
Method: http.MethodPost,
Path: "/unsubscribe/pre",
Handler: publicuser.PreUnsubscribeHandler(serverCtx),
},
{
// Verify Email
Method: http.MethodPost,
Path: "/verify_email",
Handler: publicuser.VerifyEmailHandler(serverCtx),
},
{
// Cancel pending withdrawal
Method: http.MethodPost,
Path: "/withdrawal_cancel",
Handler: publicuser.CancelWithdrawalHandler(serverCtx),
},
{
// Query Withdrawal Log
Method: http.MethodGet,
Path: "/withdrawal_log",
Handler: publicuser.QueryWithdrawalLogHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/user"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthMiddleware},
[]rest.Route{
{
// Webosocket Device Connect
Method: http.MethodGet,
Path: "/device_ws_connect",
Handler: publicuserws.DeviceWsConnectHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1/public/user"),
)
}