mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
feat: Remove query-string dep
This commit is contained in:
parent
3d643afdfa
commit
025cd12aba
2 changed files with 5 additions and 6 deletions
|
@ -19,7 +19,6 @@
|
||||||
"irc-upd": "^0.11.0",
|
"irc-upd": "^0.11.0",
|
||||||
"merge-options": "^3.0.3",
|
"merge-options": "^3.0.3",
|
||||||
"openpgp": "^5.5.0",
|
"openpgp": "^5.5.0",
|
||||||
"query-string": "^6.14.1",
|
|
||||||
"valid-url": "^1.0.9",
|
"valid-url": "^1.0.9",
|
||||||
"validator": "^13.5.2"
|
"validator": "^13.5.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
const E = require('../enums')
|
const E = require('../enums')
|
||||||
const queryString = require('query-string')
|
|
||||||
|
|
||||||
const reURI = /^matrix:u\/(?:@)?([^@:]*:[^?]*)(\?.*)?/
|
const reURI = /^matrix:u\/(?:@)?([^@:]*:[^?]*)(\?.*)?/
|
||||||
|
|
||||||
|
@ -25,14 +24,15 @@ const processURI = (uri) => {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const params = queryString.parse(match[2])
|
const params = new URLSearchParams(match[2])
|
||||||
const paramRoomId = `${params['org.keyoxide.r'][0] !== '!' ? '!' : ''}${params['org.keyoxide.r']}`
|
|
||||||
const paramEventId = `${params['org.keyoxide.e'][0] !== '$' ? '$' : ''}${params['org.keyoxide.e']}`
|
|
||||||
|
|
||||||
if (!('org.keyoxide.e' in params && 'org.keyoxide.r' in params)) {
|
if (!(params.has('org.keyoxide.e') && params.has('org.keyoxide.r'))) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const paramRoomId = `${params.get('org.keyoxide.r')[0] !== '!' ? '!' : ''}${params.get('org.keyoxide.r')}`
|
||||||
|
const paramEventId = `${params.get('org.keyoxide.e')[0] !== '$' ? '$' : ''}${params.get('org.keyoxide.e')}`
|
||||||
|
|
||||||
const profileUrl = `https://matrix.to/#/@${match[1]}`
|
const profileUrl = `https://matrix.to/#/@${match[1]}`
|
||||||
const eventUrl = `https://matrix.to/#/${paramRoomId}/${paramEventId}`
|
const eventUrl = `https://matrix.to/#/${paramRoomId}/${paramEventId}`
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue