diff --git a/bin/inboxer b/bin/inboxer index ccdd435..cc3730f 100755 Binary files a/bin/inboxer and b/bin/inboxer differ diff --git a/install.sh b/install.sh index 90dc85e..0dc02b9 100755 --- a/install.sh +++ b/install.sh @@ -85,8 +85,12 @@ else fi # --- Create directory structure ---------------------------------------------- +WEB_DIR="${INSTALL_DIR}/web" +TEMPLATES_DIR="${WEB_DIR}/templates" +STATIC_DIR="${WEB_DIR}/static" + info "Creating directories under ${INSTALL_DIR}..." -mkdir -p "${BIN_DIR}" "${DATA_DIR}" "${LOGS_DIR}" +mkdir -p "${BIN_DIR}" "${DATA_DIR}" "${LOGS_DIR}" "${TEMPLATES_DIR}" "${STATIC_DIR}" # --- Download helper --------------------------------------------------------- download() { @@ -129,6 +133,15 @@ download "${REPO_BASE}/bin/inboxer" "${BIN_DIR}/inboxer" 755 download "${REPO_BASE}/bin/config.yaml" "${BIN_DIR}/config.yaml" 644 download "${REPO_BASE}/bin/prompt.txt" "${BIN_DIR}/prompt.txt" 644 +# Web templates and static assets +info "Downloading web templates and static assets..." +download "${REPO_BASE}/web/templates/base.html" "${TEMPLATES_DIR}/base.html" 644 +download "${REPO_BASE}/web/templates/login.html" "${TEMPLATES_DIR}/login.html" 644 +download "${REPO_BASE}/web/templates/verify.html" "${TEMPLATES_DIR}/verify.html" 644 +download "${REPO_BASE}/web/templates/dashboard.html" "${TEMPLATES_DIR}/dashboard.html" 644 +download "${REPO_BASE}/web/templates/settings.html" "${TEMPLATES_DIR}/settings.html" 644 +download "${REPO_BASE}/web/static/style.css" "${STATIC_DIR}/style.css" 644 + # Adjust config paths for /opt/inboxer deployment info "Adjusting configuration paths for deployment..." sed -i 's|path: "bin/db.sqlite"|path: "'"${DATA_DIR}"'/db.sqlite"|' "${BIN_DIR}/config.yaml" diff --git a/src/internal/web/handlers.go b/src/internal/web/handlers.go index 6b4cb93..f3b6d1a 100644 --- a/src/internal/web/handlers.go +++ b/src/internal/web/handlers.go @@ -51,7 +51,7 @@ func parseTemplates() (map[string]*template.Template, error) { "currentYear": func() int { return time.Now().Year() }, } - templateDir := "src/web/templates" + templateDir := "web/templates" pages := []string{"login", "verify", "dashboard", "settings"} templates := make(map[string]*template.Template, len(pages)) @@ -565,7 +565,7 @@ func parseInt(s string, defaultValue int) int { // RegisterRoutes registers all HTTP routes func (h *Handler) RegisterRoutes(router *mux.Router) { // Static files - router.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("src/web/static")))) + router.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("web/static")))) // Public routes router.HandleFunc("/", h.LoginHandler).Methods("GET") diff --git a/src/web/static/style.css b/web/static/style.css similarity index 100% rename from src/web/static/style.css rename to web/static/style.css diff --git a/src/web/templates/base.html b/web/templates/base.html similarity index 100% rename from src/web/templates/base.html rename to web/templates/base.html diff --git a/src/web/templates/dashboard.html b/web/templates/dashboard.html similarity index 100% rename from src/web/templates/dashboard.html rename to web/templates/dashboard.html diff --git a/src/web/templates/login.html b/web/templates/login.html similarity index 100% rename from src/web/templates/login.html rename to web/templates/login.html diff --git a/src/web/templates/settings.html b/web/templates/settings.html similarity index 100% rename from src/web/templates/settings.html rename to web/templates/settings.html diff --git a/src/web/templates/verify.html b/web/templates/verify.html similarity index 100% rename from src/web/templates/verify.html rename to web/templates/verify.html