No description
  • Rust 94.4%
  • Dockerfile 5.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Spacebot 6c8f94bdaf
Some checks failed
Build and Test / kanzashi-cdn (push) Has been cancelled
chore(deps): update rust crate aws-config to v1.10.1
2026-07-26 23:27:41 +02:00
.forgejo/workflows ci: add ci 2026-07-24 06:21:13 +02:00
src initial commit 2026-07-24 01:36:58 +02:00
templates initial commit 2026-07-24 01:36:58 +02:00
.env.example initial commit 2026-07-24 01:36:58 +02:00
.gitignore initial commit 2026-07-24 01:36:58 +02:00
Cargo.lock chore(deps): update rust crate aws-config to v1.10.1 2026-07-26 23:27:41 +02:00
Cargo.toml initial commit 2026-07-24 01:36:58 +02:00
code_of_conduct.md chore: add md files 2026-07-24 05:59:53 +02:00
Dockerfile ci: add ci 2026-07-24 06:21:13 +02:00
LICENSE chore: add md files 2026-07-24 05:59:53 +02:00
README.md chore: readme 2026-07-24 04:01:19 +02:00
renovate.json Add renovate.json 2026-07-23 23:46:18 +00:00
support.md chore: add md files 2026-07-24 05:59:53 +02:00

Kanzashi image CDN

Named after Nintendo's original implementation, this is a rocket web server designed to hold and manage images at a large scale.

Uploading

Uploading images requires a POST request to /upload formatted as multipart/form-data with a form field named file.

Required Headers

Header Name Value / Format Description
X-Timestamp <current_unix_timestamp> Current UTC time in seconds (e.g., 1711200000).
X-Signature <hex_encoded_signature> Ed25519 hex signature of POST:/upload:<X-Timestamp>.
Content-Type multipart/form-data; boundary=... Required for multipart request parsing

Note

The uploaded file's extension must match one of the extensions defined in ALLOWED_EXTENSIONS (e.g., .png, .jpg).

Running

Requirements

  • Cargo with Rust 2024
  • SQLite compatible OS
  • S3 Server (minIO recommended)
  • A brain

.env configuration

A .env.example is provided for your convenience.

Name Example Value Description
MINIO_ENDPOINT http://127.0.0.1:9000 S3 Server Location
MINIO_ACCESS_KEY minioadmin S3 Server Access Key
MINIO_SECRET_KEY minioadminpassword S3 Server Secret Key
MINIO_REGION us-east-1 S3 Server location. Traditionally not needed, varies depending on setup.
ALLOWED_BUCKET kanzashi Bucket the server is restricted to store files in
DB_PASSPHRASE redacted SQLite DB Pass
ALLOWED_EXTENSIONS jpg,jpeg,png,gif,webp List of allowed file extensions that can be uploaded. Anything else is rejected.

Build

cargo build

Run

cargo run

Adding/revoking tokens

To upload to the CDN, you need a token. The panel can be accessed at /admin. Once there, check the console. You may have to scroll up to before rocket, but you will see:

====================
key: xxx
Panel located at /admin?key=xxx
====================

This key is regenerated upon every server restart. Keep it safe! It used for generating and revoking tokens. It should not be shared willy nilly.

Once into the panel, type in your application name and click Generate Key Pair. Now you have generated a private key. The public key will be available in the panel, however you must save the private key. If your application requires uploading to the CDN, this is what you will use.