Merge pull request #89 from useplunk/dev-driaug-revert

Catch up canary to main
This commit is contained in:
Dries Augustyns
2024-09-13 21:23:32 +02:00
committed by GitHub
5 changed files with 61 additions and 44 deletions
+4 -2
View File
@@ -8,8 +8,10 @@
<p align="center"> <p align="center">
<img src="https://img.shields.io/github/contributors/useplunk/plunk"/> <img src="https://img.shields.io/github/contributors/useplunk/plunk"/>
<img src="https://img.shields.io/github/actions/workflow/status/driaug/plunk-whitelabel/docker-build.yml"/> <img src="https://img.shields.io/github/actions/workflow/status/driaug/plunk-whitelabel/docker-build-prod.yml"/>
<img src="https://img.shields.io/docker/pulls/driaug/plunk"/> <img src="https://img.shields.io/docker/pulls/driaug/plunk"/>
<img src="https://img.shields.io/github/license/useplunk/plunk"/>
<img src="https://img.shields.io/github/stars/useplunk/plunk"/>
</p> </p>
## Introduction ## Introduction
@@ -39,4 +41,4 @@ You are welcome to contribute to Plunk. You can find a guide on how to contribut
<a href="https://github.com/useplunk/plunk/graphs/contributors"> <a href="https://github.com/useplunk/plunk/graphs/contributors">
<img src="https://contrib.rocks/image?repo=useplunk/plunk" /> <img src="https://contrib.rocks/image?repo=useplunk/plunk" />
</a> </a>
+36 -38
View File
@@ -1,40 +1,38 @@
{ {
"name": "plunk", "name": "plunk",
"version": "1.0.3", "version": "1.0.5",
"private": true, "private": true,
"license": "agpl-3.0", "license": "agpl-3.0",
"workspaces": { "workspaces": {
"packages": [ "packages": ["packages/*"]
"packages/*" },
] "engines": {
}, "npm": ">=6.14.x",
"engines": { "yarn": "1.22.x",
"npm": ">=6.14.x", "node": ">=18.x"
"yarn": "1.22.x", },
"node": ">=18.x" "devDependencies": {
}, "@biomejs/biome": "^1.8.3",
"devDependencies": { "lerna": "^8.1.6",
"@biomejs/biome": "^1.8.3", "prisma": "^5.17.0",
"lerna": "^8.1.6", "rimraf": "^5.0.9"
"prisma": "^5.17.0", },
"rimraf": "^5.0.9" "dependencies": {
}, "@prisma/client": "^5.17.0"
"dependencies": { },
"@prisma/client": "^5.17.0" "scripts": {
}, "dev:api": "yarn workspace @plunk/api dev",
"scripts": { "dev:dashboard": "yarn workspace @plunk/dashboard dev",
"dev:api": "yarn workspace @plunk/api dev", "dev:shared": "yarn workspace @plunk/shared dev",
"dev:dashboard": "yarn workspace @plunk/dashboard dev", "build:api": "yarn build:shared && yarn workspace @plunk/api build",
"dev:shared": "yarn workspace @plunk/shared dev", "build:dashboard": "yarn build:shared && yarn workspace @plunk/dashboard build",
"build:api": "yarn build:shared && yarn workspace @plunk/api build", "build:shared": "yarn generate && yarn workspace @plunk/shared build",
"build:dashboard": "yarn build:shared && yarn workspace @plunk/dashboard build", "clean": "rimraf node_modules yarn.lock && yarn add lerna -DW && lerna run clean",
"build:shared": "yarn generate && yarn workspace @plunk/shared build", "preinstall": "node tools/preinstall.js",
"clean": "rimraf node_modules yarn.lock && yarn add lerna -DW && lerna run clean", "migrate": "prisma migrate dev",
"preinstall": "node tools/preinstall.js", "migrate:deploy": "prisma migrate deploy",
"migrate": "prisma migrate dev", "generate": "prisma generate",
"migrate:deploy": "prisma migrate deploy", "services:up": "docker compose -f docker-compose.dev.yml up -d",
"generate": "prisma generate", "services:down": "docker compose -f docker-compose.dev.yml down"
"services:up": "docker compose -f docker-compose.dev.yml up -d", }
"services:down": "docker compose -f docker-compose.dev.yml down"
}
} }
+4 -4
View File
@@ -103,13 +103,13 @@ export class Contacts {
const { id, email } = ContactSchemas.manage.parse(req.body); const { id, email } = ContactSchemas.manage.parse(req.body);
const contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string); let contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string);
if (!contact || contact.projectId !== project.id) { if (!contact || contact.projectId !== project.id) {
throw new NotFound("contact"); throw new NotFound("contact");
} }
await prisma.contact.update({ contact = await prisma.contact.update({
where: { id: contact.id }, where: { id: contact.id },
data: { subscribed: false }, data: { subscribed: false },
}); });
@@ -154,13 +154,13 @@ export class Contacts {
const { id, email } = ContactSchemas.manage.parse(req.body); const { id, email } = ContactSchemas.manage.parse(req.body);
const contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string); let contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string);
if (!contact || contact.projectId !== project.id) { if (!contact || contact.projectId !== project.id) {
throw new NotFound("contact"); throw new NotFound("contact");
} }
await prisma.contact.update({ contact = await prisma.contact.update({
where: { id: contact.id }, where: { id: contact.id },
data: { subscribed: true }, data: { subscribed: true },
}); });
@@ -33,6 +33,7 @@ export class Events {
await prisma.event.delete({ where: { id } }); await prisma.event.delete({ where: { id } });
await redis.del(Keys.Event.id(id)); await redis.del(Keys.Event.id(id));
await redis.del(Keys.Event.event(project.id, event.name));
return res.status(200).json(event); return res.status(200).json(event);
} }
@@ -108,6 +108,22 @@ export default function Editor({ value, onChange, mode, modeSwitcher }: Markdown
keydown: (_view, event) => { keydown: (_view, event) => {
return event.key === "Enter" && !event.shiftKey; return event.key === "Enter" && !event.shiftKey;
}, },
paste: (view, event) => {
const text = event.clipboardData?.getData("text");
const urlPattern = /^(https?:\/\/)?([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*({{[\w-]+}})?)*$/;
if (editor && text && urlPattern.test(text)) {
event.preventDefault();
editor
.chain()
.focus()
.extendMarkRange("link")
.setLink({ href: text.startsWith("http") ? text : `https://${text}`, target: "_blank" })
.run();
editor.commands.insertContent(text);
}
return true;
},
}, },
}, },
onUpdate: ({ editor }) => { onUpdate: ({ editor }) => {