add https server functionality - befor auth functionality implementation

This commit is contained in:
2025-10-23 11:41:03 +06:00
parent 3e1cb1e078
commit e1bd79db8c
27 changed files with 2164 additions and 97 deletions

View File

@@ -191,12 +191,26 @@ func handleFileView(w http.ResponseWriter, r *http.Request) {
// Конвертируем Markdown в HTML
htmlContent := blackfriday.Run(content)
// Создаем HTML страницу с красивым отображением
htmlPage := fmt.Sprintf(templates.FileViewTemplate, filename, filename, string(htmlContent))
// Создаем данные для шаблона
data := struct {
Filename string
Content template.HTML
}{
Filename: filename,
Content: template.HTML(htmlContent),
}
// Парсим и выполняем шаблон
tmpl := templates.FileViewTemplate
t, err := template.New("file_view").Parse(tmpl)
if err != nil {
http.Error(w, "Ошибка шаблона", http.StatusInternalServerError)
return
}
// Устанавливаем заголовки для отображения HTML
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write([]byte(htmlPage))
t.Execute(w, data)
}
// handleDeleteFile обрабатывает удаление файла