Compare commits
3 Commits
7828d754f5
...
c9032653f9
Author | SHA1 | Date | |
---|---|---|---|
c9032653f9 | |||
e00220f0a7 | |||
c42f228463 |
2
main.lua
2
main.lua
@ -2,7 +2,7 @@ Server = "localhost"
|
||||
Username = "ErrorNoWatcher"
|
||||
HttpAddress = "127.0.0.1:8080"
|
||||
Owners = { "ErrorNoInternet" }
|
||||
Matrix = { Owners = { "@errornointernet:envs.net" } }
|
||||
MatrixOptions = { Owners = { "@errornointernet:envs.net" } }
|
||||
|
||||
for _, module in ipairs({
|
||||
"lib",
|
||||
|
@ -280,10 +280,10 @@ async fn lua_init(client: Client, state: &State, globals: &Table) -> Result<()>
|
||||
#[cfg(feature = "matrix")]
|
||||
fn matrix_init(client: &Client, state: State) {
|
||||
let globals = state.lua.globals();
|
||||
if let Ok(matrix_options) = globals.get::<Table>("MatrixOptions") {
|
||||
if let Ok(options) = globals.get::<Table>("MatrixOptions") {
|
||||
let name = client.username();
|
||||
tokio::spawn(async move {
|
||||
if let Err(error) = matrix::login(state, matrix_options, globals, name).await {
|
||||
if let Err(error) = matrix::login(state, options, globals, name).await {
|
||||
error!("failed to log into matrix account: {error:?}");
|
||||
}
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ impl Context {
|
||||
.ok()
|
||||
.and_then(|options| {
|
||||
options
|
||||
.get::<Vec<String>>("Owners")
|
||||
.get::<Vec<String>>("owners")
|
||||
.ok()
|
||||
.and_then(|owners| owners.contains(name).then_some(()))
|
||||
})
|
||||
@ -56,9 +56,9 @@ async fn persist_sync_token(
|
||||
|
||||
pub async fn login(state: State, options: Table, globals: Table, name: String) -> Result<()> {
|
||||
let (homeserver_url, username, password) = (
|
||||
options.get::<String>("HomeserverUrl")?,
|
||||
options.get::<String>("Username")?,
|
||||
&options.get::<String>("Password")?,
|
||||
options.get::<String>("homeserver_url")?,
|
||||
options.get::<String>("username")?,
|
||||
&options.get::<String>("password")?,
|
||||
);
|
||||
|
||||
let root_dir = dirs::data_dir()
|
||||
|
Loading…
x
Reference in New Issue
Block a user