mirror of
https://github.com/System-End/cdn.git
synced 2026-04-19 15:18:15 +00:00
quota doc
This commit is contained in:
parent
7c20e19399
commit
0201595af3
2 changed files with 47 additions and 3 deletions
|
|
@ -12,9 +12,9 @@ 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 |
|
||||
| **Unverified** | 10 MB | 50 MB |
|
||||
| **Verified** | 100 MB | 50 GB |
|
||||
| **"Unlimited"** | 200 MB | 300 GB |
|
||||
|
||||
**New users start unverified.** Once you verify with Hack Club, you automatically get 50GB.
|
||||
|
||||
|
|
|
|||
44
lib/tasks/fix_content_disposition.rake
Normal file
44
lib/tasks/fix_content_disposition.rake
Normal 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
|
||||
Loading…
Add table
Reference in a new issue