From d0d2b9f47b371afc94c2cdc58977e388ed30e224 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 28 Apr 2026 22:57:46 +0300 Subject: h9: scaffold go project structure - Initialize go.mod (github.com/paul/kiss-media-player) - Add internal/version.go with const Version - Add internal/config.go with env-based Config struct and validation (PORT, MEDIA_ROOT, DB_PATH, MAX_UPLOAD_SIZE_MB, SESSION_TIMEOUT_HOURS, GC_INTERVAL_MINUTES, SHARE_DEFAULT_EXPIRY_DAYS, LOG_LEVEL) - Add table-driven config validation tests (defaults, overrides, invalid values) - Add cmd/mediaplayer/main.go with -version flag - Create directory scaffold: internal/{model,repository,scanner,probe,thumb, clock,auth,service,api,setassign}, web/{css,js}, k8s - Add .gitignore for binaries and data.db - Refactor env parsing into envInt/envString helpers per go-best-practices --- .gitignore | 18 ++ PLAN.md | 455 ++++++++++++++++++++++++++++++++++++++ go.mod | 3 + internal/api/api.go | 2 + internal/auth/auth.go | 2 + internal/clock/clock.go | 2 + internal/config.go | 137 ++++++++++++ internal/config_test.go | 184 +++++++++++++++ internal/model/model.go | 2 + internal/probe/probe.go | 2 + internal/repository/repository.go | 2 + internal/scanner/scanner.go | 2 + internal/service/service.go | 2 + internal/setassign/setassign.go | 2 + internal/thumb/thumb.go | 2 + internal/version.go | 4 + 16 files changed, 821 insertions(+) create mode 100644 .gitignore create mode 100644 PLAN.md create mode 100644 go.mod create mode 100644 internal/api/api.go create mode 100644 internal/auth/auth.go create mode 100644 internal/clock/clock.go create mode 100644 internal/config.go create mode 100644 internal/config_test.go create mode 100644 internal/model/model.go create mode 100644 internal/probe/probe.go create mode 100644 internal/repository/repository.go create mode 100644 internal/scanner/scanner.go create mode 100644 internal/service/service.go create mode 100644 internal/setassign/setassign.go create mode 100644 internal/thumb/thumb.go create mode 100644 internal/version.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..08b8dee --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Binaries +mediaplayer +*.exe +*.dll +*.so +*.dylib + +# Test binaries +*.test + +# Output of the go coverage tool +*.out + +# Go workspace file +go.work + +# Database file +data.db diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..b405015 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,455 @@ +# KISS Go Media Player — Implementation Plan + +## Overview +A self-hosted, Kubernetes-deployable web media player written in Go (stdlib `net/http`) with a SQLite backend, vanilla JavaScript PWA frontend, and progressive offline capability. Designed for **KISS** (Keep It Stupidly Simple): minimal dependencies, zero frontend frameworks, fully interface-driven for testability. + +**Target test coverage:** >80% using dependency injection, hand-written mocks, and SQLite `:memory:` instances. + +--- + +## Architecture + +- **Backend:** Go 1.23, `net/http`, stdlib + `modernc.org/sqlite` +- **Frontend:** Vanilla JS, CSS Custom Properties, HTML5 `