add smtp to frontend (#2802)

* add smtp to frontend

* left align headers

* just email

* change all to email

* fix test-smtp api

* types

* fix email from and login address handling

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Matt Hill
2025-01-14 17:32:19 -07:00
committed by GitHub
parent 5d759f810c
commit e012a29b5e
21 changed files with 389 additions and 21 deletions

View File

@@ -25,9 +25,9 @@ export const customSmtp = InputSpec.of<InputSpecOf<SmtpValue>, never>({
name: "From Address",
required: true,
default: null,
placeholder: "<name>test@example.com",
placeholder: "Example Name <test@example.com>",
inputmode: "email",
patterns: [Patterns.email],
patterns: [Patterns.emailWithName],
}),
login: Value.text({
name: "Login",

View File

@@ -0,0 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type TestSmtpParams = {
server: string
port: number
from: string
to: string
login: string
password: string | null
}

View File

@@ -186,6 +186,7 @@ export { SignAssetParams } from "./SignAssetParams"
export { SignerInfo } from "./SignerInfo"
export { SmtpValue } from "./SmtpValue"
export { StartStop } from "./StartStop"
export { TestSmtpParams } from "./TestSmtpParams"
export { UnsetPublicParams } from "./UnsetPublicParams"
export { UpdatingState } from "./UpdatingState"
export { VerifyCifsParams } from "./VerifyCifsParams"

View File

@@ -52,6 +52,11 @@ export const email: Pattern = {
description: "Must be a valid email address",
}
export const emailWithName: Pattern = {
regex: regexes.emailWithName.source,
description: "Must be a valid email address, optionally with a name",
}
export const base64: Pattern = {
regex: regexes.base64.source,
description:

View File

@@ -26,8 +26,12 @@ export const torUrl =
// https://ihateregex.io/expr/ascii/
export const ascii = /^[ -~]*$/
//https://ihateregex.io/expr/email/
export const email = /[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+/
// https://www.regular-expressions.info/email.html
export const email = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/
export const emailWithName = new RegExp(
`(${email.source})|([^<]*<(${email.source})>)`,
)
//https://rgxdb.com/r/1NUN74O6
export const base64 =