0.2.5 initial commit

Makefile incomplete
This commit is contained in:
Aiden McClelland
2020-11-23 13:44:28 -07:00
commit 95d3845906
503 changed files with 53448 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { Injectable } from '@angular/core'
@Injectable({
providedIn: 'root',
})
export class ConfigService {
origin = removePort(removeProtocol(window.origin))
version = require('../../../package.json').version
api = {
useMocks: require('../../../use-mocks.json').useMocks,
url: '/api',
version: '/v0',
root: '', // empty will default to same origin
}
isConsulateIos = window['platform'] === 'ios'
isConsulateAndroid = window['platform'] === 'android'
isTor () : boolean {
return this.api.useMocks || this.origin.endsWith('.onion')
}
}
function removeProtocol (str: string): string {
if (str.startsWith('http://')) return str.slice(7)
if (str.startsWith('https://')) return str.slice(8)
return str
}
function removePort (str: string): string {
return str.split(':')[0]
}