Compare commits
No commits in common. "eadb3978471bc69e438b6e4ce3b482b9759c06a1" and "2a38c887167014c8f134df6bed544d3b589f15b6" have entirely different histories.
eadb397847
...
2a38c88716
17
README.md
17
README.md
|
@ -1,17 +0,0 @@
|
||||||
# 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,7 +47,8 @@ export const cmd = new Command()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (from.startsWith('!')) {
|
if (from.startsWith('!')) {
|
||||||
return Contact.expand(from.slice(1))
|
//@ts-ignore try expand
|
||||||
|
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-net=0.0.0.0 --allow-sys=osRelease,networkInterfaces --allow-run=/usr/sbin/sendmail,whoami ./cli.ts",
|
"cli": "deno run --allow-read --allow-env --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 (typeof name !== 'string') {
|
if (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 (typeof address !== 'string') {
|
if (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,13 +13,6 @@ export async function send(mail: Mail) {
|
||||||
subject: mail.subject,
|
subject: mail.subject,
|
||||||
text,
|
text,
|
||||||
html,
|
html,
|
||||||
attachments: [
|
attachments: mail.options.attachments.map((path) => ({ path })),
|
||||||
{
|
|
||||||
cid: 'cohabit_logo.svg',
|
|
||||||
path: 'https://cohabit.fr/images/logo.svg',
|
|
||||||
filename: 'cohabit_logo.svg',
|
|
||||||
},
|
|
||||||
...mail.options.attachments.map((path) => ({ path })),
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
import { Body, Container, Html, Markdown, Preview } from 'jsx-email'
|
import { Body, Html, Markdown, Preview, Section, Text } from 'jsx-email'
|
||||||
import { Signature } from './components/Signature.tsx'
|
import { Signature } from './_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' style={{ fontSize: '14px' }}>
|
<Html lang='fr'>
|
||||||
<BaseStyle />
|
|
||||||
<Preview>{summary}</Preview>
|
<Preview>{summary}</Preview>
|
||||||
<Body style={bodyCss}>
|
<Body>
|
||||||
<Container style={messageCss}>
|
<Markdown>{body}</Markdown>
|
||||||
<Markdown style={textCss}>{body}</Markdown>
|
<Section>
|
||||||
</Container>
|
<Text>Coh@bit</Text>
|
||||||
|
</Section>
|
||||||
<Signature />
|
<Signature />
|
||||||
</Body>
|
</Body>
|
||||||
</Html>
|
</Html>
|
||||||
|
|
|
@ -4,16 +4,12 @@ import {
|
||||||
Container,
|
Container,
|
||||||
Heading,
|
Heading,
|
||||||
Html,
|
Html,
|
||||||
Img,
|
|
||||||
Preview,
|
Preview,
|
||||||
Section,
|
Section,
|
||||||
Text,
|
Text,
|
||||||
} from 'jsx-email'
|
} from 'jsx-email'
|
||||||
import { Signature } from './components/Signature.tsx'
|
import { Signature } from './_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 }: {
|
||||||
|
@ -23,35 +19,23 @@ function Welcome(
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<Html lang='fr' style={{ fontSize: '14px' }}>
|
<Html lang='fr'>
|
||||||
<BaseStyle />
|
|
||||||
<Preview>Bienvenue au FabLab Coh@bit</Preview>
|
<Preview>Bienvenue au FabLab Coh@bit</Preview>
|
||||||
<Body style={bodyCss}>
|
<Body>
|
||||||
<Container style={messageCss}>
|
<Container>
|
||||||
<Section>
|
<Section>
|
||||||
<Heading as='h1' style={headingCss}>
|
<Heading as='h1'>Bienvenue à Coh@bit</Heading>
|
||||||
Bienvenue au<Img
|
<Text>
|
||||||
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}.
|
{firstname} {lastname} (login:{' '}
|
||||||
|
{login}). Laissez parler votre créativité, vous êtes prêt à
|
||||||
|
collaborer avec toute une communauté ouverte et accueillante.
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={textCss}>
|
<Text>
|
||||||
Votre identifiant est <span style={preCss}>{login}</span>.
|
Comment débuter :
|
||||||
</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 style={{ fontSize: '1rem' }}>
|
<ul>
|
||||||
<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.
|
||||||
|
@ -85,13 +69,9 @@ function Welcome(
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<Container
|
<Button href='https://cohabit.fr/profile'>
|
||||||
style={{ width: '100%', textAlign: 'center', padding: '1rem' }}
|
Accéder à mon compte
|
||||||
>
|
</Button>
|
||||||
<Button href='https://cohabit.fr/profil' style={buttonCss}>
|
|
||||||
Accéder à mon compte
|
|
||||||
</Button>
|
|
||||||
</Container>
|
|
||||||
</Section>
|
</Section>
|
||||||
</Container>
|
</Container>
|
||||||
<Signature />
|
<Signature />
|
||||||
|
@ -100,36 +80,6 @@ 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 { Column, Container, Row, Text } from 'jsx-email'
|
import { Container, Section, Text } from 'jsx-email'
|
||||||
|
|
||||||
export function Signature() {
|
export function Signature() {
|
||||||
return (
|
return (
|
||||||
<Container style={{ textAlign: 'center', fontSize: '12px' }}>
|
<Container>
|
||||||
<Row>
|
<Section>
|
||||||
<Column>
|
<Text>
|
||||||
<a href='https://cohabit.fr'>Accéder au site →</a>
|
<a href='https://cohabit.fr'>Accéder au site →</a>
|
||||||
</Column>
|
</Text>
|
||||||
<Column>
|
<Text>
|
||||||
<a href='tel:0556847961'>Nous téléphoner →</a>
|
<a href='tel:0556847961'>Nous téléphoner →</a>
|
||||||
</Column>
|
</Text>
|
||||||
<Column>
|
<Text>
|
||||||
<a href='mailto:fablab@iut.u-bordeaux.fr'>Nous contacter →</a>
|
<a href='mailto:fablab@iut.u-bordeaux.fr'>Nous contacter →</a>
|
||||||
</Column>
|
</Text>
|
||||||
</Row>
|
</Section>
|
||||||
<Text style={{ fontSize: '12px' }}>
|
<Text>
|
||||||
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>
|
|
@ -1,38 +0,0 @@
|
||||||
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