Commit Graph

361 Commits

Author SHA1 Message Date
projectmoon 0ca7ad4db0 Minor fix to command logging.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-28 15:08:00 +00:00
projectmoon 59be127430 Implement set room command; common code for list and set rooms.
Adds fuzzy room search that can also set by exact ID, and refactors
the code to get room list for user into a common function and struct
for use by both commands.
2021-05-28 15:08:00 +00:00
projectmoon e9c0a184bd Show room list with preformatted text.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2021-05-27 20:47:54 +00:00
projectmoon 589d0e0dbf From<String> for ListRoomsCommand
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-27 15:56:15 +00:00
projectmoon 892ccf73e3 Basic list rooms command. Needs formatting.
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2021-05-27 15:52:16 +00:00
projectmoon 896acee5ba Avoid cloned command input with From<String> instead of From<&str>.
continuous-integration/drone/push Build is passing Details
2021-05-27 15:50:43 +00:00
projectmoon d70df44d2a Remove MIT notice from bot event handlers
continuous-integration/drone/push Build is passing Details
2021-05-26 22:40:15 +00:00
projectmoon 5f15e62c6d Remove 'project' from intial informational text in license.
continuous-integration/drone/push Build is failing Details
2021-05-26 22:39:09 +00:00
projectmoon ed3b582aad Matrix SDK isn't MIT anymore.
continuous-integration/drone/push Build is passing Details
2021-05-26 22:35:12 +00:00
projectmoon 49db0062a3 Various improvements to bot responses.
continuous-integration/drone/push Build is passing Details
- Do not display username pill with quoted HTML replies.
 - Do not attempt to create matrix.to link in plain text replies.
 - Move plain text formatting responsibility outside of matrix
   send_message function.
2021-05-26 22:20:53 +00:00
projectmoon 4ae871224a Remove ExecutionError, as it is unnecessary.
continuous-integration/drone/push Build is passing Details
2021-05-26 21:25:32 +00:00
projectmoon 1ebd13e912 Change execution_allowed to a match for shorter reading.
continuous-integration/drone/push Build is passing Details
2021-05-26 21:12:21 +00:00
projectmoon 8f5b6f0636 Replace db query with simple in-memory check of if account already exists.
continuous-integration/drone/push Build is passing Details
2021-05-26 21:04:53 +00:00
projectmoon 5b3d174edc Separate registering and linking accounts.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
Can register an account with the bot to manage variables and stuff in
private room, and then separately "link" it with a password, which
makes it available to anything using the bot API (aka web app). Can
also unlink and unregister. Check command no longer validates
password. It just checks and reports your account status.
2021-05-26 15:28:59 +00:00
projectmoon 495df13fe6 Do not automatically create accounts; use enum to show this instead.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
Instead of automatically creating a user account entry for any user
executing a command, we use an Account enum which covers both
registered and "transient" unregistered users. If a user registers,
the context has the actual user instance available, with state and
everything. If a user is unregistered, then the account is considered
transient for the request, with only the username available.
2021-05-26 14:20:18 +00:00
projectmoon de92fc8488 Remove nested <p> tags in error messages.
continuous-integration/drone/push Build is passing Details
2021-05-26 07:06:00 +00:00
projectmoon b05129ad9f Localize all command parsing code into trait impls.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
This cleans up the command parser a lot, as all of the one or two line
functions and associated imports have been removed. Unfortunately it
does make the command files larger, as two trait impls are required:
one for converting to Box<dyn Command>, and one for converting from
&str to the command type.

Fixes #66.
2021-05-25 23:55:50 +00:00
projectmoon 5d002e5063 Add ability to store user active room, with skeleton accounts.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
- Adds a user_state table, currently only with active_room.
 - A user must have an account to take advantage of state.
 - Now, all users will get an 'account' even if they don't explicitly register.
 - Bonus: converts user queries to compile-time checked macros.

To support these automatically created "accounts," the accounts table
now also has an account_status column, indicating if the user is
registered or not (or pending activation--future use).

