// Timeline handlers
// Copyright (C) 2021 Ngô Ngọc Đức Huy
//
// This file is part of Yue.
//
// Yue is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Yue is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Yue. If not, see <https://www.gnu.org/licenses/>.
package main
import (
"html/template"
"log"
"net/http"
)
// Handler for home timeline
func HomeTimeline(w http.ResponseWriter, r *http.Request) {
files := []string{
"./templates/dynamic/home.tmpl",
"./templates/base.tmpl",
"./templates/partials/head.tmpl",
}
tmpl, err := template.ParseFiles(files...)
if err != nil {
log.Println(err.Error())
http.Error(w, "Internal Server Error", 500)
return
}
err = tmpl.Execute(w, nil)
if err != nil {
log.Println(err.Error())
http.Error(w, "Internal Server Error", 500)
}
}