Compare commits

..

No commits in common. "96e3be543b4acbfc1562b6690c0ba02f0e243887" and "22ab25045c4faa6f5048bf360d25b9d54d55e5c5" have entirely different histories.

4 changed files with 17 additions and 3 deletions

View File

@ -6,7 +6,6 @@ EMAIL_FROM="noreply@lauf-fuer-kaya.de"
EMAIL_REPLYTO="info@lauf-fuer-kaya.de" EMAIL_REPLYTO="info@lauf-fuer-kaya.de"
REDIS_URL=redis://localhost:6379 REDIS_URL=redis://localhost:6379
FRONTEND_URL="https://run.lauf-fuer-kaya.de" FRONTEND_URL="https://run.lauf-fuer-kaya.de"
DOCUMENT_SERVER_URL="https://documents.run.lauf-fuer-kaya.de/"
AUTHKEY="" AUTHKEY=""
EVENT_DATE="23.05.2025" EVENT_DATE="23.05.2025"
EVENT_NAME="Lauf für Kaya! 2025" EVENT_NAME="Lauf für Kaya! 2025"

BIN
bun.lockb Executable file → Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
{ {
"name": "@odit/lfk-mailer", "name": "@odit/lfk-mailer",
"version": "1.1.0", "version": "1.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
@ -13,6 +13,7 @@
"@hono/zod-openapi": "0.18.3", "@hono/zod-openapi": "0.18.3",
"@hono/zod-validator": "0.4.1", "@hono/zod-validator": "0.4.1",
"bullmq": "5.34.0", "bullmq": "5.34.0",
"bwip-js": "4.5.1",
"handlebars": "4.7.8", "handlebars": "4.7.8",
"hono": "4.6.13", "hono": "4.6.13",
"ioredis": "5.4.1", "ioredis": "5.4.1",

View File

@ -5,6 +5,7 @@ import { z } from 'zod'
import { EmailService } from '../services/email' import { EmailService } from '../services/email'
import { getEmailTemplate } from '../templates' import { getEmailTemplate } from '../templates'
import { Language } from '../types' import { Language } from '../types'
import { toBuffer } from 'bwip-js/node'
const emailRouter = new Hono() const emailRouter = new Hono()
const emailService = new EmailService() const emailService = new EmailService()
@ -17,7 +18,20 @@ const sendEmailSchema = z.object({
}) })
async function generateBarcodeDataURL(data) { async function generateBarcodeDataURL(data) {
return `${process.env.DOCUMENT_SERVER_URL}/v1/barcodes/code128/${data}` return `https://barcodeapi.org/api/128/${data}`
const buffer = await toBuffer({
bcid: 'code128',
text: data,
scale: 3,
height: 10,
includetext: true,
textxalign: 'center',
});
const base64Data = buffer.toString('base64');
const dataURL = `data:image/png;base64,${base64Data}`;
return dataURL;
} }
emailRouter.post('/', bearerAuth({ token: process.env.AUTHKEY }), zValidator('json', sendEmailSchema), async (c) => { emailRouter.post('/', bearerAuth({ token: process.env.AUTHKEY }), zValidator('json', sendEmailSchema), async (c) => {