aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-08 03:06:23 +0530
committerBobby <[email protected]>2026-03-08 03:06:23 +0530
commitcaf265e7050edefa64ecf7e13828ec9636bce867 (patch)
tree6bb8554dbb34695a74c2dca556bf512998cf62ab /pages
parentcca905d35412f1549400fc3d1aca6dc704d8cae6 (diff)
downloaddove-caf265e7050edefa64ecf7e13828ec9636bce867.tar.xz
dove-caf265e7050edefa64ecf7e13828ec9636bce867.zip
Refactor configuration handling and add mail management features
- Removed dependency on messages package in TOML loading and parsing. - Introduced new config constants and messages for better clarity and maintainability. - Implemented mail user and mailbox management with corresponding controllers and views. - Added new templates for mailboxes, mailbox creation, and user management. - Enhanced logging and error handling throughout the application. - Established a structured approach for applying default values in TOML configuration. - Created new utility functions for SMTP and email handling.
Diffstat (limited to 'pages')
-rw-r--r--pages/dashboard.go14
-rw-r--r--pages/dashboard/dashboard.go13
-rw-r--r--pages/domain/domain.go (renamed from pages/domain.go)4
-rw-r--r--pages/home/home.go (renamed from pages/home.go)2
-rw-r--r--pages/mail/mailbox.go (renamed from pages/mailbox.go)8
-rw-r--r--pages/mail/mailboxes.go (renamed from pages/mailboxes.go)8
-rw-r--r--pages/mail/users.go (renamed from pages/users.go)8
7 files changed, 28 insertions, 29 deletions
diff --git a/pages/dashboard.go b/pages/dashboard.go
deleted file mode 100644
index 3fb16fb..0000000
--- a/pages/dashboard.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package pages
-
-import (
- "dove/services"
- "dove/utils/meta"
- "dove/utils/shortcuts"
-
- "github.com/gofiber/fiber/v2"
-)
-
-func Dashboard(context *fiber.Ctx) error {
- meta.SetPageTitle(context, "Overview")
- return shortcuts.Render(context, "dashboard/overview", services.Overview())
-}
diff --git a/pages/dashboard/dashboard.go b/pages/dashboard/dashboard.go
new file mode 100644
index 0000000..319f884
--- /dev/null
+++ b/pages/dashboard/dashboard.go
@@ -0,0 +1,13 @@
+package dashboard
+
+import (
+ "dove/utils/meta"
+ "dove/utils/shortcuts"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+func Overview(context *fiber.Ctx) error {
+ meta.SetPageTitle(context, "Overview")
+ return shortcuts.Render(context, "dashboard/overview", nil)
+}
diff --git a/pages/domain.go b/pages/domain/domain.go
index d46af9c..3d01df0 100644
--- a/pages/domain.go
+++ b/pages/domain/domain.go
@@ -1,4 +1,4 @@
-package pages
+package domain
import (
domainService "dove/services/domain"
@@ -21,4 +21,4 @@ func NewDomain(context *fiber.Ctx) error {
func NewTLD(context *fiber.Ctx) error {
meta.SetPageTitle(context, "New TLD")
return shortcuts.Render(context, "domains/newtld", nil)
-} \ No newline at end of file
+}
diff --git a/pages/home.go b/pages/home/home.go
index 06f836e..6107da1 100644
--- a/pages/home.go
+++ b/pages/home/home.go
@@ -1,4 +1,4 @@
-package pages
+package home
import (
"dove/config"
diff --git a/pages/mailbox.go b/pages/mail/mailbox.go
index a444a73..81f525b 100644
--- a/pages/mailbox.go
+++ b/pages/mail/mailbox.go
@@ -1,7 +1,7 @@
-package pages
+package mail
import (
- "dove/types"
+ mailService "dove/services/mail"
"dove/utils/meta"
"dove/utils/shortcuts"
@@ -9,9 +9,9 @@ import (
)
func Mailbox(context *fiber.Ctx) error {
- address := meta.Request(context).Param("address").Required()
+ address := meta.Request(context).Param("address")
meta.SetPageTitle(context, address)
- return shortcuts.Render(context, "dashboard/mailbox", types.Mailbox{
+ return shortcuts.Render(context, "mail/mailbox", mailService.MailboxView{
Address: address,
})
}
diff --git a/pages/mailboxes.go b/pages/mail/mailboxes.go
index 611c2cb..36d9041 100644
--- a/pages/mailboxes.go
+++ b/pages/mail/mailboxes.go
@@ -1,7 +1,7 @@
-package pages
+package mail
import (
- "dove/services"
+ mailService "dove/services/mail"
"dove/utils/meta"
"dove/utils/shortcuts"
@@ -10,7 +10,7 @@ import (
func NewMailbox(context *fiber.Ctx) error {
meta.SetPageTitle(context, "New Mailbox")
- return shortcuts.Render(context, "dashboard/newmailbox", services.MailboxFormData())
+ return shortcuts.Render(context, "mail/newmailbox", mailService.MailboxFormData())
}
func Mailboxes(context *fiber.Ctx) error {
@@ -20,5 +20,5 @@ func Mailboxes(context *fiber.Ctx) error {
sorting := meta.Sort(context, []string{"address", "created_at"}, "created_at")
search := context.Query("search")
- return shortcuts.Render(context, "dashboard/mailboxes", services.ListMailboxes(pagination, sorting, search))
+ return shortcuts.Render(context, "mail/mailboxes", mailService.ListMailboxes(pagination, sorting, search))
}
diff --git a/pages/users.go b/pages/mail/users.go
index 1fc6fcc..8700c80 100644
--- a/pages/users.go
+++ b/pages/mail/users.go
@@ -1,7 +1,7 @@
-package pages
+package mail
import (
- "dove/services"
+ mailService "dove/services/mail"
"dove/utils/meta"
"dove/utils/shortcuts"
@@ -10,7 +10,7 @@ import (
func NewUser(context *fiber.Ctx) error {
meta.SetPageTitle(context, "New User")
- return shortcuts.Render(context, "dashboard/newuser", nil)
+ return shortcuts.Render(context, "mail/newuser", nil)
}
func Users(context *fiber.Ctx) error {
@@ -20,5 +20,5 @@ func Users(context *fiber.Ctx) error {
sorting := meta.Sort(context, []string{"username", "display_name", "created_at"}, "created_at")
search := context.Query("search")
- return shortcuts.Render(context, "dashboard/users", services.ListUsers(pagination, sorting, search))
+ return shortcuts.Render(context, "mail/users", mailService.ListUsers(pagination, sorting, search))
}