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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ContainerBuilder } from 'diod';
import os from 'node:os';
import path from 'node:path';
import { ThumbnailSynchronizer } from '../../../../context/storage/thumbnails/application/sync/ThumbnailSynchronizer';
import { LocalThumbnailRepository } from '../../../../context/storage/thumbnails/infrastructrue/local/LocalThumbnsailsRepository';
import { SystemThumbnailNameCalculator } from '../../../../context/storage/thumbnails/infrastructrue/local/SystemThumbnailNameCalculator';
import { RelativePathToAbsoluteConverter } from '../../../../context/virtual-drive/shared/application/RelativePathToAbsoluteConverter';
import { PATHS } from '../../../../core/electron/paths';

export async function registerThumbnailsServices(builder: ContainerBuilder) {
builder.registerAndUse(SystemThumbnailNameCalculator);
Expand All @@ -15,7 +14,7 @@ export async function registerThumbnailsServices(builder: ContainerBuilder) {
const local = new LocalThumbnailRepository(
pathConverter,
c.get(SystemThumbnailNameCalculator),
path.join(os.homedir(), '.cache', 'thumbnails'),
PATHS.THUMBNAILS_FOLDER,
);

local.init();
Expand Down
1 change: 0 additions & 1 deletion src/apps/main/preload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ declare interface Window {
onVirtualDriveStatusChange(
callback: (event: { status: import('../drive/fuse/FuseDriveStatus').FuseDriveStatus }) => void,
): () => void;
retryVirtualDriveMount(): Promise<void>;
startRemoteSync: () => Promise<void>;
openUrl: (url: string) => Promise<void>;
getPreferredAppLanguage: () => Promise<Array<string>>;
Expand Down
3 changes: 0 additions & 3 deletions src/apps/main/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,6 @@ contextBridge.exposeInMainWorld('electron', {
getVirtualDriveStatus() {
return ipcRenderer.invoke('get-virtual-drive-status');
},
retryVirtualDriveMount() {
return ipcRenderer.invoke('retry-virtual-drive-mount');
},
onVirtualDriveStatusChange(callback) {
const eventName = 'virtual-drive-status-change';
const callbackWrapper = (_, v) => {
Expand Down
4 changes: 4 additions & 0 deletions src/apps/main/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
TODO PB-6043: Stop using this class in favor of the real, src/infra/schemas UserDTO/UserResponseDTO

Check warning on line 2 in src/apps/main/types.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=internxt_drive-desktop-linux&issues=AZy-n3i7izUnMcqJ9gQn&open=AZy-n3i7izUnMcqJ9gQn&pullRequest=264
As it is the real, maintained type from the backend.
*/
export type User = {
backupsBucket: string;
bridgeUser: string;
Expand Down
7 changes: 1 addition & 6 deletions src/apps/main/virtual-drive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ipcMain } from 'electron';
import { getFuseDriveState, startVirtualDrive, stopAndClearFuseApp, stopFuse, updateFuseApp } from '../drive';
import { getFuseDriveState, startVirtualDrive, stopAndClearFuseApp, updateFuseApp } from '../drive';
import eventBus from './event-bus';

eventBus.on('USER_LOGGED_OUT', stopAndClearFuseApp);
Expand All @@ -10,8 +10,3 @@ eventBus.on('REMOTE_CHANGES_SYNCHED', updateFuseApp);
ipcMain.handle('get-virtual-drive-status', () => {
return getFuseDriveState();
});

ipcMain.handle('retry-virtual-drive-mount', async () => {
await stopFuse();
await startVirtualDrive();
});
2 changes: 0 additions & 2 deletions src/apps/main/virtual-root-folder/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ ipcMain.handle('get-virtual-drive-root', getRootVirtualDrive);
ipcMain.handle('choose-sync-root-with-dialog', chooseSyncRootWithDialog);

ipcMain.handle('open-virtual-drive-folder', openVirtualDriveRootFolder);

//ipcMain.handle('retry-virtual-drive-mount', () => chooseSyncRootWithDialog);
14 changes: 1 addition & 13 deletions src/apps/renderer/hooks/useVirtualDriveStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,5 @@ export default function useVirtualDriveStatus() {
return removeListener;
}, []);

function retryMount() {
window.electron
.retryVirtualDriveMount()
.then(() => {
return window.electron.getVirtualDriveStatus();
})
.then((status: FuseDriveStatus) => setVirtualDriveStatus(status))
.catch((err) => {
reportError(err);
});
}

return { virtualDriveStatus, retryMount };
return { virtualDriveStatus };
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import crypto from 'crypto';
import { Service } from 'diod';

export type ThumbnailSize = 'normal' | 'large' | 'x-large' | 'xx-large';

@Service()
export class SystemThumbnailNameCalculator {
thumbnailName(original: string) {
Expand Down
6 changes: 4 additions & 2 deletions src/core/electron/paths.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { app } from 'electron';
import { join } from 'path';
import path, { join } from 'node:path';
import os from 'node:os';

const HOME_FOLDER_PATH = app.getPath('home');
const LOGS = join(HOME_FOLDER_PATH, '.config', 'internxt', 'logs');

const THUMBNAILS_FOLDER = path.join(os.homedir(), '.cache', 'thumbnails');
export const PATHS = {
HOME_FOLDER_PATH,
LOGS,
THUMBNAILS_FOLDER,
};
Loading