Enable remote launcher catalog source
Some checks failed
Build / release (macos-latest) (push) Has been cancelled
Build / release (ubuntu-latest) (push) Has been cancelled
Build / release (windows-latest) (push) Has been cancelled
Windows Smoke Test / windows-smoke (push) Has been cancelled

This commit is contained in:
2026-05-05 22:46:03 +09:00
parent 9e8fd9e74b
commit 87c56a21d5
11 changed files with 188 additions and 38 deletions

View File

@@ -476,7 +476,11 @@ exports.getLibraryCatalogSource = function(){
* @param {string|null} source A remote URL or local path.
*/
exports.setLibraryCatalogSource = function(source){
config.library.catalogSource = source
if(typeof source !== 'string' || source.trim().length === 0){
config.library.catalogSource = null
} else {
config.library.catalogSource = source.trim()
}
}
/**
@@ -998,3 +1002,22 @@ exports.getAllowPrerelease = function(def = false){
exports.setAllowPrerelease = function(allowPrerelease){
config.settings.launcher.allowPrerelease = allowPrerelease
}
/**
* Validate a library catalog source.
*
* @param {string} source A remote URL or local path.
* @returns {boolean} Whether the value is allowed.
*/
exports.validateLibraryCatalogSource = function(source){
const trimmedSource = typeof source === 'string' ? source.trim() : ''
if(trimmedSource.length === 0){
return true
}
if(trimmedSource.includes('://')){
return /^https?:\/\/\S+$/i.test(trimmedSource) || trimmedSource.startsWith('file://')
}
return true
}