www/inks: add 0.9.2pre20230325 this is not a real version, but since there were no releases for some time, i packaged the latest tip of mercurial repository and put it on my webserver.
la-ninpre aaoth@aaoth.xyz
Thu, 27 Apr 2023 01:02:53 +0300
9 files changed,
222 insertions(+),
0 deletions(-)
A
www/inks/Makefile
@@ -0,0 +1,28 @@
+COMMENT = simple link aggregator +DISTNAME = inks-0.9.2pre20230325 +CATEGORIES = www +MAINTAINER = la ninpre <aaoth@aaoth.xyz> + +HOMEPAGE = https://humungus.tedunangst.com/r/inks +MASTER_SITES = https://aaoth.xyz/files/ + +# ISC +PERMIT_PACKAGE = Yes + +WANTLIB += c pthread sqlite3 +LIB_DEPENDS = databases/sqlite3 + +MODULES = lang/go +ALL_TARGET = humungus.tedunangst.com/r/inks + +pre-build: + ${SUBST_CMD} ${WRKSRC}/inks.go ${WRKSRC}/util.go + +do-install: + ${INSTALL_PROGRAM} ${MODGO_WORKSPACE}/bin/inks ${PREFIX}/bin/inks + ${INSTALL_DATA_DIR} ${PREFIX}/share/inks +.for _d in views schema.sql + cp -Rp ${WRKSRC}/${_d} ${PREFIX}/share/inks +.endfor + +.include <bsd.port.mk>
A
www/inks/distinfo
@@ -0,0 +1,2 @@
+SHA256 (inks-0.9.2pre20230325.tar.gz) = mXhpUuI37zFY2UAN5aPxBVE4QbKwH19adwGT4TLxjPo= +SIZE (inks-0.9.2pre20230325.tar.gz) = 72207
A
www/inks/patches/patch-inks_go
@@ -0,0 +1,44 @@
+Index: inks.go +--- inks.go.orig ++++ inks.go +@@ -44,7 +44,7 @@ var tagName = "inks,2019" + + func getInfo(r *http.Request) map[string]interface{} { + templinfo := make(map[string]interface{}) +- templinfo["StyleParam"] = getstyleparam("views/style.css") ++ templinfo["StyleParam"] = getstyleparam("${TRUEPREFIX}/share/${PKGSTEM}/views/style.css") + templinfo["UserInfo"] = login.GetUserInfo(r) + templinfo["LogoutCSRF"] = login.GetCSRF("logout", r) + templinfo["ServerName"] = serverName +@@ -474,7 +474,7 @@ func showrandomrss(w http.ResponseWriter, r *http.Requ + + func servecss(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Cache-Control", "max-age=7776000") +- http.ServeFile(w, r, "views"+r.URL.Path) ++ http.ServeFile(w, r, "${TRUEPREFIX}/share/${PKGSTEM}/views"+r.URL.Path) + } + func servehtml(w http.ResponseWriter, r *http.Request) { + templinfo := getInfo(r) +@@ -569,15 +569,15 @@ func serve() { + getconfig("debug", &debug) + + readviews = templates.Load(debug, +- "views/header.html", +- "views/inks.html", +- "views/tags.html", +- "views/addlink.html", +- "views/sources.html", +- "views/login.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/header.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/inks.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/tags.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/addlink.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/sources.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/login.html", + ) + if !debug { +- s := "views/style.css" ++ s := "${TRUEPREFIX}/share/${PKGSTEM}/views/style.css" + savedstyleparams[s] = getstyleparam(s) + + }
A
www/inks/patches/patch-inks_go.orig
@@ -0,0 +1,62 @@
+Index: inks.go +--- inks.go.orig ++++ inks.go +@@ -44,7 +44,7 @@ var tagName = "inks,2019" + + func getInfo(r *http.Request) map[string]interface{} { + templinfo := make(map[string]interface{}) +- templinfo["StyleParam"] = getstyleparam("views/style.css") ++ templinfo["StyleParam"] = getstyleparam("${TRUEPREFIX}/share/${PKGSTEM}/views/style.css") + templinfo["UserInfo"] = login.GetUserInfo(r) + templinfo["LogoutCSRF"] = login.GetCSRF("logout", r) + templinfo["ServerName"] = serverName +@@ -323,7 +323,7 @@ func showtags(w http.ResponseWriter, r *http.Request) + w.Header().Set("Cache-Control", "max-age=300") + } + +- err := readviews.Execute(w, "tags.html", templinfo) ++ err := readviews.Execute(w, "$tags.html", templinfo) + if err != nil { + log.Printf("error templating inks: %s", err) + } +@@ -381,7 +381,7 @@ func showsources(w http.ResponseWriter, r *http.Reques + templinfo := getInfo(r) + templinfo["SaveCSRF"] = login.GetCSRF("savesource", r) + templinfo["Sources"] = getsources() +- err := readviews.Execute(w, "sources.html", templinfo) ++ err := readviews.Execute(w, "$sources.html", templinfo) + if err != nil { + log.Print(err) + } +@@ -474,7 +474,7 @@ func showrandomrss(w http.ResponseWriter, r *http.Requ + + func servecss(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Cache-Control", "max-age=7776000") +- http.ServeFile(w, r, "views"+r.URL.Path) ++ http.ServeFile(w, r, "${are/${PKGSTEM}/views"+r.URL.Path) + } + func servehtml(w http.ResponseWriter, r *http.Request) { + templinfo := getInfo(r) +@@ -569,15 +569,15 @@ func serve() { + getconfig("debug", &debug) + + readviews = templates.Load(debug, +- "views/header.html", +- "views/inks.html", +- "views/tags.html", +- "views/addlink.html", +- "views/sources.html", +- "views/login.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/header.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/inks.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/tags.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/addlink.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/sources.html", ++ "${TRUEPREFIX}/share/${PKGSTEM}/views/login.html", + ) + if !debug { +- s := "views/style.css" ++ s := "${TRUEPREFIX}/share/${PKGSTEM}/views/style.css" + savedstyleparams[s] = getstyleparam(s) + + }
A
www/inks/patches/patch-util_go
@@ -0,0 +1,12 @@
+Index: util.go +--- util.go.orig ++++ util.go +@@ -74,7 +74,7 @@ var dbname = "inks.db" + var stmtConfig *sql.Stmt + + func initdb() { +- schema, err := ioutil.ReadFile("schema.sql") ++ schema, err := ioutil.ReadFile("${TRUEPREFIX}/share/${PKGSTEM}/schema.sql") + if err != nil { + log.Fatal(err) + }
A
www/inks/pkg/DESCR
@@ -0,0 +1,3 @@
+Simple link aggregator with rss and activitypub support. +Can be used locally or deployed remotely and served via +a reverse proxy.
A
www/inks/pkg/PLIST
@@ -0,0 +1,19 @@
+@newgroup _inks:1102 +@newuser _inks:1102:_inks::Inks Account:/var/inks:/bin/sh +@rcscript ${RCDIR}/inks +@bin bin/inks +share/doc/pkg-readmes/${PKGSTEM} +share/inks/ +share/inks/schema.sql +share/inks/views/ +share/inks/views/addlink.html +share/inks/views/header.html +share/inks/views/inks.html +share/inks/views/login.html +share/inks/views/sources.html +share/inks/views/style.css +share/inks/views/tags.html +@mode 750 +@owner _inks +@group _inks +@sample ${LOCALSTATEDIR}/inks/
A
www/inks/pkg/README
@@ -0,0 +1,40 @@
++----------------------------------------------------------------------- +| Running ${PKGSTEM} on OpenBSD ++----------------------------------------------------------------------- + +Inks requires a working reverse proxy and https to work properly. +Before following this guide, acquire a domain and a certificate for it +(for example, using acme-client(1)). + +Then, initialize the database: + +$ doas su -l _inks -c 'inks init' + +Then type in username, password, listen address and a site name. +The latter should be the same as your desired domain. + +Enable and start the inks service: + +$ doas rcctl enable inks && doas rcctl start inks + +Configure relayd(8) to forward incoming connections to local endpoint +you specified at initialization step. + +Here is an example relayd(8) config: + +``` relayd.conf +table <inks> { 127.0.0.1 } + +http protocol www { + tls keypair example.com + pass request forward to <inks> +} + +relay www { + listen on egress port 443 tls + protocol www + forward to <inks> port 1268 +} +``` + +Then enable and start relayd(8).
A
www/inks/pkg/inks.rc
@@ -0,0 +1,12 @@
+#!/bin/ksh + +daemon="${TRUEPREFIX}/bin/inks" +daemon_user="_inks" +daemon_logger="daemon.info" + +. /etc/rc.d/rc.subr + +rc_bg=YES +rc_reload=NO + +rc_cmd $1