Compare commits

..

1 Commits

Author SHA1 Message Date
aoife cassidy
d34aa2d0c9
add suspicious_hosts table to signups.sql 2025-11-29 15:46:47 +01:00
2 changed files with 4 additions and 15 deletions

View File

@ -9,12 +9,12 @@ import (
"log"
"net"
"os"
"path"
"regexp"
"slices"
"strings"
"time"
"git.tilde.town/tildetown/town/external/lockingwriter"
"git.tilde.town/tildetown/town/models"
"git.tilde.town/tildetown/town/signup"
"github.com/MakeNowJust/heredoc/v2"
@ -25,7 +25,6 @@ import (
const (
maxInputLength = 10000
logDir = "/town/var/signups/log"
)
type scene struct {
@ -148,14 +147,8 @@ func DigMX(raw string) (domains []string, err error) {
}
func main() {
logFile := path.Join(logDir, fmt.Sprintf("%d", time.Now().Unix()))
logF, err := os.Create(logFile)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
logger := log.New(logF, "", log.Ldate|log.Ltime)
lw := lockingwriter.New()
logger := log.New(lw, "signup: ", log.Ldate|log.Ltime|log.LUTC|log.Lshortfile|log.Lmsgprefix)
db, err := signup.ConnectDB()
if err != nil {
@ -242,7 +235,7 @@ func _main(l *log.Logger, db *sql.DB) error {
su.Email = string(s.Input.Bytes())
suspiciousHosts, err := models.SuspiciousHosts(db)
if err != nil {
// XXX: maybe log somewhere that the database failed
l.Println("could not connect to suspicious hosts db")
return
}
var shDomains []string

View File

@ -29,8 +29,4 @@ CREATE TABLE IF NOT EXISTS notes (
CREATE TABLE IF NOT EXISTS suspicious_hosts (
id INTEGER PRIMARY KEY,
domain TEXT,
-- unused but worth adding instead of another migration later
common_name TEXT,
tier INTEGER,
)