complete mobile image upload

This commit is contained in:
2024-12-18 01:08:25 +08:00
parent 58777e4b58
commit 24df28e53f
15 changed files with 526 additions and 136 deletions

View File

@@ -13,6 +13,7 @@ import (
oauth "schisandra-album-cloud-microservices/app/core/api/internal/handler/oauth"
sms "schisandra-album-cloud-microservices/app/core/api/internal/handler/sms"
token "schisandra-album-cloud-microservices/app/core/api/internal/handler/token"
upscale "schisandra-album-cloud-microservices/app/core/api/internal/handler/upscale"
user "schisandra-album-cloud-microservices/app/core/api/internal/handler/user"
websocket "schisandra-album-cloud-microservices/app/core/api/internal/handler/websocket"
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
@@ -199,6 +200,22 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/upload",
Handler: upscale.UploadImageHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/auth/upscale"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(10485760),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware},
@@ -233,6 +250,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/file",
Handler: websocket.FileWebsocketHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/message",