diff --git a/proxy/index.go b/proxy/index.go
index 675bd19..59de55e 100644
--- a/proxy/index.go
+++ b/proxy/index.go
@@ -2,262 +2,23 @@
package proxy
import (
+ "html/template"
"net/http"
)
-func ServeIndexPage(w http.ResponseWriter, r *http.Request) {
- html := `
-
-
-
-
- Secure Site Proxy
-
-
-
-
-
-
-
-
-
-
Security Features:
-
- - End-to-end encrypted connection
- - No logging of accessed URLs
- - Automatic content rewriting
- - Protection against private network access
-
-
-
-
-
-
-
-
-`
-
- w.Header().Set("Content-Type", "text/html; charset=utf-8")
- w.Write([]byte(html))
+type IndexHandler struct {
+ templates *template.Template
}
+
+func NewIndexHandler(templates *template.Template) *IndexHandler {
+ return &IndexHandler{
+ templates: templates,
+ }
+}
+
+func (h *IndexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "text/html; charset=utf-8")
+ if err := h.templates.ExecuteTemplate(w, "index.html", nil); err != nil {
+ http.Error(w, "Internal server error", http.StatusInternalServerError)
+ }
+}
\ No newline at end of file