Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

32 changed files with 134 additions and 171 deletions

View File

@ -8,14 +8,12 @@ metadata:
steps:
- name: build
image: docker
image: r.j3ss.co/img
privileged: true
environment:
TOKEN:
from_secret: gitea
commands:
- dockerd &
- docker login -u kieran -p $TOKEN git.v0l.io
- docker buildx create --name mybuilder --bootstrap --use
- docker buildx build -t git.v0l.io/kieran/void-cat:latest --platform linux/amd64 --push .
- kill $(cat /var/run/docker.pid)
- img login -u kieran -p $TOKEN git.v0l.io
- img build -t git.v0l.io/kieran/void-cat:latest .
- img push git.v0l.io/kieran/void-cat:latest

View File

@ -158,7 +158,6 @@ public abstract class BaseDownloadController : Controller
Response.Headers.XFrameOptions = "SAMEORIGIN";
Response.Headers.ContentDisposition = $"inline; filename=\"{meta?.Metadata?.Name}\"";
Response.ContentType = meta?.Metadata?.MimeType ?? "application/octet-stream";
Response.ContentLength = (long?)meta?.Metadata?.Size;
return meta;
}

View File

@ -65,12 +65,9 @@ public class NostrController : BaseDownloadController
{
return Unauthorized();
}
try
{
if (_settings.MaintenanceMode)
{
throw new InvalidOperationException("Site is in maintenance mode");
}
var nostrUser = await _userManager.LoginOrRegister(pubkey);
var file = Request.Form.Files.First();
@ -89,24 +86,17 @@ public class NostrController : BaseDownloadController
await _fileMetadata.Add(vf);
await _userUploads.AddFile(nostrUser.Id, vf.Id);
List<List<string>> tags = new()
{
new() {"url", new Uri(_settings.SiteUrl, $"/nostr/{vf.OriginalDigest}{Path.GetExtension(vf.Name)}").ToString()},
new() {"ox", vf.OriginalDigest ?? "", _settings.SiteUrl.ToString()},
new() {"x", vf.Digest ?? ""},
new() {"m", vf.MimeType}
};
if (!string.IsNullOrEmpty(vf.MediaDimensions))
{
tags.Add(new() {"dim", vf.MediaDimensions});
}
var ret = new Nip96UploadResult
{
FileHeader = new()
{
Tags = tags
Tags = new()
{
new() {"url", new Uri(_settings.SiteUrl, $"/nostr/{vf.OriginalDigest}{Path.GetExtension(vf.Name)}").ToString()},
new() {"ox", vf.OriginalDigest ?? "", _settings.SiteUrl.ToString()},
new() {"x", vf.Digest ?? ""},
new() {"m", vf.MimeType}
}
}
};

View File

@ -67,11 +67,10 @@ namespace VoidCat.Controllers
{
try
{
var mime = Request.Headers.GetHeader("V-Content-Type");
var stripMetadata = (mime?.StartsWith("image/") ?? false) || (Request.Headers.GetHeader("V-Strip-Metadata")
?.Equals("true", StringComparison.InvariantCultureIgnoreCase) ?? false);
var stripMetadata = Request.Headers.GetHeader("V-Strip-Metadata")
?.Equals("true", StringComparison.InvariantCultureIgnoreCase) ?? false;
if (_settings.MaintenanceMode)
if (_settings.MaintenanceMode && !stripMetadata)
{
throw new InvalidOperationException("Site is in maintenance mode");
}
@ -90,6 +89,7 @@ namespace VoidCat.Controllers
uid = nostrUser.Id;
}
var mime = Request.Headers.GetHeader("V-Content-Type");
var filename = Request.Headers.GetHeader("V-Filename");
if (string.IsNullOrEmpty(mime) && !string.IsNullOrEmpty(filename))

View File

@ -359,8 +359,7 @@ public static class Extensions
EditSecret = withEditSecret ? f.EditSecret : null,
Storage = f.Storage,
EncryptionParams = f.EncryptionParams,
MagnetLink = f.MagnetLink,
MediaDimensions = f.MediaDimensions
MagnetLink = f.MagnetLink
};
}

