Compare commits
1 Commits
49bf74e692
...
d34aa2d0c9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d34aa2d0c9 |
15
external/cmd/signup/main.go
vendored
15
external/cmd/signup/main.go
vendored
@ -9,12 +9,12 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.tilde.town/tildetown/town/external/lockingwriter"
|
||||||
"git.tilde.town/tildetown/town/models"
|
"git.tilde.town/tildetown/town/models"
|
||||||
"git.tilde.town/tildetown/town/signup"
|
"git.tilde.town/tildetown/town/signup"
|
||||||
"github.com/MakeNowJust/heredoc/v2"
|
"github.com/MakeNowJust/heredoc/v2"
|
||||||
@ -25,7 +25,6 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
maxInputLength = 10000
|
maxInputLength = 10000
|
||||||
logDir = "/town/var/signups/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type scene struct {
|
type scene struct {
|
||||||
@ -148,14 +147,8 @@ func DigMX(raw string) (domains []string, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
logFile := path.Join(logDir, fmt.Sprintf("%d", time.Now().Unix()))
|
lw := lockingwriter.New()
|
||||||
logF, err := os.Create(logFile)
|
logger := log.New(lw, "signup: ", log.Ldate|log.Ltime|log.LUTC|log.Lshortfile|log.Lmsgprefix)
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintln(os.Stderr, err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
logger := log.New(logF, "", log.Ldate|log.Ltime)
|
|
||||||
|
|
||||||
db, err := signup.ConnectDB()
|
db, err := signup.ConnectDB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -242,7 +235,7 @@ func _main(l *log.Logger, db *sql.DB) error {
|
|||||||
su.Email = string(s.Input.Bytes())
|
su.Email = string(s.Input.Bytes())
|
||||||
suspiciousHosts, err := models.SuspiciousHosts(db)
|
suspiciousHosts, err := models.SuspiciousHosts(db)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// XXX: maybe log somewhere that the database failed
|
l.Println("could not connect to suspicious hosts db")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var shDomains []string
|
var shDomains []string
|
||||||
|
|||||||
@ -29,8 +29,4 @@ CREATE TABLE IF NOT EXISTS notes (
|
|||||||
CREATE TABLE IF NOT EXISTS suspicious_hosts (
|
CREATE TABLE IF NOT EXISTS suspicious_hosts (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
domain TEXT,
|
domain TEXT,
|
||||||
|
|
||||||
-- unused but worth adding instead of another migration later
|
|
||||||
common_name TEXT,
|
|
||||||
tier INTEGER,
|
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user