4 Commits
v0.1 ... master

Author SHA1 Message Date
Brandon4466
84b28a1790 added SSL
Some checks failed
Build bang-server / Explore-Gitea-Actions (push) Failing after 12s
2025-06-08 21:00:22 -07:00
Brandon4466
1a5b4f70a7 change referrence from brandon.ad to bangmail.org
Some checks failed
Build bang-server / Explore-Gitea-Actions (push) Failing after 10s
2025-06-08 06:04:42 -07:00
Brandon4466
d73523b9e1 tags working
Some checks failed
Build bang-server / Explore-Gitea-Actions (push) Failing after 11s
2025-06-08 02:41:23 -07:00
Brandon4466
931e4466d1 fixed workflow
All checks were successful
Build bang-server / Explore-Gitea-Actions (push) Successful in 14s
2025-06-08 02:37:11 -07:00
2 changed files with 11 additions and 5 deletions

View File

@@ -24,7 +24,6 @@ jobs:
- name: Upload to Release - name: Upload to Release
uses: https://gitea.com/actions/release-action@main uses: https://gitea.com/actions/release-action@main
with: with:
files: |- files: bang
bin/**
api_key: '${{secrets.RELEASE_TOKEN}}' api_key: '${{secrets.RELEASE_TOKEN}}'
- run: echo "This job's status is ${{ job.status }}." - run: echo "This job's status is ${{ job.status }}."

13
bang.go
View File

@@ -181,7 +181,7 @@ func receiveEmailHandler(w http.ResponseWriter, r *http.Request) {
} }
email.ID = fmt.Sprintf("%d", time.Now().UnixNano()) email.ID = fmt.Sprintf("%d", time.Now().UnixNano())
email.Timestamp = time.Now() email.Timestamp = time.Now()
if email.Domain == "brandon.ad" { if email.Domain == "bangmail.org" {
if err := saveEmail(email); err != nil { if err := saveEmail(email); err != nil {
http.Error(w, "Failed to save email", http.StatusInternalServerError) http.Error(w, "Failed to save email", http.StatusInternalServerError)
return return
@@ -331,12 +331,19 @@ func withCORS(handler http.HandlerFunc) http.HandlerFunc {
func main() { func main() {
port := flag.Int("port", 8080, "port to listen on") port := flag.Int("port", 8080, "port to listen on")
certFile := flag.String("cert", "/etc/lighttpd/ssl/cert.pem", "path to SSL certificate file")
keyFile := flag.String("key", "/etc/lighttpd/ssl/key.pem", "path to SSL key file")
flag.Parse() flag.Parse()
http.HandleFunc("/users", withCORS(createUserHandler)) http.HandleFunc("/users", withCORS(createUserHandler))
http.HandleFunc("/email", withCORS(receiveEmailHandler)) http.HandleFunc("/email", withCORS(receiveEmailHandler))
http.HandleFunc("/mailbox", withCORS(listMailboxHandler)) http.HandleFunc("/mailbox", withCORS(listMailboxHandler))
http.HandleFunc("/mailbox/open", withCORS(markEmailOpenedHandler)) http.HandleFunc("/mailbox/open", withCORS(markEmailOpenedHandler))
log.Printf("Email server running on :%d", *port) log.Printf("Email server running with SSL on :%d", *port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil)) log.Fatal(http.ListenAndServeTLS(
fmt.Sprintf(":%d", *port),
*certFile,
*keyFile,
nil,
))
} }