mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-02 16:29:39 +00:00
Add isMissing to Plugin model, add manifest version and name validation, create/update plugins table
This commit is contained in:
parent
5a96d8aeb3
commit
cfe3deff3b
5 changed files with 106 additions and 7 deletions
|
|
@ -243,3 +243,21 @@ module.exports.isValidASIN = (str) => {
|
|||
if (!str || typeof str !== 'string') return false
|
||||
return /^[A-Z0-9]{10}$/.test(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse semver string that must be in format "major.minor.patch" all numbers
|
||||
*
|
||||
* @param {string} version
|
||||
* @returns {{major: number, minor: number, patch: number} | null}
|
||||
*/
|
||||
module.exports.parseSemverStrict = (version) => {
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
const [major, minor, patch] = version.split('.').map(Number)
|
||||
|
||||
if (isNaN(major) || isNaN(minor) || isNaN(patch)) {
|
||||
return null
|
||||
}
|
||||
return { major, minor, patch }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue