Initial Commit

Set the base routing and base html

Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
This commit is contained in:
Pratyush Desai 2024-10-15 01:53:17 +05:30
commit d3193b92dc
Signed by: pratyush
GPG Key ID: DBA5BB7505946FAD
9 changed files with 180 additions and 0 deletions

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# GibCasa Game Server Supervisor
## Skeleton
* Stick with HL2 and HL2DM
* Set up routing
* GS Lifecycle Management and Statistics
* Concurrency - manage simultaneously events and schedule tasks.
* File Handling - configs, logs, backups and export config server
* TODO: Add auth and db stuff later. For persistent configurations.

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.com.de/gibcasa
go 1.22.7

39
main.go Normal file
View File

@ -0,0 +1,39 @@
package main
import (
"fmt"
"html/template"
"log"
"net/http"
)
func main() {
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static"))))
// Define routes
http.HandleFunc("/", homeHandler)
http.HandleFunc("/hl2", hl2Handler)
http.HandleFunc("/quake", quakeHandler)
// Start the server
fmt.Println("Server running on http://localhost:8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}
// Render the homepage
func homeHandler(w http.ResponseWriter, r *http.Request) {
tmpl := template.Must(template.ParseFiles("templates/index.xhtml"))
tmpl.Execute(w, nil)
}
// Render the Half-Life 2 page
func hl2Handler(w http.ResponseWriter, r *http.Request) {
tmpl := template.Must(template.ParseFiles("templates/hl2.xhtml"))
tmpl.Execute(w, nil)
}
// Render the Quake page
func quakeHandler(w http.ResponseWriter, r *http.Request) {
tmpl := template.Must(template.ParseFiles("templates/quake.xhtml"))
tmpl.Execute(w, nil)
}

BIN
static/hl2cover.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
static/q1cover.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

56
static/styles.css Normal file
View File

@ -0,0 +1,56 @@
body {
background-color: #1c1c1c;
color: #bfbfbf;
font-family: 'Courier New', Courier, monospace;
text-align: center;
margin: 0;
padding: 0;
}
h1 {
color: #e0b0ff; /* Rose Pine hint */
margin-top: 30px;
}
h2 {
color: #ff79c6; /* Rose Pine inspired soft magenta */
}
.container {
margin: 0 auto;
padding: 20px;
max-width: 800px;
}
.games {
display: flex;
justify-content: space-around;
margin-top: 50px;
}
.game {
margin: 20px;
}
.game img {
width: 200px;
height: 200px;
border: 2px solid #ff79c6;
}
.section {
margin: 40px 0;
padding: 20px;
background-color: #282828;
border-radius: 10px;
}
a {
color: #e0b0ff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}

22
templates/hl2.xhtml Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/static/styles.css" />
<title>Half-Life 2</title>
</head>
<body>
<div class="container">
<h1>Half-Life 2</h1>
<div class="section">
<h2>Multiplayer Server</h2>
<p>Manage or join the multiplayer servers here.</p>
</div>
<div class="section">
<h2>Coop</h2>
<p>Start or manage cooperative campaigns here.</p>
</div>
</div>
</body>
</html>

28
templates/index.xhtml Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/static/styles.css" />
<title>Game Server Manager</title>
</head>
<body>
<div class="container">
<h1>Choose Your Game</h1>
<div class="games">
<div class="game">
<a href="/hl2">
<img src="/static/hl2cover.jpeg" alt="Half-Life 2" />
<h2>Half-Life 2</h2>
</a>
</div>
<div class="game">
<a href="/quake">
<img src="/static/q1cover.jpg" alt="Quake" />
<h2>Quake</h2>
</a>
</div>
</div>
</div>
</body>
</html>

22
templates/quake.xhtml Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/static/styles.css" />
<title>Quake</title>
</head>
<body>
<div class="container">
<h1>Quake</h1>
<div class="section">
<h2>Multiplayer Server</h2>
<p>Manage or join the multiplayer servers here.</p>
</div>
<div class="section">
<h2>Coop</h2>
<p>Start or manage cooperative campaigns here.</p>
</div>
</div>
</body>
</html>