forked from Mirrors/doipjs
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",
|
||||
"merge-options": "^3.0.3",
|
||||
"openpgp": "^5.5.0",
|
||||
"query-string": "^6.14.1",
|
||||
"valid-url": "^1.0.9",
|
||||
"validator": "^13.5.2"
|
||||
},
|
||||
|
|
|
@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
const E = require('../enums')
|
||||
const queryString = require('query-string')
|
||||
|
||||
const reURI = /^matrix:u\/(?:@)?([^@:]*:[^?]*)(\?.*)?/
|
||||
|
||||
|
@ -25,14 +24,15 @@ const processURI = (uri) => {
|
|||
return null
|
||||
}
|
||||
|
||||
const params = queryString.parse(match[2])
|
||||
const paramRoomId = `${params['org.keyoxide.r'][0] !== '!' ? '!' : ''}${params['org.keyoxide.r']}`
|
||||
const paramEventId = `${params['org.keyoxide.e'][0] !== '$' ? '$' : ''}${params['org.keyoxide.e']}`
|
||||
const params = new URLSearchParams(match[2])
|
||||
|
||||
if (!('org.keyoxide.e' in params && 'org.keyoxide.r' in params)) {
|
||||
if (!(params.has('org.keyoxide.e') && params.has('org.keyoxide.r'))) {
|
||||
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 eventUrl = `https://matrix.to/#/${paramRoomId}/${paramEventId}`
|
||||
|
||||
|
|
Loading…
Reference in a new issue