diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-30 10:45:30 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-30 10:45:30 +0300 |
| commit | adecf1fd2e55a0605d03f36952846f6336506d37 (patch) | |
| tree | c02af76c7ea906f22c742cf4be83e488e5fcf050 | |
| parent | 0d7063e5c91efeb219a4be5b93525b0837c8d3be (diff) | |
Rename module to codeberg.org/snonux/play (task aa)
- Update go.mod module path
- Replace all internal imports from github.com/paul/kiss-media-player to codeberg.org/snonux/play
- Run go mod tidy and gofmt -w .
39 files changed, 260 insertions, 259 deletions
diff --git a/cmd/mediaplayer/main.go b/cmd/mediaplayer/main.go index d064274..fcc83e7 100644 --- a/cmd/mediaplayer/main.go +++ b/cmd/mediaplayer/main.go @@ -11,12 +11,12 @@ import ( "syscall" "time" - "github.com/paul/kiss-media-player/internal" - "github.com/paul/kiss-media-player/internal/api" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal" + "codeberg.org/snonux/play/internal/api" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) func main() { @@ -1,4 +1,4 @@ -module github.com/paul/kiss-media-player +module codeberg.org/snonux/play go 1.25.0 diff --git a/internal/api/handlers.go b/internal/api/handlers.go index 8bd8238..fc1d43d 100644 --- a/internal/api/handlers.go +++ b/internal/api/handlers.go @@ -14,9 +14,9 @@ import ( "strings" "time" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) type bootstrapRequest struct { diff --git a/internal/api/handlers_more_test.go b/internal/api/handlers_more_test.go index d6e93a8..e7eb99a 100644 --- a/internal/api/handlers_more_test.go +++ b/internal/api/handlers_more_test.go @@ -15,12 +15,12 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) // ------------------------------------------------------------------ @@ -239,7 +239,7 @@ func TestServer_Bootstrap_hashError(t *testing.T) { func TestServer_Bootstrap_createUserError(t *testing.T) { store := &repository.MockStore{ UserRepo: repository.MockUserRepo{ - CountUsersFunc: func(ctx context.Context) (int, error) { return 0, nil }, + CountUsersFunc: func(ctx context.Context) (int, error) { return 0, nil }, CreateUserFunc: func(ctx context.Context, user *model.User) (int64, error) { return 0, errors.New("boom") }, }, } @@ -258,7 +258,7 @@ func TestServer_Bootstrap_createUserError(t *testing.T) { func TestServer_Bootstrap_createSessionError(t *testing.T) { store := &repository.MockStore{ UserRepo: repository.MockUserRepo{ - CountUsersFunc: func(ctx context.Context) (int, error) { return 0, nil }, + CountUsersFunc: func(ctx context.Context) (int, error) { return 0, nil }, CreateUserFunc: func(ctx context.Context, user *model.User) (int64, error) { return 1, nil }, }, } @@ -325,10 +325,10 @@ func TestServer_SetCover(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -402,11 +402,11 @@ func TestServer_Upload(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24, MaxUploadSizeMB: 10} tests := []struct { - name string - id string - svcNil bool - svcErr error - noFile bool + name string + id string + svcNil bool + svcErr error + noFile bool wantCode int }{ {"nil service", "1", true, nil, false, http.StatusNotImplemented}, @@ -471,10 +471,10 @@ func TestServer_Favorite_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -525,11 +525,11 @@ func TestServer_RemoveTag_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - tag string - svcNil bool - svcErr error + name string + id string + tag string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", "t", true, nil, http.StatusNotImplemented}, @@ -570,11 +570,11 @@ func TestServer_Stream(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error - res *service.FileResult + name string + id string + svcNil bool + svcErr error + res *service.FileResult wantCode int }{ {"nil service", "1", true, nil, nil, http.StatusNotImplemented}, @@ -614,11 +614,11 @@ func TestServer_Download(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error - res *service.FileResult + name string + id string + svcNil bool + svcErr error + res *service.FileResult wantCode int wantDisp bool }{ @@ -665,11 +665,11 @@ func TestServer_Thumbnail(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error - res *service.FileResult + name string + id string + svcNil bool + svcErr error + res *service.FileResult wantCode int }{ {"nil service", "1", true, nil, nil, http.StatusNotImplemented}, @@ -708,10 +708,10 @@ func TestServer_RegenThumbnail(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -752,10 +752,10 @@ func TestServer_CreateShare_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24, ShareDefaultExpiryDays: 14} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -791,10 +791,10 @@ func TestServer_ListShares_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -830,10 +830,10 @@ func TestServer_RevokeShare(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - token string - svcNil bool - svcErr error + name string + token string + svcNil bool + svcErr error wantCode int }{ {"nil service", "abc", true, nil, http.StatusNotImplemented}, @@ -867,11 +867,11 @@ func TestServer_SharePage(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - token string - svcNil bool - svcErr error - share *model.Share + name string + token string + svcNil bool + svcErr error + share *model.Share wantCode int }{ {"nil service", "abc", true, nil, nil, http.StatusNotImplemented}, @@ -906,11 +906,11 @@ func TestServer_ShareStream(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - token string - svcNil bool - svcErr error - res *service.FileResult + name string + token string + svcNil bool + svcErr error + res *service.FileResult wantCode int }{ {"nil service", "abc", true, nil, nil, http.StatusNotImplemented}, @@ -951,10 +951,10 @@ func TestServer_SoftDelete_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -991,10 +991,10 @@ func TestServer_Restore_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -1035,11 +1035,11 @@ func TestServer_UpsertNote(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - body string - svcNil bool - svcErr error + name string + id string + body string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", `{"content":"hi"}`, true, nil, http.StatusNotImplemented}, @@ -1078,10 +1078,10 @@ func TestServer_DeleteNote(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -1167,9 +1167,9 @@ func TestServer_AdminRescan(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - svcNil bool - svcErr error + name string + svcNil bool + svcErr error wantCode int }{ {"nil service", true, nil, http.StatusNotImplemented}, @@ -1203,9 +1203,9 @@ func TestServer_AdminListTrash(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - svcNil bool - svcErr error + name string + svcNil bool + svcErr error wantCode int }{ {"nil service", true, nil, http.StatusNotImplemented}, @@ -1239,9 +1239,9 @@ func TestServer_AdminListUsers(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - svcNil bool - svcErr error + name string + svcNil bool + svcErr error wantCode int }{ {"nil service", true, nil, http.StatusNotImplemented}, @@ -1275,10 +1275,10 @@ func TestServer_AdminCreateUser(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - body string - svcNil bool - svcErr error + name string + body string + svcNil bool + svcErr error wantCode int }{ {"nil service", `{"username":"bob","password":"pass","is_admin":false}`, true, nil, http.StatusNotImplemented}, @@ -1317,10 +1317,10 @@ func TestServer_AdminDeleteUser(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "2", true, nil, http.StatusNotImplemented}, @@ -1355,9 +1355,9 @@ func TestServer_AdminListPermissions(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - svcNil bool - svcErr error + name string + svcNil bool + svcErr error wantCode int }{ {"nil service", true, nil, http.StatusNotImplemented}, @@ -1391,10 +1391,10 @@ func TestServer_AdminGrantPermission(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - body string - svcNil bool - svcErr error + name string + body string + svcNil bool + svcErr error wantCode int }{ {"nil service", `{"set_id":1,"user_id":2,"role":"viewer"}`, true, nil, http.StatusNotImplemented}, @@ -1430,10 +1430,10 @@ func TestServer_AdminRevokePermission(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - body string - svcNil bool - svcErr error + name string + body string + svcNil bool + svcErr error wantCode int }{ {"nil service", `{"set_id":1,"user_id":2}`, true, nil, http.StatusNotImplemented}, @@ -1469,8 +1469,8 @@ func TestServer_AdminRevokePermission(t *testing.T) { type errHasher struct{} -func (e *errHasher) Hash(password string) (string, error) { return "", errors.New("hash err") } -func (e *errHasher) Compare(hash, password string) error { return errors.New("compare err") } +func (e *errHasher) Hash(password string) (string, error) { return "", errors.New("hash err") } +func (e *errHasher) Compare(hash, password string) error { return errors.New("compare err") } // ------------------------------------------------------------------ // parseMediaListQuery diff --git a/internal/api/handlers_test.go b/internal/api/handlers_test.go index 91d30fe..c853140 100644 --- a/internal/api/handlers_test.go +++ b/internal/api/handlers_test.go @@ -13,12 +13,12 @@ import ( "testing/fstest" "time" - "github.com/paul/kiss-media-player/internal" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) type memFS struct { @@ -297,7 +297,7 @@ type staticHasher struct { fixed string } -func (h *staticHasher) Hash(password string) (string, error) { return h.fixed, nil } +func (h *staticHasher) Hash(password string) (string, error) { return h.fixed, nil } func (h *staticHasher) Compare(hash, password string) error { if hash == h.fixed && password == "correct" { return nil @@ -570,14 +570,14 @@ func TestServer_MediaList(t *testing.T) { wantCode: http.StatusOK, }, { - name: "service error", - listErr: errors.New("boom"), + name: "service error", + listErr: errors.New("boom"), wantCode: http.StatusInternalServerError, }, { - name: "with query params", - query: "?set_id=1&type=video&search=foo&tags=bar,baz&favorites=2&min_duration=10&max_duration=100&sort=name&limit=5&offset=10", - filter: repository.MediaFilter{SetID: intPtr(1), Type: (*model.MediaType)(func() *string { s := "video"; return &s }()), Search: "foo", Tags: []string{"bar", "baz"}, Favorites: intPtr(2), MinDuration: floatPtr(10), MaxDuration: floatPtr(100), Sort: "name", Limit: 5, Offset: 10}, + name: "with query params", + query: "?set_id=1&type=video&search=foo&tags=bar,baz&favorites=2&min_duration=10&max_duration=100&sort=name&limit=5&offset=10", + filter: repository.MediaFilter{SetID: intPtr(1), Type: (*model.MediaType)(func() *string { s := "video"; return &s }()), Search: "foo", Tags: []string{"bar", "baz"}, Favorites: intPtr(2), MinDuration: floatPtr(10), MaxDuration: floatPtr(100), Sort: "name", Limit: 5, Offset: 10}, listResult: []model.Media{}, wantCode: http.StatusOK, }, @@ -613,12 +613,12 @@ func TestServer_MediaList(t *testing.T) { func TestServer_MediaDetail(t *testing.T) { tests := []struct { - name string - id string - result *service.MediaDetail - err error - wantCode int - wantMedia bool + name string + id string + result *service.MediaDetail + err error + wantCode int + wantMedia bool }{ {"ok", "42", &service.MediaDetail{Media: &model.Media{ID: 42, FileName: "a.mp4"}}, nil, http.StatusOK, true}, {"invalid id", "abc", nil, nil, http.StatusBadRequest, false}, diff --git a/internal/api/middleware.go b/internal/api/middleware.go index 5b99cc7..ee1d6c9 100644 --- a/internal/api/middleware.go +++ b/internal/api/middleware.go @@ -5,9 +5,9 @@ import ( "net/http" "strings" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) type ctxKey int diff --git a/internal/api/server.go b/internal/api/server.go index 897add1..370313c 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -6,10 +6,10 @@ import ( "strconv" "time" - "github.com/paul/kiss-media-player/internal" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) // Server holds HTTP handlers and dependencies. diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go index 14b92ed..ce1ab8f 100644 --- a/internal/auth/auth_test.go +++ b/internal/auth/auth_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) func TestBCryptHasher_HashAndCompare(t *testing.T) { diff --git a/internal/auth/session.go b/internal/auth/session.go index 2b5be2a..2b9cea7 100644 --- a/internal/auth/session.go +++ b/internal/auth/session.go @@ -7,9 +7,9 @@ import ( "fmt" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) // SessionManager handles session lifecycle. diff --git a/internal/probe/probe.go b/internal/probe/probe.go index 7f5b887..5a081d2 100644 --- a/internal/probe/probe.go +++ b/internal/probe/probe.go @@ -8,7 +8,7 @@ import ( "os/exec" "strconv" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // Prober extracts metadata from a media file. diff --git a/internal/probe/probe_test.go b/internal/probe/probe_test.go index 9c05846..077c88c 100644 --- a/internal/probe/probe_test.go +++ b/internal/probe/probe_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) func TestParseFFprobeOutput(t *testing.T) { @@ -61,9 +61,9 @@ func TestParseFFprobeOutput(t *testing.T) { want: &model.Metadata{Codec: "vp9"}, }, { - name: "no format or streams", + name: "no format or streams", input: `{"format":{},"streams":[]}`, - want: &model.Metadata{}, + want: &model.Metadata{}, }, } diff --git a/internal/repository/favorite.go b/internal/repository/favorite.go index 4d3e0f5..3f1774d 100644 --- a/internal/repository/favorite.go +++ b/internal/repository/favorite.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // ToggleFavorite inserts or deletes a favorite row, returning whether it is now favorited. diff --git a/internal/repository/media.go b/internal/repository/media.go index 3e79d5e..26d69ca 100644 --- a/internal/repository/media.go +++ b/internal/repository/media.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // CreateMedia inserts a new media and returns the generated ID. diff --git a/internal/repository/mock.go b/internal/repository/mock.go index 5959586..849ba9b 100644 --- a/internal/repository/mock.go +++ b/internal/repository/mock.go @@ -5,7 +5,7 @@ import ( "context" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // compile-time checks. diff --git a/internal/repository/note.go b/internal/repository/note.go index 0b33212..0ae012f 100644 --- a/internal/repository/note.go +++ b/internal/repository/note.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // UpsertNote inserts or replaces a note for a user and media. diff --git a/internal/repository/playback_accumulator.go b/internal/repository/playback_accumulator.go index 51b4aa8..ea84086 100644 --- a/internal/repository/playback_accumulator.go +++ b/internal/repository/playback_accumulator.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // UpsertAccumulator inserts or replaces a playback accumulator. diff --git a/internal/repository/playback_progress.go b/internal/repository/playback_progress.go index 1d05dcd..63ac129 100644 --- a/internal/repository/playback_progress.go +++ b/internal/repository/playback_progress.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // UpsertProgress inserts or replaces playback progress. diff --git a/internal/repository/repository.go b/internal/repository/repository.go index b93484c..3de011c 100644 --- a/internal/repository/repository.go +++ b/internal/repository/repository.go @@ -5,7 +5,7 @@ import ( "context" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // Store is the composite interface for all repositories. diff --git a/internal/repository/session.go b/internal/repository/session.go index df24ed0..b1aa7df 100644 --- a/internal/repository/session.go +++ b/internal/repository/session.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // CreateSession inserts a new session. diff --git a/internal/repository/set.go b/internal |
