mirror of
https://github.com/gnmyt/LicenseAPI.git
synced 2026-01-11 02:31:46 +00:00
Fix license.ts#replaceLicenseDefaults
This commit is contained in:
@ -29,13 +29,26 @@ export const generateRandom = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const replaceLicenseDefaults = (defaultKey: string) => {
|
export const replaceLicenseDefaults = (defaultKey: string) => {
|
||||||
return defaultKey.replace(/N/g, () => String(Math.floor(Math.random() * 10)))
|
return defaultKey.split('').map(char => {
|
||||||
.replace(/C/g, () => generateCharacter())
|
switch (char) {
|
||||||
.replace(/L/g, () => String.fromCharCode(Math.floor(Math.random() * 26) + 97))
|
case 'N':
|
||||||
.replace(/U/g, () => String.fromCharCode(Math.floor(Math.random() * 26) + 65))
|
return String(Math.floor(Math.random() * 10));
|
||||||
.replace(/S/g, () => generateSpecialCharacter())
|
case 'C':
|
||||||
.replace(/A/g, () => generateAlphaNumeric())
|
return generateCharacter();
|
||||||
.replace(/R/g, () => generateRandom());
|
case 'L':
|
||||||
|
return String.fromCharCode(Math.floor(Math.random() * 26) + 97);
|
||||||
|
case 'U':
|
||||||
|
return String.fromCharCode(Math.floor(Math.random() * 26) + 65);
|
||||||
|
case 'S':
|
||||||
|
return generateSpecialCharacter();
|
||||||
|
case 'A':
|
||||||
|
return generateAlphaNumeric();
|
||||||
|
case 'R':
|
||||||
|
return generateRandom();
|
||||||
|
default:
|
||||||
|
return char;
|
||||||
|
}
|
||||||
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
export const checkLicenseConfiguration = async (access: IProject, config: ILicense) => {
|
export const checkLicenseConfiguration = async (access: IProject, config: ILicense) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user