Compare commits
8 Commits
86b679f245
...
84932c2449
Author | SHA1 | Date |
---|---|---|
leah | 84932c2449 | |
leah | 667161d876 | |
leah | da5a3f53dc | |
leah | 7e177e3b1a | |
leah | 078b6a7a65 | |
leah | 4c10954036 | |
leah | e9e99646cb | |
leah | e7e119b934 |
|
@ -15,3 +15,6 @@
|
|||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
# sensitive data that shouldn't be pushed
|
||||
data/*
|
||||
config.yml
|
10
README.md
10
README.md
|
@ -1,3 +1,11 @@
|
|||
# admin
|
||||
quick little admin panel.
|
||||
|
||||
quick little admin panel
|
||||
## todo
|
||||
- [ ] respectable web ui
|
||||
- [ ] signup form
|
||||
- [ ] lots of db code
|
||||
- [ ] gitea authentication
|
||||
- [ ] pam auth (maube?)
|
||||
- [ ] automatic user creaton/deletion
|
||||
- [ ] resource usage dashboard
|
|
@ -0,0 +1,14 @@
|
|||
server:
|
||||
name: "south london"
|
||||
homepage: "https://southlondon.cc"
|
||||
|
||||
admin:
|
||||
# webroot: "/admin" # Set this if you're running the admin panel on using a
|
||||
# custom path instead of a subdomain.
|
||||
# e.g. southlondon.cc/admin instead of admin.southlondon.cc
|
||||
|
||||
|
||||
auth:
|
||||
gitea-url: "https://tildegit.org"
|
||||
authorized-users:
|
||||
- lp0
|
2
go.mod
2
go.mod
|
@ -1,3 +1,5 @@
|
|||
module tildegit.org/southlondon/admin
|
||||
|
||||
go 1.17
|
||||
|
||||
require gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
@ -0,0 +1,57 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type ServerConfig struct {
|
||||
Name string
|
||||
Homepage string
|
||||
}
|
||||
type AdminConfig struct {
|
||||
WebRoot string
|
||||
}
|
||||
type AuthConfig struct {
|
||||
GiteaURL string
|
||||
AuthorizedUsers []string
|
||||
}
|
||||
type Config struct {
|
||||
Server ServerConfig
|
||||
Admin AdminConfig
|
||||
Auth AuthConfig
|
||||
}
|
||||
|
||||
var config = new(Config)
|
||||
|
||||
func loadConfig() (err error) {
|
||||
configfile, err := ioutil.ReadFile("config.yml")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = yaml.Unmarshal(configfile, &config)
|
||||
return err
|
||||
}
|
||||
|
||||
func main() {
|
||||
err := loadConfig()
|
||||
if err != nil {
|
||||
log.Fatal("oh no !!!")
|
||||
}
|
||||
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
|
||||
})
|
||||
|
||||
err = http.ListenAndServe(":8080", nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
color: purple;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>{ server.name } Admin Panel</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='main.css'>
|
||||
<script src='main.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
leah you better write some fucking tests this time around
|
Reference in New Issue