MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / getCorsInstructions

Function getCorsInstructions

src/utils/urlCloudStorage.ts:150–205  ·  view source on GitHub ↗
(provider: CloudProvider)

Source from the content-addressed store, hash-verified

148 * Get provider-specific CORS setup instructions.
149 */
150export function getCorsInstructions(provider: CloudProvider): string {
151 switch (provider) {
152 case 's3':
153 return `AWS S3 CORS Configuration:
1541. Go to your S3 bucket in the AWS Console
1552. Navigate to Permissions -> CORS configuration
1563. 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 ]
1664. Save the configuration`;
167
168 case 'gcs':
169 return `Google Cloud Storage CORS Configuration:
1701. Create a cors.json file:
171 [
172 {
173 "origin": ["*"],
174 "method": ["GET", "HEAD"],
175 "responseHeader": ["Content-Type", "Content-Length"],
176 "maxAgeSeconds": 3600
177 }
178 ]
1792. Apply using gsutil:
180 gsutil cors set cors.json gs://YOUR_BUCKET_NAME`;
181
182 case 'r2':
183 return `Cloudflare R2 CORS Configuration:
1841. Go to your R2 bucket in Cloudflare Dashboard
1852. Navigate to Settings -> CORS Policy
1863. Add a CORS rule:
187 - Allowed Origins: * (or your specific domain)
188 - Allowed Methods: GET, HEAD
189 - Allowed Headers: *
190 - Max Age: 3600
1914. Save the configuration`;
192
193 case 'dropbox':
194 return `Dropbox Sharing Setup:
1951. Right-click the file/folder in Dropbox
1962. Select "Share" -> "Copy link"
1973. Ensure link access is set to "Anyone with the link"
198
199Note: Dropbox automatically handles CORS for shared links.
200If 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}

Callers 3

urlUtils.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected