diff --git a/client/config/metadata.cjs b/client/config/metadata.cjs index 2d3408a..b9ad4da 100644 --- a/client/config/metadata.cjs +++ b/client/config/metadata.cjs @@ -22,7 +22,7 @@ module.exports = { 'GM.setValue' ], connect: [ - 'cpatapi.cpsrvweb2016.cp-austria.at' + '3cxtapi.cp-austria.at' ], 'run-at': 'document-end' } diff --git a/client/src/call-history.ts b/client/src/call-history.ts index 8f43c11..1ca0ce3 100644 --- a/client/src/call-history.ts +++ b/client/src/call-history.ts @@ -2,6 +2,7 @@ import * as chrono from 'chrono-node' import { TapiContact } from './tapi-contact' import { extractNumber } from './utils' import GM_fetch from '@trim21/gm-fetch' +import { Config } from './config' export class CallHistory { private callerIds: { [number: string]: TapiContact } = {} @@ -86,7 +87,7 @@ export class CallHistory { if (this.callerIds[number] !== undefined) { this.updateCallHistoryEntry(element, this.callerIds[number]) } else { - var response = await GM_fetch('http://cpatapi.cpsrvweb2016.cp-austria.at/callerid/' + encodeURIComponent(number)) + var response = await GM_fetch(Config.tapi_server_url + '/callerid/' + encodeURIComponent(number)) var callerId: TapiContact = { tD_NAME: '' } if (response.status === 200) { callerId = await response.json() as TapiContact diff --git a/client/src/call-notification.ts b/client/src/call-notification.ts index c6358e2..7c6f97a 100644 --- a/client/src/call-notification.ts +++ b/client/src/call-notification.ts @@ -1,6 +1,7 @@ import GM_fetch from '@trim21/gm-fetch' import { TapiContact } from './tapi-contact' import { extractNumber } from './utils' +import { Config } from './config' export class CallNotification { public async showCallNotification (element: HTMLElement) { @@ -14,7 +15,7 @@ export class CallNotification { } console.log('TAPI searching callerid for', number) - var response = await GM_fetch('http://cpatapi.cpsrvweb2016.cp-austria.at/callerid/' + encodeURIComponent(number)) + var response = await GM_fetch(Config.tapi_server_url + '/callerid/' + encodeURIComponent(number)) console.log('TAPI callerid response', response) var notification = { text: number diff --git a/client/src/config.ts b/client/src/config.ts new file mode 100644 index 0000000..654b647 --- /dev/null +++ b/client/src/config.ts @@ -0,0 +1,5 @@ +class _Config { + public tapi_server_url: string = 'https://3cxtapi.cp-austria.at' +} + +export const Config = new _Config() diff --git a/client/src/search.ts b/client/src/search.ts index f056826..bca3ff7 100644 --- a/client/src/search.ts +++ b/client/src/search.ts @@ -3,6 +3,7 @@ import { TapiContact } from './tapi-contact' import { debounce } from './debounce' import { fireChangeEvents } from './utils' import GM_fetch from '@trim21/gm-fetch' +import { Config } from './config' export class Search { private currentSearchText = '' @@ -103,7 +104,7 @@ export class Search { return } console.log('Searching TAPI') - var response = await GM_fetch('http://cpatapi.cpsrvweb2016.cp-austria.at/search?query=' + encodeURIComponent(searchText)) + var response = await GM_fetch(Config.tapi_server_url + '/search?query=' + encodeURIComponent(searchText)) console.log('TAPI Search response', response) var contacts = await response.json() as TapiContact[] console.log('TAPI Contacts', contacts) diff --git a/client/src/status.ts b/client/src/status.ts index 02c5812..d516fad 100644 --- a/client/src/status.ts +++ b/client/src/status.ts @@ -1,3 +1,4 @@ +import { Config } from './config'; import './status.css'; import { ZcStatus } from './zc-status'; import GM_fetch from "@trim21/gm-fetch"; @@ -26,7 +27,7 @@ export class Status { private async checkStatus() { if (this._enabled) { try { - var response = await GM_fetch('http://cpatapi.cpsrvweb2016.cp-austria.at/availability/' + encodeURIComponent(this._user)); + var response = await GM_fetch(Config.tapi_server_url + '/availability/' + encodeURIComponent(this._user)); if (response.status == 200) { var status = await response.json() as ZcStatus; if (this._currentStatus !== status.loggedIn) { @@ -69,44 +70,44 @@ export class Status { menu.appendChild(link); var html = - ''; + ''; var modal = document.createElement('modal-container'); modal.id = 'zc-modal'; modal.classList.add('modal');