mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: paste compression & verification enforcement settings; enforce 2fa on admins setting; increase paste validation; anonymous uploads
fix: minor styling issue on main elements; resolve lint issue refactor: remove 2FA badge on user pages; enhance paste creation flow; body background color always neutral-950; improve paste creation paste info (lines, cchars etc) for mobile
This commit is contained in:
@@ -13,9 +13,12 @@ namespace SharpbinV3.Server.Services
|
||||
private readonly ICompressionService _cs = cs;
|
||||
private readonly PasteSettings _pasteSettings = options.Value;
|
||||
|
||||
public async Task<Paste> Create(User? author, string content, string title, string syntax, int visibility, long expiresAt)
|
||||
public async Task<Paste> Create(User? author, string content, string title, string syntax, int visibility, long expiresAt, bool shouldCompress)
|
||||
{
|
||||
var compressedData = _cs.Compress(content);
|
||||
var data = Encoding.UTF8.GetBytes(content);
|
||||
if (shouldCompress)
|
||||
data = _cs.Compress(content);
|
||||
|
||||
var paste = new Paste
|
||||
{
|
||||
UUID = Guid.CreateVersion7(),
|
||||
@@ -23,10 +26,10 @@ namespace SharpbinV3.Server.Services
|
||||
Title = title,
|
||||
AuthorUUID = author?.UUID,
|
||||
User = author,
|
||||
Content = compressedData,
|
||||
Size = compressedData.Length,
|
||||
Content = data,
|
||||
Size = data.Length,
|
||||
TrueSize = Encoding.UTF8.GetByteCount(content),
|
||||
IsCompressed = compressedData.Length < Encoding.UTF8.GetByteCount(content),
|
||||
IsCompressed = data.Length < Encoding.UTF8.GetByteCount(content),
|
||||
Syntax = syntax,
|
||||
Visibility = visibility,
|
||||
ExpiresAt = expiresAt,
|
||||
|
||||
Reference in New Issue
Block a user