1.1.8
Good to know
Please check the
versionfield in thepackage.jsonfile for the version number
Fix LanguageDetectionAlert Multi-language
Update level: 1.1.7+ must modify; 1.1.7- do not modify.
After upgrading the multi-language structure in 1.1.7, the location where
LanguageDetectionAlertretrieves multi-language text was not updated, so this fixes it.
// const messages = require(`@/i18n/messages/${currentLocale}.json`); // remove
const messages = require(`@/i18n/messages/${currentLocale}/common.json`); // addShare isValidRedirectUrl for Login Validation
Update level: Optional modification.
This change is to synchronize the validation process across different login methods.
Move the URL validation method isValidRedirectUrl from app/auth/confirm/route.ts to a separate file app/auth/utils.ts
const ALLOWED_REDIRECT_HOSTS = (
process.env.NODE_ENV === 'development'
? (process.env.ALLOWED_REDIRECT_HOSTS?.split(',') || [])
: []
).concat(process.env.NEXT_PUBLIC_SITE_URL!).filter(Boolean) as string[]
export function isValidRedirectUrl(url: string): boolean {
try {
if (url.startsWith('/api/')) {
return false;
}
if (url.startsWith('/')) {
return true;
}
const parsedUrl = new URL(url)
return ALLOWED_REDIRECT_HOSTS.includes(parsedUrl.host)
} catch {
return false
}
}Use the same URL validation in both app/auth/callback/route.ts and app/auth/confirm/route.ts:
let next = searchParams.get('next') ?? '/'
next = next == 'null' ? '/' : next
// Add
if (!isValidRedirectUrl(next)) {
console.error('Invalid redirect URL')
return NextResponse.redirect(new URL(`/redirect-error?code=invalid_redirect`, origin))
}Optimize Image Upload Failure Handling
Update level: Optional modification.
This change is to clear selected images after image upload failure.
if (
!presignedUrlActionResponse.success ||
!presignedUrlActionResponse.data
) {
setPreviewUrl(null); // add, Line 70
toast.error(t("uploadError"), {
description:
presignedUrlActionResponse.error || t("presignedUrlError"),
});
return "";
}
// ...
try {
// ...
} catch (error) {
setPreviewUrl(null); // add, Line 107
console.error("MDX Image Upload failed:", error);
toast.error(getErrorMessage(error) || t("upload.uploadErrorUnexpected"));
} finally {
// ...
}Remove period_start and period_end Fields from orders Table
Update level: No modification needed.
This change removes meaningless fields. Whether you keep them or not does not affect functionality. It's recommended that cloned code does not need modification.
-
Remove the
period_startandperiod_enddefinitions fromdata/orders.sql -
Remove lines involving
period_startandperiod_endfields in thehandleInvoicePaidfunction withinlib/stripe/webhook-handlers.ts:
// period_start: invoice.period_start ? new Date(invoice.period_start * 1000).toISOString() : null, // remove
// period_end: invoice.period_end ? new Date(invoice.period_end * 1000).toISOString() : null, // remove-
Delete the
period_startandperiod_endfields in Supabase Console Table Editor -
Update local Supabase type definitions:
supabase gen types typescript --project-id <your-project-id> --schema public > lib/supabase/types.tsAnnual Subscription Example
Example code: subscription-yearly branch
Documentation: https://nexty.dev/docs/guide/payment/yearly-subscription