mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Make matrix URIs compliant with MSC2312
This commit is contained in:
parent
aebd0eabe8
commit
622d56b47d
1 changed files with 6 additions and 6 deletions
|
@ -17,7 +17,7 @@ const bent = require('bent')
|
||||||
const req = bent('GET')
|
const req = bent('GET')
|
||||||
const queryString = require('query-string')
|
const queryString = require('query-string')
|
||||||
const utils = require('../utils')
|
const utils = require('../utils')
|
||||||
const reURI = /^matrix\:u\/(\@[^:]*\:[^?]*)(\?.*)?/
|
const reURI = /^matrix\:u\/(?:\@)?([^@:]*\:[^?]*)(\?.*)?/
|
||||||
|
|
||||||
const processURI = (uri, opts) => {
|
const processURI = (uri, opts) => {
|
||||||
if (!opts) {
|
if (!opts) {
|
||||||
|
@ -32,7 +32,7 @@ const processURI = (uri, opts) => {
|
||||||
if (match[2]) {
|
if (match[2]) {
|
||||||
const params = queryString.parse(match[2])
|
const params = queryString.parse(match[2])
|
||||||
if ('org.keyoxide.e' in params && 'org.keyoxide.r' in params) {
|
if ('org.keyoxide.e' in params && 'org.keyoxide.r' in params) {
|
||||||
profileUrl = `https://matrix.to/#/${match[1]}`
|
profileUrl = `https://matrix.to/#/@${match[1]}`
|
||||||
eventUrl = `https://matrix.to/#/${params['org.keyoxide.r']}/${params['org.keyoxide.e']}`
|
eventUrl = `https://matrix.to/#/${params['org.keyoxide.r']}/${params['org.keyoxide.e']}`
|
||||||
proofUrl = utils.generateProxyURL(
|
proofUrl = utils.generateProxyURL(
|
||||||
'matrix',
|
'matrix',
|
||||||
|
@ -48,7 +48,7 @@ const processURI = (uri, opts) => {
|
||||||
name: 'matrix',
|
name: 'matrix',
|
||||||
},
|
},
|
||||||
profile: {
|
profile: {
|
||||||
display: match[1],
|
display: `@${match[1]}`,
|
||||||
uri: profileUrl,
|
uri: profileUrl,
|
||||||
qr: null,
|
qr: null,
|
||||||
},
|
},
|
||||||
|
@ -70,12 +70,12 @@ const processURI = (uri, opts) => {
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
{
|
{
|
||||||
uri: 'matrix:u/@alice:matrix.domain.org',
|
uri:
|
||||||
|
'matrix:u/alice:matrix.domain.org?org.keyoxide.r=!123:domain.org&org.keyoxide.e=$123',
|
||||||
shouldMatch: true,
|
shouldMatch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uri:
|
uri: 'matrix:u/alice:matrix.domain.org',
|
||||||
'matrix:u/@alice:matrix.domain.org?org.keyoxide.r=!123:domain.org&org.keyoxide.e=$123',
|
|
||||||
shouldMatch: true,
|
shouldMatch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue