diff options
| -rw-r--r-- | www/inks/Makefile | 28 | ||||
| -rw-r--r-- | www/inks/distinfo | 2 | ||||
| -rw-r--r-- | www/inks/patches/patch-inks_go | 44 | ||||
| -rw-r--r-- | www/inks/patches/patch-inks_go.orig | 62 | ||||
| -rw-r--r-- | www/inks/patches/patch-util_go | 12 | ||||
| -rw-r--r-- | www/inks/pkg/DESCR | 3 | ||||
| -rw-r--r-- | www/inks/pkg/PLIST | 19 | ||||
| -rw-r--r-- | www/inks/pkg/README | 40 | ||||
| -rw-r--r-- | www/inks/pkg/inks.rc | 12 |
9 files changed, 222 insertions, 0 deletions
diff --git a/www/inks/Makefile b/www/inks/Makefile new file mode 100644 index 0000000..6cff61b --- /dev/null +++ b/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> diff --git a/www/inks/distinfo b/www/inks/distinfo new file mode 100644 index 0000000..c36db69 --- /dev/null +++ b/www/inks/distinfo @@ -0,0 +1,2 @@ +SHA256 (inks-0.9.2pre20230325.tar.gz) = mXhpUuI37zFY2UAN5aPxBVE4QbKwH19adwGT4TLxjPo= +SIZE (inks-0.9.2pre20230325.tar.gz) = 72207 diff --git a/www/inks/patches/patch-inks_go b/www/inks/patches/patch-inks_go new file mode 100644 index 0000000..216ed18 --- /dev/null +++ b/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) + + } diff --git a/www/inks/patches/patch-inks_go.orig b/www/inks/patches/patch-inks_go.orig new file mode 100644 index 0000000..2fe69ee --- /dev/null +++ b/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) + + } diff --git a/www/inks/patches/patch-util_go b/www/inks/patches/patch-util_go new file mode 100644 index 0000000..b3cd374 --- /dev/null +++ b/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) + } diff --git a/www/inks/pkg/DESCR b/www/inks/pkg/DESCR new file mode 100644 index 0000000..5e463ba --- /dev/null +++ b/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. diff --git a/www/inks/pkg/PLIST b/www/inks/pkg/PLIST new file mode 100644 index 0000000..9ae3dd1 --- /dev/null +++ b/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/ diff --git a/www/inks/pkg/README b/www/inks/pkg/README new file mode 100644 index 0000000..dbea6ad --- /dev/null +++ b/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). diff --git a/www/inks/pkg/inks.rc b/www/inks/pkg/inks.rc new file mode 100644 index 0000000..eee67aa --- /dev/null +++ b/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 |
