diff --git a/public/timemachine/dither-gradient.afphoto b/public/timemachine/dither-gradient.afphoto new file mode 100644 index 00000000..9ba58fb1 Binary files /dev/null and b/public/timemachine/dither-gradient.afphoto differ diff --git a/public/timemachine/ipodtouch-dither.gif b/public/timemachine/ipodtouch-dither.gif new file mode 100644 index 00000000..be2050f1 Binary files /dev/null and b/public/timemachine/ipodtouch-dither.gif differ diff --git a/public/timemachine/ipodtouch.png b/public/timemachine/ipodtouch.png new file mode 100644 index 00000000..20fbfb44 Binary files /dev/null and b/public/timemachine/ipodtouch.png differ diff --git a/public/timemachine/opengraph.png b/public/timemachine/opengraph.png new file mode 100644 index 00000000..e7a7af9a Binary files /dev/null and b/public/timemachine/opengraph.png differ diff --git a/public/timemachine/splash.gif b/public/timemachine/splash.gif new file mode 100644 index 00000000..5aeb0c22 Binary files /dev/null and b/public/timemachine/splash.gif differ diff --git a/public/timemachine/twittercard.png b/public/timemachine/twittercard.png new file mode 100644 index 00000000..db5bc13f Binary files /dev/null and b/public/timemachine/twittercard.png differ diff --git a/src/email/email.go b/src/email/email.go index 918a5899..7021f898 100644 --- a/src/email/email.go +++ b/src/email/email.go @@ -91,6 +91,41 @@ func SendPasswordReset(toAddress string, toName string, username string, resetTo return nil } +type TimeMachineEmailData struct { + ProfileUrl string + Username string + UserEmail string + DiscordUsername string + MediaUrl string + DeviceInfo string + Description string +} + +func SendTimeMachineEmail(profileUrl, username, userEmail, discordUsername, mediaUrl, deviceInfo, description string, perf *perf.RequestPerf) error { + perf.StartBlock("EMAIL", "Time machine email") + defer perf.EndBlock() + + contents, err := renderTemplate("email_time_machine.html", TimeMachineEmailData{ + ProfileUrl: profileUrl, + Username: username, + UserEmail: userEmail, + DiscordUsername: discordUsername, + MediaUrl: mediaUrl, + DeviceInfo: deviceInfo, + Description: description, + }) + if err != nil { + return err + } + + err = sendMail("team@handmade.network", "HMN Team", "[time machine] New submission", contents) + if err != nil { + return oops.New(err, "Failed to send email") + } + + return nil +} + var EmailRegex = regexp.MustCompile(`^[^:\p{Cc} ]+@[^:\p{Cc} ]+\.[^:\p{Cc} ]+$`) func IsEmail(address string) bool { diff --git a/src/hmnurl/urls.go b/src/hmnurl/urls.go index a1fae055..9a7cbd17 100644 --- a/src/hmnurl/urls.go +++ b/src/hmnurl/urls.go @@ -105,6 +105,27 @@ func BuildJamFeed2022() string { return Url("/jam/2022/feed", nil) } +var RegexTimeMachine = regexp.MustCompile("^/timemachine$") + +func BuildTimeMachine() string { + defer CatchPanic() + return Url("/timemachine", nil) +} + +var RegexTimeMachineForm = regexp.MustCompile("^/timemachine/submit$") + +func BuildTimeMachineForm() string { + defer CatchPanic() + return Url("/timemachine/submit", nil) +} + +var RegexTimeMachineFormDone = regexp.MustCompile("^/timemachine/thanks$") + +func BuildTimeMachineFormDone() string { + defer CatchPanic() + return Url("/timemachine/thanks", nil) +} + // QUESTION(ben): Can we change these routes? var RegexLoginAction = regexp.MustCompile("^/login$") diff --git a/src/templates/svg/appleinc.svg b/src/templates/img/appleinc.svg similarity index 100% rename from src/templates/svg/appleinc.svg rename to src/templates/img/appleinc.svg diff --git a/src/templates/svg/chevron-down-thick.svg b/src/templates/img/chevron-down-thick.svg similarity index 100% rename from src/templates/svg/chevron-down-thick.svg rename to src/templates/img/chevron-down-thick.svg diff --git a/src/templates/svg/chevron-down.svg b/src/templates/img/chevron-down.svg similarity index 100% rename from src/templates/svg/chevron-down.svg rename to src/templates/img/chevron-down.svg diff --git a/src/templates/svg/chevron-left.svg b/src/templates/img/chevron-left.svg similarity index 100% rename from src/templates/svg/chevron-left.svg rename to src/templates/img/chevron-left.svg diff --git a/src/templates/svg/chevron-right.svg b/src/templates/img/chevron-right.svg similarity index 100% rename from src/templates/svg/chevron-right.svg rename to src/templates/img/chevron-right.svg diff --git a/src/templates/svg/close.svg b/src/templates/img/close.svg similarity index 100% rename from src/templates/svg/close.svg rename to src/templates/img/close.svg diff --git a/src/templates/svg/discord.svg b/src/templates/img/discord.svg similarity index 100% rename from src/templates/svg/discord.svg rename to src/templates/img/discord.svg diff --git a/src/templates/svg/google.svg b/src/templates/img/google.svg similarity index 100% rename from src/templates/svg/google.svg rename to src/templates/img/google.svg diff --git a/src/templates/svg/hmn_circuit.svg b/src/templates/img/hmn_circuit.svg similarity index 100% rename from src/templates/svg/hmn_circuit.svg rename to src/templates/img/hmn_circuit.svg diff --git a/src/templates/svg/spotify.svg b/src/templates/img/spotify.svg similarity index 100% rename from src/templates/svg/spotify.svg rename to src/templates/img/spotify.svg diff --git a/src/templates/img/timemachine/win95-border-btn-pressed.gif b/src/templates/img/timemachine/win95-border-btn-pressed.gif new file mode 100644 index 00000000..b343fed0 Binary files /dev/null and b/src/templates/img/timemachine/win95-border-btn-pressed.gif differ diff --git a/src/templates/img/timemachine/win95-border-btn.gif b/src/templates/img/timemachine/win95-border-btn.gif new file mode 100644 index 00000000..56dabe73 Binary files /dev/null and b/src/templates/img/timemachine/win95-border-btn.gif differ diff --git a/src/templates/img/timemachine/win95-border-input.gif b/src/templates/img/timemachine/win95-border-input.gif new file mode 100644 index 00000000..9a7500a0 Binary files /dev/null and b/src/templates/img/timemachine/win95-border-input.gif differ diff --git a/src/templates/img/timemachine/win95-border-inset.gif b/src/templates/img/timemachine/win95-border-inset.gif new file mode 100644 index 00000000..f9a49adb Binary files /dev/null and b/src/templates/img/timemachine/win95-border-inset.gif differ diff --git a/src/templates/img/timemachine/win95-border.gif b/src/templates/img/timemachine/win95-border.gif new file mode 100644 index 00000000..620d4dba Binary files /dev/null and b/src/templates/img/timemachine/win95-border.gif differ diff --git a/src/templates/img/timemachine/win95-camera.png b/src/templates/img/timemachine/win95-camera.png new file mode 100644 index 00000000..4aa88adb Binary files /dev/null and b/src/templates/img/timemachine/win95-camera.png differ diff --git a/src/templates/img/timemachine/win95-check.png b/src/templates/img/timemachine/win95-check.png new file mode 100644 index 00000000..b184ecc0 Binary files /dev/null and b/src/templates/img/timemachine/win95-check.png differ diff --git a/src/templates/img/timemachine/win95-checklist.png b/src/templates/img/timemachine/win95-checklist.png new file mode 100644 index 00000000..a973d808 Binary files /dev/null and b/src/templates/img/timemachine/win95-checklist.png differ diff --git a/src/templates/img/timemachine/win95-close.gif b/src/templates/img/timemachine/win95-close.gif new file mode 100644 index 00000000..ef7389bc Binary files /dev/null and b/src/templates/img/timemachine/win95-close.gif differ diff --git a/src/templates/img/timemachine/win95-computer.png b/src/templates/img/timemachine/win95-computer.png new file mode 100644 index 00000000..43184e5b Binary files /dev/null and b/src/templates/img/timemachine/win95-computer.png differ diff --git a/src/templates/img/timemachine/win95-info.png b/src/templates/img/timemachine/win95-info.png new file mode 100644 index 00000000..12a33401 Binary files /dev/null and b/src/templates/img/timemachine/win95-info.png differ diff --git a/src/templates/img/timemachine/win95-media.png b/src/templates/img/timemachine/win95-media.png new file mode 100644 index 00000000..610361c7 Binary files /dev/null and b/src/templates/img/timemachine/win95-media.png differ diff --git a/src/templates/img/timemachine/win95-pad.png b/src/templates/img/timemachine/win95-pad.png new file mode 100644 index 00000000..21c49533 Binary files /dev/null and b/src/templates/img/timemachine/win95-pad.png differ diff --git a/src/templates/img/timemachine/win95-play.png b/src/templates/img/timemachine/win95-play.png new file mode 100644 index 00000000..524219f3 Binary files /dev/null and b/src/templates/img/timemachine/win95-play.png differ diff --git a/src/templates/img/timemachine/win95-scroll.png b/src/templates/img/timemachine/win95-scroll.png new file mode 100644 index 00000000..0fb0bd5f Binary files /dev/null and b/src/templates/img/timemachine/win95-scroll.png differ diff --git a/src/templates/img/timemachine/win95-upload.png b/src/templates/img/timemachine/win95-upload.png new file mode 100644 index 00000000..f79d3af4 Binary files /dev/null and b/src/templates/img/timemachine/win95-upload.png differ diff --git a/src/templates/svg/twitter.svg b/src/templates/img/twitter.svg similarity index 100% rename from src/templates/svg/twitter.svg rename to src/templates/img/twitter.svg diff --git a/src/templates/src/email_time_machine.html b/src/templates/src/email_time_machine.html new file mode 100644 index 00000000..6bd6e08f --- /dev/null +++ b/src/templates/src/email_time_machine.html @@ -0,0 +1,6 @@ +

Submission by {{ .Username }} ({{ .UserEmail }}) {{ if .DiscordUsername }} On Discord: {{ .DiscordUsername }} {{ end }}

+

Submitted url: {{ .MediaUrl }}

+Device info:
+
{{ .DeviceInfo }}
+Description:
+
{{ .Description }}
diff --git a/src/templates/src/include/footer.html b/src/templates/src/include/footer.html index 72b87b4a..12f6936c 100644 --- a/src/templates/src/include/footer.html +++ b/src/templates/src/include/footer.html @@ -1,6 +1,6 @@