add serialmail
This commit is contained in:
parent
3f5911d180
commit
c99418a24a
6 changed files with 156 additions and 0 deletions
24
serialmail-git/.SRCINFO
Normal file
24
serialmail-git/.SRCINFO
Normal file
|
@ -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
|
4
serialmail-git/.gitignore
vendored
Normal file
4
serialmail-git/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/alps/
|
||||
/serialmail/
|
||||
/pkg/
|
||||
/src/
|
52
serialmail-git/PKGBUILD
Normal file
52
serialmail-git/PKGBUILD
Normal file
|
@ -0,0 +1,52 @@
|
|||
# Maintainer: Lain Iwakura <lain@serialexperiments.club>
|
||||
|
||||
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
|
||||
}
|
4
serialmail-git/serialmail.conf
Normal file
4
serialmail-git/serialmail.conf
Normal file
|
@ -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"
|
57
serialmail-git/serialmail.patch
Normal file
57
serialmail-git/serialmail.patch
Normal file
|
@ -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...] <upstream servers...>\n")
|
||||
+ fmt.Fprintf(flag.CommandLine.Output(), "usage: serialmail [options...] <upstream servers...>\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)
|
15
serialmail-git/serialmail.service
Normal file
15
serialmail-git/serialmail.service
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue