Skip to content

Commit

Permalink
Merge pull request #89 from useplunk/dev-driaug-revert
Browse files Browse the repository at this point in the history
Catch up canary to main
  • Loading branch information
driaug authored Sep 13, 2024
2 parents c6c7a53 + 2130811 commit 1ecef9f
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 44 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

<p align="center">
<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/github/license/useplunk/plunk"/>
<img src="https://img.shields.io/github/stars/useplunk/plunk"/>
</p>

## Introduction
Expand Down Expand Up @@ -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">
<img src="https://contrib.rocks/image?repo=useplunk/plunk" />
</a>
</a>
74 changes: 36 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
{
"name": "plunk",
"version": "1.0.3",
"private": true,
"license": "agpl-3.0",
"workspaces": {
"packages": [
"packages/*"
]
},
"engines": {
"npm": ">=6.14.x",
"yarn": "1.22.x",
"node": ">=18.x"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"lerna": "^8.1.6",
"prisma": "^5.17.0",
"rimraf": "^5.0.9"
},
"dependencies": {
"@prisma/client": "^5.17.0"
},
"scripts": {
"dev:api": "yarn workspace @plunk/api dev",
"dev:dashboard": "yarn workspace @plunk/dashboard dev",
"dev:shared": "yarn workspace @plunk/shared dev",
"build:api": "yarn build:shared && yarn workspace @plunk/api build",
"build:dashboard": "yarn build:shared && yarn workspace @plunk/dashboard build",
"build:shared": "yarn generate && yarn workspace @plunk/shared build",
"clean": "rimraf node_modules yarn.lock && yarn add lerna -DW && lerna run clean",
"preinstall": "node tools/preinstall.js",
"migrate": "prisma migrate dev",
"migrate:deploy": "prisma migrate deploy",
"generate": "prisma generate",
"services:up": "docker compose -f docker-compose.dev.yml up -d",
"services:down": "docker compose -f docker-compose.dev.yml down"
}
"name": "plunk",
"version": "1.0.5",
"private": true,
"license": "agpl-3.0",
"workspaces": {
"packages": ["packages/*"]
},
"engines": {
"npm": ">=6.14.x",
"yarn": "1.22.x",
"node": ">=18.x"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"lerna": "^8.1.6",
"prisma": "^5.17.0",
"rimraf": "^5.0.9"
},
"dependencies": {
"@prisma/client": "^5.17.0"
},
"scripts": {
"dev:api": "yarn workspace @plunk/api dev",
"dev:dashboard": "yarn workspace @plunk/dashboard dev",
"dev:shared": "yarn workspace @plunk/shared dev",
"build:api": "yarn build:shared && yarn workspace @plunk/api build",
"build:dashboard": "yarn build:shared && yarn workspace @plunk/dashboard build",
"build:shared": "yarn generate && yarn workspace @plunk/shared build",
"clean": "rimraf node_modules yarn.lock && yarn add lerna -DW && lerna run clean",
"preinstall": "node tools/preinstall.js",
"migrate": "prisma migrate dev",
"migrate:deploy": "prisma migrate deploy",
"generate": "prisma generate",
"services:up": "docker compose -f docker-compose.dev.yml up -d",
"services:down": "docker compose -f docker-compose.dev.yml down"
}
}
8 changes: 4 additions & 4 deletions packages/api/src/controllers/v1/Contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ export class Contacts {

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) {
throw new NotFound("contact");
}

await prisma.contact.update({
contact = await prisma.contact.update({
where: { id: contact.id },
data: { subscribed: false },
});
Expand Down Expand Up @@ -154,13 +154,13 @@ export class Contacts {

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) {
throw new NotFound("contact");
}

await prisma.contact.update({
contact = await prisma.contact.update({
where: { id: contact.id },
data: { subscribed: true },
});
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/controllers/v1/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class Events {
await prisma.event.delete({ where: { id } });

await redis.del(Keys.Event.id(id));
await redis.del(Keys.Event.event(project.id, event.name));

return res.status(200).json(event);
}
Expand Down
16 changes: 16 additions & 0 deletions packages/dashboard/src/components/Input/MarkdownEditor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@ export default function Editor({ value, onChange, mode, modeSwitcher }: Markdown
keydown: (_view, event) => {
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 }) => {
Expand Down

0 comments on commit 1ecef9f

Please sign in to comment.