mirror of https://github.com/lhie1/Rules.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
638 B
JavaScript
23 lines
638 B
JavaScript
const knownURLs = [
|
|
{domain: 'api.rixcloud.io', name: 'rixCloud'},
|
|
{domain: 'dler.cloud', name: 'Dler Cloud'}
|
|
]
|
|
|
|
function getConfName(url) {
|
|
let matchConst = knownURLs.find(i => url.indexOf(i.domain) > -1)
|
|
if (matchConst) {
|
|
return matchConst.name
|
|
} else {
|
|
let path = url.split('?')[0].split('/')
|
|
let filename = path[path.length - 1]
|
|
if (filename.indexOf('.conf') == filename.length - 5) {
|
|
return filename.substring(0, filename.length - 5)
|
|
} else {
|
|
return filename
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
getConfName: getConfName
|
|
} |