|
|
@ -2,14 +2,8 @@ const EXPORTED_SYMBOLS = ["pEpServer"]; |
|
|
|
|
|
|
|
let pepServerInstance; |
|
|
|
const MIN_REQUIRED_VERSION = "0.14.0"; |
|
|
|
const MAX_RETRY_ATTEMPTS = 2; |
|
|
|
const SERVER_TYPE_CALL_FUNC = "callFunction"; |
|
|
|
const PEP_WRONG_SEC_TOKEN_CODE = -32600; |
|
|
|
|
|
|
|
const PEP_RESPONSE_OK = 0; |
|
|
|
const PEP_RESPONSE_UNENCRYPTED = 1024; |
|
|
|
const PEP_RESPONSE_DECRYPTED = 1026; |
|
|
|
|
|
|
|
class pEpServer { |
|
|
|
constructor(log, connectionInfoDetector, xhrQueue) { |
|
|
|
if (pepServerInstance) return pepServerInstance; |
|
|
@ -103,23 +97,7 @@ class pEpServer { |
|
|
|
} |
|
|
|
|
|
|
|
getConnectionAddress() { |
|
|
|
let connectionObject = this.connectionInfo; |
|
|
|
if (!this.connectionInfo) { |
|
|
|
connectionObject = { |
|
|
|
// provide a default (that should fail)
|
|
|
|
address: "127.0.0.1", |
|
|
|
port: 0, |
|
|
|
path: "/none/", |
|
|
|
pathQueryRef: "/none/", |
|
|
|
security_token: "", |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
return `http://${connectionObject.address}:${connectionObject.port}${"path" in connectionObject ? connectionObject.path : connectionObject.pathQueryRef}`; |
|
|
|
} |
|
|
|
|
|
|
|
resetConnectionInfo() { |
|
|
|
this.connectionInfo = null; |
|
|
|
return `http://${this.connectionInfo.address}:${this.connectionInfo.port}${this.connectionInfo.path}`; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|