This repository has no description
1# Bluesky Avatar Updater
2
3[](http://unmaintained.tech/)
4
5A Rust tool to automatically rotate your Bluesky profile avatar and banner every hour.
6
7## Features
8
9- **Automated Rotation**: Automatically updates your profile assets every hour.
10- **Environment Support**: Loads configuration from `.env` files.
11- **Logging**: Robust file logging with 14-day rotation.
12- **Cron Integration**: Self-installs as an hourly cron job for persistent updates.
13- **Asset Mapping**: Supports detailed hourly CID mapping for both avatar and banner.
14
15## Requirements
16
17To run this project, you will need the following:
18
19- Rust 1.85+ (Cargo)
20
21## Installation
22
231. Clone the repository:
24
25 ```bash
26 git clone https://github.com/ewanc26/bluesky-avatar-updater.git
27 cd bluesky-avatar-updater
28 ```
29
302. Build the project:
31
32 ```bash
33 cargo build --release
34 ```
35
363. Create a `.env` file in the `assets/` directory (or the root) and add your environment variables:
37
38 ```plaintext
39 ENDPOINT=https://bsky.social
40 HANDLE=your_handle.bsky.social
41 PASSWORD=your_app_password
42 DID=did:plc:your_did
43 UPDATE_BANNER=false
44 ```
45
464. Create `assets/cids.json` with hourly blob mappings:
47
48 ```json
49 {
50 "00": {
51 "avatar": "cid_for_midnight",
52 "banner": "banner_cid_for_midnight"
53 },
54 "01": { "avatar": "cid_for_1am", "banner": "banner_cid_for_1am" }
55 }
56 ```
57
58## Usage
59
60Run the updater from the repository root:
61
62```bash
63cargo run --release
64```
65
66On start-up, the script will:
67
681. Load configuration and environment variables.
692. Confirm the endpoint is healthy.
703. Read the CID mapping from `assets/cids.json`.
714. Select the avatar/banner CID for the current hour.
725. Log in to Bluesky and update the profile record.
736. Ensure an hourly cron job exists for future runs.
74
75## File Structure
76
77- `src/main.rs`: Main orchestration.
78- `src/bsky.rs`: Bluesky API and blob handling.
79- `src/cron.rs`: Cron job management.
80- `src/utils.rs`: Utility functions and environment validation.
81- `assets/cids.json`: Mapping of hours to avatar and banner CIDs.
82
83## License
84
85This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
86
87## ☕ Support
88
89If you found this useful, consider [buying me a ko-fi](https://ko-fi.com/ewancroft)!