View File

@ -32,5 +32,4 @@ public class VoidFileMeta
public string Storage { get; init; } = "local-disk";
public string? EncryptionParams { get; init; }
public string? MagnetLink { get; init; }
public string? MediaDimensions { get; init; }
}

View File

@ -40,7 +40,6 @@ public class CompressContent
}
}
var ffProbe = await TryProbe(input, cts);
var probe = isImage ? await ImageFile.FromFileAsync(input) : default;
var ffmpeg = FFMpegArguments
.FromFileInput(input)
@ -74,9 +73,7 @@ public class CompressContent
var result = await ffmpeg.ProcessAsynchronously();
return new(result, output)
{
MimeType = outMime,
Width = ffProbe?.PrimaryVideoStream?.Width,
Height = ffProbe?.PrimaryVideoStream?.Height,
MimeType = outMime
};
}
catch (Exception ex)
@ -87,24 +84,8 @@ public class CompressContent
return new(false, output);
}
private async Task<IMediaAnalysis?> TryProbe(string path, CancellationToken cts)
{
try
{
return await FFProbe.AnalyseAsync(path, cancellationToken: cts);
}
catch
{
// ignored
}
return default;
}
public record CompressResult(bool Success, string OutPath)
{
public string? MimeType { get; init; }
public int? Width { get; init; }
public int? Height { get; init; }
}
}

View File

@ -73,8 +73,7 @@ public class LocalDiskFileStore : StreamFileStore, IFileStore
Size = (ulong)fInfo.Length,
Digest = hash.ToHex(),
MimeType = res.MimeType ?? vf.MimeType,
OriginalDigest = originalHash.ToHex(),
MediaDimensions = res is {Width: not null, Height: not null} ? $"{res.Width.Value}x{res.Height.Value}" : null
OriginalDigest = originalHash.ToHex()
};
}
else

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const { existsSync } = require(`fs`);
const { createRequire } = require(`module`);
const { resolve } = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/use-at-your-own-risk
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint/use-at-your-own-risk your application uses
module.exports = absRequire(`eslint/use-at-your-own-risk`);

View File

@ -2,13 +2,5 @@
"name": "eslint",
"version": "8.51.0-sdk",
"main": "./lib/api.js",
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
},
"exports": {
"./package.json": "./package.json",
".": "./lib/api.js",
"./use-at-your-own-risk": "./lib/unsupported-api.js"
}
"type": "commonjs"
}

View File

@ -1,7 +1,6 @@
{
"name": "prettier",
"version": "3.0.3-sdk",
"main": "./index.cjs",
"type": "commonjs",
"bin": "./bin/prettier.cjs"
"main": "./index.js",
"type": "commonjs"
}

View File

@ -11,10 +11,10 @@ const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript
// Setup the environment to be able to require typescript/lib/typescript.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript your application uses
module.exports = absRequire(`typescript`);
// Defer to the real typescript/lib/typescript.js your application uses
module.exports = absRequire(`typescript/lib/typescript.js`);

View File

@ -1,10 +1,6 @@
{
"name": "typescript",
"version": "5.3.3-sdk",
"version": "5.2.2-sdk",
"main": "./lib/typescript.js",
"type": "commonjs",
"bin": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
}
"type": "commonjs"
}

View File

