diff --git a/serialmail-git/.SRCINFO b/serialmail-git/.SRCINFO new file mode 100644 index 0000000..0baaf53 --- /dev/null +++ b/serialmail-git/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = serialmail-git + pkgdesc = SerialMail Client and Server + pkgver = r23.08368aa + pkgrel = 1 + url = https://mail.serialexperiments.club + arch = x86_64 + license = MIT + makedepends = git + makedepends = go + depends = glibc + options = !lto + backup = etc/serialmail.conf + source = serialmail::git+ssh://git@git.serialexperiments.club/lain/SerialMail + source = alps::git+https://git.sr.ht/~migadu/alps + source = serialmail.conf + source = serialmail.service + source = serialmail.patch + sha256sums = SKIP + sha256sums = SKIP + sha256sums = 6536775eff65350cbadd3fb5611bfe52e85ad0c2e3ddb167a8b3905dc7c31fee + sha256sums = 216d06349704b33ac45307e0f329e43e90643462b1d8cd2f567cf1976d9d0d7a + sha256sums = c40cdd8f1a0557bbf91ee8ba3d6a244fb4191bb39172bbdad247677b41fcc051 + +pkgname = serialmail-git diff --git a/serialmail-git/.gitignore b/serialmail-git/.gitignore new file mode 100644 index 0000000..e54f445 --- /dev/null +++ b/serialmail-git/.gitignore @@ -0,0 +1,4 @@ +/alps/ +/serialmail/ +/pkg/ +/src/ diff --git a/serialmail-git/PKGBUILD b/serialmail-git/PKGBUILD new file mode 100644 index 0000000..6dcc5ca --- /dev/null +++ b/serialmail-git/PKGBUILD @@ -0,0 +1,52 @@ +# Maintainer: Lain Iwakura + +pkgname=serialmail-git +pkgver=r23.08368aa +pkgrel=1 +license=('MIT') +pkgdesc="SerialMail Client and Server" +depends=('glibc') +makedepends=('git' 'go') +options=('!lto') +arch=('x86_64') +url="https://mail.serialexperiments.club" +backup=("etc/serialmail.conf") +source=( + "serialmail::git+ssh://git@git.serialexperiments.club/lain/SerialMail" + "alps::git+https://git.sr.ht/~migadu/alps" + "serialmail.conf" + "serialmail.service" + "serialmail.patch" +) +sha256sums=('SKIP' + 'SKIP' + '6536775eff65350cbadd3fb5611bfe52e85ad0c2e3ddb167a8b3905dc7c31fee' + '216d06349704b33ac45307e0f329e43e90643462b1d8cd2f567cf1976d9d0d7a' + 'c40cdd8f1a0557bbf91ee8ba3d6a244fb4191bb39172bbdad247677b41fcc051') + +pkgver() { + cd serialmail + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd alps + patch -p1 < ../serialmail.patch +} + +build() { + cd alps + export GOFLAGS="-buildmode=pie -trimpath -modcacherw" + go build -o serialmail ./cmd/alps +} + +package() { + mkdir -p "$pkgdir"/var/www/serialmail/lain/ + cp -dR serialmail/* "$pkgdir"/var/www/serialmail/lain/ + mkdir -p "$pkgdir"/usr/lib/serialmail/ + cp -dR alps/plugins "$pkgdir"/usr/lib/serialmail/ + install -Dm755 alps/serialmail "$pkgdir"/usr/bin/serialmail + install -Dm644 serialmail.conf "$pkgdir"/etc/serialmail.conf + install -Dm644 serialmail.service "$pkgdir"/usr/lib/systemd/system/serialmail.service + install -Dm644 serialmail/LICENSE "$pkgdir"/usr/share/licenses/serialmail/LICENSE +} diff --git a/serialmail-git/serialmail.conf b/serialmail-git/serialmail.conf new file mode 100644 index 0000000..769c172 --- /dev/null +++ b/serialmail-git/serialmail.conf @@ -0,0 +1,4 @@ +ADDR="localhost:1323" +LOGIN_KEY="your-secret-key" +IMAP_SERVER="imaps://imap.serialexperiments.club:993" +SMTP_SERVER="smtps://smtp.serialexperiments.club:465" diff --git a/serialmail-git/serialmail.patch b/serialmail-git/serialmail.patch new file mode 100644 index 0000000..bf4840e --- /dev/null +++ b/serialmail-git/serialmail.patch @@ -0,0 +1,57 @@ +--- a/cmd/alps/main.go ++++ b/cmd/alps/main.go +@@ -23,21 +23,18 @@ import ( + _ "git.sr.ht/~migadu/alps/plugins/viewtext" + ) + +-var themesPath = "./themes" +- + func main() { + var ( + addr string + loginKey string + options alps.Options + ) +- flag.StringVar(&options.Theme, "theme", "", "default theme") + flag.StringVar(&addr, "addr", ":1323", "listening address") + flag.BoolVar(&options.Debug, "debug", false, "enable debug logs") + flag.StringVar(&loginKey, "login-key", "", "Fernet key for login persistence") + + flag.Usage = func() { +- fmt.Fprintf(flag.CommandLine.Output(), "usage: alps [options...] \n") ++ fmt.Fprintf(flag.CommandLine.Output(), "usage: serialmail [options...] \n") + flag.PrintDefaults() + } + +@@ -48,7 +45,8 @@ func main() { + flag.Usage() + return + } +- options.ThemesPath = themesPath ++ options.ThemesPath = "/var/www/serialmail" ++ options.Theme = "lain" + + if loginKey != "" { + fernetKey, err := fernet.DecodeKey(loginKey) +--- a/plugin.go ++++ b/plugin.go +@@ -7,7 +7,7 @@ import ( + ) + + // PluginDir is the path to the plugins directory. +-const PluginDir = "plugins" ++const PluginDir = "/usr/lib/serialmail/plugins" + + // Plugin extends alps with additional functionality. + type Plugin interface { +--- a/server.go ++++ b/server.go +@@ -423,7 +423,7 @@ func New(e *echo.Echo, options *Options) (*Server, error) { + return func(ectx echo.Context) error { + // `style-src 'unsafe-inline'` is required for e-mails with + // embedded stylesheets +- ectx.Response().Header().Set("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'") ++ ectx.Response().Header().Set("Content-Security-Policy", "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src *") + // DNS prefetching has privacy implications + ectx.Response().Header().Set("X-DNS-Prefetch-Control", "off") + return next(ectx) diff --git a/serialmail-git/serialmail.service b/serialmail-git/serialmail.service new file mode 100644 index 0000000..62f2d82 --- /dev/null +++ b/serialmail-git/serialmail.service @@ -0,0 +1,15 @@ +[Unit] +Description=SerialMail Server +After=network.target +Wants=network-online.target + +[Service] +DynamicUser=yes +User=serialmail +Group=serialmail +EnvironmentFile=/etc/serialmail.conf +ExecStart=/usr/bin/serialmail -addr $ADDR -login-key $LOGIN_KEY $IMAP_SERVER $SMTP_SERVER +Restart=on-failure + +[Install] +WantedBy=multi-user.target