Compare commits
10 commits
2a38c88716
...
eadb397847
Author | SHA1 | Date | |
---|---|---|---|
Julien Oculi | eadb397847 | ||
Julien Oculi | 86da84b319 | ||
Julien Oculi | 40d57ce880 | ||
Julien Oculi | 44a9090a39 | ||
Julien Oculi | 8194fd3aa3 | ||
Julien Oculi | f3918321bd | ||
Julien Oculi | 0c6da9d10a | ||
Julien Oculi | 3072d3af20 | ||
Julien Oculi | 2e4f4e0b2c | ||
Julien Oculi | ba33da8d16 |
17
README.md
Normal file
17
README.md
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# Coh@mail
|
||||||
|
|
||||||
|
Mail cli for Coh@bit.
|
||||||
|
|
||||||
|
> [!WARNING] Early preview Much more to come, stay up to date
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
> [!WARNING] Currently bin manually added to [releases](./releases) tab.
|
||||||
|
|
||||||
|
## Basic usage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./cohamail -h
|
||||||
|
# OR
|
||||||
|
./cohamail <subcommand> -h
|
||||||
|
```
|
|
@ -47,8 +47,7 @@ export const cmd = new Command()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (from.startsWith('!')) {
|
if (from.startsWith('!')) {
|
||||||
//@ts-ignore try expand
|
return Contact.expand(from.slice(1))
|
||||||
return expand(from.slice(1))
|
|
||||||
}
|
}
|
||||||
return Contact.fromString(from)
|
return Contact.fromString(from)
|
||||||
})()
|
})()
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"compile:send": "deno compile --allow-read --allow-env --allow-sys=osRelease --allow-run=mail,whoami ./cli/send.ts",
|
"compile:send": "deno compile --allow-read --allow-env --allow-sys=osRelease --allow-run=mail,whoami ./cli/send.ts",
|
||||||
"cli": "deno run --allow-read --allow-env --allow-sys=osRelease,networkInterfaces --allow-run=/usr/sbin/sendmail,whoami ./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"
|
"utils:scp": "scp -O -P 55555 -i C:/Users/Julien/.ssh/id_ed25519_cohabit -r $(pwd) julien@cohabit.fr:/home/julien/cohabit_mail"
|
||||||
},
|
},
|
||||||
"fmt": {
|
"fmt": {
|
||||||
|
|
|
@ -21,12 +21,12 @@ export class Contact {
|
||||||
|
|
||||||
const { name, address } = custom[shortName as keyof typeof custom]
|
const { name, address } = custom[shortName as keyof typeof custom]
|
||||||
|
|
||||||
if (name !== 'string') {
|
if (typeof name !== 'string') {
|
||||||
throw new SyntaxError(
|
throw new SyntaxError(
|
||||||
`missing key "name" in contact short name config for "${shortName}"`,
|
`missing key "name" in contact short name config for "${shortName}"`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (address !== 'string') {
|
if (typeof address !== 'string') {
|
||||||
throw new SyntaxError(
|
throw new SyntaxError(
|
||||||
`missing key "address" in contact short name config for "${shortName}"`,
|
`missing key "address" in contact short name config for "${shortName}"`,
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,6 +13,13 @@ export async function send(mail: Mail) {
|
||||||
subject: mail.subject,
|
subject: mail.subject,
|
||||||
text,
|
text,
|
||||||
html,
|
html,
|
||||||
attachments: mail.options.attachments.map((path) => ({ path })),
|
attachments: [
|
||||||
|
{
|
||||||
|
cid: 'cohabit_logo.svg',
|
||||||
|
path: 'https://cohabit.fr/images/logo.svg',
|
||||||
|
filename: 'cohabit_logo.svg',
|
||||||
|
},
|
||||||
|
...mail.options.attachments.map((path) => ({ path })),
|
||||||
|
],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
import { Body, Html, Markdown, Preview, Section, Text } from 'jsx-email'
|
import { Body, Container, Html, Markdown, Preview } from 'jsx-email'
|
||||||
import { Signature } from './_Signature.tsx'
|
import { Signature } from './components/Signature.tsx'
|
||||||
import type { Template } from '../types.ts'
|
import type { Template } from '../types.ts'
|
||||||
|
import { BaseStyle, bodyCss, messageCss, textCss } from './styles/base.tsx'
|
||||||
|
|
||||||
function Message(
|
function Message(
|
||||||
{ summary, body }: { summary?: string; body: string },
|
{ summary, body }: { summary?: string; body: string },
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<Html lang='fr'>
|
<Html lang='fr' style={{ fontSize: '14px' }}>
|
||||||
|
<BaseStyle />
|
||||||
<Preview>{summary}</Preview>
|
<Preview>{summary}</Preview>
|
||||||
<Body>
|
<Body style={bodyCss}>
|
||||||
<Markdown>{body}</Markdown>
|
<Container style={messageCss}>
|
||||||
<Section>
|
<Markdown style={textCss}>{body}</Markdown>
|
||||||
<Text>Coh@bit</Text>
|
</Container>
|
||||||
</Section>
|
|
||||||
<Signature />
|
<Signature />
|
||||||
</Body>
|
</Body>
|
||||||
</Html>
|
</Html>
|
||||||
|
|
|
@ -4,12 +4,16 @@ import {
|
||||||
Container,
|
Container,
|
||||||
Heading,
|
Heading,
|
||||||
Html,
|
Html,
|
||||||
|
Img,
|
||||||
Preview,
|
Preview,
|
||||||
Section,
|
Section,
|
||||||
Text,
|
Text,
|
||||||
} from 'jsx-email'
|
} from 'jsx-email'
|
||||||
import { Signature } from './_Signature.tsx'
|
import { Signature } from './components/Signature.tsx'
|
||||||
import type { Template } from '../types.ts'
|
import type { Template } from '../types.ts'
|
||||||
|
import type { JSX } from 'preact'
|
||||||
|
import { bodyCss, messageCss, rootCss, textCss } from './styles/base.tsx'
|
||||||
|
import { BaseStyle } from './styles/base.tsx'
|
||||||
|
|
||||||
function Welcome(
|
function Welcome(
|
||||||
{ firstname, lastname, login }: {
|
{ firstname, lastname, login }: {
|
||||||
|
@ -19,23 +23,35 @@ function Welcome(
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<Html lang='fr'>
|
<Html lang='fr' style={{ fontSize: '14px' }}>
|
||||||
|
<BaseStyle />
|
||||||
<Preview>Bienvenue au FabLab Coh@bit</Preview>
|
<Preview>Bienvenue au FabLab Coh@bit</Preview>
|
||||||
<Body>
|
<Body style={bodyCss}>
|
||||||
<Container>
|
<Container style={messageCss}>
|
||||||
<Section>
|
<Section>
|
||||||
<Heading as='h1'>Bienvenue à Coh@bit</Heading>
|
<Heading as='h1' style={headingCss}>
|
||||||
<Text>
|
Bienvenue au<Img
|
||||||
|
src='cid:cohabit_logo.svg'
|
||||||
|
alt='FabLab Cohabit'
|
||||||
|
style={imgCss}
|
||||||
|
/>
|
||||||
|
</Heading>
|
||||||
|
<Text style={textCss}>
|
||||||
Bravo ! Vous avez rejoint le FabLab Coh@bit en tant que{' '}
|
Bravo ! Vous avez rejoint le FabLab Coh@bit en tant que{' '}
|
||||||
{firstname} {lastname} (login:{' '}
|
{firstname} {lastname}.
|
||||||
{login}). Laissez parler votre créativité, vous êtes prêt à
|
|
||||||
collaborer avec toute une communauté ouverte et accueillante.
|
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text style={textCss}>
|
||||||
Comment débuter :
|
Votre identifiant est <span style={preCss}>{login}</span>.
|
||||||
|
</Text>
|
||||||
|
<Text style={textCss}>
|
||||||
|
Laissez parler votre créativité, vous êtes prêt à collaborer avec
|
||||||
|
toute une communauté ouverte et accueillante.
|
||||||
|
</Text>
|
||||||
|
<Text style={textCss}>
|
||||||
|
Par où commencer ?
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<ul>
|
<ul style={{ fontSize: '1rem' }}>
|
||||||
<li>
|
<li>
|
||||||
Accéder au <a href='https://cohabit.fr'>site de Coh@bit</a>{' '}
|
Accéder au <a href='https://cohabit.fr'>site de Coh@bit</a>{' '}
|
||||||
et découvrir le FabLab.
|
et découvrir le FabLab.
|
||||||
|
@ -69,9 +85,13 @@ function Welcome(
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<Button href='https://cohabit.fr/profile'>
|
<Container
|
||||||
|
style={{ width: '100%', textAlign: 'center', padding: '1rem' }}
|
||||||
|
>
|
||||||
|
<Button href='https://cohabit.fr/profil' style={buttonCss}>
|
||||||
Accéder à mon compte
|
Accéder à mon compte
|
||||||
</Button>
|
</Button>
|
||||||
|
</Container>
|
||||||
</Section>
|
</Section>
|
||||||
</Container>
|
</Container>
|
||||||
<Signature />
|
<Signature />
|
||||||
|
@ -80,6 +100,36 @@ function Welcome(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const headingCss: JSX.CSSProperties = {
|
||||||
|
fontFamily: 'Garamond, serif',
|
||||||
|
color: rootCss.accentColor,
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: '-1rem 0 3rem',
|
||||||
|
fontSize: '2.5rem',
|
||||||
|
}
|
||||||
|
|
||||||
|
const preCss: JSX.CSSProperties = {
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
fontSize: '1rem',
|
||||||
|
padding: '0.2rem',
|
||||||
|
borderRadius: '0.4rem',
|
||||||
|
backgroundColor: rootCss.backgroundColor,
|
||||||
|
}
|
||||||
|
|
||||||
|
const buttonCss: JSX.CSSProperties = {
|
||||||
|
color: 'white',
|
||||||
|
padding: '1rem',
|
||||||
|
borderRadius: '0.4rem',
|
||||||
|
fontSize: '1.2rem',
|
||||||
|
backgroundColor: rootCss.accentColor,
|
||||||
|
}
|
||||||
|
|
||||||
|
const imgCss: JSX.CSSProperties = {
|
||||||
|
display: 'inline',
|
||||||
|
padding: '1rem',
|
||||||
|
transform: 'translateY(40%)',
|
||||||
|
}
|
||||||
|
|
||||||
const template: Template<typeof Welcome, Parameters<typeof Welcome>[0]> = {
|
const template: Template<typeof Welcome, Parameters<typeof Welcome>[0]> = {
|
||||||
props: [
|
props: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { Container, Section, Text } from 'jsx-email'
|
import { Column, Container, Row, Text } from 'jsx-email'
|
||||||
|
|
||||||
export function Signature() {
|
export function Signature() {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container style={{ textAlign: 'center', fontSize: '12px' }}>
|
||||||
<Section>
|
<Row>
|
||||||
<Text>
|
<Column>
|
||||||
<a href='https://cohabit.fr'>Accéder au site →</a>
|
<a href='https://cohabit.fr'>Accéder au site →</a>
|
||||||
</Text>
|
</Column>
|
||||||
<Text>
|
<Column>
|
||||||
<a href='tel:0556847961'>Nous téléphoner →</a>
|
<a href='tel:0556847961'>Nous téléphoner →</a>
|
||||||
</Text>
|
</Column>
|
||||||
<Text>
|
<Column>
|
||||||
<a href='mailto:fablab@iut.u-bordeaux.fr'>Nous contacter →</a>
|
<a href='mailto:fablab@iut.u-bordeaux.fr'>Nous contacter →</a>
|
||||||
</Text>
|
</Column>
|
||||||
</Section>
|
</Row>
|
||||||
<Text>
|
<Text style={{ fontSize: '12px' }}>
|
||||||
Coh@bit, IUT de Bordeaux, Bâtiment 10A, 15 rue Naudet, 33170 GRADIGNAN
|
Coh@bit, IUT de Bordeaux, Bâtiment 10A, 15 rue Naudet, 33170 GRADIGNAN
|
||||||
</Text>
|
</Text>
|
||||||
</Container>
|
</Container>
|
38
templates/styles/base.tsx
Normal file
38
templates/styles/base.tsx
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import type { JSX } from 'preact'
|
||||||
|
|
||||||
|
export const rootCss = {
|
||||||
|
accentColor: '#48D200',
|
||||||
|
backgroundColor: '#F2E6DC',
|
||||||
|
} satisfies JSX.CSSProperties
|
||||||
|
|
||||||
|
export const bodyCss: JSX.CSSProperties = {
|
||||||
|
fontFamily: 'system-ui, "Trebuchet MS", sans-serif',
|
||||||
|
accentColor: rootCss.accentColor,
|
||||||
|
backgroundColor: rootCss.backgroundColor,
|
||||||
|
padding: '0.5rem 0',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const messageCss: JSX.CSSProperties = {
|
||||||
|
padding: '1rem',
|
||||||
|
borderRadius: '0.4rem',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
textWrap: 'balance',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const textCss: JSX.CSSProperties = {
|
||||||
|
fontSize: '1rem',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const rawCss = `
|
||||||
|
a {
|
||||||
|
color: ${rootCss.accentColor};
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: ${rootCss.accentColor};
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
export function BaseStyle() {
|
||||||
|
return <style dangerouslySetInnerHTML={{ __html: rawCss }}></style>
|
||||||
|
}
|
Loading…
Reference in a new issue