diff --git a/pb/pb_migrations/1763066773_updated_posts.js b/pb/pb_migrations/1763066773_updated_posts.js new file mode 100644 index 0000000..4bf57df --- /dev/null +++ b/pb/pb_migrations/1763066773_updated_posts.js @@ -0,0 +1,26 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("jbzxvie5c27b6od") + + // update collection data + unmarshal({ + "createRule": "", + "deleteRule": "", + "updateRule": "", + "viewRule": "" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("jbzxvie5c27b6od") + + // update collection data + unmarshal({ + "createRule": null, + "deleteRule": null, + "updateRule": null, + "viewRule": null + }, collection) + + return app.save(collection) +}) diff --git a/pb/pb_migrations/1763066790_updated_posts.js b/pb/pb_migrations/1763066790_updated_posts.js new file mode 100644 index 0000000..6f1077e --- /dev/null +++ b/pb/pb_migrations/1763066790_updated_posts.js @@ -0,0 +1,28 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("jbzxvie5c27b6od") + + // update collection data + unmarshal({ + "createRule": null, + "deleteRule": null, + "listRule": null, + "updateRule": null, + "viewRule": null + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("jbzxvie5c27b6od") + + // update collection data + unmarshal({ + "createRule": "", + "deleteRule": "", + "listRule": "", + "updateRule": "", + "viewRule": "" + }, collection) + + return app.save(collection) +}) diff --git a/pb/pb_migrations/1763067132_updated_photos.js b/pb/pb_migrations/1763067132_updated_photos.js new file mode 100644 index 0000000..d03d23c --- /dev/null +++ b/pb/pb_migrations/1763067132_updated_photos.js @@ -0,0 +1,20 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("my9ej2vdwzwoqov") + + // update collection data + unmarshal({ + "listRule": "@request.auth.email=\"site@breadone.net\"" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("my9ej2vdwzwoqov") + + // update collection data + unmarshal({ + "listRule": "" + }, collection) + + return app.save(collection) +}) diff --git a/pb/pb_migrations/1763067184_updated_posts.js b/pb/pb_migrations/1763067184_updated_posts.js new file mode 100644 index 0000000..7b56504 --- /dev/null +++ b/pb/pb_migrations/1763067184_updated_posts.js @@ -0,0 +1,22 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("jbzxvie5c27b6od") + + // update collection data + unmarshal({ + "listRule": "@request.auth.email=\"site@breadone.net\"", + "viewRule": "@request.auth.email=\"site@breadone.net\"" + }, collection) + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("jbzxvie5c27b6od") + + // update collection data + unmarshal({ + "listRule": null, + "viewRule": null + }, collection) + + return app.save(collection) +}) diff --git a/web/package-lock.json b/web/package-lock.json index 86fe398..b314ed0 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -11,6 +11,7 @@ "@astrojs/node": "^9.5.0", "@tailwindcss/vite": "^4.1.17", "astro": "^5.15.4", + "pocketbase": "^0.26.3", "tailwindcss": "^4.1.17" } }, @@ -4398,6 +4399,12 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pocketbase": { + "version": "0.26.3", + "resolved": "https://registry.npmjs.org/pocketbase/-/pocketbase-0.26.3.tgz", + "integrity": "sha512-5deUKRoEczpxxuHzwr6/DHVmgbggxylEVig8CKN+MjvtYxPUqX/C6puU0yaR2yhTi8zrh7J9s7Ty+qBGwVzWOQ==", + "license": "MIT" + }, "node_modules/postcss": { "version": "8.5.6", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", diff --git a/web/package.json b/web/package.json index ffdf137..86f31bc 100644 --- a/web/package.json +++ b/web/package.json @@ -12,6 +12,7 @@ "@astrojs/node": "^9.5.0", "@tailwindcss/vite": "^4.1.17", "astro": "^5.15.4", + "pocketbase": "^0.26.3", "tailwindcss": "^4.1.17" } } diff --git a/web/src/utils/pocketbase.ts b/web/src/utils/pocketbase.ts new file mode 100644 index 0000000..cb7bb75 --- /dev/null +++ b/web/src/utils/pocketbase.ts @@ -0,0 +1,13 @@ +import PocketBase from "pocketbase"; + +const pb = new PocketBase("/"); + +export const authPB = async () => { + if (!pb.authStore.isValid) { + await pb.collection('users').authWithPassword( + import.meta.env.PB_EMAIL, + import.meta.env.PB_PW + ); + } + return pb; +};