Compare commits

..

No commits in common. "a88178c2ce4bc7031c76ccb28f6df0c74bcc5c7a" and "dc000ac4defa26b9a5021048555394c77ae7f3f4" have entirely different histories.

8 changed files with 828 additions and 909 deletions

2
cli.ts
View file

@ -1,5 +1,5 @@
import config from './deno.json' with { type: 'json' }
import { Command } from '@cliffy/command'
import { Command } from '@cliffy/command/command.ts'
import { cmd as send } from './cli/send.ts'
import { cmd as preview } from './cli/preview.ts'

View file

@ -1,4 +1,4 @@
import { Input } from '@cliffy/prompt'
import { Input } from '@cliffy/prompt/input.ts'
import type { Template } from '../types.ts'
import type { JSX } from 'preact'

View file

@ -1,6 +1,6 @@
import { fromFileUrl } from '@std/path'
import type { JSX } from 'preact'
import { EnumType } from '@cliffy/command'
import { EnumType } from '@cliffy/command/mod.ts'
import type { Template } from '../types.ts'
export const templates: Map<

View file

@ -1,4 +1,4 @@
import { Command } from '@cliffy/command'
import { Command } from '@cliffy/command/mod.ts'
import { renderTemplate } from '../src/template.tsx'
import { templates, templateType } from './_templates_loader.ts'
import { promptProps } from './_prompt_template.ts'

View file

@ -1,4 +1,4 @@
import { Command } from '@cliffy/command'
import { Command } from '@cliffy/command/mod.ts'
import { Contact } from '../src/contact.ts'
import { send } from '../src/send.ts'
import type { Mail } from '../types.ts'

View file

@ -1,5 +1,5 @@
{
"name": "@cohabit/mailer",
"name": "@cohabit/cohamail",
"version": "0.2.1",
"exports": {
".": "./mod.ts",
@ -8,8 +8,9 @@
"./templates": "./templates/mod.ts"
},
"tasks": {
"compile": "deno compile --allow-read --allow-env --allow-net=0.0.0.0 --allow-sys=osRelease,networkInterfaces --allow-run=/usr/sbin/sendmail,whoami --output=bin/mailer --target=x86_64-unknown-linux-gnu ./cli.ts",
"cli": "deno run --allow-read --allow-env --allow-net=0.0.0.0 --allow-sys=osRelease,networkInterfaces --allow-run=/usr/sbin/sendmail,whoami ./cli.ts"
"compile": "deno compile --allow-read --allow-env --allow-net=0.0.0.0 --allow-sys=osRelease,networkInterfaces --allow-run=/usr/sbin/sendmail,whoami --output=bin/cohamail --target=x86_64-unknown-linux-gnu ./cli.ts",
"cli": "deno run --allow-read --allow-env --allow-net=0.0.0.0 --allow-sys=osRelease,networkInterfaces --allow-run=/usr/sbin/sendmail,whoami ./cli.ts",
"utils:scp": "scp -O -P 55555 -i C:/Users/Julien/.ssh/id_ed25519_cohabit -r $(pwd) julien@cohabit.fr:/home/julien/cohabit_mail"
},
"fmt": {
"singleQuote": true,
@ -17,8 +18,7 @@
"useTabs": true
},
"imports": {
"@cliffy/command": "jsr:@cliffy/command@^1.0.0-rc.5",
"@cliffy/prompt": "jsr:@cliffy/prompt@^1.0.0-rc.5",
"@cliffy/": "https://deno.land/x/cliffy@v1.0.0-rc.3/",
"@std/path": "jsr:@std/path@^0.221.0",
"jsx-email": "npm:jsx-email@^1.10.12",
"nodemailer": "npm:nodemailer@^6.9.13",

1706
deno.lock

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,4 @@
import accounts from '../config/account.json' with { type: 'json' }
import dkim from '../config/dkim.json' with { type: 'json' }
import custom from '../config/account.json' with { type: 'json' }
export class Contact {
#name: string
@ -16,11 +15,11 @@ export class Contact {
}
static expand(shortName: string): Contact {
if (!(shortName in accounts)) {
if (!(shortName in custom)) {
throw new Error('unknown short name contact')
}
const { name, address } = accounts[shortName as keyof typeof accounts]
const { name, address } = custom[shortName as keyof typeof custom]
if (typeof name !== 'string') {
throw new SyntaxError(
@ -32,9 +31,7 @@ export class Contact {
`missing key "address" in contact short name config for "${shortName}"`,
)
}
const addressRegExp = new RegExp(String.raw`\w+@(\w+\.)?${dkim.domainName}`)
if (!(addressRegExp.test(address))) {
if (!(/\w+@(\w+\.)?cohabit\.fr/.test(address))) {
throw new SyntaxError(
`invalid "address" in contact short name config for "${shortName}"`,
)