This commit is contained in:
gpu 2026-01-20 20:35:33 +08:00
commit 258dde42fd
8 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,9 @@
namespace HoneyBox.Admin.Business.Models.Upload;
public class GetPresignedUrlRequest
{
public string? FileName { get; set; }
public string? ContentType { get; set; }
public int ExpiresInSeconds { get; set; } = 600;
public long FileSize { get; set; }
}

View File

@ -0,0 +1,13 @@
namespace HoneyBox.Admin.Business.Models.Upload;
public class PresignedUrlResponse
{
public string? UploadUrl { get; set; }
public string? AccessUrl { get; set; }
public string? FileUrl { get; set; }
public string? ObjectKey { get; set; }
public DateTime ExpiresAt { get; set; }
public int ExpiresIn { get; set; }
public string? StorageType { get; set; }
public Dictionary<string, string>? Headers { get; set; }
}

View File

@ -0,0 +1,10 @@
namespace HoneyBox.Admin.Business.Models.Upload;
public class UploadResponse
{
public string? Url { get; set; }
public string? FileName { get; set; }
public long Size { get; set; }
public long FileSize { get; set; }
public string? ContentType { get; set; }
}

View File

@ -0,0 +1,26 @@
namespace HoneyBox.Admin.Business.Models.Upload;
public class UploadResult
{
public bool Success { get; set; }
public string? Url { get; set; }
public string? ErrorMessage { get; set; }
public static UploadResult Ok(string url)
{
return new UploadResult
{
Success = true,
Url = url
};
}
public static UploadResult Fail(string errorMessage)
{
return new UploadResult
{
Success = false,
ErrorMessage = errorMessage
};
}
}

View File

@ -2,6 +2,16 @@
# 此阶段用于在快速模式(默认为调试配置)下从 VS 运行时
FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble AS base
# Install SkiaSharp native dependencies
RUN apt-get update && apt-get install -y \
libfontconfig1 \
libfreetype6 \
libx11-6 \
libxext6 \
libxrender1 \
libc6-dev \
libgdiplus \
&& rm -rf /var/lib/apt/lists/*
USER $APP_UID
WORKDIR /app
EXPOSE 8080

View File

@ -55,6 +55,7 @@
<!-- Image Processing for Captcha -->
<PackageReference Include="SkiaSharp" Version="2.88.8" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.8" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,14 @@
# 构建阶段
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN rm -f package-lock.json && npm install
COPY . .
RUN npm run build
# 生产阶段
FROM nginx:alpine
COPY --from=build /wwwroot /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -0,0 +1,18 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://xiangyi-admin-api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}