Use accessToken instead of password
This commit is contained in:
parent
5d3f6c226c
commit
3caf8a6502
@ -4,6 +4,7 @@
|
||||
"matrixdomain": "matrix.org",
|
||||
"matrixuser": "smsbot",
|
||||
"matrixpass": "hunter2",
|
||||
"matrixaccesstoken": "",
|
||||
"inviteusers": ["@annoyme:matrix.org"],
|
||||
"smsapikey": "Voxtelesys SMS API key goes here",
|
||||
"smsfrom": "Voxtelesys DID goes here",
|
||||
|
14
main.js
14
main.js
@ -457,13 +457,12 @@ function handleHTTPRequest(req, res) {
|
||||
}
|
||||
}
|
||||
|
||||
const client = sdk.createClient({baseUrl: settings.homeserver});
|
||||
const client = sdk.createClient({baseUrl: settings.homeserver, userId: settings.matrixuser, accessToken: settings.matrixaccesstoken});
|
||||
var httpserver = express();
|
||||
var jsonParser = bodyParser.json();
|
||||
client.login("m.login.password", {"user": settings.matrixuser, "password": settings.matrixpass}).then((response) => {
|
||||
client.startClient();
|
||||
logger.info("Plugged into the matrix.");
|
||||
client.once('sync', function (state, prevState, res) {
|
||||
client.startClient({initialSyncLimit: 10});
|
||||
logger.info("Plugged into the matrix.");
|
||||
client.once('sync', function (state, prevState, res) {
|
||||
logger.debug("Initial sync complete (" + state + ")");
|
||||
initialsynccomplete = true;
|
||||
httpserver.post("*", jsonParser, (req, res) => {
|
||||
@ -480,8 +479,8 @@ client.login("m.login.password", {"user": settings.matrixuser, "password": setti
|
||||
setInterval(checkSMS, settings.smsinterval * 1000);
|
||||
checkSMS();
|
||||
}
|
||||
});
|
||||
client.on("Room.timeline", function (event, room) {
|
||||
});
|
||||
client.on("Room.timeline", function (event, room) {
|
||||
try {
|
||||
if (!initialsynccomplete) {
|
||||
return; // ignore anything while we were offline
|
||||
@ -676,5 +675,4 @@ client.login("m.login.password", {"user": settings.matrixuser, "password": setti
|
||||
} catch (ex) {
|
||||
logger.error("Error handling incoming event: " + ex);
|
||||
}
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user