Automate your mattermost custom status with the help of visible Wi-Fi SSID.
Development site is hosted on gitlab.
Released binaries are available from this page.
Here after is the command line help. ```text automattermostatus 0.1.10 Automate mattermost status with the help of wifi network
Use current visible wifi SSID to automate your mattermost status. This program is meant to either be running in
background or be call regularly with option --delay 0
. It will then update your mattermost custom status according to
the config file
USAGE: automattermostatus [FLAGS] [OPTIONS]
FLAGS:
-h, --help
Prints help information
-q, --quiet
Decrease the output's verbosity level.
Used once, it will set error log level. Used twice, will silent the log completely
-v, --verbose
Increase the output's verbosity level
Pass many times to increase verbosity level, up to 3.
-V, --version
Prints version information
OPTIONS:
-b, --begin
beginning of status update with the format hh:mm
Before this time the status won't be updated [env: BEGIN=]
--state-dir <cache dir>
directory for state file
Will use content of XDG_CACHE_HOME if unset. [env: STATE_DIR=]
--mm-secret-cmd <command>
mattermost secret command
The secret is either a `password` (default) or a`token` according to `secret_type` option [env:
MM_SECRET_CMD=]
--delay <delay>
delay between wifi SSID polling in seconds [env: DELAY=]
-e, --end <end hh:mm>
end of status update with the format hh:mm
After this time the status won't be updated [env: END=]
--expires-at <expiry hh:mm>
Expiration time with the format hh:mm
This parameter is used to set the custom status expiration time Set to "0" to avoid setting expiration time
[env: EXPIRES_AT=]
-i, --interface-name <itf_name>
wifi interface name [env: INTERFACE_NAME=]
-t, --secret-type <secret-type>
Type of secret. Either `Password` (default) or `Token` [env: SECRET_TYPE=] [possible values: Token,
Password]
--mm-secret <token>
mattermost private Token
Usage of this option may leak your personal token. It is recommended to use `mm_token_cmd` or
`keyring_service`.
The secret is either a `password` (default) or a`token` according to `secret_type` option [env: MM_SECRET]
--keyring-service <token service name>
Service name used for mattermost secret lookup in OS keyring.
The secret is either a `password` (default) or a`token` according to `secret_type` option [env:
KEYRING_SERVICE=]
-u, --mm-url <url>
mattermost URL [env: MM_URL=]
--mm-user <username>
User name used for mattermost login or for password or private token lookup in OS keyring [env: MM_USER=]
-s, --status <wifi_substr::emoji::text>...
Status configuration triplets (:: separated)
Each triplet shall have the format: "wifi_substring::emoji_name::status_text". If `wifi_substring` is empty,
the ssociated status will be used for off time.
```
Automattermostatus get configuration from both a config file and a command line (the later override the former).
The config file is created if it does not exist. It is created or read in the following places depending on your OS:
- the XDG user directory specifications on Linux (usually ~/.config/automattermostatus/automattermostatus.toml
),
- the Known Folder system on Windows (usually {FOLDERID_RoamingAppData}\automattermostatus\config
),
- the Standard Directories on macOS (usually $HOME/Library/Application Support/automattermost
).
A sample config file is:
```toml
#
interface_name = 'wlp0s20f3'
::
# status = ["corporatewifi::corplogo::On premise work", "homenet::house::Working home", "::sleeping::Off time"]
mm_url = 'https://mattermost.example.com'
verbose = 'Info'
mm_secret
, mm_secret_cmd
or kering_*
mm_user
secret_type = "Token"
mm_secret_cmd
orkeyring_user
and keyring_service
.keyring_service
.mm_user
keyringservice = 'mattermostsecret'
expires_at = "19:30"
begin = "8:00" end = "19:30"
EveryWeek
: the day is always offEvenWeek
: the day is off on even week (iso week number)OddWeek
: the day is off on odd week (iso week number)[offdays] Sat = 'EveryWeek' Sun = 'EveryWeek' Wed = 'EvenWeek' ```
The secret use to authenticate to the mattermost instance may be either a
private access token or a password associated with your username (see
secret_type
configuration parameter).
The advantage of using your private access token is that it would work even if you've set up a MFA (multi-factor authentication). The cons is that your account shall have been explicitly authorized to use a private access token by your mattermost instance administrator.
Your private
token, if enabled on your account,
is available under Account Parameters > Security > Personal Access Token
.
You should avoid to use mm_secret
parameter as it may leak your token to
other people having access to your computer. It is recommended to use the
mm_secret_cmd
option or better your local OS keyring with mm_user
and
keyring_service
parameters.
For example, on linux you may use secret-tool
:
```sh
secret-tool store --label='token' name automattermostatus
mm_token_cmd
to retrieve your token:secret-tool lookup name automattermostatus
or the `keyring` command:
sh
keyring set mattermosttoken mattermostusername
toml
secrettype = "Token" mmuser = 'username' keyringservice = 'mattermosttoken' ``` On Mac OS you may use Keychain to store the mattermost access token, and it will be looked up by automattermostatus with a configuration similar to the one given here before.
On Windows, I have no mean to test, but it looks like you may use any software based upon Microsoft Credential Locker to store your mattermost access token.
On linux automattermostatus depends upon NetworkManager
for getting the
visible SSIDs without root rights.
You can either compile yourself, download the latest binaries from the release page or install one of the available packages.
Use your favorite aur helper. For example:
yay -S automattermostatus
You can build the automattermostatus
binary with:
cargo build --release --locked
The binaries are then found in the target/release
directory.
You may either copy the distrib/automattermostatus.desktop
in
/etc/xdg/autostart
or in $HOME/.config/autostart
or if you use systemd,
you may copy the auttoolmostatus systemd unit
distrib/automattermostatus.service
in $HOME/.config/systemd/user
and do
sh
systemctl status --user enable --now automattermostatus
The logs are then visible with
sh
journalctl --user -u automattermostatus
TODO
TODO
Licensed under Apache License, Version 2.0 (LICENSE-APACHE).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.
You may open issues or feature requests on the gitlab issue page.
You may fork the project on gitlab, develop your patch or feature on a new branch and submit a new merge request after having push back to your forked repo.
Do not hesitate to open an issue beforehand to discuss the bug fix strategy or to ask about the feature you imagine.