mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 20:32:50 +02:00
Log in with Matrix
This commit is contained in:
parent
63cc089bdb
commit
443618b974
13 changed files with 222 additions and 23 deletions
|
@ -377,6 +377,27 @@ async function getAlias(alias) {
|
|||
return root.room_id
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type namespaced event type, e.g. m.direct
|
||||
* @param {string} [mxid] you
|
||||
* @returns the *content* of the account data "event"
|
||||
*/
|
||||
async function getAccountData(type, mxid) {
|
||||
if (!mxid) mxid = `@${reg.sender_localpart}:${reg.ooye.server_name}`
|
||||
const root = await mreq.mreq("GET", `/client/v3/user/${mxid}/account_data/${type}`)
|
||||
return root
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type namespaced event type, e.g. m.direct
|
||||
* @param {any} content whatever you want
|
||||
* @param {string} [mxid] you
|
||||
*/
|
||||
async function setAccountData(type, content, mxid) {
|
||||
if (!mxid) mxid = `@${reg.sender_localpart}:${reg.ooye.server_name}`
|
||||
await mreq.mreq("PUT", `/client/v3/user/${mxid}/account_data/${type}`, content)
|
||||
}
|
||||
|
||||
module.exports.path = path
|
||||
module.exports.register = register
|
||||
module.exports.createRoom = createRoom
|
||||
|
@ -406,3 +427,5 @@ module.exports.getMedia = getMedia
|
|||
module.exports.sendReadReceipt = sendReadReceipt
|
||||
module.exports.ackEvent = ackEvent
|
||||
module.exports.getAlias = getAlias
|
||||
module.exports.getAccountData = getAccountData
|
||||
module.exports.setAccountData = setAccountData
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue