refactor: project structure

This commit is contained in:
trafficlunar 2025-12-15 16:59:04 +00:00
parent 0942761cd8
commit b6cf11f680
11 changed files with 23 additions and 18 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
themes/*.css linguist-detectable=false

View file

@ -3,3 +3,4 @@
- [ ] View incidents - [ ] View incidents
- [ ] Latency graphs? - [ ] Latency graphs?
- [ ] README - [ ] README
- [ ] Site metadata

2
go.mod
View file

@ -1,4 +1,4 @@
module status-page module statsys
go 1.25.4 go 1.25.4

View file

@ -1,4 +1,4 @@
package main package internal
import ( import (
"log" "log"

View file

@ -1,4 +1,4 @@
package main package internal
import ( import (
"database/sql" "database/sql"
@ -12,7 +12,7 @@ import (
var STATUS_PRIORITY = map[string]int{"Offline": 2, "Degraded": 1, "Online": 0} var STATUS_PRIORITY = map[string]int{"Offline": 2, "Degraded": 1, "Online": 0}
var db *sql.DB var db *sql.DB
func InitializeDatabase() { func InitDatabase() {
// open/create database // open/create database
var err error var err error
db, err = sql.Open("sqlite", "status.db") db, err = sql.Open("sqlite", "status.db")

View file

@ -1,4 +1,4 @@
package main package internal
import ( import (
"html/template" "html/template"

View file

@ -1,4 +1,4 @@
package main package internal
import ( import (
"log" "log"

11
main.go Normal file
View file

@ -0,0 +1,11 @@
package main
import "statsys/internal"
func main() {
internal.LoadConfig()
internal.InitDatabase()
defer internal.CloseDatabase()
internal.StartCheckingStatuses()
internal.StartHttpServer()
}

View file

@ -1,9 +0,0 @@
package main
func main() {
LoadConfig()
InitializeDatabase()
defer CloseDatabase()
StartCheckingStatuses()
StartHttpServer()
}

View file

@ -18,6 +18,7 @@
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
height: max-content; height: max-content;
min-height: 100%;
max-width: 40rem; max-width: 40rem;
padding: 4rem 2rem 1.5rem; padding: 4rem 2rem 1.5rem;
background-color: white; background-color: white;

View file

@ -86,7 +86,7 @@ hr {
} }
.status-bar.Unknown { .status-bar.Unknown {
background: radial-gradient(circle at center, #94a3b8 3px, transparent 3px); background: radial-gradient(circle at center, rgba(0, 0, 0, 0.1) 3px, transparent 3px);
} }
.bars-footer { .bars-footer {
@ -111,7 +111,7 @@ footer a:hover {
} }
.combobox-trigger { .combobox-trigger {
background-color: white; background-color: #f8fafc;
border: 1px solid rgba(15, 23, 42, 0.4); border: 1px solid rgba(15, 23, 42, 0.4);
} }
@ -124,7 +124,7 @@ footer a:hover {
} }
.combobox-dropdown { .combobox-dropdown {
background-color: white; background-color: #f8fafc;
border: 1px solid rgba(15, 23, 42, 0.4); border: 1px solid rgba(15, 23, 42, 0.4);
} }