@ -1,6 +1,6 @@
{
"name": "@void-cat/api",
"version": "1.0.12",
"version": "1.0.11",
"description": "void.cat API package",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@ -9,7 +9,7 @@
"author": "Kieran",
"license": "MIT",
"scripts": {
"build": "tsc"
"build": "rm -rf dist && tsc"
},
"devDependencies": {
"@types/sjcl": "^1.0.30",

View File

@ -104,7 +104,6 @@ export interface VoidFileMeta {
encryptionParams?: string;
magnetLink?: string;
storage: string;
mediaDimensions?: string;
}
export interface VirusScanStatus {

View File

@ -1,34 +1,41 @@
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="link" viewBox="0 0 22 22" fill="none">
<path d="M8.99996 12C9.42941 12.5742 9.97731 13.0492 10.6065 13.393C11.2357 13.7367 11.9315 13.9411 12.6466 13.9924C13.3617 14.0436 14.0795 13.9404 14.7513 13.6898C15.4231 13.4392 16.0331 13.0471 16.54 12.54L19.54 9.54003C20.4507 8.59702 20.9547 7.334 20.9433 6.02302C20.9319 4.71204 20.4061 3.45797 19.479 2.53093C18.552 1.60389 17.2979 1.07805 15.987 1.06666C14.676 1.05526 13.413 1.55924 12.47 2.47003L10.75 4.18003M13 10C12.5705 9.4259 12.0226 8.95084 11.3934 8.60709C10.7642 8.26333 10.0684 8.05891 9.3533 8.00769C8.63816 7.95648 7.92037 8.05966 7.24861 8.31025C6.57685 8.56083 5.96684 8.95296 5.45996 9.46003L2.45996 12.46C1.54917 13.403 1.04519 14.666 1.05659 15.977C1.06798 17.288 1.59382 18.5421 2.52086 19.4691C3.4479 20.3962 4.70197 20.922 6.01295 20.9334C7.32393 20.9448 8.58694 20.4408 9.52995 19.53L11.24 17.82" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8.99996 12C9.42941 12.5742 9.97731 13.0492 10.6065 13.393C11.2357 13.7367 11.9315 13.9411 12.6466 13.9924C13.3617 14.0436 14.0795 13.9404 14.7513 13.6898C15.4231 13.4392 16.0331 13.0471 16.54 12.54L19.54 9.54003C20.4507 8.59702 20.9547 7.334 20.9433 6.02302C20.9319 4.71204 20.4061 3.45797 19.479 2.53093C18.552 1.60389 17.2979 1.07805 15.987 1.06666C14.676 1.05526 13.413 1.55924 12.47 2.47003L10.75 4.18003M13 10C12.5705 9.4259 12.0226 8.95084 11.3934 8.60709C10.7642 8.26333 10.0684 8.05891 9.3533 8.00769C8.63816 7.95648 7.92037 8.05966 7.24861 8.31025C6.57685 8.56083 5.96684 8.95296 5.45996 9.46003L2.45996 12.46C1.54917 13.403 1.04519 14.666 1.05659 15.977C1.06798 17.288 1.59382 18.5421 2.52086 19.4691C3.4479 20.3962 4.70197 20.922 6.01295 20.9334C7.32393 20.9448 8.58694 20.4408 9.52995 19.53L11.24 17.82"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
<symbol id="download" viewBox="0 0 20 20" fill="none">
<path d="M19 13V14.2C19 15.8802 19 16.7202 18.673 17.362C18.3854 17.9265 17.9265 18.3854 17.362 18.673C16.7202 19 15.8802 19 14.2 19H5.8C4.11984 19 3.27976 19 2.63803 18.673C2.07354 18.3854 1.6146 17.9265 1.32698 17.362C1 16.7202 1 15.8802 1 14.2V13M15 8L10 13M10 13L5 8M10 13V1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M19 13V14.2C19 15.8802 19 16.7202 18.673 17.362C18.3854 17.9265 17.9265 18.3854 17.362 18.673C16.7202 19 15.8802 19 14.2 19H5.8C4.11984 19 3.27976 19 2.63803 18.673C2.07354 18.3854 1.6146 17.9265 1.32698 17.362C1 16.7202 1 15.8802 1 14.2V13M15 8L10 13M10 13L5 8M10 13V1"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
<symbol id="file" viewBox="0 0 18 22" fill="none">
<path d="M11 1.26953V5.40007C11 5.96012 11 6.24015 11.109 6.45406C11.2049 6.64222 11.3578 6.7952 11.546 6.89108C11.7599 7.00007 12.0399 7.00007 12.6 7.00007H16.7305M11 16H5M13 12H5M17 8.98822V16.2C17 17.8802 17 18.7202 16.673 19.362C16.3854 19.9265 15.9265 20.3854 15.362 20.673C14.7202 21 13.8802 21 12.2 21H5.8C4.11984 21 3.27976 21 2.63803 20.673C2.07354 20.3854 1.6146 19.9265 1.32698 19.362C1 18.7202 1 17.8802 1 16.2V5.8C1 4.11984 1 3.27976 1.32698 2.63803C1.6146 2.07354 2.07354 1.6146 2.63803 1.32698C3.27976 1 4.11984 1 5.8 1H9.01178C9.74555 1 10.1124 1 10.4577 1.08289C10.7638 1.15638 11.0564 1.27759 11.3249 1.44208C11.6276 1.6276 11.887 1.88703 12.4059 2.40589L15.5941 5.59411C16.113 6.11297 16.3724 6.3724 16.5579 6.67515C16.7224 6.94356 16.8436 7.2362 16.9171 7.5423C17 7.88757 17 8.25445 17 8.98822Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11 1.26953V5.40007C11 5.96012 11 6.24015 11.109 6.45406C11.2049 6.64222 11.3578 6.7952 11.546 6.89108C11.7599 7.00007 12.0399 7.00007 12.6 7.00007H16.7305M11 16H5M13 12H5M17 8.98822V16.2C17 17.8802 17 18.7202 16.673 19.362C16.3854 19.9265 15.9265 20.3854 15.362 20.673C14.7202 21 13.8802 21 12.2 21H5.8C4.11984 21 3.27976 21 2.63803 20.673C2.07354 20.3854 1.6146 19.9265 1.32698 19.362C1 18.7202 1 17.8802 1 16.2V5.8C1 4.11984 1 3.27976 1.32698 2.63803C1.6146 2.07354 2.07354 1.6146 2.63803 1.32698C3.27976 1 4.11984 1 5.8 1H9.01178C9.74555 1 10.1124 1 10.4577 1.08289C10.7638 1.15638 11.0564 1.27759 11.3249 1.44208C11.6276 1.6276 11.887 1.88703 12.4059 2.40589L15.5941 5.59411C16.113 6.11297 16.3724 6.3724 16.5579 6.67515C16.7224 6.94356 16.8436 7.2362 16.9171 7.5423C17 7.88757 17 8.25445 17 8.98822Z"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
<symbol id="download-cloud" viewBox="0 0 22 20" fill="none">
<path d="M3 14.2422C1.79401 13.435 1 12.0602 1 10.5C1 8.15643 2.79151 6.23129 5.07974 6.01937C5.54781 3.17213 8.02024 1 11 1C13.9798 1 16.4522 3.17213 16.9203 6.01937C19.2085 6.23129 21 8.15643 21 10.5C21 12.0602 20.206 13.435 19 14.2422M7 15L11 19M11 19L15 15M11 19V10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3 14.2422C1.79401 13.435 1 12.0602 1 10.5C1 8.15643 2.79151 6.23129 5.07974 6.01937C5.54781 3.17213 8.02024 1 11 1C13.9798 1 16.4522 3.17213 16.9203 6.01937C19.2085 6.23129 21 8.15643 21 10.5C21 12.0602 20.206 13.435 19 14.2422M7 15L11 19M11 19L15 15M11 19V10"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
<symbol id="upload-cloud" viewBox="0 0 22 20" fill="none">
<path d="M3 14.2422C1.79401 13.435 1 12.0602 1 10.5C1 8.15643 2.79151 6.23129 5.07974 6.01937C5.54781 3.17213 8.02024 1 11 1C13.9798 1 16.4522 3.17213 16.9203 6.01937C19.2085 6.23129 21 8.15643 21 10.5C21 12.0602 20.206 13.435 19 14.2422M7 14L11 10M11 10L15 14M11 10V19" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3 14.2422C1.79401 13.435 1 12.0602 1 10.5C1 8.15643 2.79151 6.23129 5.07974 6.01937C5.54781 3.17213 8.02024 1 11 1C13.9798 1 16.4522 3.17213 16.9203 6.01937C19.2085 6.23129 21 8.15643 21 10.5C21 12.0602 20.206 13.435 19 14.2422M7 14L11 10M11 10L15 14M11 10V19"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
<symbol id="save" viewBox="0 0 20 20" fill="none">
<path d="M5 1V4.4C5 4.96005 5 5.24008 5.10899 5.45399C5.20487 5.64215 5.35785 5.79513 5.54601 5.89101C5.75992 6 6.03995 6 6.6 6H13.4C13.9601 6 14.2401 6 14.454 5.89101C14.6422 5.79513 14.7951 5.64215 14.891 5.45399C15 5.24008 15 4.96005 15 4.4V2M15 19V12.6C15 12.0399 15 11.7599 14.891 11.546C14.7951 11.3578 14.6422 11.2049 14.454 11.109C14.2401 11 13.9601 11 13.4 11H6.6C6.03995 11 5.75992 11 5.54601 11.109C5.35785 11.2049 5.20487 11.3578 5.10899 11.546C5 11.7599 5 12.0399 5 12.6V19M19 7.32548V14.2C19 15.8802 19 16.7202 18.673 17.362C18.3854 17.9265 17.9265 18.3854 17.362 18.673C16.7202 19 15.8802 19 14.2 19H5.8C4.11984 19 3.27976 19 2.63803 18.673C2.07354 18.3854 1.6146 17.9265 1.32698 17.362C1 16.7202 1 15.8802 1 14.2V5.8C1 4.11984 1 3.27976 1.32698 2.63803C1.6146 2.07354 2.07354 1.6146 2.63803 1.32698C3.27976 1 4.11984 1 5.8 1H12.6745C13.1637 1 13.4083 1 13.6385 1.05526C13.8425 1.10425 14.0376 1.18506 14.2166 1.29472C14.4184 1.4184 14.5914 1.59135 14.9373 1.93726L18.0627 5.06274C18.4086 5.40865 18.5816 5.5816 18.7053 5.78343C18.8149 5.96237 18.8957 6.15746 18.9447 6.36154C19 6.59171 19 6.8363 19 7.32548Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5 1V4.4C5 4.96005 5 5.24008 5.10899 5.45399C5.20487 5.64215 5.35785 5.79513 5.54601 5.89101C5.75992 6 6.03995 6 6.6 6H13.4C13.9601 6 14.2401 6 14.454 5.89101C14.6422 5.79513 14.7951 5.64215 14.891 5.45399C15 5.24008 15 4.96005 15 4.4V2M15 19V12.6C15 12.0399 15 11.7599 14.891 11.546C14.7951 11.3578 14.6422 11.2049 14.454 11.109C14.2401 11 13.9601 11 13.4 11H6.6C6.03995 11 5.75992 11 5.54601 11.109C5.35785 11.2049 5.20487 11.3578 5.10899 11.546C5 11.7599 5 12.0399 5 12.6V19M19 7.32548V14.2C19 15.8802 19 16.7202 18.673 17.362C18.3854 17.9265 17.9265 18.3854 17.362 18.673C16.7202 19 15.8802 19 14.2 19H5.8C4.11984 19 3.27976 19 2.63803 18.673C2.07354 18.3854 1.6146 17.9265 1.32698 17.362C1 16.7202 1 15.8802 1 14.2V5.8C1 4.11984 1 3.27976 1.32698 2.63803C1.6146 2.07354 2.07354 1.6146 2.63803 1.32698C3.27976 1 4.11984 1 5.8 1H12.6745C13.1637 1 13.4083 1 13.6385 1.05526C13.8425 1.10425 14.0376 1.18506 14.2166 1.29472C14.4184 1.4184 14.5914 1.59135 14.9373 1.93726L18.0627 5.06274C18.4086 5.40865 18.5816 5.5816 18.7053 5.78343C18.8149 5.96237 18.8957 6.15746 18.9447 6.36154C19 6.59171 19 6.8363 19 7.32548Z"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
<symbol id="hash" viewBox="0 0 18 20" fill="none">
<path d="M1 6H17M1 14H17M5 1V19M13 1V19" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M1 6H17M1 14H17M5 1V19M13 1V19" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round"/>
</symbol>
<symbol id="check-circle" viewBox="0 0 22 22" fill="none">
<path d="M6.5 11L9.5 14L15.5 8M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6.5 11L9.5 14L15.5 8M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
<symbol id="alert-circle" viewBox="0 0 22 22" fill="none">
<path d="M11 7V11M11 15H11.01M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
<symbol id="trash" viewBox="0 0 20 22" fill="none">
<path d="M14 5V4.2C14 3.0799 14 2.51984 13.782 2.09202C13.5903 1.71569 13.2843 1.40973 12.908 1.21799C12.4802 1 11.9201 1 10.8 1H9.2C8.07989 1 7.51984 1 7.09202 1.21799C6.71569 1.40973 6.40973 1.71569 6.21799 2.09202C6 2.51984 6 3.0799 6 4.2V5M8 10.5V15.5M12 10.5V15.5M1 5H19M17 5V16.2C17 17.8802 17 18.7202 16.673 19.362C16.3854 19.9265 15.9265 20.3854 15.362 20.673C14.7202 21 13.8802 21 12.2 21H7.8C6.11984 21 5.27976 21 4.63803 20.673C4.07354 20.3854 3.6146 19.9265 3.32698 19.362C3 18.7202 3 17.8802 3 16.2V5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11 7V11M11 15H11.01M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</symbol>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
};
}

View File

@ -48,19 +48,13 @@ export function Admin() {
<h2>Files</h2>
<ImageGrid
loadPage={(r) => AdminApi.adminListFiles(r)}
actions={(f) => (
<>
<IconButton
name="trash"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
deleteFile(f.id);
}}
/>
</>
)}
/>
actions={(f) => <>
<IconButton name="trash" onClick={(e) => {
e.preventDefault();
e.stopPropagation();
deleteFile(f.id)
}} />
</>} />
{editUser && (
<VoidModal title="Edit user">

View File

@ -89,7 +89,7 @@ export function FileEdit({ file }: FileEditProps) {
return (
<div className="file-edit flex">
<div className="flex-1">
<div className="flx-1">
<h3>File info</h3>
<dl>
<dt>Filename:</dt>
@ -131,7 +131,7 @@ export function FileEdit({ file }: FileEditProps) {
Save
</VoidButton>
</div>
<div className="flex-1">
<div className="flx-1">
<h3>Payment Config</h3>
Type:
<select

View File

@ -25,8 +25,9 @@ export function GlobalStats() {
</div>
<div className="flex gap-2 items-center">
<Icon name="hash" />
{(stats?.count ?? 0).toLocaleString()}
{stats?.count ?? 0}
</div>
</div>
{stats?.buildInfo && (
<div className="fixed bottom-2 left-2 text-xs text-slate-700">

View File

@ -44,7 +44,7 @@ export default function ApiKeyList() {
return (
<>
<div className="flex flex-center">
<div className="grow">
<div className="flx-grow">
<h1>API Keys</h1>
</div>
<div>

View File

@ -0,0 +1,16 @@
.header {
user-select: none;
display: flex;
padding: 5px 0;
align-items: center;
}
.header .title {
font-size: 30px;
line-height: 2;
flex-grow: 1;
}
.header img.logo {
height: 80px;
}

View File

@ -1,3 +1,5 @@
import "./Header.css";
import { useEffect } from "react";
import { Link } from "react-router-dom";
import { useDispatch, useSelector } from "react-redux";
@ -46,11 +48,11 @@ export function Header() {
}, [jwt]);
return (
<div className="flex justify-between items-center page">
<Link to="/" className="flex gap-2 items-center">
<img src="/logo_128.jpg" alt="logo" className="h-20" />
<div className="text-2xl">{window.location.hostname}</div>
</Link>
<div className="header page">
<img src="/logo_128.jpg" alt="logo" className="logo" />
<div className="title">
<Link to="/">{window.location.hostname}</Link>
</div>
{profile ? (
<InlineProfile
profile={profile}

View File

@ -3,7 +3,7 @@ export interface IconProps {
size?: number;
className?: string;
onClick?: React.MouseEventHandler;
}
};
const Icon = (props: IconProps) => {
const size = props.size || 20;
@ -21,14 +21,9 @@ const Icon = (props: IconProps) => {
);
};
export function IconButton({ onClick, ...props }: IconProps) {
return (
<button
onClick={onClick}
className="p-2 bg-slate-800 rounded-xl hover:bg-slate-600"
>
<Icon {...props} />
</button>
);
export function IconButton({onClick, ...props}: IconProps) {
return <button onClick={onClick} className="p-2 bg-slate-800 rounded-xl hover:bg-slate-600">
<Icon {...props} />
</button>
}
export default Icon;

View File

@ -18,4 +18,4 @@
.image-grid video,
.image-grid audio {
height: inherit;
}
}

View File

@ -17,7 +17,7 @@ import { PageSelector } from "./PageSelector";
interface ImageGridProps {
loadPage: (req: PagedRequest) => Promise<PagedResponse<any>>;
actions?: (f: VoidFileResponse) => ReactNode;
actions?: (f: VoidFileResponse) => ReactNode
}
export default function ImageGrid(props: ImageGridProps) {
@ -107,11 +107,9 @@ export default function ImageGrid(props: ImageGridProps) {
{files?.results.map((v) => (
<Link key={v.id} to={`/${v.id}`} className="relative">
{renderPreview(v)}
{props.actions && (
<div className="absolute hover:opacity-100 h-full w-full opacity-0 border border-slate-600 flex flex-wrap gap-2 items-center justify-center bg-[rgba(0,0,0,0.5)]">
{props.actions(v)}
</div>
)}
{props.actions && <div className="absolute hover:opacity-100 h-full w-full opacity-0 border border-slate-600 flex flex-wrap gap-2 items-center justify-center bg-[rgba(0,0,0,0.5)]">
{props.actions(v)}
</div>}
</Link>
))}
</div>

View File

@ -276,8 +276,8 @@ export function FilePreview() {
{renderOpenGraphTags()}
</Helmet>
{renderVirusWarning()}
<div className="flex items-center">
<div className="grow">
<div className="flex flex-center">
<div className="flx-grow">
{info.uploader ? <InlineProfile profile={info.uploader} /> : null}
</div>
<div>

View File

@ -198,7 +198,7 @@ export function ProfilePage() {
)}
</div>
<div className="flex">
<div className="flex-1">
<div className="flx-1">
<div className="avatar" style={avatarStyles}>
{cantEditProfile ? (
<div className="edit-avatar" onClick={() => changeAvatar()}>
@ -207,7 +207,7 @@ export function ProfilePage() {
) : null}
</div>
</div>
<div className="flex-1">
<div className="flx-1">
<dl>
<dt>Created</dt>
<dd>{moment(profile.created).fromNow()}</dd>

View File

@ -6,20 +6,12 @@
body {
margin: 0;
font-family: "Source Code Pro", monospace;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: black;
color: white;
}
h1 {
font-size: 2rem;
}
h2 {
font-size: 1.75rem;
}
h3 {
font-size: 1.5rem;
}
a {
color: white;
text-decoration: none;
@ -47,6 +39,30 @@ a:hover {
background-color: #666;
}
.flex {
display: flex;
}
.flex-inline {
display: inline-flex;
}
.flx-1 {
flex: 1;
}
.flx-2 {
flex: 2;
}
.flx-grow {
flex-grow: 1;
}
.flex-center {
align-items: center;
}
input[type="text"],
input[type="number"],
input[type="password"],
@ -59,7 +75,6 @@ select {
padding: 10px 20px;
margin: 5px;
border: 0;
color: black;
}
input[type="checkbox"] {

View File

@ -1,8 +1,12 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./index.html", "./src/**/*.{ts,tsx}"],
content: [
"./index.html",
"./src/**/*.{ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
};
}

View File

@ -30,9 +30,9 @@ export default defineConfig({
},
},
define: {},
server: {
server:{
proxy: {
"/d": "http://localhost:7195/",
},
},
"/d": "http://localhost:7195/"
}
}
});