diff options
Diffstat (limited to 'cmd/web/index.go')
| -rw-r--r-- | cmd/web/index.go | 121 |
1 files changed, 4 insertions, 117 deletions
diff --git a/cmd/web/index.go b/cmd/web/index.go index 3121384..b90faf8 100644 --- a/cmd/web/index.go +++ b/cmd/web/index.go @@ -3,129 +3,16 @@ package main import ( "html/template" "net/http" + _ "embed" "riedstra.dev/mitch/steam-export/steam" ) var ( - Templ = template.Must(template.New("index").Parse(` -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <link id="maincss" rel="stylesheet" href="/style.css" defer> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>Steam Game index</title> -</head> -<body> + //go:embed templates/index.html + indexTemplate string - -<nav> - <a href="/">Home</a> - {{ if .Local }} - <div style="display: block; float: right;"> - <a href="/quit">Shutdown Server / Quit</a> - </div> - {{ end }} -</nav> - -{{ if .Local }} -<script src="/main.js"></script> -<h2>Library: {{.Lib.Folder}}</h2> - -<div id="status"> - <div id="installBar" class="installBar" style="display: none;">0%</div> -</div> - -<pre><code id="message" style="display: none;"> -</code></pre> -<br /> - -<h3>About</h3> -<p> -The steam exporter is designed to let you export your steam games, either to -another local hard drive or another computer on the network. -</p> -<p> -It also allows you to import games from across the network as well if you -provide an HTTP url from which to download the game file as exported -from this application. -</p> -<p> -<a href="/steam-export-web.exe"> - You can download this application from this UI as well here. -</a> -</p> - -<p> -You can give people this link to view the library remotely and download -games from your computer: -<br /><br /> -<a href="http://{{.HostIP}}:{{.Port}}/">http://{{.HostIP}}:{{.Port}}/</a> -</p> -{{ else }} -<h2>Remote Steam library access</h2> - -<a href="/steam-export-web.exe"> - If you need this program to install the games click here. -</a> - -<p> -Right click and copy the link address to paste into your local machine -if you do not wish to store the archive or have enough space for it on -your drive. -</p> -{{ end }} - -<p> -Installed games: - -Tip: You can right click and save link as to specify a save location, e.g. -an external hard drive -</p> - -<ul> -{{ range $key, $val := .Lib.Games }} -<li> -<a href="/download/{{$key}}">{{$key}} ({{$val.GetSize}})</a> -</li> -{{ end }} -</ul> - -{{ if .Local }} -Delete a game: ( Type out exact name, case sensitive ) - -<form action="/delete" method="POST"> - <input type="text" name="name" /> - <input type="submit" value="Delete"> -</form> - -Install a game from a URL or local file path: - -<form action="/install" method="GET"> - <input type="text" name="uri" /> - <input type="submit" value="Install"> -</form> - -<p> -Note that You can also give someone a URL to install a game if they're running -this program, e.g. <br /> -http://127.0.0.1:8899/install?uri=http://my-server-ip-or-hostname/download/My Game -</p> - - -Change library path -<form action="/setLib" method="GET"> - <input type="text" name="path" /> - <input type="submit" value="Update"> -</form> -{{ end }} - -<h3>Version information</h3> -<pre><code>{{.Version}}</pre></code> - -</body> -`)) + Templ = template.Must(template.New("index").Parse(indexTemplate)) ) func index(w http.ResponseWriter, r *http.Request) { |
