Compare commits
2 Commits
e938828a8c
...
b5f1b17684
| Author | SHA1 | Date | |
|---|---|---|---|
| b5f1b17684 | |||
| f9853c921d |
@@ -47,6 +47,7 @@ func MessagesInboxHandler(db *sql.DB) http.HandlerFunc {
|
|||||||
tmpl := templateHelpers.LoadTemplateFiles("messages.html", "templates/account/messages/index.html")
|
tmpl := templateHelpers.LoadTemplateFiles("messages.html", "templates/account/messages/index.html")
|
||||||
|
|
||||||
if err := tmpl.ExecuteTemplate(w, "layout", context); err != nil {
|
if err := tmpl.ExecuteTemplate(w, "layout", context); err != nil {
|
||||||
|
// ToDo: Make this load all error pages without defining explictly.
|
||||||
templateHelpers.RenderError(w, r, 500)
|
templateHelpers.RenderError(w, r, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ func TemplateFuncs() template.FuncMap {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rangeClass": rangeClass,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,6 @@ func PageRange(current, total int) []int {
|
|||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: Should be ball range class, and should it even be here?
|
|
||||||
func rangeClass(n int) string {
|
func rangeClass(n int) string {
|
||||||
switch {
|
switch {
|
||||||
case n >= 1 && n <= 9:
|
case n >= 1 && n <= 9:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var db *sql.DB
|
|||||||
func InitDB(filepath string) *sql.DB {
|
func InitDB(filepath string) *sql.DB {
|
||||||
var err error
|
var err error
|
||||||
cfg := config.Get()
|
cfg := config.Get()
|
||||||
db, err := sql.Open("sqlite", filepath)
|
db, err = sql.Open("sqlite", filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("❌ Failed to open DB:", err)
|
log.Fatal("❌ Failed to open DB:", err)
|
||||||
}
|
}
|
||||||
@@ -29,6 +29,7 @@ func InitDB(filepath string) *sql.DB {
|
|||||||
SchemaUsersMessages,
|
SchemaUsersMessages,
|
||||||
SchemaUsersNotifications,
|
SchemaUsersNotifications,
|
||||||
SchemaAuditLog,
|
SchemaAuditLog,
|
||||||
|
SchemaAuditLogin,
|
||||||
SchemaLogTicketMatching,
|
SchemaLogTicketMatching,
|
||||||
SchemaAdminAccessLog,
|
SchemaAdminAccessLog,
|
||||||
SchemaNewAuditLog,
|
SchemaNewAuditLog,
|
||||||
|
|||||||
@@ -175,6 +175,16 @@ CREATE TABLE IF NOT EXISTS audit_log (
|
|||||||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
);`
|
);`
|
||||||
|
|
||||||
|
const SchemaAuditLogin = `
|
||||||
|
CREATE TABLE IF NOT EXISTS audit_login (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
username TEXT,
|
||||||
|
success BOOLEAN,
|
||||||
|
ip TEXT,
|
||||||
|
user_agent TEXT,
|
||||||
|
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);`
|
||||||
|
|
||||||
const SchemaSyndicates = `
|
const SchemaSyndicates = `
|
||||||
CREATE TABLE IF NOT EXISTS syndicates (
|
CREATE TABLE IF NOT EXISTS syndicates (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
|||||||
Reference in New Issue
Block a user