Doorbell works, added user friendliness for setup
This commit is contained in:
18
logAuthToken.mjs
Normal file
18
logAuthToken.mjs
Normal file
@@ -0,0 +1,18 @@
|
||||
import { MatrixAuth } from "matrix-bot-sdk";
|
||||
|
||||
import configMain from "./config.json" assert {type: "json"};
|
||||
import config from "./logAuthToken.json" assert {type: "json"};
|
||||
|
||||
const homeserverUrl = configMain.homeserver;
|
||||
const username = config.username;
|
||||
const password = config.password;
|
||||
|
||||
function configNotFound(name) {
|
||||
throw new Error(`ERROR: Config option "${name}" not found`);
|
||||
}
|
||||
|
||||
if (!homeserverUrl) configNotFound("config.json => homeserver");
|
||||
if (!username) configNotFound("logAuthToken.json => username");
|
||||
if (!password) configNotFound("logAuthToken.json => password");
|
||||
|
||||
console.log("Access token: " + (await new MatrixAuth(homeserverUrl).passwordLogin(username, password)).accessToken);
|
||||
Reference in New Issue
Block a user