mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-23 06:59:29 -07:00
Support xmpp via doip-proxy
This commit is contained in:
parent
994701b181
commit
8e73360d46
2 changed files with 7 additions and 5 deletions
|
@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
const utils = require('../utils')
|
||||||
const reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/
|
const reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/
|
||||||
|
|
||||||
const processURI = (uri, opts) => {
|
const processURI = (uri, opts) => {
|
||||||
|
@ -32,10 +33,7 @@ const processURI = (uri, opts) => {
|
||||||
qr: uri,
|
qr: uri,
|
||||||
},
|
},
|
||||||
proof: {
|
proof: {
|
||||||
uri:
|
uri: utils.generateProxyURL('xmpp', `${match[1]}@${match[2]}`, opts),
|
||||||
'xmppVcardServerDomain' in opts
|
|
||||||
? `https://${opts.xmppVcardServerDomain}/api/vcard/${match[1]}@${match[2]}/DESC`
|
|
||||||
: null,
|
|
||||||
fetch: null,
|
fetch: null,
|
||||||
useProxy: false,
|
useProxy: false,
|
||||||
format: 'json',
|
format: 'json',
|
||||||
|
|
|
@ -2,9 +2,13 @@ const generateProxyURL = (type, url, opts) => {
|
||||||
if (!opts || !opts.doipProxyHostname) {
|
if (!opts || !opts.doipProxyHostname) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
let addParam = ''
|
||||||
|
if (type == 'xmpp') {
|
||||||
|
addParam += '/DESC'
|
||||||
|
}
|
||||||
return `https://${
|
return `https://${
|
||||||
opts.doipProxyHostname
|
opts.doipProxyHostname
|
||||||
}/api/1/get/${type}/${encodeURIComponent(url)}`
|
}/api/1/get/${type}/${encodeURIComponent(url)}${addParam}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateClaim = (fingerprint, format) => {
|
const generateClaim = (fingerprint, format) => {
|
||||||
|
|
Loading…
Reference in a new issue