New 3cx tapi server url

This commit is contained in:
2026-03-19 13:38:06 +01:00
parent 535cf6ea05
commit c16c07ea42
6 changed files with 52 additions and 43 deletions

View File

@@ -22,7 +22,7 @@ module.exports = {
'GM.setValue' 'GM.setValue'
], ],
connect: [ connect: [
'cpatapi.cpsrvweb2016.cp-austria.at' '3cxtapi.cp-austria.at'
], ],
'run-at': 'document-end' 'run-at': 'document-end'
} }

View File

@@ -2,6 +2,7 @@ import * as chrono from 'chrono-node'
import { TapiContact } from './tapi-contact' import { TapiContact } from './tapi-contact'
import { extractNumber } from './utils' import { extractNumber } from './utils'
import GM_fetch from '@trim21/gm-fetch' import GM_fetch from '@trim21/gm-fetch'
import { Config } from './config'
export class CallHistory { export class CallHistory {
private callerIds: { [number: string]: TapiContact } = {} private callerIds: { [number: string]: TapiContact } = {}
@@ -86,7 +87,7 @@ export class CallHistory {
if (this.callerIds[number] !== undefined) { if (this.callerIds[number] !== undefined) {
this.updateCallHistoryEntry(element, this.callerIds[number]) this.updateCallHistoryEntry(element, this.callerIds[number])
} else { } 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: '' } var callerId: TapiContact = { tD_NAME: '' }
if (response.status === 200) { if (response.status === 200) {
callerId = await response.json() as TapiContact callerId = await response.json() as TapiContact

View File

@@ -1,6 +1,7 @@
import GM_fetch from '@trim21/gm-fetch' import GM_fetch from '@trim21/gm-fetch'
import { TapiContact } from './tapi-contact' import { TapiContact } from './tapi-contact'
import { extractNumber } from './utils' import { extractNumber } from './utils'
import { Config } from './config'
export class CallNotification { export class CallNotification {
public async showCallNotification (element: HTMLElement) { public async showCallNotification (element: HTMLElement) {
@@ -14,7 +15,7 @@ export class CallNotification {
} }
console.log('TAPI searching callerid for', number) 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) console.log('TAPI callerid response', response)
var notification = { var notification = {
text: number text: number

5
client/src/config.ts Normal file
View File

@@ -0,0 +1,5 @@
class _Config {
public tapi_server_url: string = 'https://3cxtapi.cp-austria.at'
}
export const Config = new _Config()

View File

@@ -3,6 +3,7 @@ import { TapiContact } from './tapi-contact'
import { debounce } from './debounce' import { debounce } from './debounce'
import { fireChangeEvents } from './utils' import { fireChangeEvents } from './utils'
import GM_fetch from '@trim21/gm-fetch' import GM_fetch from '@trim21/gm-fetch'
import { Config } from './config'
export class Search { export class Search {
private currentSearchText = '' private currentSearchText = ''
@@ -103,7 +104,7 @@ export class Search {
return return
} }
console.log('Searching TAPI') 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) console.log('TAPI Search response', response)
var contacts = await response.json() as TapiContact[] var contacts = await response.json() as TapiContact[]
console.log('TAPI Contacts', contacts) console.log('TAPI Contacts', contacts)

View File

@@ -1,3 +1,4 @@
import { Config } from './config';
import './status.css'; import './status.css';
import { ZcStatus } from './zc-status'; import { ZcStatus } from './zc-status';
import GM_fetch from "@trim21/gm-fetch"; import GM_fetch from "@trim21/gm-fetch";
@@ -26,7 +27,7 @@ export class Status {
private async checkStatus() { private async checkStatus() {
if (this._enabled) { if (this._enabled) {
try { 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) { if (response.status == 200) {
var status = await response.json() as ZcStatus; var status = await response.json() as ZcStatus;
if (this._currentStatus !== status.loggedIn) { if (this._currentStatus !== status.loggedIn) {