mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-08-13 14:27:27 +00:00
Feat/mail all members (#55)
* feat(mail): give every verified member a free @bbs.profullstack.com mailbox Email was built but paid-only (Founding Lifetime gate) and never wired to a running backend. Make it a free benefit of membership and split the address domain from the mail-server host. - internal/mailu: Mailu admin-API client; EnsureUser idempotently provisions a mailbox via the loopback admin REST API (token = mailu.env API_TOKEN). - main.go: auto-provision <name>@<mailDomain> at join@ verification and on first Mail open; un-gate the Mail hub entry + mail@ (membership/email-verified, not Premium); address domain (AGENTBBS_MAIL_ADDR_DOMAIN, default the BBS host) is now distinct from the mail server host (AGENTBBS_MAIL_DOMAIN) and the webmail URL. Drop the forwardemail alias path (Mailu now owns delivery for everyone). - mailbox: gate on membership (a registered handle) instead of Paid; ErrNotPaid -> ErrNotMember. - join@ copy: list email under free membership; premium now pitches custom domains + Tor only. - setup.sh / docs/mail.md / deploy/mailu: address-domain vs server-host split, Mailu API token, MX for the address domain, local-relay SMTP for verify codes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * chore(mailu): pin Docker network subnet to match SUBNET; ignore runtime state The base compose declares no network, so Docker assigns the default bridge an arbitrary subnet that won't match mailu.env SUBNET — breaking Mailu's internal service auth/relay. Add a docker-compose.override.yml.example that pins the default network to 192.168.203.0/24, and gitignore the live override + Mailu runtime state (mailu.env, certs/, data/). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * feat(mail): plaintext loopback IMAP so the gateway bypasses Mailu's front Mailu's front (nginx mail proxy) pre-authenticates against Mailu's user DB before proxying to Dovecot, which rejects the Dovecot master-user login <addr>*gateway. The gateway must reach Dovecot directly. The imap container has no TLS cert (only the front does), so the bypass is plaintext over loopback — the master password never leaves the host. - mailbox: IMAPConfig.Plaintext dials with DialInsecure (loopback only). - main.go: mailClientFor sets Plaintext from AGENTBBS_MAIL_IMAP_PLAINTEXT. - override.example: add the unbound resolver (admin needs DNSSEC), webmail image fix (2024.06 uses mailu/webmail), and publish Dovecot 143 on 127.0.0.1:14143. - docs/mail.md: document the front-bypass, the dovecot.conf master passdb (Mailu includes that exact filename), and the 644 master-users perms (640 = temp_fail). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * deploy(mailu): wire gateway IMAP to the loopback Dovecot path in setup.sh setup.sh §9e set AGENTBBS_MAIL_IMAP_ADDR to the front's :993, which the front's auth proxy rejects for the master-user login (and would clobber the working loopback wiring on every self-update). Point it at 127.0.0.1:14143 + AGENTBBS_MAIL_IMAP_PLAINTEXT=1 instead, matching the override + docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * feat(mail): give free members a webmail password at join@ The gateway opens mailboxes via the Dovecot master user (no member password), but webmail (Roundcube) needs the member to have a password. join@ now sets a fresh, readable webmail password via the Mailu API and shows it with the webmail URL + login, so free members can use webmail at mail.profullstack.com. - mailu: SetPassword (PATCH /user/<email> raw_password) + test. - main.go: setWebmailPassword + readablePassword; join@ displays url/login/password. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
de5517c000
commit
006235ce92
13 changed files with 725 additions and 164 deletions
|
|
@ -31,6 +31,7 @@ import (
|
|||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
|
@ -59,11 +60,11 @@ import (
|
|||
"github.com/profullstack/agentbbs/internal/calls"
|
||||
"github.com/profullstack/agentbbs/internal/chat"
|
||||
"github.com/profullstack/agentbbs/internal/forgejo"
|
||||
"github.com/profullstack/agentbbs/internal/forwardemail"
|
||||
"github.com/profullstack/agentbbs/internal/games"
|
||||
"github.com/profullstack/agentbbs/internal/hub"
|
||||
"github.com/profullstack/agentbbs/internal/mail"
|
||||
"github.com/profullstack/agentbbs/internal/mailbox"
|
||||
"github.com/profullstack/agentbbs/internal/mailu"
|
||||
"github.com/profullstack/agentbbs/internal/news"
|
||||
"github.com/profullstack/agentbbs/internal/payments"
|
||||
"github.com/profullstack/agentbbs/internal/plugin"
|
||||
|
|
@ -73,9 +74,9 @@ import (
|
|||
"github.com/profullstack/agentbbs/internal/store"
|
||||
"github.com/profullstack/agentbbs/internal/tor"
|
||||
"github.com/profullstack/agentbbs/plugins/about"
|
||||
"github.com/profullstack/agentbbs/plugins/hello"
|
||||
"github.com/profullstack/agentbbs/plugins/agentgames"
|
||||
"github.com/profullstack/agentbbs/plugins/arcade"
|
||||
"github.com/profullstack/agentbbs/plugins/hello"
|
||||
"github.com/profullstack/agentbbs/plugins/members"
|
||||
qryptinviteplugin "github.com/profullstack/agentbbs/plugins/qryptinvite"
|
||||
)
|
||||
|
|
@ -98,21 +99,24 @@ func envInt(k string, def int) int {
|
|||
}
|
||||
|
||||
type app struct {
|
||||
st store.Store
|
||||
pods *pods.Manager // nil when no container engine on host
|
||||
sites *sites.Manager
|
||||
registry []plugin.Plugin
|
||||
sandbox *sandbox.Runner
|
||||
mail mail.Config
|
||||
fe forwardemail.Config // premium @bbs email provisioning
|
||||
forgejo forgejo.Config // AgentGit git.profullstack.com account provisioning
|
||||
live *liveReg // in-memory live-session registry (admin console)
|
||||
gamesReg *games.Registry // AgentGames catalog
|
||||
mm *games.Matchmaker // AgentGames matchmaker (agent-vs-agent)
|
||||
dataDir string
|
||||
assets string
|
||||
host string // public hostname used in user-facing messages
|
||||
newsAddr string // loopback NNTP address the news@ reader dials
|
||||
st store.Store
|
||||
pods *pods.Manager // nil when no container engine on host
|
||||
sites *sites.Manager
|
||||
registry []plugin.Plugin
|
||||
sandbox *sandbox.Runner
|
||||
mail mail.Config
|
||||
mailu *mailu.Client // member mailbox provisioning (nil when unconfigured)
|
||||
mailDomain string // email address domain, e.g. bbs.profullstack.com
|
||||
mailHost string // mail server host (IMAP/SMTP), e.g. mail.profullstack.com
|
||||
webmailURL string // webmail (Roundcube) URL shown to members
|
||||
forgejo forgejo.Config // AgentGit git.profullstack.com account provisioning
|
||||
live *liveReg // in-memory live-session registry (admin console)
|
||||
gamesReg *games.Registry // AgentGames catalog
|
||||
mm *games.Matchmaker // AgentGames matchmaker (agent-vs-agent)
|
||||
dataDir string
|
||||
assets string
|
||||
host string // public hostname used in user-facing messages
|
||||
newsAddr string // loopback NNTP address the news@ reader dials
|
||||
}
|
||||
|
||||
// Version is the agentbbs stack release, surfaced via `agentbbs version` and
|
||||
|
|
@ -155,22 +159,28 @@ func main() {
|
|||
}
|
||||
|
||||
host := env("AGENTBBS_HOST", "bbs.profullstack.com")
|
||||
fe := forwardemail.ConfigFromEnv()
|
||||
if fe.Domain == "" {
|
||||
// Member mailboxes live on a dedicated mail subdomain (mail.profullstack.com),
|
||||
// not the BBS host and not the apex (which is reserved for corporate mail).
|
||||
fe.Domain = env("AGENTBBS_MAIL_DOMAIN", "mail.profullstack.com")
|
||||
// Member email addresses are <name>@<addr-domain> (e.g. bbs.profullstack.com).
|
||||
// The mail server (IMAP/SMTP/webmail) lives on a dedicated host
|
||||
// (mail.profullstack.com); the apex is reserved for corporate mail.
|
||||
mailHost := env("AGENTBBS_MAIL_DOMAIN", "mail.profullstack.com")
|
||||
mailDomain := env("AGENTBBS_MAIL_ADDR_DOMAIN", host)
|
||||
mailuClient := mailu.NewFromEnv()
|
||||
if !mailuClient.Configured() {
|
||||
mailuClient = nil
|
||||
}
|
||||
a := &app{
|
||||
st: st,
|
||||
sandbox: sandbox.New(sandbox.Mode(env("AGENTBBS_SANDBOX", "auto"))),
|
||||
mail: mail.ConfigFromEnv(),
|
||||
fe: fe,
|
||||
forgejo: forgejo.ConfigFromEnv(),
|
||||
live: newLiveReg(),
|
||||
dataDir: dataDir,
|
||||
assets: env("AGENTBBS_ASSETS", "./assets"),
|
||||
host: host,
|
||||
st: st,
|
||||
sandbox: sandbox.New(sandbox.Mode(env("AGENTBBS_SANDBOX", "auto"))),
|
||||
mail: mail.ConfigFromEnv(),
|
||||
mailu: mailuClient,
|
||||
mailDomain: mailDomain,
|
||||
mailHost: mailHost,
|
||||
webmailURL: env("AGENTBBS_WEBMAIL_URL", "https://"+mailHost),
|
||||
forgejo: forgejo.ConfigFromEnv(),
|
||||
live: newLiveReg(),
|
||||
dataDir: dataDir,
|
||||
assets: env("AGENTBBS_ASSETS", "./assets"),
|
||||
host: host,
|
||||
}
|
||||
a.gamesReg = games.Catalog()
|
||||
a.mm = games.NewMatchmaker(a.gamesReg, a.st,
|
||||
|
|
@ -485,19 +495,22 @@ func (a *app) sessionApps(s ssh.Session, su store.User, guest bool) []hub.Sessio
|
|||
Cmd: sessionExec{run: func() error { return a.runNews(s, su.Name) }},
|
||||
})
|
||||
|
||||
// Mail — a Founding Lifetime Member perk: the AgentMail TUI.
|
||||
// Mail — a free benefit of membership: the AgentMail TUI for your
|
||||
// <name>@<mailDomain> mailbox.
|
||||
mailLock := ""
|
||||
switch {
|
||||
case guest:
|
||||
mailLock = membersOnly
|
||||
case !su.Premium:
|
||||
mailLock = "Founding Lifetime Member feature ($99 one-time) — upgrade: ssh join@" + a.host
|
||||
case !a.mailEnabled():
|
||||
mailLock = "mail is temporarily unavailable on this host"
|
||||
}
|
||||
apps = append(apps, hub.SessionApp{
|
||||
Title: "Mail",
|
||||
Description: "your " + a.fe.Domain + " mailbox",
|
||||
Description: "your " + a.mailAddress(su.Name) + " mailbox",
|
||||
Locked: mailLock,
|
||||
Cmd: sessionExec{run: func() error {
|
||||
// Make sure the mailbox exists before opening it.
|
||||
_ = a.ensureMailbox(su)
|
||||
c, err := a.mailClientFor(su)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -612,7 +625,7 @@ func (a *app) handleJoin(s ssh.Session) {
|
|||
}, "\n"))
|
||||
|
||||
// 1) email -> emailed code -> enter code. A verified account is a free
|
||||
// member: it gets a Docker pod, IRC/news, and a /~name homepage, all from the hub.
|
||||
// member: it gets a Docker pod, a mailbox, IRC/news, and a /~name homepage.
|
||||
if !u.EmailVerified {
|
||||
if !a.verifyEmailInteractive(s, in, &u) {
|
||||
_ = s.Exit(1)
|
||||
|
|
@ -621,22 +634,41 @@ func (a *app) handleJoin(s ssh.Session) {
|
|||
a.notifySignup(u)
|
||||
}
|
||||
|
||||
// Every verified member gets a homepage at https://<host>/~<name>.
|
||||
// Every verified member gets a homepage at https://<host>/~<name> and a
|
||||
// mailbox at <name>@<mailDomain> (best-effort; mail is a bonus, never a gate).
|
||||
seedHomepage(filepath.Join(a.dataDir, "users", u.Name, "public_html"), u.Name, a.host)
|
||||
_ = a.ensureMailbox(u)
|
||||
// Give them a webmail password so free members can log into webmail. The
|
||||
// in-BBS reader uses the gateway master user and needs no password, but
|
||||
// Roundcube does. (Re)set on each join@; they can change it in webmail.
|
||||
webmailPW := a.setWebmailPassword(u)
|
||||
|
||||
wish.Println(s, "\n"+strings.Join([]string{
|
||||
includes := []string{
|
||||
" You're in. One login gets you everything — no other servers to ssh into:",
|
||||
"",
|
||||
" ssh " + u.Name + "@" + a.host,
|
||||
"",
|
||||
" Inside, free membership includes:",
|
||||
" • your own Linux pod (a full shell)",
|
||||
" • email " + a.mailAddress(u.Name) + " (pick “Mail” in the hub)",
|
||||
" • IRC chat + Usenet/news (members-only)",
|
||||
" • the arcade & games",
|
||||
" • your homepage https://" + a.host + "/~" + u.Name,
|
||||
}, "\n"))
|
||||
}
|
||||
if a.webmailURL != "" && webmailPW != "" {
|
||||
includes = append(includes,
|
||||
"",
|
||||
" Webmail (read your mail in a browser):",
|
||||
" • url "+a.webmailURL,
|
||||
" • login "+a.mailAddress(u.Name),
|
||||
" • password "+webmailPW+" (change it in webmail Settings)",
|
||||
)
|
||||
} else if a.webmailURL != "" {
|
||||
includes = append(includes, " • webmail "+a.webmailURL)
|
||||
}
|
||||
wish.Println(s, "\n"+strings.Join(includes, "\n"))
|
||||
|
||||
// 2) Founding Lifetime ($99 one-time): personal @host email + custom domains.
|
||||
// 2) Founding Lifetime ($99 one-time): custom domains + Tor shell.
|
||||
a.offerPremium(s, &u)
|
||||
_ = s.Exit(0)
|
||||
}
|
||||
|
|
@ -796,10 +828,11 @@ func (a *app) verifyEmailInteractive(s ssh.Session, in *bufio.Reader, u *store.U
|
|||
return false
|
||||
}
|
||||
|
||||
// ensurePremium upgrades *u to premium if its CoinPay charge has settled,
|
||||
// provisioning the member's @host email alias on the transition. It is silent
|
||||
// (no session output) so it is safe to call from the hub. Returns the current
|
||||
// premium state.
|
||||
// ensurePremium upgrades *u to premium if its CoinPay charge has settled. It is
|
||||
// silent (no session output) so it is safe to call from the hub. Returns the
|
||||
// current premium state. Email is no longer a premium perk — every verified
|
||||
// member gets a mailbox (see ensureMailbox) — so this only unlocks custom
|
||||
// domains and the Tor shell.
|
||||
func (a *app) ensurePremium(u *store.User) bool {
|
||||
if u.Premium {
|
||||
return true
|
||||
|
|
@ -816,33 +849,25 @@ func (a *app) ensurePremium(u *store.User) bool {
|
|||
return false
|
||||
}
|
||||
u.Premium = true
|
||||
// Create their <name>@host alias forwarding to the email they verified.
|
||||
if a.fe.Configured() && u.Email != "" {
|
||||
if err := a.fe.CreateAlias(u.Name, u.Email); err != nil {
|
||||
log.Error("forwardemail alias", "err", err, "alias", a.fe.Address(u.Name))
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// showPremiumWelcome prints a premium member's perks: their mailbox, the webmail
|
||||
// URL, the in-hub Mail/Tor entries, and custom domains.
|
||||
// showPremiumWelcome prints a premium member's perks: custom domains and the
|
||||
// in-hub Tor shell. (Email is free for all members — see the join@ summary.)
|
||||
func (a *app) showPremiumWelcome(s ssh.Session, u store.User) {
|
||||
lines := []string{
|
||||
"",
|
||||
" ★ Founding Lifetime Member — thanks! Your perks:",
|
||||
" ★ Founding Lifetime Member — thanks! Your bonus perks:",
|
||||
"",
|
||||
" mailbox " + a.fe.Address(u.Name),
|
||||
" webmail https://" + a.fe.Domain,
|
||||
" mail/tor pick “Mail” or “Tor shell” in the hub: ssh " + u.Name + "@" + a.host,
|
||||
" domains ssh domain@" + a.host + " add <yourdomain.com>",
|
||||
" tor pick “Tor shell” in the hub: ssh " + u.Name + "@" + a.host,
|
||||
"",
|
||||
}
|
||||
wish.Println(s, strings.Join(lines, "\n"))
|
||||
}
|
||||
|
||||
// offerPremium pitches the $99 Founding Lifetime membership — a personal @host email and
|
||||
// custom domains. When CoinPay can mint a charge in-session it shows the exact
|
||||
// offerPremium pitches the $99 Founding Lifetime membership — custom domains and
|
||||
// the Tor shell. When CoinPay can mint a charge in-session it shows the exact
|
||||
// amount and deposit address; otherwise it falls back to a pay command.
|
||||
// Non-blocking: the member pays out of band and perks unlock on their next
|
||||
// connect (or re-running join@).
|
||||
|
|
@ -859,9 +884,9 @@ func (a *app) offerPremium(s ssh.Session, u *store.User) {
|
|||
" ★ Founding Lifetime Member — $" + payments.PremiumAmount() + ", one-time",
|
||||
" Only the first " + payments.FoundingCap + " accounts. Pay once, keep it for life.",
|
||||
"",
|
||||
" Everything in your free membership stays free — founding adds these",
|
||||
" bonus features, forever:",
|
||||
" • your own mailbox " + a.fe.Address(u.Name) + " (webmail: https://" + a.fe.Domain + ")",
|
||||
" Everything in your free membership stays free — including your",
|
||||
" " + a.mailAddress(u.Name) + " mailbox. Founding adds these bonus",
|
||||
" features, forever:",
|
||||
" • custom domains point yourdomain.com at your homepage",
|
||||
" • Tor a “Tor shell” in your pod — everything over Tor",
|
||||
" • locked-in price founding rate is yours for life — never renew, never pay again",
|
||||
|
|
@ -1301,29 +1326,95 @@ func (a *app) runNews(s ssh.Session, name string) error {
|
|||
return news.RunReader(s, addr, name)
|
||||
}
|
||||
|
||||
// mailClientFor builds a paid-gated AgentMail client for a member, connecting to
|
||||
// the self-hosted Mailu backend. IMAP uses Dovecot master-user auth (login
|
||||
// "<name>*<master>") so the BBS gateway can open any member's mailbox with one
|
||||
// secret; SMTP defaults to the co-located relay (no auth). Returns an error if
|
||||
// the IMAP connection/login fails.
|
||||
// mailAddress is a member's email address, e.g. alice@bbs.profullstack.com.
|
||||
func (a *app) mailAddress(name string) string { return name + "@" + a.mailDomain }
|
||||
|
||||
// mailEnabled reports whether member mailboxes can be provisioned (Mailu admin
|
||||
// API configured). When false the address is still shown but not created.
|
||||
func (a *app) mailEnabled() bool { return a.mailu.Configured() }
|
||||
|
||||
// ensureMailbox provisions the member's <name>@<mailDomain> mailbox on Mailu if
|
||||
// it doesn't already exist. Idempotent and best-effort: it logs and returns the
|
||||
// error but callers treat mail as a bonus that shouldn't block onboarding. A
|
||||
// no-op when Mailu isn't configured.
|
||||
func (a *app) ensureMailbox(u store.User) error {
|
||||
if !a.mailEnabled() || u.Name == "" {
|
||||
return nil
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
if err := a.mailu.EnsureUser(ctx, u.Name, a.mailDomain); err != nil {
|
||||
log.Error("provision mailbox", "err", err, "address", a.mailAddress(u.Name))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// setWebmailPassword sets (and returns) a fresh webmail password for the member
|
||||
// so free members can log into webmail. Best-effort: returns "" when Mailu isn't
|
||||
// configured or the API call fails. The in-BBS reader doesn't use this (it goes
|
||||
// through the gateway master user); only webmail needs a member password.
|
||||
func (a *app) setWebmailPassword(u store.User) string {
|
||||
if !a.mailEnabled() || u.Name == "" {
|
||||
return ""
|
||||
}
|
||||
pw := readablePassword()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
if err := a.mailu.SetPassword(ctx, u.Name, a.mailDomain, pw); err != nil {
|
||||
log.Error("set webmail password", "err", err, "address", a.mailAddress(u.Name))
|
||||
return ""
|
||||
}
|
||||
return pw
|
||||
}
|
||||
|
||||
// readablePassword returns a 16-char password from an unambiguous alphabet (no
|
||||
// 0/O/1/l/I) — easy to read off a terminal once and type into webmail.
|
||||
func readablePassword() string {
|
||||
const alphabet = "abcdefghijkmnpqrstuvwxyzACDEFGHJKLMNPQRSTUVWXYZ23456789"
|
||||
var b [16]byte
|
||||
if _, err := rand.Read(b[:]); err != nil {
|
||||
// Fall back to a hex token; correctness over readability.
|
||||
var f [12]byte
|
||||
_, _ = rand.Read(f[:])
|
||||
return hex.EncodeToString(f[:])
|
||||
}
|
||||
for i := range b {
|
||||
b[i] = alphabet[int(b[i])%len(alphabet)]
|
||||
}
|
||||
return string(b[:])
|
||||
}
|
||||
|
||||
// mailClientFor builds an AgentMail client for a member, connecting to the
|
||||
// self-hosted Mailu backend. IMAP uses Dovecot master-user auth (login
|
||||
// "<addr>*<master>") so the BBS gateway can open any member's mailbox with one
|
||||
// secret; SMTP defaults to the co-located relay (no auth). The client stamps
|
||||
// outgoing mail with the member's <name>@<mailDomain> address. Returns an error
|
||||
// if the IMAP connection/login fails.
|
||||
func (a *app) mailClientFor(su store.User) (*mailbox.Client, error) {
|
||||
domain := env("AGENTBBS_MAIL_DOMAIN", "mail.profullstack.com")
|
||||
login := su.Name
|
||||
// Mailu keys mailboxes by full address, so the IMAP login (and the master
|
||||
// login "<addr>*<master>") must use the address, not the bare handle.
|
||||
login := a.mailAddress(su.Name)
|
||||
if master := os.Getenv("AGENTBBS_MAIL_MASTER_USER"); master != "" {
|
||||
login = su.Name + "*" + master
|
||||
login = a.mailAddress(su.Name) + "*" + master
|
||||
}
|
||||
cfg := mailbox.IMAPConfig{
|
||||
IMAPAddr: env("AGENTBBS_MAIL_IMAP_ADDR", domain+":993"),
|
||||
IMAPAddr: env("AGENTBBS_MAIL_IMAP_ADDR", a.mailHost+":993"),
|
||||
SMTPAddr: env("AGENTBBS_MAIL_SMTP_ADDR", "127.0.0.1:25"),
|
||||
Username: login,
|
||||
Password: os.Getenv("AGENTBBS_MAIL_MASTER_PASS"),
|
||||
// Mailu's front nginx pre-authenticates against its user DB before
|
||||
// proxying, which rejects the "<addr>*master" master login. The gateway
|
||||
// therefore talks to Dovecot directly over loopback (plaintext, on-host)
|
||||
// when AGENTBBS_MAIL_IMAP_PLAINTEXT=1. See docs/mail.md.
|
||||
Plaintext: os.Getenv("AGENTBBS_MAIL_IMAP_PLAINTEXT") == "1",
|
||||
// SMTPUser/SMTPPass left empty: submit via the trusted local relay.
|
||||
}
|
||||
tr, err := mailbox.NewIMAPTransport(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mailbox.NewClient(tr, mailbox.Identity{Name: su.Name, Paid: su.Premium}, domain, 50), nil
|
||||
return mailbox.NewClient(tr, mailbox.Identity{Name: su.Name, Paid: su.Premium}, a.mailDomain, 50), nil
|
||||
}
|
||||
|
||||
// handleMail routes a Founding Lifetime member into AgentMail: an interactive
|
||||
|
|
@ -1347,11 +1438,18 @@ func (a *app) handleMail(s ssh.Session) {
|
|||
_ = s.Exit(1)
|
||||
return
|
||||
}
|
||||
if !a.ensurePremium(&u) {
|
||||
wish.Println(s, " mail is a Founding Lifetime Member feature ($99 one-time). Upgrade: ssh join@"+a.host)
|
||||
if !u.EmailVerified {
|
||||
wish.Println(s, " verify your email first: ssh -t join@"+a.host)
|
||||
_ = s.Exit(1)
|
||||
return
|
||||
}
|
||||
if !a.mailEnabled() {
|
||||
wish.Println(s, " mail is temporarily unavailable on this host.")
|
||||
_ = s.Exit(1)
|
||||
return
|
||||
}
|
||||
// Mail is a free benefit of membership — make sure the mailbox exists.
|
||||
_ = a.ensureMailbox(u)
|
||||
sessID, _ := a.st.RecordSession(u.ID, s.User(), remoteIP(s), "mail")
|
||||
defer func() { _ = a.st.EndSession(sessID) }()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue