Skip to content

Commit 1f2250a

Browse files
authored
v2.5.0 (#130)
* Add gh action for enabling 500 loc (#117) * feat: ignore pull request that have the label Release * Integrate drive desktop core (#113) * Update package.json * Update package.json * Update yarn.lock * Use released version * integrate core logger with main.ts * chore: Integrate core logger in antivirus feature * chore: setup logs and renderer logs for antivirus --------- Co-authored-by: AlexisMora <[email protected]> * Integrate logger for backups * chore: migrate virtual drive related files to the new logger * chore: update project version * chore: remove util logger * chore: migrated hydration api to use the proper logger * chore migrate to new logger + add todo comments for found dead code * chore: mark files as dead code * chore: update publish.yml workflow * chore: more migration of logger * chore:update desktop core package * feat: product availability from drive-desktop-core * update types * feat: create common functions for report generation * fix: added prop types and differentiate between directory and file filters on scan subdirectory * feat: generate report for app cache section * Feat: generate report for logs files * feat: Generate report for trash section * Feat: generate report for web storage and cache sections * update the package-json version * WIP * Feat: Add customDirectoryFilter in process dirent * Feat: add web browser directory filter on app cache report * Update web storage and cache with brave and firefox browsers paths * feat: Generate report * Feat: generate ipc report * Feat: cleaner context * Feat: create loading, generate report and translations * feat: connect report to ui * Feat: use tanstack virtualizer to manage large item list + change way of selecting items in order to be more maneagable for large lists * Feat: confirm dialog and mock cleanup * translations and mock cleanup * Feat: update ipc function to accept refresh of the report * Feat: Cleaning and final ui + translations * chore: add new variant to button * Feat: Define ipc methods to comunicate through processes + define types in backend * feat: Clean service + ipc handlers * Feat: Add cleanup service to front * Added logs to the generation report * fix visual bug * Feat: Product availability in the front * Feat: Add diskusage * chore: Update log paths because got changed on the core library * Feat: Add cleaner onboarding * add cleaner in the header/gear menu * Check products at the begining * disable section when no item is scanned
1 parent 6baf249 commit 1f2250a

File tree

229 files changed

+6202
-1364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+6202
-1364
lines changed

.erb/configs/webpack.config.base.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const configuration: webpack.Configuration = {
4444
* Determine the array of extensions that should be used to resolve modules.
4545
*/
4646
resolve: {
47+
symlinks: false,
4748
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
4849
modules: [webpackPaths.srcPath, 'node_modules'],
4950
},

.github/workflows/publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535
echo "NEW_CRYPTO_KEY=${{ secrets.NEW_CRYPTO_KEY }}" >> .env
3636
echo "NEW_DRIVE_URL=https://gateway.internxt.com/drive" >> .env
3737
echo "DRIVE_API_URL=https://gateway.internxt.com/api" >> .env
38-
echo "BRIDGE_URL=https://api.internxt.com" >> .env
38+
echo "PAYMENTS_URL=https://gateway.internxt.com/payments" >> .env
39+
echo "INTERNXT_DESKTOP_HEADER_KEY=${{ secrets.INTERNXT_DESKTOP_HEADER_KEY }}" >> .env
40+
echo "BRIDGE_URL=https://gateway.internxt.com/network" >> .env
3941
echo "APP_SEGMENT_KEY=${{ secrets.APP_SEGMENT_KEY }}" >> .env
4042
echo "APP_SEGMENT_KEY_TEST=${{ secrets.APP_SEGMENT_KEY_TEST }}" >> .env
4143
echo "BUG_REPORTING_URL=https://desktop-bug-reporting.inxt.workers.dev" >> .env

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "internxt",
3-
"version": "2.4.11",
3+
"version": "2.5.0",
44
"author": "Internxt <[email protected]>",
55
"description": "Internxt Drive client UI",
66
"license": "AGPL-3.0",
@@ -277,7 +277,7 @@
277277
"dependencies": {
278278
"@headlessui/react": "^1.4.2",
279279
"@iconscout/react-unicons": "^1.1.6",
280-
"@internxt/drive-desktop-core": "0.0.3",
280+
"@internxt/drive-desktop-core": "0.1.1",
281281
"@internxt/inxt-js": "^2.2.3",
282282
"@internxt/lib": "^1.1.6",
283283
"@internxt/scan": "1.0.3",
@@ -286,11 +286,13 @@
286286
"@radix-ui/react-select": "^1.2.2",
287287
"@sentry/electron": "^4.5.0",
288288
"@sentry/react": "^7.51.0",
289+
"@tanstack/react-virtual": "^3.13.12",
289290
"async": "^3.2.4",
290291
"axios": "^1.1.3",
291292
"bottleneck": "^2.19.5",
292293
"bytes": "^3.1.1",
293294
"chance": "^1.1.11",
295+
"check-disk-space": "^3.4.0",
294296
"crypto-js": "4.1.1",
295297
"dayjs": "^1.10.7",
296298
"diod": "^2.0.0",

release/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "internxt",
3-
"version": "2.4.11",
3+
"version": "2.5.0",
44
"description": "Internxt Drive client UI",
55
"main": "./dist/main/main.js",
66
"author": "Internxt <[email protected]>",

src/apps/antivirus/ipc/AntivirusIPCHandler.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { logger } from '@internxt/drive-desktop-core/build/backend';
22
import { shell, BrowserWindow, ipcMain } from 'electron';
33
import { AntivirusIPCMain } from './AntivirusIPCMain';
44
import { SelectedItemToScanProps } from '../../main/antivirus/Antivirus';
5-
import { PaymentsService } from '../../main/payments/service';
5+
66
import { getManualScanMonitorInstance } from '../../main/antivirus/ManualSystemScan';
7-
import { buildPaymentsService } from '../../main/payments/builder';
87
import { getMultiplePathsFromDialog } from '../../main/device/service';
98
import { ScanProgress } from './messages/BackgroundProcessMessages';
109
import fs from 'fs';
10+
import { getStoredUserProducts } from '../../../backend/features/payments/services/get-stored-user-products';
1111

1212
/**
1313
* Service class for handling antivirus scan operations
@@ -311,7 +311,6 @@ export class AntivirusScanService {
311311
* Handles antivirus IPC messaging between main and renderer processes
312312
*/
313313
export class AntivirusIPCHandler {
314-
private paymentService: PaymentsService | null = null;
315314

316315
/**
317316
* Broadcast scan progress to all open windows
@@ -367,14 +366,10 @@ export class AntivirusIPCHandler {
367366
*/
368367
private setupAvailabilityHandler(): void {
369368
AntivirusIPCMain.handle('antivirus:is-available', async () => {
370-
if (!this.paymentService) {
371-
this.paymentService = buildPaymentsService();
372-
}
373369

374370
try {
375-
const availableProducts =
376-
await this.paymentService.getAvailableProducts();
377-
return availableProducts.antivirus;
371+
const availableProducts = getStoredUserProducts();
372+
return !!availableProducts?.antivirus;
378373
} catch (error) {
379374
logger.error({
380375
tag: 'ANTIVIRUS',
@@ -620,12 +615,12 @@ export class AntivirusIPCHandler {
620615

621616
logger.debug({
622617
tag: 'ANTIVIRUS',
623-
msg: 'All handlers removed',
618+
msg: 'All Antivirus handlers removed',
624619
});
625620
} catch (error) {
626621
logger.error({
627622
tag: 'ANTIVIRUS',
628-
msg: 'Error removing handlers:',
623+
msg: 'Error removing Antivirus handlers:',
629624
error,
630625
});
631626
}

src/apps/backups/BackupService.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Service } from 'diod';
2-
import Logger from 'electron-log';
32
import { FileBatchUpdater } from '../../context/local/localFile/application/update/FileBatchUpdater';
43
import { FileBatchUploader } from '../../context/local/localFile/application/upload/FileBatchUploader';
54
import { LocalFile } from '../../context/local/localFile/domain/LocalFile';
@@ -30,6 +29,7 @@ import { RetryOptions } from '../shared/retry/types';
3029
import { RetryHandler } from '../shared/retry/RetryHandler';
3130
import { BackupsDanglingFilesService } from './BackupsDanglingFilesService';
3231
import { UsageModule } from '../../backend/features/usage/usage.module';
32+
import { logger } from '@internxt/drive-desktop-core/build/backend';
3333

3434
@Service()
3535
export class BackupService {
@@ -50,51 +50,51 @@ export class BackupService {
5050
info: BackupInfo,
5151
abortController: AbortController
5252
): Promise<DriveDesktopError | undefined> {
53-
Logger.info('[BACKUPS] Starting backup for:', info.pathname);
53+
logger.debug({ tag: 'BACKUPS', msg: 'Starting backup for:', pathname: info.pathname });
5454

5555
try {
56-
Logger.info('[BACKUPS] Generating local tree');
56+
logger.debug({ tag: 'BACKUPS', msg: 'Generating local tree' });
5757
const localTreeEither = await this.localTreeBuilder.run(
5858
info.pathname as AbsolutePath
5959
);
6060

6161
if (localTreeEither.isLeft()) {
6262
const error = localTreeEither.getLeft();
63-
Logger.error('[BACKUPS] Error generating local tree:', error);
63+
logger.error({ tag: 'BACKUPS', msg: 'Error generating local tree:', error });
6464
return error;
6565
}
6666

6767
const local = localTreeEither.getRight();
68-
Logger.info('[BACKUPS] Local tree generated successfully');
68+
logger.debug({ tag: 'BACKUPS', msg: 'Local tree generated successfully' });
6969

70-
Logger.info('[BACKUPS] Generating remote tree');
70+
logger.debug({ tag: 'BACKUPS', msg: 'Generating remote tree' });
7171
const remote = await this.remoteTreeBuilder.run(info.folderId, info.folderUuid);
72-
Logger.info('[BACKUPS] Remote tree generated successfully');
72+
logger.debug({ tag: 'BACKUPS', msg: 'Remote tree generated successfully' });
7373

74-
Logger.info('[BACKUPS] Calculating folder differences');
74+
logger.debug({ tag: 'BACKUPS', msg: 'Calculating folder differences' });
7575
const foldersDiff = FoldersDiffCalculator.calculate(local, remote);
76-
Logger.info('[BACKUPS] Folder differences calculated');
76+
logger.debug({ tag: 'BACKUPS', msg: 'Folder differences calculated' });
7777

78-
Logger.info('[BACKUPS] Calculating file differences');
78+
logger.debug({ tag: 'BACKUPS', msg: 'Calculating file differences' });
7979
const filesDiff = DiffFilesCalculatorService.calculate(local, remote);
8080

8181
if (filesDiff.dangling.size > 0) {
82-
Logger.info('[BACKUPS] Dangling files found, handling them');
82+
logger.debug({ tag: 'BACKUPS', msg: 'Dangling files found, handling them' });
8383
const filesToResync =
8484
await this.backupsDanglingFilesService.handleDanglingFilesOnBackup(
8585
filesDiff.dangling
8686
);
8787
for (const [localFile, remoteFile] of filesToResync) {
8888
filesDiff.modified.set(localFile, remoteFile);
8989
}
90-
Logger.info(`[BACKUPS] ${filesToResync.size} dangling files to resync`);
90+
logger.debug({ tag: 'BACKUPS', msg: `${filesToResync.size} dangling files to resync` });
9191
filesDiff.total += filesDiff.dangling.size;
9292
}
93-
Logger.info('[BACKUPS] File differences calculated');
93+
logger.debug({ tag: 'BACKUPS', msg: 'File differences calculated' });
9494

95-
Logger.info('[BACKUPS] Checking available space');
95+
logger.debug({ tag: 'BACKUPS', msg: 'Checking available space' });
9696
await this.isThereEnoughSpace(filesDiff);
97-
Logger.info('[BACKUPS] Space check completed');
97+
logger.debug({ tag: 'BACKUPS', msg: 'Space check completed' });
9898

9999
const itemsAlreadyBacked =
100100
filesDiff.unmodified.length + foldersDiff.unmodified.length;
@@ -106,20 +106,20 @@ export class BackupService {
106106
itemsAlreadyBacked
107107
);
108108

109-
Logger.info('[BACKUPS] Starting folder backup');
109+
logger.debug({ tag: 'BACKUPS', msg: 'Starting folder backup' });
110110
await this.backupFolders(foldersDiff, local, remote);
111-
Logger.info('[BACKUPS] Folder backup completed');
111+
logger.debug({ tag: 'BACKUPS', msg: 'Folder backup completed' });
112112

113-
Logger.info('[BACKUPS] Starting file backup');
113+
logger.debug({ tag: 'BACKUPS', msg: 'Starting file backup' });
114114
await this.backupFiles(filesDiff, local, remote, abortController);
115-
Logger.info('[BACKUPS] File backup completed');
115+
logger.debug({ tag: 'BACKUPS', msg: 'File backup completed' });
116116

117-
Logger.info('[BACKUPS] Backup process completed successfully');
117+
logger.debug({ tag: 'BACKUPS', msg: 'Backup process completed successfully' });
118118
return undefined;
119119
} catch (error) {
120-
Logger.error('[BACKUPS] Backup process failed with error:', error);
120+
logger.error({ tag: 'BACKUPS', msg: 'Backup process failed with error:', error });
121121
if (error instanceof DriveDesktopError) {
122-
Logger.error('[BACKUPS] DriveDesktopError cause:', error.cause);
122+
logger.error({ tag: 'BACKUPS', msg: 'DriveDesktopError cause:', cause: error.cause });
123123
return error;
124124
}
125125
return new DriveDesktopError('UNKNOWN', 'An unknown error occurred');
@@ -193,9 +193,9 @@ export class BackupService {
193193
local: LocalTree,
194194
remote: RemoteTree
195195
) {
196-
Logger.info('[BACKUPS] Backing folders');
196+
logger.debug({ tag: 'BACKUPS', msg: 'Backing folders' });
197197

198-
Logger.info('[BACKUPS] Folders added', diff.added.length);
198+
logger.debug({ tag: 'BACKUPS', msg: 'Folders added', count: diff.added.length });
199199

200200
for (const localFolder of diff.added) {
201201
const remoteParentPath = relative(local.root.path, localFolder.basedir());
@@ -230,17 +230,17 @@ export class BackupService {
230230
remote: RemoteTree,
231231
abortController: AbortController
232232
) {
233-
Logger.info('[BACKUPS] Backing files');
233+
logger.debug({ tag: 'BACKUPS', msg: 'Backing files' });
234234

235235
const { added, modified, deleted } = filesDiff;
236236

237-
Logger.info('[BACKUPS] Files added', added.length);
237+
logger.debug({ tag: 'BACKUPS', msg: 'Files added', count: added.length });
238238
await this.uploadAndCreate(local.root.path, added, remote, abortController);
239239

240-
Logger.info('[BACKUPS] Files modified', modified.size);
240+
logger.debug({ tag: 'BACKUPS', msg: 'Files modified', count: modified.size });
241241
await this.uploadAndUpdate(modified, local, remote, abortController);
242242

243-
Logger.info('[BACKUPS] Files deleted', deleted.length);
243+
logger.debug({ tag: 'BACKUPS', msg: 'Files deleted', count: deleted.length });
244244
await this.deleteRemoteFiles(deleted, abortController);
245245
}
246246

@@ -278,7 +278,7 @@ export class BackupService {
278278
const batches = ModifiedFilesBatchCreator.run(modified);
279279

280280
for (const batch of batches) {
281-
Logger.debug('Signal aborted', abortController.signal.aborted);
281+
logger.debug({ tag: 'BACKUPS', msg: 'Signal aborted', aborted: abortController.signal.aborted });
282282
if (abortController.signal.aborted) {
283283
return;
284284
}
@@ -313,7 +313,7 @@ export class BackupService {
313313
}
314314

315315
private logAndReportError(error: unknown) {
316-
Logger.error(error);
316+
logger.error({ tag: 'BACKUPS', msg: 'Error occurred', error });
317317
const message = error instanceof Error ? error.message : 'unknown';
318318
BackupsIPCRenderer.send('backups.process-error', message);
319319
}

src/apps/backups/BackupsDanglingFilesService.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Service } from 'diod';
22
import { LocalFile } from '../../context/local/localFile/domain/LocalFile';
33
import { File } from '../../context/virtual-drive/files/domain/File';
4-
import Logger from 'electron-log';
54
import { StorageFileService } from '../../context/storage/StorageFiles/StorageFileService';
5+
import { logger } from '@internxt/drive-desktop-core/build/backend';
66

77
@Service()
88
export class BackupsDanglingFilesService {
@@ -11,37 +11,49 @@ export class BackupsDanglingFilesService {
1111
async handleDanglingFilesOnBackup(
1212
danglingFiles: Map<LocalFile, File>
1313
): Promise<Map<LocalFile, File>> {
14-
Logger.info(
15-
`BackupsDanglingFilesService started for: ${danglingFiles.size} dangling files`
16-
);
14+
logger.debug({
15+
tag: 'BACKUPS',
16+
msg: 'BackupsDanglingFilesService started for dangling files',
17+
count: danglingFiles.size
18+
});
1719
const filesToResync = new Map<LocalFile, File>();
1820

1921
for (const [localFile, remoteFile] of danglingFiles) {
2022
try {
21-
Logger.info(
22-
`[BACKUP DANGLING FILE] Checking file ${remoteFile.contentsId}...`
23-
);
23+
logger.debug({
24+
tag: 'BACKUPS',
25+
msg: '[BACKUP DANGLING FILE] Checking file',
26+
contentsId: remoteFile.contentsId
27+
});
2428
const resultEither = await this.storageFileService.isFileDownloadable(
2529
remoteFile.contentsId
2630
);
2731
if (resultEither.isRight()) {
2832
const isFileDownloadable = resultEither.getRight();
2933
if (!isFileDownloadable) {
30-
Logger.warn(
31-
`[BACKUP DANGLING FILE] File ${remoteFile.contentsId} is not downloadable, backing up again...`
32-
);
34+
logger.warn({
35+
tag: 'BACKUPS',
36+
msg: '[BACKUP DANGLING FILE] File is not downloadable, backing up again',
37+
contentsId: remoteFile.contentsId
38+
});
3339
filesToResync.set(localFile, remoteFile);
3440
}
3541
} else {
3642
const error = resultEither.getLeft();
37-
Logger.error(
38-
`[BACKUP DANGLING FILE] Error checking file ${remoteFile.contentsId}: ${error.message}`
39-
);
43+
logger.error({
44+
tag: 'BACKUPS',
45+
msg: '[BACKUP DANGLING FILE] Error checking file',
46+
contentsId: remoteFile.contentsId,
47+
error: error.message
48+
});
4049
}
4150
} catch (error) {
42-
Logger.error(
43-
`[BACKUP DANGLING FILE] Error while handling dangling file ${remoteFile.contentsId}: ${error}`
44-
);
51+
logger.error({
52+
tag: 'BACKUPS',
53+
msg: '[BACKUP DANGLING FILE] Error while handling dangling file',
54+
contentsId: remoteFile.contentsId,
55+
error
56+
});
4557
}
4658
}
4759
return filesToResync;

src/apps/backups/diff/DiffFilesCalculatorService.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { LocalTree } from '../../../context/local/localTree/domain/LocalTree';
55
import { File } from '../../../context/virtual-drive/files/domain/File';
66
import { RemoteTree } from '../../../context/virtual-drive/remoteTree/domain/RemoteTree';
77
import { relative } from '../utils/relative';
8-
import Logger from 'electron-log';
98
import configStore from '../../main/config';
9+
import { logger } from '@internxt/drive-desktop-core/build/backend';
1010

1111
export type FilesDiff = {
1212
added: Array<LocalFile>;
@@ -39,7 +39,7 @@ export class DiffFilesCalculatorService {
3939
const remoteNode = remote.get(remotePath);
4040

4141
if (remoteNode.isFolder()) {
42-
Logger.debug('Folder should be a file', remoteNode.name);
42+
logger.debug({ tag: 'BACKUPS', msg: 'Folder should be a file', fileName: remoteNode.name });
4343
return;
4444
}
4545

@@ -49,9 +49,11 @@ export class DiffFilesCalculatorService {
4949
const localModificationTime = Math.trunc(local.modificationTime / 1000);
5050

5151
if (this.isDangledFile(remoteNode.createdAt)) {
52-
Logger.debug(
53-
`Possible Dangled File Found with name ${remoteNode.name} while backing up`
54-
);
52+
logger.debug({
53+
tag: 'BACKUPS',
54+
msg: 'Possible Dangled File Found while backing up',
55+
fileName: remoteNode.name
56+
});
5557
dangling.set(local, remoteNode);
5658
return;
5759
}

0 commit comments

Comments
 (0)