2020-05-24 12:31:00 +08:00
|
|
|
|
|
|
|
# photos
|
|
|
|
|
|
|
|
A photo bucket management suite.
|
|
|
|
|
2020-05-26 12:45:55 +08:00
|
|
|
## `admin`
|
|
|
|
|
|
|
|
Create new buckets. Standalone tool.
|
|
|
|
|
2020-05-24 12:31:00 +08:00
|
|
|
## `control`
|
|
|
|
|
|
|
|
Implement access controls by signing or proxying requests.
|
|
|
|
|
2020-05-26 12:45:55 +08:00
|
|
|
### Operations
|
|
|
|
|
|
|
|
#### `GET /list?bucket=BUCKET&auth=TOKEN`
|
|
|
|
|
|
|
|
1. Consult the bucket for metadata.json
|
|
|
|
2. Get read access method for the bucket
|
|
|
|
3. Validate the token against the access method
|
|
|
|
4. Return ListObjectsV2 for prefix `photo/`
|
|
|
|
- Can also 307 redirect to the bucket read URL, if is public readable
|
|
|
|
|
|
|
|
#### `GET /read?bucket=BUCKET&auth=TOKEN&object=OBJECTNAME`
|
|
|
|
|
|
|
|
1. Consult the bucket for metadata.json
|
|
|
|
2. Get read access method for the bucket
|
|
|
|
3. Validate the token against the access method
|
|
|
|
4. Validate that OBJECTNAME starts with `photo/`
|
|
|
|
5. If necessary, presign an object URL for 4 days
|
|
|
|
- Cache presigned URLs for 2 days in memory/Redis
|
|
|
|
6. 307 redirect to presigned URL
|
|
|
|
|
|
|
|
#### `PUT /write?bucket=BUCKET&auth=TOKEN&object=OBJECTNAME`
|
|
|
|
|
|
|
|
1. Consult the bucket for metadata.json
|
|
|
|
2. Get write access method for the bucket
|
|
|
|
3. Validate the token against the access method
|
|
|
|
4. Validate that OBJECTNAME starts with `photo/`
|
2020-05-26 13:36:04 +08:00
|
|
|
5. If necessary, presign an object URL for 30 minutes
|
2020-05-26 12:45:55 +08:00
|
|
|
6. 307 redirect to presigned URL
|
|
|
|
|
|
|
|
### Authentication
|
|
|
|
|
|
|
|
#### Token
|
|
|
|
|
|
|
|
The read/write token is checked against a simple string defined in the bucket.
|
|
|
|
|
|
|
|
#### OpenID Connect
|
|
|
|
|
|
|
|
Recommended IDP: [dex](https://github.com/dexidp/dex)
|
|
|
|
|
|
|
|
The read/write operation is gated by a signed key corresponding to allowed
|
|
|
|
users defined in the bucket.
|
|
|
|
|
2020-05-24 12:31:00 +08:00
|
|
|
## `web`
|
|
|
|
|
2020-05-26 12:45:55 +08:00
|
|
|
Generates the web interface for a photo bucket. Also updates the shared asset bucket on start.
|
|
|
|
|
|
|
|
### Operations
|
|
|
|
|
|
|
|
#### `POST /webhook`
|
|
|
|
#### `POST /update?bucket=BUCKET`
|
|
|
|
|
|
|
|
Regenerate and upload `index.html` and `manage/index.html` to bucket.
|
|
|
|
|
|
|
|
## `indexer`
|
|
|
|
|
|
|
|
Pointed to by a reverse proxy to handle the following paths on all buckets:
|
|
|
|
|
|
|
|
- `/`
|
|
|
|
- `/manage/`
|
|
|
|
|
|
|
|
#### `GET /*`
|
|
|
|
|
|
|
|
A proxy for all buckets, treats the URL as a directory and serves up directory + `index.html`.
|
2020-05-24 12:31:00 +08:00
|
|
|
|
2020-05-26 15:12:22 +08:00
|
|
|
## `thumbnail`
|
2020-05-24 12:31:00 +08:00
|
|
|
|
2020-05-26 12:45:55 +08:00
|
|
|
Generate thumbnails from photo buckets. Registers webhooks.
|
2020-05-24 12:31:00 +08:00
|
|
|
|
2020-05-26 12:45:55 +08:00
|
|
|
### Operations
|
2020-05-24 12:31:00 +08:00
|
|
|
|
2020-05-26 12:45:55 +08:00
|
|
|
#### `POST /webhook`
|
|
|
|
#### `POST /update?bucket=BUCKET&object=OBJECT`
|
|
|
|
|
|
|
|
1. Perform thumbnail generation using libvips in a pool queue.
|
|
|
|
2. Block until done
|
|
|
|
|
|
|
|
<!-- vim: set conceallevel=2 et ts=2 sw=2: -->
|