diff --git a/backend/migrations/007_add_scan_settings.up.sql b/backend/migrations/007_add_scan_settings.up.sql deleted file mode 100644 index 1b3b7e4..0000000 --- a/backend/migrations/007_add_scan_settings.up.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Add scan settings to users table -ALTER TABLE users ADD COLUMN scan_frequency_minutes INTEGER DEFAULT 60; -ALTER TABLE users ADD COLUMN auto_scan_enabled BOOLEAN DEFAULT true; \ No newline at end of file diff --git a/go.mod b/go.mod index 80a7958..cc180fc 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.25 require ( github.com/ArcadiaLin/go-epub v0.1.1 + github.com/a-h/templ v0.3.977 github.com/fsnotify/fsnotify v1.9.0 github.com/go-playground/validator/v10 v10.30.1 github.com/golang-jwt/jwt v3.2.2+incompatible @@ -23,7 +24,7 @@ require ( github.com/labstack/gommon v0.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect golang.org/x/net v0.47.0 // indirect diff --git a/go.sum b/go.sum index 9d33cf5..b342b1b 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/ArcadiaLin/go-epub v0.1.1 h1:13roe62tarrZ1Y1QTxE+Bzd/NKlChhRzegLVmU5Hgws= github.com/ArcadiaLin/go-epub v0.1.1/go.mod h1:GY09AG6jnEbsYytkw6VeICLOt25F1GQDGXjYS7cxNhU= +github.com/a-h/templ v0.3.977 h1:kiKAPXTZE2Iaf8JbtM21r54A8bCNsncrfnokZZSrSDg= +github.com/a-h/templ v0.3.977/go.mod h1:oCZcnKRf5jjsGpf2yELzQfodLphd2mwecwG4Crk5HBo= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -17,6 +19,8 @@ github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy0 github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= @@ -38,15 +42,15 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= diff --git a/internal/handlers/auth.go b/internal/handlers/auth.go index 82f52aa..f9b677d 100644 --- a/internal/handlers/auth.go +++ b/internal/handlers/auth.go @@ -141,8 +141,9 @@ func (h *AuthHandler) Register(c echo.Context) error { `, token, fmt.Sprintf(`{"id":"%s","email":"%s","username":"%s"}`, uuid.UUID(user.ID.Bytes).String(), user.Email, user.Username)) +`, token, fmt.Sprintf(`{"id":"%s","email":"%s","username":"%s"}`, uuid.UUID(user.ID.Bytes).String(), user.Email, user.Username), token) return c.HTML(http.StatusCreated, html) } @@ -237,8 +238,9 @@ func (h *AuthHandler) Login(c echo.Context) error { `, token, fmt.Sprintf(`{"id":"%s","email":"%s","username":"%s"}`, uuid.UUID(user.ID.Bytes).String(), user.Email, user.Username)) +`, token, fmt.Sprintf(`{"id":"%s","email":"%s","username":"%s"}`, uuid.UUID(user.ID.Bytes).String(), user.Email, user.Username), token) return c.HTML(http.StatusOK, html) } diff --git a/templates/admin.html b/templates/admin.html deleted file mode 100644 index 1dae2ff..0000000 --- a/templates/admin.html +++ /dev/null @@ -1,143 +0,0 @@ -{{template "base.html" .}} - -{{define "title"}}Admin Dashboard - Bookmann{{end}} - -{{define "content"}} - - - -
- - - - -
-
- {{if eq .CurrentPage "dashboard"}} - -
-

Dashboard

-

Overview of your Bookmann library and settings

-
- - -
-
-
-
πŸ“–
-
-

Library

-

Manage your ebook collection

-
-
- View Library -
- -
-
-
βš™οΈ
-
-

Settings

-

Configure your preferences

-
-
- Manage Settings -
- -
-
-
πŸ”
-
-

Scanner

-

Library scanning options

-
-
- Configure Scanner -
-
- - -
-

Quick Actions

-
- - -
Manage Folders
-
Add or remove scan directories
-
-
-
- {{end}} -
-
-
- - -{{end}} \ No newline at end of file diff --git a/templates/admin.templ b/templates/admin.templ new file mode 100644 index 0000000..beec66c --- /dev/null +++ b/templates/admin.templ @@ -0,0 +1,175 @@ +package templates + +templ Admin(user User, currentPage string) { + + + + + Admin Dashboard - Bookmann + + + + + + +
+ + +
+
+ if currentPage == "dashboard" { +
+

Dashboard

+

Overview of your Bookmann library and settings

+
+ +
+
+
+
πŸ“–
+
+

Library

+

Manage your ebook collection

+
+
+ View Library +
+ +
+
+
βš™οΈ
+
+

Settings

+

Configure your preferences

+
+
+ Manage Settings +
+ +
+
+
πŸ”
+
+

Scanner

+

Library scanning options

+
+
+ Configure Scanner +
+
+ +
+

Quick Actions

+
+ + +
Manage Folders
+
Add or remove scan directories
+
+
+
+ } +
+
+
+ + + + +} \ No newline at end of file diff --git a/templates/admin_library.html b/templates/admin_library.html deleted file mode 100644 index 9b44be8..0000000 --- a/templates/admin_library.html +++ /dev/null @@ -1,303 +0,0 @@ -{{template "base.html" .}} - -{{define "title"}}Library Management - Bookmann{{end}} - -{{define "content"}} - - - -
- - - - -
-
- -
- -

Library Management

-

Configure your ebook folders and scanning preferences

-
- - -
- -
-

πŸ“ Ebook Folders

-

Manage the directories where Bookmann scans for ebooks. Supported formats: EPUB, PDF, MOBI, AZW3, FB2, TXT

- - -
-

Add Folder

-
- - -
-
-
- - -
-

Configured Folders

-
- -
-
-
- - -
-

πŸ” Scan Settings

-

Configure how and when Bookmann scans your folders for new ebooks

- -
- -
-

Automatic Scanning

- -
- - -
-

Scan Frequency

- -

How often to scan when automatic scanning is enabled

-
-
- - -
-

Manual Scan

-
- - Manually scan all configured folders immediately -
-
-
-
- - -
-

πŸ“Š Library Statistics

-
-
-
-
-
Folders
-
-
-
-
-
Books
-
-
-
-
-
Last Scan
-
-
-
-
-
-
-
- - -{{end}} \ No newline at end of file diff --git a/templates/admin_library.templ b/templates/admin_library.templ new file mode 100644 index 0000000..19dec79 --- /dev/null +++ b/templates/admin_library.templ @@ -0,0 +1,186 @@ +package templates + +templ AdminLibrary(user User) { + + + + + Library Management - Bookmann + + + + + + +
+ + +
+
+
+ +

Library Management

+

Configure library scanning settings and manage ebook folders

+
+ +
+
+

Scan Settings

+ +
+

Scan Frequency

+
+ + +
+
+
+ +
+

Auto Scan

+
+ + + +
+
+
+
+ +
+

Ebook Folders

+

Manage folders that Bookmann scans for ebooks

+ +
+ +
+ +
+ + +
+
+
+
+
+
+
+ + + + +} \ No newline at end of file diff --git a/templates/admin_profile.html b/templates/admin_profile.html deleted file mode 100644 index fd7ed89..0000000 --- a/templates/admin_profile.html +++ /dev/null @@ -1,198 +0,0 @@ -{{template "base.html" .}} - -{{define "title"}}Profile Settings - Bookmann{{end}} - -{{define "content"}} - - - -
- - - - -
-
- -
- -

Profile Settings

-

Manage your account information and preferences

-
- - -
- -
-

Account Information

- - -
-

Username

-
- - -
-
-
- - -
-

Email Address

-
- - -
-
-
- - -
-

Change Password

-
-
- - -
-
- - -
-
- - -
- -
-
-
-
- - -
-

Appearance

- -
-

Theme

-
- - -
-
-
-
- - -
-

Danger Zone

-
-

Delete Account

-

- Once you delete your account, there is no going back. Please be certain. -

- -
-
-
-
-
-
- - -{{end}} \ No newline at end of file diff --git a/templates/admin_profile.templ b/templates/admin_profile.templ new file mode 100644 index 0000000..2340885 --- /dev/null +++ b/templates/admin_profile.templ @@ -0,0 +1,152 @@ +package templates + +templ AdminProfile(user User) { + + + + + Profile Settings - Bookmann + + + + + + +
+ + +
+
+
+ +

Profile Settings

+

Manage your account information and preferences

+
+ +
+
+

Account Information

+ +
+

Username

+
+ + +
+
+
+ +
+

Email Address

+
+ + +
+
+
+ +
+

Change Password

+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+
+
+ + + + +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html deleted file mode 100644 index 2e1360a..0000000 --- a/templates/base.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - {{block "title" .}}Bookmann{{end}} - - - - - - {{block "content" .}}{{end}} - - - \ No newline at end of file diff --git a/templates/dashboard.html b/templates/dashboard.html deleted file mode 100644 index 75a6cb8..0000000 --- a/templates/dashboard.html +++ /dev/null @@ -1,446 +0,0 @@ -{{template "base.html" .}} - -{{define "title"}}Dashboard - Bookmann{{end}} - -{{define "content"}} - - - -
- -
-
-
-

Your Ebook Library

-

Manage your ebook collection and reading progress

-
- -
-
- - -
-
- - -
-
- - - - - -
- -
- - -
- Loading your ebooks... -
- - - - - - -
- - - - - -{{end}} \ No newline at end of file diff --git a/templates/dashboard.templ b/templates/dashboard.templ new file mode 100644 index 0000000..fb75cc1 --- /dev/null +++ b/templates/dashboard.templ @@ -0,0 +1,163 @@ +package templates + +templ Dashboard(user User) { + + + + + + Dashboard - Bookmann + + + + + + + + +
+ +
+
+
+

Your Ebook Library

+

Manage your ebook collection and reading progress

+
+ +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ Loading your ebooks... +
+
+ + + + +} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index 8a9d62a..0000000 --- a/templates/index.html +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - Bookmann - Home - - - - - - -
-
-
-
-
- -
- -
-

- πŸ“š Bookmann -

-

- Your personal ebook management system. Track reading progress, organize your library, and enjoy beautiful themes. -

- -
-
-
- - -
-
-
-

Why Bookmann?

-

Discover the features that make ebook management effortless

-
- -
-
-
-
- πŸ“– -
-

Reading Progress

-

Track your reading progress across all your ebooks with detailed statistics.

-
-
- -
-
-
- 🎨 -
-

Beautiful Themes

-

Choose from 11 stunning themes including Tokyo Night, Dracula, and Catppuccin variants.

-
-
- -
-
-
- ⚑ -
-

Fast & Modern

-

Built with Go and HTMX for lightning-fast performance and smooth interactions.

-
-
-
-
-
- - -
-
-
-

Join Bookmann Today

-

Create your account or sign in to start managing your ebook library

-
- -
-
-

Login

-
-
-
- - -
-
- - -
- -
-
-
- -
-

Create Account

-
-
-
- - -
-
- - -
-
- - -
- -
-
-
-
- -
-
-
- - - - \ No newline at end of file diff --git a/templates/index.templ b/templates/index.templ new file mode 100644 index 0000000..1cd55d2 --- /dev/null +++ b/templates/index.templ @@ -0,0 +1,317 @@ +package templates + +templ Index() { + + + + + + Bookmann - Home + + + + + + +
+
+
+
+
+ +
+ +
+

+ πŸ“š Bookmann +

+

+ Your personal ebook management system. Track reading progress, organize your library, and enjoy beautiful themes. +

+ +
+
+
+ + +
+
+
+

Why Bookmann?

+

Discover the features that make ebook management effortless

+
+ +
+
+
+
+ πŸ“– +
+

Reading Progress

+

Track your reading progress across all your ebooks with detailed statistics.

+
+
+ +
+
+
+ 🎨 +
+

Beautiful Themes

+

Choose from 11 stunning themes including Tokyo Night, Dracula, and Catppuccin variants.

+
+
+ +
+
+
+ ⚑ +
+

Fast & Modern

+

Built with Go and HTMX for lightning-fast performance and smooth interactions.

+
+
+
+
+
+ + +
+
+
+

Join Bookmann Today

+

Create your account or sign in to start managing your ebook library

+
+ +
+
+

Login

+
+
+
+ + +
+
+ + +
+ +
+
+
+ +
+

Create Account

+
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+ +
+
+
+ + + + +} \ No newline at end of file diff --git a/templates/login.html b/templates/login.html deleted file mode 100644 index 371a05c..0000000 --- a/templates/login.html +++ /dev/null @@ -1,65 +0,0 @@ -{{template "base.html" .}} - -{{define "title"}}Login{{end}} - -{{define "content"}} -
-
-

Login

- -
- -
-
- - -
-
- - -
- -
- -
- -

- Don't have an account? Register -

-
- -{{end}} \ No newline at end of file diff --git a/templates/login.templ b/templates/login.templ new file mode 100644 index 0000000..aa473b8 --- /dev/null +++ b/templates/login.templ @@ -0,0 +1,196 @@ +package templates + +templ Login() { + + + + + + Login + + + + + +
+
+

Login to Bookmann

+ +
+ +
+
+ + +
+
+ + +
+ +
+ +
+ +

+ Don't have an account? Sign Up +

+
+ + + +} \ No newline at end of file diff --git a/templates/register.html b/templates/register.html deleted file mode 100644 index 5fca1fa..0000000 --- a/templates/register.html +++ /dev/null @@ -1,33 +0,0 @@ -{{template "base.html" .}} - -{{define "title"}}Register{{end}} - -{{define "content"}} -
-

Register

- -
-
- - -
-
- - -
-
- - -
- -
- -
- -

- Already have an account? Login -

-
-{{end}} \ No newline at end of file diff --git a/templates/register.templ b/templates/register.templ new file mode 100644 index 0000000..bf61dba --- /dev/null +++ b/templates/register.templ @@ -0,0 +1,156 @@ +package templates + +templ Register() { + + + + + + Register + + + + + +
+

Register for Bookmann

+ +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+ +

+ Already have an account? Login +

+
+ + +} \ No newline at end of file diff --git a/templates/types.go b/templates/types.go new file mode 100644 index 0000000..05432ea --- /dev/null +++ b/templates/types.go @@ -0,0 +1,12 @@ +package templates + +type User struct { + ID string + Username string + Email string +} + +type PageData struct { + User User + CurrentPage string +}