The User model has been updated with extra properties from the state,
and the user is now carrried in the Context during command execution.
A user is ensured to be created before executing the command.
2021-05-25 22:29:01 +00:00
projectmoon 849a1b6a14 Remove most of Room DB API
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2021-05-24 22:25:20 +00:00
projectmoon 97be5d5ccb Add migration to remove room state management tables.
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2021-05-24 22:10:41 +00:00
projectmoon 395753e8a9 Remove room state mgmt; let matrix SDK do it on-demand instead.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
Fixes #71.

Fixes #20.
2021-05-24 21:45:51 +00:00
projectmoon df0248d99a More useful account registration message.
continuous-integration/drone/push Build is passing Details
2021-05-23 13:58:58 +00:00
projectmoon 76214bc790 Add an account deletion command.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2021-05-22 23:12:17 +00:00
projectmoon 921c4cd644 Update sqlx offline json for user query.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-22 22:53:01 +00:00
projectmoon 8c2a90e86b Tests for secure commands and user DB API.
continuous-integration/drone/pr Build was killed Details
continuous-integration/drone/push Build is failing Details
2021-05-22 22:48:47 +00:00
projectmoon 926dae57fb Add check password command.
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2021-05-22 22:25:00 +00:00
projectmoon 4557498ac6 Improved command logging, sensitive to secure commands.
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2021-05-22 22:17:33 +00:00
projectmoon ca34841d86 Functional user account registration.
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2021-05-22 14:52:32 +00:00
projectmoon c1ec7366e4 Add user accounts, registration command, secure command valiation. 2021-05-22 14:01:16 +00:00
projectmoon a84d4fd869 Make command parsing case insensitive.
continuous-integration/drone/push Build is passing Details
2021-05-21 22:40:03 +00:00
projectmoon 34ee2c6e5d Consider command execution secure when proper conditions are met.
continuous-integration/drone/push Build is failing Details
- If the room is end-to-end encrypted.
 - If only the sending user and the bot are present in the room.

This lays groundwork for sensitive commands like registering a user
account with the bot.
2021-05-21 22:28:45 +00:00
projectmoon 9de74d05a9 Add an is_secure attribute for commands. 2021-05-21 15:32:08 +00:00
projectmoon 5643677627 Consolidate dice and variable parsers under parser module.
continuous-integration/drone/push Build is passing Details
2021-05-21 14:44:03 +00:00
projectmoon de63fd914e Move commands.rs to commands/mod.rs; move migrate_cli.rs. 2021-05-21 14:35:56 +00:00
projectmoon e73ad118b2 Move some declaration-only modules to mod.rs files in folders. 2021-05-21 14:30:46 +00:00
projectmoon 3d5cda39c8 Consolidate dice module into logic module. 2021-05-21 14:26:58 +00:00
projectmoon 402f236ba7 Remove sled and all related crates from dependencies.
continuous-integration/drone/push Build is passing Details
2021-05-21 14:21:22 +00:00
projectmoon 059538b95d Remove remaining warnings. 2021-05-21 14:14:03 +00:00
projectmoon 4de273db4a Remove sled code; promote sql to top level 2021-05-21 14:05:25 +00:00
projectmoon a33367fada Update dependencies to fix matrix SDK list users bug.
continuous-integration/drone/push Build is passing Details
2021-05-20 15:40:52 +00:00
projectmoon 5630b4ed20 Add sled migration utility.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2021-05-20 15:30:44 +00:00
projectmoon 6b6be06c89 Update sqlx offline json.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-19 21:36:16 +00:00
projectmoon a3b39ee42c Use ON CONFLICT and transactions where appropriate.
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2021-05-19 21:34:11 +00:00
projectmoon 7eee16961e Add tests for dbstate.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-19 21:16:39 +00:00
projectmoon 43d8f9574f Allow 'upserts' in insert_room_info. Add a few more room db tests. 2021-05-19 21:06:28 +00:00
projectmoon 1c4cd3d139 Add tests for rooms db API
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 22:15:03 +00:00
projectmoon d1c04b8817 Tests for all of the variables DB api.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 21:39:48 +00:00
projectmoon 5e899cd962 Return key not found error if value not found for user.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 15:37:20 +00:00
projectmoon 257f3a066c Some user variable tests.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 15:17:30 +00:00
projectmoon e539dcac1f Move migrations to sqlite directory. Remove in-memory temp db until refinery supports sqlx.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 14:50:49 +00:00