add templater
This commit is contained in:
@ -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 += "/"
|
||||
|
Reference in New Issue
Block a user