summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--derelict.go40
-rw-r--r--go.mod5
-rw-r--r--go.sum2
-rw-r--r--page.css75
-rw-r--r--recent.tmpl30
-rw-r--r--view.tmpl34
7 files changed, 187 insertions, 0 deletions
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"}}
+<!doctype html>
+<html lang="en">
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<link rel="stylesheet" type="text/css" href="/page.css">
+<title>Derelict - 3D visualizations of after the battle wreckage fields for EVE Online</title>
+
+<header>
+<h1>DERELICT</h1>
+</header>
+
+<section>
+<h2>Recent</h2>
+<table>
+ <tr><td><a href="#">Battle in Amamake</a><td>127 wrecks<td>3 grids<td>2021-03-29 18:00
+ <tr><td><a href="#">Battle in Eytjangard</a><td>20 wrecks<td>2 grids<td>2021-03-24 18:00
+ <tr><td><a href="#">Battle in N-RAEL</a><td>8 wrecks<td>1 grid<td>2021-03-22 18:00
+</table>
+<h2>About</h2>
+<p><strong>Derelict</strong> 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.
+</section>
+
+<footer>
+Hosted and developed by <a href="https://ignore.pl">ignore.pl</a><br>
+<a href="https://git.ignore.pl/derelict/tree/NOTICE">Copyright notice</a>
+</footer>
+{{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"}}
+<!doctype html>
+<html lang="en">
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+<link rel="stylesheet" type="text/css" href="/style.css">
+<title>Derelict</title>
+<body>
+<div id="wrapper">
+ <div id="container"></div>
+ <div id="toolbar">
+ <h1>Derelict</h1>
+ <p>LMB and drag in space to rotate camera.<br>RMB and drag in space to move camera.
+ <p>LMB wreck to open killmail.<br>RMB wreck to focus camera.
+ <p>Address must contain <code>id</code> parameter to show some wrecks.
+ <br>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:
+ <ul>
+ <li><a href="?id=30002016_202012141900">Random nano gang</a>
+ <li><a href="?id=30002537_202104060300">Battle in Amamake</a>
+ <li><a href="?id=31000376_202103301800">Another nano gang</a>
+ <li><a href="?id=31001761_202012040000">Foxholers eviction defense</a>
+ <li><a href="?id=31000488_202104142200">Fight in J123450</a>
+ <li><a href="?id=30002134_202104152000">French fries nano</a>
+ </ul>
+ <p>I plan to address this issue.
+ <h2>Grid</h2>
+ <select id="grid"></select>
+ <h2>Timeline</h2>
+ <input type="range" id="timeline">
+ </div>
+</div>
+<script type="module" src="/derelict.js"></script>
+{{end}}