Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place

add message about 413/419 errors

Changed files
+28 -1
public
editor
src
lib
routes
+19
public/editor/tabs/UploadTab.tsx
··· 176 176 setSkippedFiles(result.skippedFiles || []) 177 177 setFailedFiles(result.failedFiles || []) 178 178 setUploadedCount(result.uploadedCount || result.fileCount || 0) 179 + 180 + // Debug: log failed files 181 + console.log('Failed files:', result.failedFiles) 182 + 183 + // Check for 419/413 errors and show alert 184 + const hasSizeError = result.failedFiles?.some((file: any) => { 185 + const error = file.error?.toLowerCase() || '' 186 + console.log('Checking error:', error, 'contains PDS?', error.includes('pds')) 187 + return error.includes('pds is not allowing') || 188 + error.includes('your pds is not allowing') || 189 + error.includes('request entity too large') 190 + }) 191 + 192 + console.log('Has size error:', hasSizeError) 193 + 194 + if (hasSizeError) { 195 + window.alert('Some files were too large for your PDS. Your PDS is not allowing uploads large enough to store your site. Please contact your PDS host. This could also possibly be a result of it being behind Cloudflare free tier.') 196 + } 197 + 179 198 setSelectedSiteRkey('') 180 199 setNewSiteName('') 181 200 setSelectedFiles(null)
+1 -1
src/lib/constants.ts
··· 1 1 export const BASE_HOST = Bun.env.BASE_DOMAIN || "wisp.place"; 2 2 export const MAX_SITE_SIZE = 300 * 1024 * 1024; //300MB 3 3 export const MAX_FILE_SIZE = 100 * 1024 * 1024; //100MB 4 - export const MAX_FILE_COUNT = 2000; 4 + export const MAX_FILE_COUNT = 1000;
+8
src/routes/wisp.ts
··· 350 350 351 351 const isTimeout = error?.name === 'AbortError' || error?.message === 'Upload timeout'; 352 352 const isRateLimited = error?.status === 429 || error?.message?.toLowerCase().includes('rate'); 353 + const isRequestEntityTooLarge = error?.status === 419 || error?.status === 413; 354 + 355 + // Special handling for 419/413 Request Entity Too Large errors 356 + if (isRequestEntityTooLarge) { 357 + const customError = new Error('Your PDS is not allowing uploads large enough to store your site. Please contact your PDS host. This could also possibly be a result of it being behind Cloudflare free tier.'); 358 + (customError as any).status = 419; 359 + throw customError; 360 + } 353 361 354 362 // Retry on DPoP nonce conflicts, timeouts, or rate limits 355 363 if ((isDPoPNonceError || isTimeout || isRateLimited) && attempt < maxRetries - 1) {