Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export const SCREENSHOT_WIDTH = 1040;
export const SCREENSHOT_HEIGHT = 1248;
export const LIMIT_OF_ZIP_SITES_PER_USER = 5;
export const LIMIT_OF_PROMPTS_PER_USER = 100;
export const LIMIT_ARCHIVE_SIZE = 100 * 1024 * 1024; // 100MB
export const SIZE_LIMIT_MB = 250;
export const SIZE_LIMIT_BYTES = SIZE_LIMIT_MB * 1024 * 1024; // 250MB
export const AUTO_UPDATE_INTERVAL_MS = 60 * 60 * 1000;
export const WINDOWS_TITLEBAR_HEIGHT = 32;
export const ABOUT_WINDOW_WIDTH = 284;
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/use-archive-error-messages.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { sprintf } from '@wordpress/i18n';
import { useI18n } from '@wordpress/react-i18n';
import { useMemo } from 'react';

const SIZE_LIMIT_MB = 100;
import { SIZE_LIMIT_MB } from '../constants';

export function useArchiveErrorMessages() {
const { __ } = useI18n();
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/use-archive-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Sentry from '@sentry/electron/renderer';
import { sprintf } from '@wordpress/i18n';
import { useI18n } from '@wordpress/react-i18n';
import { useCallback, useEffect, useMemo } from 'react';
import { LIMIT_ARCHIVE_SIZE } from '../constants';
import { SIZE_LIMIT_MB } from '../constants';
import { getIpcApi } from '../lib/get-ipc-api';
import { isWpcomNetworkError } from '../lib/is-wpcom-network-error';
import { useArchiveErrorMessages } from './use-archive-error-messages';
Expand Down Expand Up @@ -84,7 +84,7 @@ export function useArchiveSite() {
__(
'The site exceeds the maximum size of %dMB. Please remove some files and try again.'
),
Math.floor( LIMIT_ARCHIVE_SIZE / 1024 / 1024 )
SIZE_LIMIT_MB
)
);
setUploadingSites( ( _uploadingSites ) => ( { ..._uploadingSites, [ siteId ]: false } ) );
Expand Down
4 changes: 2 additions & 2 deletions src/ipc-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import nodePath from 'path';
import * as Sentry from '@sentry/electron/main';
import archiver from 'archiver';
import { DEFAULT_PHP_VERSION } from '../vendor/wp-now/src/constants';
import { LIMIT_ARCHIVE_SIZE } from './constants';
import { SIZE_LIMIT_BYTES } from './constants';
import { isEmptyDir, pathExists, isWordPressDirectory, sanitizeFolderName } from './lib/fs-utils';
import { getImageData } from './lib/get-image-data';
import { exportBackup } from './lib/import-export/export/export-manager';
Expand Down Expand Up @@ -362,7 +362,7 @@ export async function archiveSite( event: IpcMainInvokeEvent, id: string ) {
} );
const stats = fs.statSync( zipPath );
const zipContent = fs.readFileSync( zipPath );
return { zipPath, zipContent, exceedsSizeLimit: stats.size > LIMIT_ARCHIVE_SIZE };
return { zipPath, zipContent, exceedsSizeLimit: stats.size > SIZE_LIMIT_BYTES };
}

export function removeTemporalFile( event: IpcMainInvokeEvent, path: string ) {
Expand Down