mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
chore: rename SharpbinV3 dir to SharpbinV3.Server
This commit is contained in:
@@ -12,19 +12,19 @@ EXPOSE 8081
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["SharpbinV3/SharpbinV3.csproj", "SharpbinV3/"]
|
COPY ["SharpbinV3.Server.csproj", "./"]
|
||||||
RUN dotnet restore "./SharpbinV3/SharpbinV3.csproj"
|
RUN dotnet restore "./SharpbinV3.Server.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/SharpbinV3"
|
WORKDIR "/src/SharpbinV3"
|
||||||
RUN dotnet build "./SharpbinV3.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
RUN dotnet build "../SharpbinV3.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
# This stage is used to publish the service project to be copied to the final stage
|
# This stage is used to publish the service project to be copied to the final stage
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
RUN dotnet publish "./SharpbinV3.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
RUN dotnet publish "../SharpbinV3.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
ENTRYPOINT ["dotnet", "SharpbinV3.dll"]
|
ENTRYPOINT ["dotnet", "SharpbinV3.Server.dll"]
|
||||||
@@ -7,7 +7,6 @@ namespace SharpbinV3.Server.Services
|
|||||||
{
|
{
|
||||||
Task<User> CreateUser(string username, string password, string? email, string? displayName);
|
Task<User> CreateUser(string username, string password, string? email, string? displayName);
|
||||||
Task<JWTResult> GenerateJWTToken(User user);
|
Task<JWTResult> GenerateJWTToken(User user);
|
||||||
Task<bool> ValidateJWTToken(string token);
|
|
||||||
Task<JWTResult> RefreshJWTToken(string token, string refreshToken);
|
Task<JWTResult> RefreshJWTToken(string token, string refreshToken);
|
||||||
Task<User> UpdateUser(User user);
|
Task<User> UpdateUser(User user);
|
||||||
Task UpdateLoginTime(User user);
|
Task UpdateLoginTime(User user);
|
||||||
@@ -10,7 +10,7 @@ namespace SharpbinV3.Server.Services
|
|||||||
Task<bool> Exists(string id);
|
Task<bool> Exists(string id);
|
||||||
Task<bool> Exists(Guid uuid);
|
Task<bool> Exists(Guid uuid);
|
||||||
Task<bool> EditText(Paste paste, string text);
|
Task<bool> EditText(Paste paste, string text);
|
||||||
Task<Paste> Get(string id);
|
Task<Paste?> Get(string id);
|
||||||
Task<List<Paste>> GetList(int offset, int count, bool publicOnly = false);
|
Task<List<Paste>> GetList(int offset, int count, bool publicOnly = false);
|
||||||
Task<bool> ValidateSyntax(string syntax);
|
Task<bool> ValidateSyntax(string syntax);
|
||||||
Task<bool> ValidateTitle(string title);
|
Task<bool> ValidateTitle(string title);
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
<Solution>
|
<Solution>
|
||||||
<Project Path="SharpbinV3/SharpbinV3.Server.csproj" />
|
<Project Path="SharpbinV3.Server/SharpbinV3.Server.csproj" />
|
||||||
</Solution>
|
</Solution>
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using SharpbinV3.Server.Data.Entities;
|
|
||||||
|
|
||||||
namespace SharpbinV3.Server.Data
|
|
||||||
{
|
|
||||||
public sealed class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
|
|
||||||
{
|
|
||||||
public DbSet<User> Users => Set<User>();
|
|
||||||
public DbSet<Paste> Pastes => Set<Paste>();
|
|
||||||
public DbSet<RefreshToken> RefreshTokens => Set<RefreshToken>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace SharpbinV3.Server.Data.Entities
|
|
||||||
{
|
|
||||||
[Index(nameof(PID), IsUnique = true)]
|
|
||||||
[Index(nameof(UUID), IsUnique = true)]
|
|
||||||
[Index(nameof(ID), IsUnique = true)]
|
|
||||||
[Index(nameof(AuthorUUID))]
|
|
||||||
[Index(nameof(ExpiresAt))]
|
|
||||||
[Index(nameof(Views))]
|
|
||||||
[Index(nameof(Visibility))]
|
|
||||||
public sealed class Paste
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public int PID { get; set; }
|
|
||||||
public required Guid UUID { get; set; } // uuid v7 includes timestamp, this counts as created at
|
|
||||||
public required string ID { get; set; }
|
|
||||||
public string? Title { get; set; }
|
|
||||||
|
|
||||||
public required Guid AuthorUUID { get; set; } = Guid.Empty; // uuid of the user who created the paste, or Guid.Empty for anonymous pastes
|
|
||||||
public User? User { get; set; }
|
|
||||||
|
|
||||||
public long? EditedAt { get; set; }
|
|
||||||
|
|
||||||
public required byte[] Content { get; set; }
|
|
||||||
public long Size { get; set; } // stored size (may be compressed)
|
|
||||||
public long TrueSize { get; set; } // uncompressed size
|
|
||||||
public bool IsCompressed { get; set; } = false;
|
|
||||||
|
|
||||||
public int Views { get; set; }
|
|
||||||
public string? Syntax { get; set; }
|
|
||||||
public int Visibility { get; set; } = 0; // 0 = public, 1 = unlisted, 2 = private (encrypted pastes handled on frontend)
|
|
||||||
|
|
||||||
public long ExpiresAt { get; set; } // timestamp of when the paste expires, or 0 for never
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace SharpbinV3.Server.Data.Entities
|
|
||||||
{
|
|
||||||
public sealed class RefreshToken
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public Guid UserUUID { get; set; }
|
|
||||||
public required string Token { get; set; }
|
|
||||||
public required string JwtId { get; set; }
|
|
||||||
public required long CreatedAt { get; set; }
|
|
||||||
public required long ExpiresAt { get; set; }
|
|
||||||
public bool Used { get; set; } = false;
|
|
||||||
public User? User { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace SharpbinV3.Server.Data.Entities
|
|
||||||
{
|
|
||||||
[Index(nameof(UUID), IsUnique = true)]
|
|
||||||
public sealed class User
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public int UID { get; set; }
|
|
||||||
public required Guid UUID { get; set; } = Guid.CreateVersion7(); // uuid v7 includes timestamp
|
|
||||||
public required string Username { get; set; }
|
|
||||||
public required string PasswordHash { get; set; }
|
|
||||||
public string? Email { get; set; }
|
|
||||||
public string? DisplayName { get; set; }
|
|
||||||
public long? LastLogin { get; set; }
|
|
||||||
public int[] Roles { get; set; } = [0]; // 0 = regular user, 1 = moderator, 255 = admin
|
|
||||||
public int Visibility { get; set; } = 0; // 0 = public, 1 = unlisted, 2 = private
|
|
||||||
public List<Paste> Pastes { get; set; } = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user