-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #408 from nworbnhoj/chat
mtxchat app and chat library
- Loading branch information
Showing
36 changed files
with
3,787 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[package] | ||
name = "mtxchat" | ||
version = "0.1.0" | ||
authors = ["john <[email protected]>"] | ||
edition = "2018" | ||
description = "Matrix chat" | ||
|
||
# Dependency versions enforced by Cargo.lock. | ||
[dependencies] | ||
log = "0.4.14" | ||
num-derive = { version = "0.3.3", default-features = false} | ||
num-traits = { version = "0.2.14", default-features = false} | ||
xous = "0.9.51" | ||
xous-ipc = "0.9.51" | ||
log-server = { package = "xous-api-log", version = "0.1.47" } | ||
ticktimer-server = { package = "xous-api-ticktimer", version = "0.9.47" } | ||
xous-names = { package = "xous-api-names", version = "0.9.49" } | ||
gam = { path = "../../services/gam" } | ||
graphics-server = { path = "../../services/graphics-server" } | ||
trng = { path = "../../services/trng"} | ||
locales = { path = "../../locales"} | ||
ime-plugin-api = { path = "../../services/ime-plugin-api"} | ||
ime-plugin-shell = { path = "../../services/ime-plugin-shell"} | ||
content-plugin-api = { path = "../../services/content-plugin-api"} # all content canvas providers must provide this API | ||
codec = { path = "../../services/codec"} | ||
com = { path = "../../services/com"} | ||
com_rs = { git = "https://github.com/betrusted-io/com_rs", rev = "891bdd3ca8e41f81510d112483e178aea3e3a921" } | ||
llio = { path = "../../services/llio"} | ||
net = { path = "../../services/net" } | ||
pddb = { path = "../../services/pddb" } | ||
# new dependencies for mtxcli | ||
chat = { path = "../../libs/chat" } | ||
modals = { path = "../../services/modals" } | ||
percent-encoding = "2.2" | ||
rkyv = {version = "0.4.3", default-features = false, features = ["const_generics"]} | ||
rustls = { version = "0.21.7" } | ||
serde = { version = "1.0", features = [ "derive" ] } | ||
tls = { path = "../../libs/tls" } | ||
ureq = { version = "2.7.1", features = ["json"] } | ||
url = "2.2.2" | ||
|
||
[features] | ||
default = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# mtxchat | ||
|
||
This is the skeleton of a [matrix] chat application. | ||
|
||
The UI and local storage are provided by the xous chat library. | ||
|
||
Contributions to development of apps/mtxchat and libs/chat are most welcome. | ||
|
||
|
||
## Build | ||
|
||
Run mtxchat in hosted mode with ```cargo xtask run --app mtxchat ``` | ||
|
||
Build mtxchat for the Precursor device with ``` cargo xtask app-image --app mtxchat``` | ||
|
||
|
||
## Prerequisites: | ||
|
||
Use another device such as a mobile or PC to: | ||
|
||
* Create a new Matrix user (if needed): | ||
* https://matrix.org/faq/#how-do-i-get-an-account-and-get-started%3F | ||
* https://matrix.org/docs/projects/try-matrix-now/ | ||
* Find (or create) a new room to join for chatting: | ||
* https://doc.matrix.tu-dresden.de/en/rooms/create/ | ||
* https://spec.matrix.org/latest/#room-structure | ||
* Join the room | ||
|
||
On Precursor, make sure to trust a tls certificate offered by the matrix server. | ||
* shellchat `net tls probe matrix.org` and then `sleep coldboot` | ||
|
||
|
||
## Functionality | ||
|
||
mtxchat provides the following basic functionality: | ||
* login to an existing account on a [matrix] server | ||
* nominate an existing room on a [matrix] server | ||
* read recent posts | ||
* post text to the room | ||
|
||
|
||
## Structure | ||
|
||
The `mtxchat` code is primarily concerned with the [matrix] specific protocols, while the Chat library handles the UI and pddb storage. | ||
|
||
Much of the code in `main.rs` `lib.rs` `web.rs` & `url.rs` has been adapted from `mtxcli`. | ||
|
||
The Chat library provides the UI to display a series of matrix events (Posts) in a matrix room (Dialogue) stored in the pddb. Each Dialogue is stored in the `pddb:dict` `mtxchat.dialogue` under a descriptive `pddb:key` (ie `#xous-apps:matrix.org`). | ||
|
||
`mtxchat` passes a menu to the Chat UI: | ||
* `room` to type a [matrix] room/server | ||
* `login` to type a username/server & passwords | ||
* `logout` | ||
|
||
The `mtxchat` servers is set to receive: | ||
* `MtxchatOp::Post` A memory msg containing an outbount user post | ||
* `MtxchatOp::Event` A scalar msg containing important Chat UI events | ||
* `mtxchat::Menu` A scalar msg containing click on a mtxchat MenuItem | ||
* `MtxchatOp::Rawkeys` A scalar msg for each keystroke | ||
|
||
|
||
## Troubleshooting | ||
|
||
If you see the message `WARNING: clock not set` that is likely because the Precursor real time clock needs to be set (e.g. if the battery has been completely discharged). Please go to the menu **Preferences | Set Timezone** to set the time zone (and update the time via NTP). | ||
|
||
If you see the message `authentication failed` it might be because the `user` and `password` variables are not set properly. | ||
Alternatively it could be because TLS certificate validation | ||
has failed because the clock has not been set (see above). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
{ | ||
"mtxchat.clock.warning": { | ||
"en": "WARNING: clock not set", | ||
"en-tts": "WARNING: clock not set", | ||
"fr": "AVERTISSEMENT : horloge non réglée", | ||
"ja": "WARNING: clock not set *EN*", | ||
"zh": "WARNING: clock not set *EN*" | ||
}, | ||
"mtxchat.filter.failed": { | ||
"en": "error: could not create filter", | ||
"en-tts": "error: could not create filter", | ||
"fr": "erreur: impossible de créer un filtre *MT*", | ||
"ja": "error: could not create filter *EN*", | ||
"zh": "error: could not create filter *EN*" | ||
}, | ||
"mtxchat.get.help": { | ||
"en": "/get key", | ||
"en-tts": "get key", | ||
"fr": "/get clé", | ||
"ja": "/get key *EN*", | ||
"zh": "/get key *EN*" | ||
}, | ||
"mtxchat.greeting": { | ||
"en": "Welcome to the MTXCHAT demo. Type /help for available commands", | ||
"en-tts": "Welcome to the simple MTXCHAT demo. Type /help for available commands", | ||
"fr": "Bienvenue à la démo simple de MTXCHAT. Tapez /help pour les commandes disponibles", | ||
"ja": "シンプルなMTXCHATデモへようこそ", | ||
"zh": "简单的 mtxcli 演示活动" | ||
}, | ||
"mtxchat.heap.help": { | ||
"en": "/heap", | ||
"en-tts": "heap", | ||
"fr": "/heap", | ||
"ja": "/heap", | ||
"zh": "/heap" | ||
}, | ||
"mtxchat.help.help": { | ||
"en": "/help [cmd]", | ||
"en-tts": "help [cmd]", | ||
"fr": "/help [cmd]", | ||
"ja": "/help [cmd] *EN*", | ||
"zh": "/help [cmd] *EN*" | ||
}, | ||
"mtxchat.help.overview": { | ||
"en": "available mtxcli commands:", | ||
"en-tts": "available mtxcli commands:", | ||
"fr": "commandes mtxcli disponibles:", | ||
"ja": "available mtxcli commands: *EN*", | ||
"zh": "available mtxcli commands: *EN*" | ||
}, | ||
"mtxchat.initialized": { | ||
"en": "MTXCHAT ready", | ||
"en-tts": "MTXCHAT ready", | ||
"fr": "MTXCHAT prêt", | ||
"ja": "MTXCHAT ready *EN*", | ||
"zh": "MTXCHAT ready *EN*" | ||
}, | ||
"mtxchat.login.item": { | ||
"en": "Login", | ||
"en-tts": "Login", | ||
"ja": "Login *EN*", | ||
"zh": "Login *EN*" | ||
}, | ||
"mtxchat.logged.out": { | ||
"en": "logged out", | ||
"en-tts": "logged out", | ||
"fr": "déconnecté", | ||
"ja": "logged out *EN*", | ||
"zh": "logged out *EN*" | ||
}, | ||
"mtxchat.logging.in": { | ||
"en": "logging in...", | ||
"en-tts": "logging in", | ||
"fr": "connexion...", | ||
"ja": "logging in... *EN*", | ||
"zh": "logging in... *EN*" | ||
}, | ||
"mtxchat.login.failed": { | ||
"en": "authentication failed", | ||
"en-tts": "authentication failed", | ||
"fr": "échec de l'authentification", | ||
"ja": "authentication failed *EN*", | ||
"zh": "authentication failed *EN*" | ||
}, | ||
"mtxchat.login.help": { | ||
"en": "/login", | ||
"en-tts": "login", | ||
"fr": "/login (connexion)", | ||
"ja": "/login *EN*", | ||
"zh": "/login *EN*" | ||
}, | ||
"mtxchat.logout.item": { | ||
"en": "Logout", | ||
"en-tts": "Logout", | ||
"fr": "Logout (déconnexion)", | ||
"ja": "Logout *EN*", | ||
"zh": "Logout *EN*" | ||
}, | ||
"mtxchat.migration.completed": { | ||
"en": "migration completed", | ||
"en-tts": "migration completed", | ||
"fr": "migration terminée", | ||
"ja": "migration completed *EN*", | ||
"zh": "migration completed *EN*" | ||
}, | ||
"mtxchat.migrations.complete": { | ||
"en": "migrations complete", | ||
"en-tts": "migrations complete", | ||
"fr": "tous les migrations terminées", | ||
"ja": "migrations complete *EN*", | ||
"zh": "migrations complete *EN*" | ||
}, | ||
"mtxchat.not.connected": { | ||
"en": "not connected", | ||
"en-tts": "not conntected", | ||
"fr": "déconnecté", | ||
"ja": "not connected *EN*", | ||
"zh": "not connected *EN*" | ||
}, | ||
"mtxchat.pddb.warning": { | ||
"en": "WARNING: pddb not mounted", | ||
"en-tts": "WARNING: pddb not mounted", | ||
"fr": "AVERTISSEMENT: pddb pas monté", | ||
"ja": "WARNING: pddb not mounted *EN*", | ||
"zh": "WARNING: pddb not mounted *EN*" | ||
}, | ||
"mtxchat.login.title": { | ||
"en": "Matrix login", | ||
"en-tts": "Matrix login" | ||
}, | ||
"mtxchat.password": { | ||
"en": "password", | ||
"en-tts": "password", | ||
"fr": "de-passe", | ||
"ja": "password *EN*", | ||
"zh": "password *EN*" | ||
}, | ||
"mtxchat.room": { | ||
"en": "room", | ||
"en-tts": "room" | ||
}, | ||
"mtxchat.room.title": { | ||
"en": "Matrix room", | ||
"en-tts": "Matrix room" | ||
}, | ||
"mtxchat.room.item": { | ||
"en": "Room", | ||
"en-tts": "Room" | ||
}, | ||
"mtxchat.room.name": { | ||
"en": "room name", | ||
"en-tts": "room name" | ||
}, | ||
"mtxchat.domain": { | ||
"en": "domain", | ||
"en-tts": "domain" | ||
}, | ||
"mtxchat.user_name": { | ||
"en": "username", | ||
"en-tts": "username", | ||
"fr": "utilisateur", | ||
"ja": "username *EN*", | ||
"zh": "username *EN*" | ||
}, | ||
"mtxchat.roomid.failed": { | ||
"en": "error: could not find room_id", | ||
"en-tts": "error: could not find room_id", | ||
"fr": "erreur: impossible de trouver chambre", | ||
"ja": "error: could not find room_id *EN*", | ||
"zh": "error: could not find room_id *EN*" | ||
}, | ||
"mtxchat.running.migrations": { | ||
"en": "Running migrations from version", | ||
"en-tts": "Running migrations from version", | ||
"fr": "Exécution des migrations à partir de la version", | ||
"ja": "Running migrations from version *EN*", | ||
"zh": "Running migrations from version *EN*" | ||
}, | ||
"mtxchat.send.failed": { | ||
"en": "failed to send!", | ||
"en-tts": "failed to send!", | ||
"fr": "n'a pas envoyé!", | ||
"ja": "failed to send! *EN*", | ||
"zh": "failed to send! *EN*" | ||
}, | ||
"mtxchat.set.help": { | ||
"en": "/set key value", | ||
"en-tts": "set key value", | ||
"fr": "/set clé valeur", | ||
"ja": "/set key value *EN*", | ||
"zh": "/set key value *EN*" | ||
}, | ||
"mtxchat.status.help": { | ||
"en": "/status", | ||
"en-tts": "status", | ||
"fr": "/status (statut)", | ||
"ja": "/status *EN*", | ||
"zh": "/status *EN*" | ||
}, | ||
"mtxchat.unknown.help": { | ||
"en": "unknown command", | ||
"en-tts": "unknown command", | ||
"fr": "commande inconnue", | ||
"ja": "unknown command *EN*", | ||
"zh": "unknown command *EN*" | ||
}, | ||
"mtxchat.unset.help": { | ||
"en": "/unset key", | ||
"en-tts": "unset key", | ||
"fr": "/unset clé", | ||
"ja": "/unset key *EN*", | ||
"zh": "/unset key *EN*" | ||
}, | ||
"mtxchat.wifi.connected": { | ||
"en": "WiFi connected", | ||
"en-tts": "WiFi connected", | ||
"fr": "WiFi connecté", | ||
"ja": "WiFi connected *EN*", | ||
"zh": "WiFi connected *EN*" | ||
}, | ||
"mtxchat.wifi.warning": { | ||
"en": "WiFi not connected. Entering read-only mode", | ||
"en-tts": "WiFi not connected Entering read-only mode", | ||
"fr": "WiFi pas connecté", | ||
"ja": "WiFi not connected. Entering read-only mode *EN*", | ||
"zh": "WiFi not connected. Entering read-only mode *EN*" | ||
}, | ||
"mtxchat.listen.patience": { | ||
"en": "It takes a while to get new events from the [matrix] server.\nPlease be patient :-)", | ||
"en-tts": "It takes a while to get new events from the [matrix] server.\nPlease be patient." | ||
}, | ||
"mtxchat.close.item": { | ||
"en": "Close menu", | ||
"en-tts": "Close menu" | ||
} | ||
} |
Oops, something went wrong.