diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..1f65bd1390 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners + +* @flybayer diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 65a6c13e5d..37078c4876 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms # github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -# patreon: # Replace with a single Patreon username +patreon: flybayer open_collective: blitzjs -custom: ['https://paypal.me/thebayers?locale.x=en_US'] +custom: ['https://paypal.me/thebayers'] diff --git a/README.md b/README.md index 1ef2c711b0..6960726051 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ The initial Blitz demo is live at [first-demo.blitzjs.com](https://first-demo.bl It's source code is at [examples/first-demo](https://github.com/blitz-js/blitz/blob/canary/examples/first-demo). NOTE: The API is very alpha, and will change. +## Sponsors + +_Sponsor Blitz and display your logo and hiring status here. [See options on Open Collective](https://opencollective.com/blitzjs)_ + ## I invite you to join me — let’s build the future of web dev together. 🤝 If you’re interested in helping or just want to keep a pulse on the project, [drop your email here 👉 Blitzjs.com](https://blitzjs.com) diff --git a/examples/first-demo/controllers/comments.ts b/examples/first-demo/controllers/comments.ts index 2348ed98ee..145756cebb 100644 --- a/examples/first-demo/controllers/comments.ts +++ b/examples/first-demo/controllers/comments.ts @@ -1,5 +1,5 @@ import {Controller} from '@blitzjs/core' -import alex from 'alex' +import {validContent} from '../utils/contentFilter' export const CommentsController = Controller(({db}) => ({ name: 'CommentsController', @@ -7,8 +7,8 @@ export const CommentsController = Controller(({db}) => ({ permit: ['content'], async create(params, newData) { - if (alex(newData.content).messages.length || newData.content?.toLowerCase().includes('4chan')) { - newData.content = 'Be nice' + if (!validContent(newData.content)) { + newData.content = 'Fruit' } const data = await db.comment.create({ diff --git a/examples/first-demo/controllers/posts.ts b/examples/first-demo/controllers/posts.ts index d04f75001e..fa044b8b20 100644 --- a/examples/first-demo/controllers/posts.ts +++ b/examples/first-demo/controllers/posts.ts @@ -1,5 +1,5 @@ import {Controller} from '@blitzjs/core' -import alex from 'alex' +import {validContent} from '../utils/contentFilter' export const PostsController = Controller(({db}) => ({ name: 'PostsController', @@ -7,7 +7,7 @@ export const PostsController = Controller(({db}) => ({ permit: ['title', 'content'], async index() { - const posts = await db.post.findMany({orderBy: {id: 'asc'}}) + const posts = await db.post.findMany({orderBy: {id: 'desc'}, first: 20}) return { data: {posts}, @@ -23,11 +23,11 @@ export const PostsController = Controller(({db}) => ({ }, async create(params, newData) { - if (alex(newData.title).messages.length || newData.title?.toLowerCase().includes('4chan')) { - newData.title = 'Be nice' + if (!validContent(newData.title)) { + newData.title = 'Fruit' } - if (alex(newData.content).messages.length || newData.content?.toLowerCase().includes('4chan')) { - newData.content = 'Be nice' + if (!validContent(newData.content)) { + newData.content = 'Fruit' } const data = await db.post.create({ @@ -44,11 +44,11 @@ export const PostsController = Controller(({db}) => ({ }, async update(params, newData) { - if (alex(newData.title).messages.length || newData.title?.toLowerCase().includes('4chan')) { - newData.title = 'Be nice' + if (!validContent(newData.title)) { + newData.title = 'Fruit' } - if (alex(newData.content).messages.length || newData.content?.toLowerCase().includes('4chan')) { - newData.content = 'Be nice' + if (!validContent(newData.content)) { + newData.content = 'Fruit' } const data = await db.post.update({ diff --git a/examples/first-demo/pages/posts/[id].tsx b/examples/first-demo/pages/posts/[id].tsx index e91c9185af..5164d3f081 100644 --- a/examples/first-demo/pages/posts/[id].tsx +++ b/examples/first-demo/pages/posts/[id].tsx @@ -63,6 +63,8 @@ function Page({post}) { + +
For your safety, content can only be the name of a fruit
) } diff --git a/examples/first-demo/pages/posts/[id]/edit.js b/examples/first-demo/pages/posts/[id]/edit.js index df34c3faab..43b653ce7f 100644 --- a/examples/first-demo/pages/posts/[id]/edit.js +++ b/examples/first-demo/pages/posts/[id]/edit.js @@ -17,6 +17,8 @@ function Page({post}) {For your safety, content can only be the name of a fruit
+