mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-11-20 09:26:52 +01:00
* Refactor file upload and toast notifications Replaces react-hot-toast with a custom toast system using @radix-ui/react-toast, updating all usages and adding new UI components for toast and dialog. Refactors file upload to use a two-step process: first generating an S3 upload URL, then adding the file to the database, and adds file deletion support with confirmation dialog and S3 cleanup. Updates Prisma schema, removes unused fields, and cleans up navigation and admin settings page. * Enforce file upload limit and update dependencies on opensaas-sh Added a check to restrict users to 2 file uploads in the demo, with a new helper function and error handling. Updated navigation items, improved landing page content, and removed unused dependencies (react-hot-toast). Added @radix-ui/react-toast, updated testimonials, and made minor content and code improvements. * update tests * Improve file deletion error handling and cleanup Refactors file deletion to delete the database record before attempting S3 deletion, ensuring the file is removed from the app even if S3 deletion fails. Adds error logging for failed S3 deletions to aid in manual cleanup. Also simplifies error handling in the file upload page and removes unused imports in the demo app page. * Add credit check and S3 file existence validation Added logic to decrement user credits or throw an error if out of credits in the AI demo app. Updated file upload operations to validate file existence in S3 before adding to the database, and implemented S3 file existence check utility. Minor UI and code improvements included. * Update s3Utils.ts * update app_diff * fix diff * Update deletions * Improve toast UI, error handling, and credit messaging Updated toast action hover style and icon spacing for better UI consistency. Enhanced error handling in file deletion to display specific error messages. Refined credit/subscription error message in GPT response operation for clarity and removed redundant credit decrement logic. * Refactor file upload validation and error handling Replaces error state management with toast notifications for file upload errors and success. Refactors file type validation to use a new ALLOWED_FILE_TYPES_CONST and type AllowedFileTypes. Updates validation logic to throw errors instead of returning error objects, and simplifies type handling across file upload modules. * Refactor file upload to use s3Key and add cleanup job Replaces the 'key' field with 's3Key' for file storage references throughout the codebase and database schema. Updates all related logic, types, and API contracts to use 's3Key'. Adds a scheduled job to delete old files from S3 and the database. Cleans up file type validation constants and improves consistency in file upload and download operations. * add orphaned file clean up * remove s3 cleanup job from template removed but added suggestion to docs. * Update SettingsPage.tsx * prettier format * Update UI, remove unused files Updated README with deployment and demo details. Removed unused App.tsx and package-lock.json files. Modified Main.css, NavBar constants, file uploading logic, file upload operations, and landing page content sections for improved UI and functionality. * remove pricing page from isMarketingPage
148 lines
6.9 KiB
Diff
148 lines
6.9 KiB
Diff
--- template/app/main.wasp
|
|
+++ opensaas-sh/app/main.wasp
|
|
@@ -3,31 +3,32 @@
|
|
version: "^0.18.0"
|
|
},
|
|
|
|
- title: "My Open SaaS App",
|
|
+ title: "Open SaaS",
|
|
|
|
head: [
|
|
"<link rel='icon' href='/favicon.ico' />",
|
|
"<meta charset='utf-8' />",
|
|
- "<meta name='description' content='Your apps main description and features.' />",
|
|
- "<meta name='author' content='Your (App) Name' />",
|
|
- "<meta name='keywords' content='saas, solution, product, app, service' />",
|
|
-
|
|
+ "<meta name='description' content='Build and launch your SaaS application faster with our free, open-source starter kit. Features include auth, payments, AI example app, and admin dashboard.' />",
|
|
+ "<meta name='author' content='Open SaaS' />",
|
|
+ "<meta name='keywords' content='saas, starter, boilerplate, free, open source, authentication, payments' />",
|
|
+
|
|
+ "<meta property='og:site_name' content='Open SaaS' />",
|
|
"<meta property='og:type' content='website' />",
|
|
- "<meta property='og:title' content='Your Open SaaS App' />",
|
|
- "<meta property='og:site_name' content='Your Open SaaS App' />",
|
|
- "<meta property='og:url' content='https://your-saas-app.com' />",
|
|
- "<meta property='og:description' content='Your apps main description and features.' />",
|
|
- "<meta property='og:image' content='https://your-saas-app.com/public-banner.webp' />",
|
|
- "<meta name='twitter:image' content='https://your-saas-app.com/public-banner.webp' />",
|
|
+ "<meta property='og:title' content='Open SaaS' />",
|
|
+ "<meta property='og:url' content='https://opensaas.sh' />",
|
|
+ "<meta property='og:description' content='Free, open-source SaaS boilerplate starter for React & NodeJS. Powered by Wasp.' />",
|
|
+ "<meta property='og:image' content='https://opensaas.sh/public-banner.webp' />",
|
|
+
|
|
+ "<meta name=\"twitter:title\" content=\"Open SaaS\" />",
|
|
+ "<meta name=\"twitter:text:title\" content=\"Open SaaS\" />",
|
|
+ "<meta name='twitter:image' content='https://opensaas.sh/public-banner.webp' />",
|
|
+ "<meta name=\"twitter:image:alt\" content=\"Open SaaS\" />",
|
|
"<meta name='twitter:image:width' content='800' />",
|
|
"<meta name='twitter:image:height' content='400' />",
|
|
"<meta name='twitter:card' content='summary_large_image' />",
|
|
- // TODO: You can put your Plausible analytics scripts below (https://docs.opensaas.sh/guides/analytics/):
|
|
- // NOTE: Plausible does not use Cookies, so you can simply add the scripts here.
|
|
- // Google, on the other hand, does, so you must instead add the script dynamically
|
|
- // via the Cookie Consent component after the user clicks the "Accept" cookies button.
|
|
- "<script defer data-domain='<your-site-id>' src='https://plausible.io/js/script.js'></script>", // for production
|
|
- "<script defer data-domain='<your-site-id>' src='https://plausible.io/js/script.local.js'></script>", // for development
|
|
+
|
|
+ "<script defer data-domain='opensaas.sh' data-api='/waspara/wasp/event' src='/waspara/wasp/script.js'></script>",
|
|
+ "<script defer src='/piggy.js'></script>",
|
|
],
|
|
|
|
// 🔐 Auth out of the box! https://wasp.sh/docs/auth/overview
|
|
@@ -39,7 +40,7 @@
|
|
email: {
|
|
fromField: {
|
|
name: "Open SaaS App",
|
|
- email: "me@example.com"
|
|
+ email: "vince@wasp-lang.dev"
|
|
},
|
|
emailVerification: {
|
|
clientRoute: EmailVerificationRoute,
|
|
@@ -51,21 +52,18 @@
|
|
},
|
|
userSignupFields: import { getEmailUserFields } from "@src/auth/userSignupFields",
|
|
},
|
|
- // Uncomment to enable Google Auth (check https://wasp.sh/docs/auth/social-auth/google for setup instructions):
|
|
- // google: { // Guide for setting up Auth via Google
|
|
- // userSignupFields: import { getGoogleUserFields } from "@src/auth/userSignupFields",
|
|
- // configFn: import { getGoogleAuthConfig } from "@src/auth/userSignupFields",
|
|
- // },
|
|
- // Uncomment to enable GitHub Auth (check https://wasp.sh/docs/auth/social-auth/github for setup instructions):
|
|
- // gitHub: {
|
|
- // userSignupFields: import { getGitHubUserFields } from "@src/auth/userSignupFields",
|
|
- // configFn: import { getGitHubAuthConfig } from "@src/auth/userSignupFields",
|
|
- // },
|
|
- // Uncomment to enable Discord Auth (check https://wasp.sh/docs/auth/social-auth/discord for setup instructions):
|
|
- // discord: {
|
|
- // userSignupFields: import { getDiscordUserFields } from "@src/auth/userSignupFields",
|
|
- // configFn: import { getDiscordAuthConfig } from "@src/auth/userSignupFields"
|
|
- // }
|
|
+ google: {
|
|
+ userSignupFields: import { getGoogleUserFields } from "@src/auth/userSignupFields",
|
|
+ configFn: import { getGoogleAuthConfig } from "@src/auth/userSignupFields",
|
|
+ },
|
|
+ gitHub: {
|
|
+ userSignupFields: import { getGitHubUserFields } from "@src/auth/userSignupFields",
|
|
+ configFn: import { getGitHubAuthConfig } from "@src/auth/userSignupFields",
|
|
+ },
|
|
+ discord: {
|
|
+ userSignupFields: import { getDiscordUserFields } from "@src/auth/userSignupFields",
|
|
+ configFn: import { getDiscordAuthConfig } from "@src/auth/userSignupFields"
|
|
+ }
|
|
},
|
|
onAuthFailedRedirectTo: "/login",
|
|
onAuthSucceededRedirectTo: "/demo-app",
|
|
@@ -87,11 +85,11 @@
|
|
// NOTE: "Dummy" provider is just for local development purposes.
|
|
// Make sure to check the server logs for the email confirmation url (it will not be sent to an address)!
|
|
// Once you are ready for production, switch to e.g. "SendGrid" or "Mailgun" providers. Check out https://docs.opensaas.sh/guides/email-sending/ .
|
|
- provider: Dummy,
|
|
+ provider: SendGrid,
|
|
defaultFrom: {
|
|
name: "Open SaaS App",
|
|
// When using a real provider, e.g. SendGrid, you must use the same email address that you configured your account to send out emails with!
|
|
- email: "me@example.com"
|
|
+ email: "vince@wasp-lang.dev"
|
|
},
|
|
},
|
|
}
|
|
@@ -207,9 +205,9 @@
|
|
}
|
|
|
|
api paymentsWebhook {
|
|
- fn: import { paymentsWebhook } from "@src/payment/webhook",
|
|
+ fn: import { stripeWebhook } from "@src/payment/stripe/webhook",
|
|
entities: [User],
|
|
- middlewareConfigFn: import { paymentsMiddlewareConfigFn } from "@src/payment/webhook",
|
|
+ middlewareConfigFn: import { stripeMiddlewareConfigFn } from "@src/payment/stripe/webhook",
|
|
httpRoute: (POST, "/payments-webhook")
|
|
}
|
|
//#endregion
|
|
@@ -245,6 +243,17 @@
|
|
fn: import { deleteFile } from "@src/file-upload/operations",
|
|
entities: [User, File]
|
|
}
|
|
+
|
|
+job deleteFilesJob {
|
|
+ executor: PgBoss,
|
|
+ perform: {
|
|
+ fn: import { deleteFilesJob } from "@src/file-upload/workers"
|
|
+ },
|
|
+ schedule: {
|
|
+ cron: "0 5 * * *" // every day at 5am
|
|
+ },
|
|
+ entities: [File]
|
|
+}
|
|
//#endregion
|
|
|
|
//#region Analytics
|
|
@@ -291,7 +300,6 @@
|
|
component: import AdminCalendar from "@src/admin/elements/calendar/CalendarPage"
|
|
}
|
|
|
|
-
|
|
route AdminUIButtonsRoute { path: "/admin/ui/buttons", to: AdminUIButtonsPage }
|
|
page AdminUIButtonsPage {
|
|
authRequired: true,
|