ActivityWatch/aw-server-rust
关于
High-performance implementation of the ActivityWatch server, written in Rust
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- +3
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文aw-server-rust
A reimplementation of aw-server in Rust.
Features missing compared to the Python implementation of aw-server:
- API explorer (Swagger/OpenAPI)
How to compile
Build with cargo:
cargo build --release
You can also build with make, which will build the web assets as well:
make build
Your built executable will be located in ./target/release/aw-server-rust. If you want to use it with a development version of aw-qt you'll want to copy this binary into your venv:
cp target/release/aw-server ../venv/bin/aw-server-rust
How to run
If you want to quick-compile for debugging, run cargo run from the project root:
cargo run --bin aw-server
NOTE: This will start aw-server-rust in testing mode (on port 5666 instead of port 5600).
Docker
A multi-stage scripts/Dockerfile is included. It builds the web UI and the
server, and produces a slim Debian-based image containing only the aw-server
binary (the web UI assets are embedded into it at compile time).
The aw-webui submodule must be initialized before building:
git submodule update --init --recursive
docker build -f scripts/Dockerfile -t aw-server-rust:local .
Run it with:
docker run -d --name aw-server-rust \
-p 5600:5600 \
-v aw-server-rust-data:/home/aw/.local/share/activitywatch \
aw-server-rust:local aw-server-rust --host 0.0.0.0
Notes:
- The server binds to
127.0.0.1by default, which is unreachable from outside the container. Pass--host 0.0.0.0(as above) to make it reachable. - The server runs as the unprivileged user
aw(uid/gid10001). When using a bind mount instead of a named volume, the host directory must be writable by that uid (sudo chown -R 10001:10001 <dir>). - The database lives in
/home/aw/.local/share/activitywatch/aw-server-rust. Mount a volume there to keep it across container recreations. Images built before the switch to a non-root user stored it under/root/.local/share; to keep existing data, copy it over and fix its ownership, e.g.docker run --rm -v aw-server-rust-data:/data alpine sh -c 'chown -R 10001:10001 /data'. - The image only ships
aw-server. Theaw-syncbinary is deliberately not built, since on Linux it pulls in OpenSSL with thevendoredfeature and compiles it from source. docker buildproduces an image for the architecture of the machine running it. To target a different one, usedocker buildx build --platform linux/amd64 -f scripts/Dockerfile ....
Configuration
The server reads its configuration from ~/.config/activitywatch/aw-server-rust/config.toml (or config-testing.toml in testing mode).
Available options:
# Address to listen on
#address = "127.0.0.1"
# Port to listen on (default: 5600, testing: 5666)
#port = 5600
# Additional exact CORS origins to allow (e.g. for custom web interfaces)
#cors = ["http://localhost:3000"]
# Additional regex CORS origins to allow (e.g. for sideloaded browser extensions)
#cors_regex = ["chrome-extension://yourextensionidhere"]
Custom CORS Origins
By default, the server allows requests from:
- The server's own origin (
http://127.0.0.1:<port>,http://localhost:<port>) - The official Chrome extension (
chrome-extension://nglaklhklhcoonedhgnpgddginnjdadi) - All Firefox extensions (
moz-extension://.*)
To allow additional origins (e.g. a sideloaded Chrome extension), add them to your config:
# Allow a specific sideloaded Chrome extension
cors_regex = ["chrome-extension://jmdbkmbphoikckgkcnpoojbfeiaoaocl"]
# Or allow all Chrome extensions (less secure, but convenient for development)
cors_regex = ["chrome-extension://.*"]
Syncing
For details about aw-sync-rust, see the README in its subdirectory.
探索相关项目
加载中…