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
···
setSkippedFiles(result.skippedFiles || [])
setFailedFiles(result.failedFiles || [])
setUploadedCount(result.uploadedCount || result.fileCount || 0)
+
+
// Debug: log failed files
+
console.log('Failed files:', result.failedFiles)
+
+
// Check for 419/413 errors and show alert
+
const hasSizeError = result.failedFiles?.some((file: any) => {
+
const error = file.error?.toLowerCase() || ''
+
console.log('Checking error:', error, 'contains PDS?', error.includes('pds'))
+
return error.includes('pds is not allowing') ||
+
error.includes('your pds is not allowing') ||
+
error.includes('request entity too large')
+
})
+
+
console.log('Has size error:', hasSizeError)
+
+
if (hasSizeError) {
+
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.')
+
}
+
setSelectedSiteRkey('')
setNewSiteName('')
setSelectedFiles(null)
+1 -1
src/lib/constants.ts
···
export const BASE_HOST = Bun.env.BASE_DOMAIN || "wisp.place";
export const MAX_SITE_SIZE = 300 * 1024 * 1024; //300MB
export const MAX_FILE_SIZE = 100 * 1024 * 1024; //100MB
-
export const MAX_FILE_COUNT = 2000;
+
export const MAX_FILE_COUNT = 1000;
+8
src/routes/wisp.ts
···
const isTimeout = error?.name === 'AbortError' || error?.message === 'Upload timeout';
const isRateLimited = error?.status === 429 || error?.message?.toLowerCase().includes('rate');
+
const isRequestEntityTooLarge = error?.status === 419 || error?.status === 413;
+
+
// Special handling for 419/413 Request Entity Too Large errors
+
if (isRequestEntityTooLarge) {
+
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.');
+
(customError as any).status = 419;
+
throw customError;
+
}
// Retry on DPoP nonce conflicts, timeouts, or rate limits
if ((isDPoPNonceError || isTimeout || isRateLimited) && attempt < maxRetries - 1) {