Inject API origin bootstrap and update docs

This commit is contained in:
Andreas Dueren
2025-11-18 21:05:58 -06:00
parent 3b7a853c71
commit f29b570b82
5 changed files with 95 additions and 19 deletions

View File

@@ -14,35 +14,35 @@ Before using Ente, configure an S3-compatible object storage provider:
# Authorise once (replace with your key ID/secret)
b2 authorize-account <KEY_ID> <APP_KEY>
# Clear any native rules
b2 bucket update --cors-rules '[]' ente-due-ren allPublic
# Inspect the current bucket type (usually allPrivate) and capture it
BUCKET_TYPE=$(b2 get-bucket ente-due-ren | awk -F'"' '/bucketType/ {print $4}')
# Clear any native rules without changing visibility
b2 update-bucket ente-due-ren "$BUCKET_TYPE" --cors-rules '[]'
# Apply the S3-compatible rule (adjust origins as needed)
cat >cors.json <<'EOF'
[
{
"corsRuleName": "ente-web",
"allowedOrigins": [
"https://ente.due.ren",
"https://accounts.due.ren",
"https://auth.due.ren",
"https://albums.due.ren",
"https://cast.due.ren",
"https://family.due.ren"
],
"corsRuleName": "entephotos",
"allowedOrigins": ["*"],
"allowedHeaders": ["*"],
"allowedOperations": [
"s3_get_object",
"s3_head_object",
"b2_download_file_by_id",
"b2_download_file_by_name",
"b2_download_file_by_id"
"b2_upload_file",
"b2_upload_part",
"s3_get",
"s3_post",
"s3_put",
"s3_head"
],
"exposeHeaders": ["ETag","Content-Length","Content-Type"],
"maxAgeSeconds": 86400
"exposeHeaders": ["X-Amz-Request-Id","X-Amz-Id-2","ETag"],
"maxAgeSeconds": 3600
}
]
EOF
b2 bucket update --cors-rules "$(<cors.json)" ente-due-ren allPublic
b2 update-bucket ente-due-ren "$BUCKET_TYPE" --cors-rules "$(<cors.json)"
```
Verify with `curl -I -H 'Origin: https://ente.due.ren' <signed-url>`; you should see `Access-Control-Allow-Origin`.