оменял логику определения сервера

master
Sipachev Igor 3 years ago
parent a6bdaac2ef
commit d4a7dbeb08
  1. 25
      popup/src/api/DomainResolver.ts

@ -29,29 +29,24 @@ export class DomainResolver {
const parts = url.match(/http:\/\/.*?\.(.*?)\..*?/) || [] const parts = url.match(/http:\/\/.*?\.(.*?)\..*?/) || []
const nickname = parts[1] || null const nickname = parts[1] || null
const isPlacetgroup = url.indexOf('laen') > -1 ||
url.indexOf('smsmoney') > -1 ||
url.indexOf('smsraha') > -1 ||
url.indexOf('placetgroup') > -1
const isNordecum = url.indexOf('smspinigai') > -1 || const isNordecum = url.indexOf('smspinigai') > -1 ||
url.indexOf('paskolos') > -1 || url.indexOf('paskolos') > -1 ||
url.indexOf('nordecum') > -1 url.indexOf('nordecum') > -1
if (!isPlacetgroup && !isNordecum) { const project = isNordecum ? 'nordecum' : 'placetgroup'
const tld = isNordecum ? 'lt' : 'com'
const isLocal = url.indexOf('.sv') !== -1
if (isLocal && !nickname) {
return null return null
} }
const project = isPlacetgroup ? 'placetgroup' : 'nordecum' url = isLocal
const tld = isPlacetgroup ? 'com' : 'lt' ? 'http://' + project + '.' + nickname + '.sv'
const isLocal = url.indexOf('.sv') !== -1 : 'https://dev.' + project + '.' + tld
if (nickname && isLocal) {
url = project + '.' + nickname + '.sv' console.log('domain_resolver', parts, nickname, isNordecum, project, tld, url)
} else {
url = 'dev.' + project + '.' + tld
}
url = (isLocal ? 'http://' : 'https://') + url
console.log('domain_resolver', parts, nickname, isPlacetgroup, project, tld, url)
return url return url
} }
} }

Loading…
Cancel
Save