all repos — ports @ a8921593398f8b600e09b82a69a2c4a077785510

collection of ports for openbsd

www/inks/patches/patch-inks_go.orig (view raw)

 1Index: inks.go
 2--- inks.go.orig
 3+++ inks.go
 4@@ -44,7 +44,7 @@ var tagName = "inks,2019"
 5 
 6 func getInfo(r *http.Request) map[string]interface{} {
 7 	templinfo := make(map[string]interface{})
 8-	templinfo["StyleParam"] = getstyleparam("views/style.css")
 9+	templinfo["StyleParam"] = getstyleparam("${TRUEPREFIX}/share/${PKGSTEM}/views/style.css")
10 	templinfo["UserInfo"] = login.GetUserInfo(r)
11 	templinfo["LogoutCSRF"] = login.GetCSRF("logout", r)
12 	templinfo["ServerName"] = serverName
13@@ -323,7 +323,7 @@ func showtags(w http.ResponseWriter, r *http.Request) 
14 		w.Header().Set("Cache-Control", "max-age=300")
15 	}
16 
17-	err := readviews.Execute(w, "tags.html", templinfo)
18+	err := readviews.Execute(w, "$tags.html", templinfo)
19 	if err != nil {
20 		log.Printf("error templating inks: %s", err)
21 	}
22@@ -381,7 +381,7 @@ func showsources(w http.ResponseWriter, r *http.Reques
23 	templinfo := getInfo(r)
24 	templinfo["SaveCSRF"] = login.GetCSRF("savesource", r)
25 	templinfo["Sources"] = getsources()
26-	err := readviews.Execute(w, "sources.html", templinfo)
27+	err := readviews.Execute(w, "$sources.html", templinfo)
28 	if err != nil {
29 		log.Print(err)
30 	}
31@@ -474,7 +474,7 @@ func showrandomrss(w http.ResponseWriter, r *http.Requ
32 
33 func servecss(w http.ResponseWriter, r *http.Request) {
34 	w.Header().Set("Cache-Control", "max-age=7776000")
35-	http.ServeFile(w, r, "views"+r.URL.Path)
36+	http.ServeFile(w, r, "${are/${PKGSTEM}/views"+r.URL.Path)
37 }
38 func servehtml(w http.ResponseWriter, r *http.Request) {
39 	templinfo := getInfo(r)
40@@ -569,15 +569,15 @@ func serve() {
41 	getconfig("debug", &debug)
42 
43 	readviews = templates.Load(debug,
44-		"views/header.html",
45-		"views/inks.html",
46-		"views/tags.html",
47-		"views/addlink.html",
48-		"views/sources.html",
49-		"views/login.html",
50+		"${TRUEPREFIX}/share/${PKGSTEM}/views/header.html",
51+		"${TRUEPREFIX}/share/${PKGSTEM}/views/inks.html",
52+		"${TRUEPREFIX}/share/${PKGSTEM}/views/tags.html",
53+		"${TRUEPREFIX}/share/${PKGSTEM}/views/addlink.html",
54+		"${TRUEPREFIX}/share/${PKGSTEM}/views/sources.html",
55+		"${TRUEPREFIX}/share/${PKGSTEM}/views/login.html",
56 	)
57 	if !debug {
58-		s := "views/style.css"
59+		s := "${TRUEPREFIX}/share/${PKGSTEM}/views/style.css"
60 		savedstyleparams[s] = getstyleparam(s)
61 
62 	}