@@ -17,7 +17,7 @@ import {
1717
1818import fs from 'fs' ;
1919import path from 'path' ;
20- import { guessLabelFromName , md5hash , suggestIfTypo } from './utils.js' ;
20+ import { guessLabelFromName , md5hash , suggestIfTypo , slugifyString } from './utils.js' ;
2121import {
2222 AdminForthSortDirections ,
2323 type AdminForthComponentDeclarationFull ,
@@ -30,7 +30,6 @@ import AdminForth from "adminforth";
3030import { AdminForthConfigMenuItem } from "adminforth" ;
3131
3232
33-
3433export default class ConfigValidator implements IConfigValidator {
3534
3635 customComponentsDir : string | undefined ;
@@ -169,9 +168,8 @@ export default class ConfigValidator implements IConfigValidator {
169168 }
170169
171170 // slug should have only lowercase letters, dashes and numbers
172- customization . brandNameSlug = customization . brandName . toLowerCase ( ) . replace ( / [ ^ a - z 0 - 9 - ] / g , '' ) ;
171+ customization . brandNameSlug = slugifyString ( customization . brandName ) ;
173172
174-
175173 if ( customization . brandLogo ) {
176174 errors . push ( ...this . checkCustomFileExists ( customization . brandLogo ) ) ;
177175 }
@@ -1002,6 +1000,7 @@ export default class ConfigValidator implements IConfigValidator {
10021000 if ( newConfig . auth . userMenuSettingsPages ) {
10031001 for ( const page of newConfig . auth . userMenuSettingsPages ) {
10041002 this . validateComponent ( { file : page . component } , errors ) ;
1003+ page . slug = page . slug ?? slugifyString ( page . pageLabel ) ;
10051004 }
10061005 }
10071006
0 commit comments