@@ -19,8 +19,10 @@ import {
1919} from '@modules/subscription-template/constants' ;
2020import { RemnawaveSettingsEntity } from '@modules/remnawave-settings/entities/remnawave-settings.entity' ;
2121import {
22+ CustomRemarksSchema ,
2223 PasskeySettingsSchema ,
2324 TBrandingSettings ,
25+ TCustomRemarks ,
2426 THwidSettings ,
2527 TOauth2Settings ,
2628 TPasswordAuthSettings ,
@@ -282,22 +284,6 @@ async function seedSubscriptionTemplate() {
282284}
283285
284286async function seedSubscriptionSettings ( ) {
285- const existingConfig = await prisma . subscriptionSettings . findFirst ( ) ;
286-
287- if ( existingConfig ) {
288- if ( existingConfig . hwidSettings === null ) {
289- await prisma . subscriptionSettings . update ( {
290- where : { uuid : existingConfig . uuid } ,
291- data : { hwidSettings : DEFAULT_HWID_SETTINGS } ,
292- } ) ;
293-
294- consola . success ( '🔐 Default HWID Settings have been seeded!' ) ;
295- }
296-
297- consola . info ( 'Default subscription settings already seeded!' ) ;
298- return ;
299- }
300-
301287 const customRemarks = {
302288 expiredUsers : [ '⌛ Subscription expired' , 'Contact support' ] ,
303289 limitedUsers : [ '🚧 Subscription limited' , 'Contact support' ] ,
@@ -308,13 +294,42 @@ async function seedSubscriptionSettings() {
308294 '→ No hosts found' ,
309295 '→ Check Hosts tab' ,
310296 ] ,
311- emptyInternal : [
297+ emptyInternalSquads : [
312298 '→ Remnawave' ,
313299 'Did you forget to add internal squads?' ,
314300 '→ No internal squads found' ,
315301 'User has no internal squads' ,
316302 ] ,
317- } ;
303+ } satisfies TCustomRemarks ;
304+
305+ const existingConfig = await prisma . subscriptionSettings . findFirst ( ) ;
306+
307+ if ( existingConfig ) {
308+ if ( existingConfig . hwidSettings === null ) {
309+ await prisma . subscriptionSettings . update ( {
310+ where : { uuid : existingConfig . uuid } ,
311+ data : { hwidSettings : DEFAULT_HWID_SETTINGS } ,
312+ } ) ;
313+
314+ consola . success ( '🔐 Default HWID Settings have been seeded!' ) ;
315+ }
316+
317+ if ( existingConfig . customRemarks ) {
318+ const isValid = await CustomRemarksSchema . safeParseAsync ( existingConfig . customRemarks ) ;
319+ if ( ! isValid . success ) {
320+ await prisma . subscriptionSettings . update ( {
321+ where : { uuid : existingConfig . uuid } ,
322+ data : { customRemarks : customRemarks } ,
323+ } ) ;
324+
325+ consola . success ( '🔐 Custom remarks updated!' ) ;
326+ return ;
327+ }
328+ }
329+
330+ consola . success ( '🔐 Custom remarks seeded!' ) ;
331+ return ;
332+ }
318333
319334 await prisma . subscriptionSettings . create ( {
320335 data : {
0 commit comments