add templater

This commit is contained in:
idk
2022-01-22 00:32:39 -05:00
parent f3905a3e35
commit 239aef0bba
4 changed files with 56 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"log"
"net/http"
"path/filepath"
"strings"
@ -37,6 +38,23 @@ func NewClient(hostname string, lang string, os string, arch string) (*Client, e
return m, nil
}
func (m *Client) ServeHTTP(rw http.ResponseWriter, rq http.Request) {
path := rq.URL.Path
switch path {
case "/start-tor-browser":
case "/start-i2p-browser":
case "/start-tor":
case "/stop-tor":
default:
b, e := m.Page()
if e != nil {
fmt.Fprintf(rw, "Error: %s", e)
}
rw.Write([]byte(b))
}
rw.Write([]byte("Hello, world!"))
}
func (m *Client) generateMirrorJSON() (map[string]interface{}, error) {
if !strings.HasSuffix(m.hostname, "/") {
m.hostname += "/"