From 7f84074fe3117614281c1e6c93af21f3333d96c1 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 16 Apr 2021 01:23:34 +0200 Subject: Added stub go server --- .gitignore | 1 + derelict.go | 40 +++++++++++++++++++++++++++++++++ go.mod | 5 +++++ go.sum | 2 ++ page.css | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ recent.tmpl | 30 +++++++++++++++++++++++++ view.tmpl | 34 ++++++++++++++++++++++++++++ 7 files changed, 187 insertions(+) create mode 100644 derelict.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 page.css create mode 100644 recent.tmpl create mode 100644 view.tmpl diff --git a/.gitignore b/.gitignore index 8691330..265df06 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__ *.json +derelict diff --git a/derelict.go b/derelict.go new file mode 100644 index 0000000..2f5e8b3 --- /dev/null +++ b/derelict.go @@ -0,0 +1,40 @@ +package main + +import ( + "embed" + "github.com/gorilla/mux" + "html/template" + "log" + "net/http" + "os" +) + +//go:embed *.json *.css *.js *.svg +var content embed.FS + +//go:embed *.tmpl +var internal embed.FS + +var templates *template.Template + +func main() { + port := os.Getenv("DERELICTPORT") + if port == "" { + port = "8080" + } + templates = template.Must(template.ParseFS(internal, "*.tmpl")) + + router := mux.NewRouter() + router.HandleFunc("/", handleRecent).Methods("GET") + router.HandleFunc("/view", handleView).Queries("id", "{id:[_0-9]+}").Methods("GET") + router.PathPrefix("/").Handler(http.FileServer(http.FS(content))) + log.Fatal(http.ListenAndServe(":"+port, router)) +} + +func handleRecent(w http.ResponseWriter, r *http.Request) { + templates.ExecuteTemplate(w, "recent", "") +} + +func handleView(w http.ResponseWriter, r *http.Request) { + templates.ExecuteTemplate(w, "view", "") +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..413e46a --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module git.ignore.pl/derelict-field + +go 1.16 + +require github.com/gorilla/mux v1.8.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..5350288 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= diff --git a/page.css b/page.css new file mode 100644 index 0000000..99e6b01 --- /dev/null +++ b/page.css @@ -0,0 +1,75 @@ +body { + background: #19191b; + color: #ccc; + font-family: sans-serif; +} + +body > * { + max-width: 42em; + margin: 0 auto; +} + +header { + text-align: center; +} + +section { + border: 1px solid #242529; + padding: 0.6em; +} + +section > :first-child { + margin-top: 0; +} + +h1 { + color: #5a5252; +} + +h2 { + background: #242529; + padding: 0.2em 0.5em; +} + +table { + width: 100%; + border: 1px solid #59595b; + padding: 0.2em; + border-spacing: 0; +} + +table td:last-child { + text-align: right; +} + +tr:hover { + background: #353331; +} + +a:link { + color: #a96e3d; +} + +a:hover { + color: #e69958; +} + +a:visited { + color: #bd402d; +} + +a:visited:hover { + color: #e44e37; +} + +a:active, +a:visited:active { + color: #e675e6; +} + +footer { + text-align: center; + color: #777; + font-size: 80%; + padding: 1em; +} \ No newline at end of file diff --git a/recent.tmpl b/recent.tmpl new file mode 100644 index 0000000..8f0a48d --- /dev/null +++ b/recent.tmpl @@ -0,0 +1,30 @@ +{{define "recent"}} + + + + + +Derelict - 3D visualizations of after the battle wreckage fields for EVE Online + +
+

DERELICT

+
+ +
+

Recent

+ +
Battle in Amamake127 wrecks3 grids2021-03-29 18:00 +
Battle in Eytjangard20 wrecks2 grids2021-03-24 18:00 +
Battle in N-RAEL8 wrecks1 grid2021-03-22 18:00 +
+

About

+

Derelict is a tool for 3D visualizations of after the battle wreckage fields for EVE Online. Main +aim of the project is to create a toolset for creators and services to present battles as 3D visualizations to their +audiences. +

+ + +{{end}} diff --git a/view.tmpl b/view.tmpl new file mode 100644 index 0000000..835d2f0 --- /dev/null +++ b/view.tmpl @@ -0,0 +1,34 @@ +{{define "view"}} + + + + + +Derelict + +
+
+
+

Derelict

+

LMB and drag in space to rotate camera.
RMB and drag in space to move camera. +

LMB wreck to open killmail.
RMB wreck to focus camera. +

Address must contain id parameter to show some wrecks. +
Currently there is no service that would offer an API to acquire battle reports, so only battles that I + uploaded manually are available as of now: +

+

I plan to address this issue. +

Grid

+ +

Timeline

+ +
+
+ +{{end}} -- cgit v1.1