mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 20:32:50 +02:00
sending events in matrix
This commit is contained in:
parent
6990957c9e
commit
8a0c2b5663
13 changed files with 2764 additions and 10 deletions
20
d2m/actions/register-user.js
Normal file
20
d2m/actions/register-user.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
// @ts-check
|
||||
|
||||
const reg = require("../../matrix/read-registration.js")
|
||||
const fetch = require("node-fetch")
|
||||
|
||||
fetch("https://matrix.cadence.moe/_matrix/client/v3/register", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
type: "m.login.application_service",
|
||||
username: "_ooye_example"
|
||||
}),
|
||||
headers: {
|
||||
Authorization: `Bearer ${reg.as_token}`
|
||||
}
|
||||
}).then(res => res.text()).then(text => {
|
||||
// {"user_id":"@_ooye_example:cadence.moe","home_server":"cadence.moe","access_token":"XXX","device_id":"XXX"}
|
||||
console.log(text)
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue