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