updated layout for small screens - colapsable sidepanel, fix issue with link to favicon when url_prefix is used

This commit is contained in:
2026-04-23 06:49:02 +00:00
parent a30eb4d42d
commit 62bf16589f
7 changed files with 156 additions and 55 deletions
+8 -2
View File
@@ -31,6 +31,7 @@ func (h *Handlers) LoginPage(c *gin.Context) {
returnTo := c.Query("return_to")
c.HTML(http.StatusOK, "login", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"csrf_token": token,
"return_to": returnTo,
"ContentTemplate": "login_content",
@@ -143,6 +144,7 @@ func (h *Handlers) MFALoginPage(c *gin.Context) {
token, _ := c.Get("csrf_token")
c.HTML(http.StatusOK, "mfa", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"csrf_token": token,
"ContentTemplate": "mfa_content",
"ScriptsTemplate": "mfa_scripts",
@@ -159,6 +161,7 @@ func (h *Handlers) MFALoginVerify(c *gin.Context) {
h.recordFailedAttempt(c, "mfa", "", nil)
c.HTML(http.StatusUnauthorized, "mfa", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"csrf_token": token,
"error": "Invalid code format",
"ContentTemplate": "mfa_content",
@@ -177,7 +180,7 @@ func (h *Handlers) MFALoginVerify(c *gin.Context) {
var secret string
if err := h.authSvc.DB.QueryRow(`SELECT mfa_secret FROM users WHERE id = ?`, uid).Scan(&secret); err != nil || secret == "" {
h.recordFailedAttempt(c, "mfa", "", &uid)
c.HTML(http.StatusUnauthorized, "mfa", gin.H{"error": "MFA not enabled", "Page": "mfa", "ContentTemplate": "mfa_content", "ScriptsTemplate": "mfa_scripts", "app_name": h.config.AppName})
c.HTML(http.StatusUnauthorized, "mfa", gin.H{"error": "MFA not enabled", "Page": "mfa", "ContentTemplate": "mfa_content", "ScriptsTemplate": "mfa_scripts", "app_name": h.config.AppName, "LoginAndEdits": h.config.LoginAndEdits})
return
}
if !verifyTOTP(secret, code, time.Now()) {
@@ -185,6 +188,7 @@ func (h *Handlers) MFALoginVerify(c *gin.Context) {
h.recordFailedAttempt(c, "mfa", "", &uid)
c.HTML(http.StatusUnauthorized, "mfa", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"csrf_token": token,
"error": "Invalid code",
"ContentTemplate": "mfa_content",
@@ -223,7 +227,7 @@ func (h *Handlers) ProfileMFASetupPage(c *gin.Context) {
// create new enrollment
s, e := generateBase32Secret()
if e != nil {
c.HTML(http.StatusInternalServerError, "error", gin.H{"error": "Failed to create enrollment", "Page": "error", "ContentTemplate": "error_content", "ScriptsTemplate": "error_scripts", "app_name": h.config.AppName})
c.HTML(http.StatusInternalServerError, "error", gin.H{"error": "Failed to create enrollment", "Page": "error", "ContentTemplate": "error_content", "ScriptsTemplate": "error_scripts", "app_name": h.config.AppName, "LoginAndEdits": h.config.LoginAndEdits})
return
}
_, _ = h.authSvc.DB.Exec(`INSERT OR REPLACE INTO mfa_enrollments (user_id, secret) VALUES (?, ?)`, *uidPtr, s)
@@ -240,6 +244,7 @@ func (h *Handlers) ProfileMFASetupPage(c *gin.Context) {
notesTree, _ := utils.BuildTreeStructure(h.config.NotesDir, h.config.NotesDirHideSidepane, h.config)
c.HTML(http.StatusOK, "mfa_setup", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"notes_tree": notesTree,
"active_path": []string{},
"current_note": nil,
@@ -342,6 +347,7 @@ func (h *Handlers) LoginPost(c *gin.Context) {
h.recordFailedAttempt(c, "password", username, nil)
c.HTML(http.StatusUnauthorized, "login", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"csrf_token": token,
"error": err.Error(),
"return_to": returnTo,
+9
View File
@@ -22,6 +22,7 @@ func (h *Handlers) CreateNotePageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -32,6 +33,7 @@ func (h *Handlers) CreateNotePageHandler(c *gin.Context) {
c.HTML(http.StatusOK, "create", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"folder_path": folderPath,
"notes_tree": notesTree,
"active_path": utils.GetActivePath(folderPath),
@@ -163,6 +165,7 @@ func (h *Handlers) EditNotePageHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid note path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Note path must end with .md or .markdown",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -176,6 +179,7 @@ func (h *Handlers) EditNotePageHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -189,6 +193,7 @@ func (h *Handlers) EditNotePageHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This note cannot be edited",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -203,6 +208,7 @@ func (h *Handlers) EditNotePageHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "Note not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested note does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -216,6 +222,7 @@ func (h *Handlers) EditNotePageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read note",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -229,6 +236,7 @@ func (h *Handlers) EditNotePageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -251,6 +259,7 @@ func (h *Handlers) EditNotePageHandler(c *gin.Context) {
c.HTML(http.StatusOK, "edit", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"title": title,
"content": string(content),
"note_path": notePath,
+44 -2
View File
@@ -297,6 +297,7 @@ func (h *Handlers) AdminLogsPage(c *gin.Context) {
c.HTML(http.StatusOK, "admin_logs", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"NoSidebar": true,
"breadcrumbs": []gin.H{{"Name": "/", "URL": "/"}, {"Name": "Admin", "URL": "/editor/admin"}, {"Name": "Logs", "URL": ""}},
"Page": "admin_logs",
@@ -354,6 +355,7 @@ func (h *Handlers) ProfilePage(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -370,6 +372,7 @@ func (h *Handlers) ProfilePage(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to load profile",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -386,8 +389,8 @@ func (h *Handlers) ProfilePage(c *gin.Context) {
"breadcrumbs": utils.GenerateBreadcrumbs(""),
"Authenticated": true,
"IsAdmin": isAdmin(c),
"Email": email,
"MFAEnabled": mfa.Valid && mfa.String != "",
"LoginAndEdits": h.config.LoginAndEdits,
"Email": email, "MFAEnabled": mfa.Valid && mfa.String != "",
"ContentTemplate": "profile_content",
"ScriptsTemplate": "profile_scripts",
"Page": "profile",
@@ -739,6 +742,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -752,6 +756,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -762,6 +767,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this file",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -777,6 +783,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "File not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested file does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -792,6 +799,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Editing not allowed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This file type cannot be edited here",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -806,6 +814,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read file",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -820,6 +829,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build notes tree",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -843,6 +853,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
"notes_tree": notesTree,
"active_path": utils.GetActivePath(folderPath),
"breadcrumbs": utils.GenerateBreadcrumbs(folderPath),
"LoginAndEdits": h.config.LoginAndEdits,
"Authenticated": isAuthenticated(c),
"IsAdmin": isAdmin(c),
"ContentTemplate": "edit_text_content",
@@ -913,6 +924,7 @@ func (h *Handlers) IndexHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read directory",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -929,6 +941,7 @@ func (h *Handlers) IndexHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -944,6 +957,7 @@ func (h *Handlers) IndexHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -954,6 +968,7 @@ func (h *Handlers) IndexHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this folder",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -989,6 +1004,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1002,6 +1018,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This directory is not accessible",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1015,6 +1032,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1025,6 +1043,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this folder",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1038,6 +1057,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "Folder not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1051,6 +1071,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1069,6 +1090,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
"breadcrumbs": utils.GenerateBreadcrumbs(folderPath),
"allowed_image_extensions": h.config.AllowedImageExtensions,
"allowed_file_extensions": h.config.AllowedFileExtensions,
"LoginAndEdits": h.config.LoginAndEdits,
"Authenticated": isAuthenticated(c),
"IsAdmin": isAdmin(c),
"ContentTemplate": "folder_content",
@@ -1085,6 +1107,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid note path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Note path must end with .md or .markdown",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1098,6 +1121,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1111,6 +1135,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This note is not accessible",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1124,6 +1149,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1134,6 +1160,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this note",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1169,6 +1196,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "Note not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested note does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1180,6 +1208,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "Note not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested note does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1194,6 +1223,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read note",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1207,6 +1237,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to render markdown",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1220,6 +1251,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1253,6 +1285,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
"active_path": utils.GetActivePath(folderPath),
"current_note": notePath,
"breadcrumbs": utils.GenerateBreadcrumbs(folderPath),
"LoginAndEdits": h.config.LoginAndEdits,
"Authenticated": isAuthenticated(c),
"IsAdmin": isAdmin(c),
"ContentTemplate": "note_content",
@@ -1377,6 +1410,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1390,6 +1424,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1400,6 +1435,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this file",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1414,6 +1450,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "File not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested file does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1427,6 +1464,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "File type not allowed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This file type cannot be viewed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1440,6 +1478,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read file",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1453,6 +1492,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1482,6 +1522,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
"notes_tree": notesTree,
"active_path": utils.GetActivePath(folderPath),
"breadcrumbs": utils.GenerateBreadcrumbs(folderPath),
"LoginAndEdits": h.config.LoginAndEdits,
"Authenticated": isAuthenticated(c),
"IsAdmin": isAdmin(c),
"ContentTemplate": "view_text_content",
@@ -1664,6 +1705,7 @@ func (h *Handlers) AdminPage(c *gin.Context) {
"breadcrumbs": utils.GenerateBreadcrumbs(""),
"Authenticated": true,
"IsAdmin": true,
"LoginAndEdits": h.config.LoginAndEdits,
"users": users,
"groups": groups,
"permissions": perms,
+2
View File
@@ -17,6 +17,7 @@ func (h *Handlers) SettingsPageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -27,6 +28,7 @@ func (h *Handlers) SettingsPageHandler(c *gin.Context) {
c.HTML(http.StatusOK, "settings", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"notes_tree": notesTree,
"active_path": []string{},
"current_note": nil,