Simple file explorer for HTTP server resources
  • C# 82.9%
  • HTML 13.7%
  • CSS 2.4%
  • Dockerfile 1%
Find a file
bpeskiewicz 4e4d52d6bf
All checks were successful
Build and Release / build-and-push (push) Successful in 34s
Merge pull request 'Adjust release workflow for pull requests' (#12) from bugfix/docker-build into main
Reviewed-on: #12
2026-04-24 20:14:43 +00:00
.forgejo/workflows Fix smoke test container networking 2026-04-24 22:11:49 +02:00
src refactor: centralize signed download links and tighten result/path coverage 2026-04-24 18:58:20 +00:00
tests Fix nullable and analyzer warnings in tests 2026-04-24 18:58:20 +00:00
.dockerignore Adjust release workflow for pull requests 2026-04-24 22:01:05 +02:00
.editorconfig feat: implement Result/Monad pattern for error handling 2026-04-21 14:46:13 +02:00
.env.example chore: update CI, docs, and config for .NET 9 migration 2026-04-18 17:07:40 +02:00
.gitignore refactor: centralize signed download links and tighten result/path coverage 2026-04-24 18:58:20 +00:00
Directory.Build.props refactor: remove service interfaces and consolidate analyzer config 2026-04-18 22:54:24 +02:00
Dockerfile Create /data directory 2026-04-24 22:06:29 +02:00
FileGateway.slnx test: add E2E test project with auth, download, and file table tests 2026-04-19 21:27:08 +02:00
LICENSE Initial commit 2026-04-03 12:49:18 +00:00
plan-monad.md docs: update plan-monad.md with implementation status 2026-04-24 18:58:20 +00:00
README.md chore: update CI, docs, and config for .NET 9 migration 2026-04-18 17:07:40 +02:00

file-gateway

A web-based file explorer built with ASP.NET Core 9 and Blazor. Browse, download, and manage files on a server through a responsive web UI or programmatically via REST API.

Features

  • Cookie-based authentication with login/logout
  • Directory browsing and file downloading
  • Signed download URLs for external client compatibility
  • Rate limiting (configurable requests per window)
  • Path safety validation (prevents directory traversal)
  • Responsive web interface (Blazor + MudBlazor)
  • Health check endpoint
  • Cross-platform (Windows and Unix path support)
  • Modular architecture (Core library + Server)

Prerequisites

Quick Start

git clone <repository-url>
cd file-gateway
dotnet restore

Configure src/FileGateway.Server/appsettings.json (or use user secrets / environment variables):

{
  "FileGateway": {
    "RootDir": "/path/to/your/files"
  },
  "Auth": {
    "AuthUser": "admin",
    "AuthPass": "your-secure-password"
  },
  "RateLimit": {
    "WindowMs": 60000,
    "MaxRequests": 100
  },
  "DownloadToken": {
    "TokenTtlSeconds": 3600,
    "Secret": "a-random-secret-at-least-32-characters-long"
  }
}

Start the server:

dotnet run --project src/FileGateway.Server

Open http://localhost:3000 in your browser.

Configuration

All configuration is managed via appsettings.json, environment variables, or .NET user secrets.

Section Key Description Default
FileGateway RootDir Root directory for file operations Required
Auth AuthUser Username for authentication Required
Auth AuthPass Password for authentication Required
RateLimit WindowMs Rate limit window in milliseconds 60000
RateLimit MaxRequests Max requests per window 100
DownloadToken TokenTtlSeconds Download link expiration (seconds) 3600
DownloadToken Secret Secret key for signing download tokens Required

Development

# Run with hot-reload
dotnet watch --project src/FileGateway.Server

# Build the solution
dotnet build

# Run the server
dotnet run --project src/FileGateway.Server

Testing

# Run all tests
dotnet test

# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"

# Check formatting
dotnet format --verify-no-changes

Docker

Using Docker Compose

Create a docker-compose.yml:

services:
  file-gateway:
    image: forgejo.fistach.ovh/bpeskiewicz/file-gateway:latest
    ports:
      - "3000:3000"
    environment:
      FileGateway__RootDir: /data
      Auth__AuthUser: admin
      Auth__AuthPass: your-secure-password
      DownloadToken__Secret: a-random-secret-at-least-32-characters-long
    volumes:
      - /path/to/your/files:/data:ro
    restart: unless-stopped

Run with:

docker compose up -d

Building Locally

docker build -t file-gateway .

docker run -d \
  -p 3000:3000 \
  -e FileGateway__RootDir=/data \
  -e Auth__AuthUser=admin \
  -e Auth__AuthPass=your-secure-password \
  -e DownloadToken__Secret=a-random-secret-at-least-32-characters-long \
  -v /path/to/your/files:/data:ro \
  file-gateway

API Endpoints

Method Endpoint Description
POST /api/auth/login Authenticate and receive cookie
GET/POST /api/auth/logout Clear authentication cookie
GET /api/files List directory contents
GET /api/files/download Download a file
GET /api/files/links Get signed download links
GET /api/health Application health and uptime

Project Structure

src/
  FileGateway.Server/    ASP.NET Core host, controllers, Blazor UI
  FileGateway.Core/      Shared models, security, business logic
tests/
  FileGateway.Server.Tests/
  FileGateway.Core.Tests/

License

MIT