(provider: CloudProvider)
| 148 | * Get provider-specific CORS setup instructions. |
| 149 | */ |
| 150 | export function getCorsInstructions(provider: CloudProvider): string { |
| 151 | switch (provider) { |
| 152 | case 's3': |
| 153 | return `AWS S3 CORS Configuration: |
| 154 | 1. Go to your S3 bucket in the AWS Console |
| 155 | 2. Navigate to Permissions -> CORS configuration |
| 156 | 3. Add a CORS rule allowing your origin: |
| 157 | [ |
| 158 | { |
| 159 | "AllowedOrigins": ["*"], |
| 160 | "AllowedMethods": ["GET", "HEAD"], |
| 161 | "AllowedHeaders": ["*"], |
| 162 | "ExposeHeaders": ["Content-Length", "Content-Type"], |
| 163 | "MaxAgeSeconds": 3600 |
| 164 | } |
| 165 | ] |
| 166 | 4. Save the configuration`; |
| 167 | |
| 168 | case 'gcs': |
| 169 | return `Google Cloud Storage CORS Configuration: |
| 170 | 1. Create a cors.json file: |
| 171 | [ |
| 172 | { |
| 173 | "origin": ["*"], |
| 174 | "method": ["GET", "HEAD"], |
| 175 | "responseHeader": ["Content-Type", "Content-Length"], |
| 176 | "maxAgeSeconds": 3600 |
| 177 | } |
| 178 | ] |
| 179 | 2. Apply using gsutil: |
| 180 | gsutil cors set cors.json gs://YOUR_BUCKET_NAME`; |
| 181 | |
| 182 | case 'r2': |
| 183 | return `Cloudflare R2 CORS Configuration: |
| 184 | 1. Go to your R2 bucket in Cloudflare Dashboard |
| 185 | 2. Navigate to Settings -> CORS Policy |
| 186 | 3. Add a CORS rule: |
| 187 | - Allowed Origins: * (or your specific domain) |
| 188 | - Allowed Methods: GET, HEAD |
| 189 | - Allowed Headers: * |
| 190 | - Max Age: 3600 |
| 191 | 4. Save the configuration`; |
| 192 | |
| 193 | case 'dropbox': |
| 194 | return `Dropbox Sharing Setup: |
| 195 | 1. Right-click the file/folder in Dropbox |
| 196 | 2. Select "Share" -> "Copy link" |
| 197 | 3. Ensure link access is set to "Anyone with the link" |
| 198 | |
| 199 | Note: Dropbox automatically handles CORS for shared links. |
| 200 | If you're getting errors, ensure: |
| 201 | - The file is shared publicly (not restricted) |
| 202 | - The link hasn't expired |
| 203 | - You're using a file link, not a folder link`; |
| 204 | } |
| 205 | } |
no outgoing calls
no test coverage detected