quota doc

This commit is contained in:
24c02 2026-02-03 18:35:45 -05:00
parent 7c20e19399
commit 0201595af3
2 changed files with 47 additions and 3 deletions

View file

@ -13,8 +13,8 @@ CDN provides free storage for the Hack Club community. Your quota depends on whe
| Tier | Per File | Total Storage |
|------|----------|---------------|
| **Unverified** | 10 MB | 50 MB |
| **Verified** | 50 MB | 50 GB |
| **Unlimited** | 200 MB | 300 GB |
| **Verified** | 100 MB | 50 GB |
| **"Unlimited"** | 200 MB | 300 GB |
**New users start unverified.** Once you verify with Hack Club, you automatically get 50GB.

View file

@ -0,0 +1,44 @@
# frozen_string_literal: true
namespace :storage do
desc "Update all existing blobs to have Content-Disposition: inline"
task fix_content_disposition: :environment do
require "aws-sdk-s3"
service = ActiveStorage::Blob.service
unless service.is_a?(ActiveStorage::Service::S3Service)
puts "This task only works with S3/R2 storage. Current service: #{service.class}"
exit 1
end
client = service.client
bucket = service.bucket
total = ActiveStorage::Blob.count
updated = 0
errors = 0
puts "Updating Content-Disposition for #{total} blobs..."
ActiveStorage::Blob.find_each.with_index do |blob, index|
print "\rProcessing #{index + 1}/#{total}..."
begin
client.copy_object(
bucket: bucket.name,
copy_source: "#{bucket.name}/#{blob.key}",
key: blob.key,
content_disposition: "inline",
content_type: blob.content_type,
metadata_directive: "REPLACE"
)
updated += 1
rescue Aws::S3::Errors::ServiceError => e
puts "\nError updating #{blob.key}: #{e.message}"
errors += 1
end
end
puts "\nDone! Updated: #{updated}, Errors: #{errors}"
end
end