From 2141524ee4e940c9f026c6cdce76839380048e65 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 10 Jan 2023 19:11:13 +0530 Subject: [PATCH 01/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index a955ae39f..a32a5d698 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit a955ae39fa97232131682ad72d866bf3155a0906 +Subproject commit a32a5d69850542ea3da276d78ec9d2264bdcd117 From ffedd39bd89f9b22be2e0318cb51fd8dd672c157 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 11 Jan 2023 16:46:45 +0530 Subject: [PATCH 02/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index a32a5d698..86a7f1cda 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit a32a5d69850542ea3da276d78ec9d2264bdcd117 +Subproject commit 86a7f1cdab5c3a9a2cfbd0daecb9f7e1dd06660e From 5182578de3dc16cbc87e392ad82e482f468cd6cf Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 11 Jan 2023 23:01:02 +0530 Subject: [PATCH 03/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 86a7f1cda..8d35ee519 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 86a7f1cdab5c3a9a2cfbd0daecb9f7e1dd06660e +Subproject commit 8d35ee519e1f19d12c38b22b51d2dea03863346a From 97b82c156dd39934f39068dafdb8dbbd6dad3328 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 11 Jan 2023 23:01:24 +0530 Subject: [PATCH 04/93] v1.6.17-beta.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e1ed6ff2f..e6bd3c583 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-alpha.3", + "version": "1.6.17-beta.1", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 99fc6bd1af887963d478001df4901c38008fcaa0 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 09:12:47 +0530 Subject: [PATCH 05/93] add process name in spike log --- src/utils/processStats.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 7bf262cd9..64f900d58 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -68,7 +68,7 @@ async function logSpikeMainMemoryUsage() { process.getHeapStatistics() ); - ElectronLog.log('reporting memory usage spike', { + ElectronLog.log('reporting main memory usage spike', { currentProcessMemoryInfo: normalizedCurrentProcessMemoryInfo, previousProcessMemoryInfo: normalizedPreviousProcessMemoryInfo, heapStatistics, @@ -122,7 +122,7 @@ async function logSpikeRendererMemoryUsage() { process.getHeapStatistics() ); - ElectronLog.log('reporting memory usage spike', { + ElectronLog.log('reporting renderer memory usage spike', { currentProcessMemoryInfo: normalizedCurrentProcessMemoryInfo, previousProcessMemoryInfo: normalizedPreviousProcessMemoryInfo, heapStatistics, From c583a3c3fbb0dbb29b6885fda4fac8daf5603135 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 09:13:07 +0530 Subject: [PATCH 06/93] v1.6.17-beta.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e6bd3c583..3f482bd66 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-beta.1", + "version": "1.6.17-beta.2", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 0ebd43da2de60953fd9a1f3e0d8587ebd9e0a4ed Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 10:24:31 +0530 Subject: [PATCH 07/93] v1.6.17-beta.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3f482bd66..a72e3a320 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-beta.2", + "version": "1.6.17-beta.3", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From f2c60381b31854acf47affc1f5c353a6878eeaae Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 12:48:55 +0530 Subject: [PATCH 08/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 8d35ee519..b7d8fc630 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 8d35ee519e1f19d12c38b22b51d2dea03863346a +Subproject commit b7d8fc63017c73447209db3d7a2c4a6acff37183 From db4b1829db89597fa1fa04f1e334b646a705a9c3 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 13:21:20 +0530 Subject: [PATCH 09/93] fix spike MemoryUsage logging --- src/utils/processStats.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 64f900d58..80e3c404b 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -44,8 +44,8 @@ async function logSpikeMainMemoryUsage() { processMemoryInfo.private ); const previewMemoryUsage = Math.max( - previousMainProcessMemoryInfo.private, - previousMainProcessMemoryInfo.residentSet + previousMainProcessMemoryInfo.residentSet ?? 0, + previousMainProcessMemoryInfo.private ); const isSpiking = currentMemoryUsage - previewMemoryUsage >= @@ -92,9 +92,10 @@ let rendererUsingHighMemory = false; async function logSpikeRendererMemoryUsage() { const processMemoryInfo = await process.getProcessMemoryInfo(); const currentMemoryUsage = Math.max( - processMemoryInfo.residentSet, + processMemoryInfo.residentSet ?? 0, processMemoryInfo.private ); + const previewMemoryUsage = Math.max( previousRendererProcessMemoryInfo.private, previousRendererProcessMemoryInfo.residentSet @@ -110,6 +111,8 @@ async function logSpikeRendererMemoryUsage() { (isHighMemoryUsage && !rendererUsingHighMemory) || (!isHighMemoryUsage && rendererUsingHighMemory); + console.log(convertBytesToHumanReadable(currentMemoryUsage * 1024)); + if (isSpiking || shouldReport) { const normalizedCurrentProcessMemoryInfo = await getNormalizedProcessMemoryInfo(processMemoryInfo); From 2d26d61bade01af95df22944f7198f61adde6dfe Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 13:25:00 +0530 Subject: [PATCH 10/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index b7d8fc630..c3508053c 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit b7d8fc63017c73447209db3d7a2c4a6acff37183 +Subproject commit c3508053ca0b11341445ae0b38dac9185e1cfab3 From 6ea0dd9ee2524e50deee46bae4545a76b5396852 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 15:18:34 +0530 Subject: [PATCH 11/93] log currentMemoryUsage each second --- src/utils/processStats.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 80e3c404b..fd4c0cda0 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -40,15 +40,15 @@ let mainProcessUsingHighMemory = false; async function logSpikeMainMemoryUsage() { const processMemoryInfo = await process.getProcessMemoryInfo(); const currentMemoryUsage = Math.max( - processMemoryInfo.residentSet, + processMemoryInfo.residentSet ?? 0, processMemoryInfo.private ); - const previewMemoryUsage = Math.max( + const previousMemoryUsage = Math.max( previousMainProcessMemoryInfo.residentSet ?? 0, previousMainProcessMemoryInfo.private ); const isSpiking = - currentMemoryUsage - previewMemoryUsage >= + currentMemoryUsage - previousMemoryUsage >= MAIN_MEMORY_USAGE_DIFF_IN_KILOBYTES_CONSIDERED_AS_SPIKE; const isHighMemoryUsage = @@ -58,6 +58,10 @@ async function logSpikeMainMemoryUsage() { (isHighMemoryUsage && !mainProcessUsingHighMemory) || (!isHighMemoryUsage && mainProcessUsingHighMemory); + ElectronLog.log( + 'main processMemory', + convertBytesToHumanReadable(currentMemoryUsage * 1024) + ); if (isSpiking || shouldReport) { const normalizedCurrentProcessMemoryInfo = await getNormalizedProcessMemoryInfo(processMemoryInfo); @@ -96,12 +100,12 @@ async function logSpikeRendererMemoryUsage() { processMemoryInfo.private ); - const previewMemoryUsage = Math.max( + const previousMemoryUsage = Math.max( previousRendererProcessMemoryInfo.private, - previousRendererProcessMemoryInfo.residentSet + previousRendererProcessMemoryInfo.residentSet ?? 0 ); const isSpiking = - currentMemoryUsage - previewMemoryUsage >= + currentMemoryUsage - previousMemoryUsage >= RENDERER_MEMORY_USAGE_DIFF_IN_KILOBYTES_CONSIDERED_AS_SPIKE; const isHighMemoryUsage = @@ -111,7 +115,10 @@ async function logSpikeRendererMemoryUsage() { (isHighMemoryUsage && !rendererUsingHighMemory) || (!isHighMemoryUsage && rendererUsingHighMemory); - console.log(convertBytesToHumanReadable(currentMemoryUsage * 1024)); + ElectronLog.log( + 'renderer processMemory', + convertBytesToHumanReadable(currentMemoryUsage * 1024) + ); if (isSpiking || shouldReport) { const normalizedCurrentProcessMemoryInfo = From f919c0e28b8e5a9bd766d0433e3eb18ce1dc51a0 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 15:31:51 +0530 Subject: [PATCH 12/93] increase main spike and threshold value --- src/utils/processStats.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index fd4c0cda0..08cba6dc7 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -5,9 +5,9 @@ const LOGGING_INTERVAL_IN_MICROSECONDS = 30 * 1000; // 30 seconds const SPIKE_DETECTION_INTERVAL_IN_MICROSECONDS = 1 * 1000; // 1 seconds -const MAIN_MEMORY_USAGE_DIFF_IN_KILOBYTES_CONSIDERED_AS_SPIKE = 10 * 1024; // 10 MB +const MAIN_MEMORY_USAGE_DIFF_IN_KILOBYTES_CONSIDERED_AS_SPIKE = 50 * 1024; // 50 MB -const HIGH_MAIN_MEMORY_USAGE_THRESHOLD_IN_KILOBYTES = 100 * 1024; // 100 MB +const HIGH_MAIN_MEMORY_USAGE_THRESHOLD_IN_KILOBYTES = 200 * 1024; // 200 MB const RENDERER_MEMORY_USAGE_DIFF_IN_KILOBYTES_CONSIDERED_AS_SPIKE = 200 * 1024; // 200 MB From 7d8578a7401f44cd8ba1b8dd73cf18018e2cfb60 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 15:32:59 +0530 Subject: [PATCH 13/93] remove per second logging --- src/utils/processStats.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 08cba6dc7..25710dbd2 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -58,10 +58,6 @@ async function logSpikeMainMemoryUsage() { (isHighMemoryUsage && !mainProcessUsingHighMemory) || (!isHighMemoryUsage && mainProcessUsingHighMemory); - ElectronLog.log( - 'main processMemory', - convertBytesToHumanReadable(currentMemoryUsage * 1024) - ); if (isSpiking || shouldReport) { const normalizedCurrentProcessMemoryInfo = await getNormalizedProcessMemoryInfo(processMemoryInfo); @@ -115,11 +111,6 @@ async function logSpikeRendererMemoryUsage() { (isHighMemoryUsage && !rendererUsingHighMemory) || (!isHighMemoryUsage && rendererUsingHighMemory); - ElectronLog.log( - 'renderer processMemory', - convertBytesToHumanReadable(currentMemoryUsage * 1024) - ); - if (isSpiking || shouldReport) { const normalizedCurrentProcessMemoryInfo = await getNormalizedProcessMemoryInfo(processMemoryInfo); From e530a022d8e769cfe03762d11cfc81cd4cc7cb18 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 15:36:29 +0530 Subject: [PATCH 14/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 8d35ee519..b7d8fc630 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 8d35ee519e1f19d12c38b22b51d2dea03863346a +Subproject commit b7d8fc63017c73447209db3d7a2c4a6acff37183 From b48d368b637094cf644af82cee2a43b94f67abbc Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 15:37:55 +0530 Subject: [PATCH 15/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index c3508053c..b7d8fc630 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit c3508053ca0b11341445ae0b38dac9185e1cfab3 +Subproject commit b7d8fc63017c73447209db3d7a2c4a6acff37183 From f78e739ba5c0bd2597900e87e37646cc733b72bf Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 12 Jan 2023 15:47:04 +0530 Subject: [PATCH 16/93] v1.6.17-beta.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a72e3a320..aeef1f4fa 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-beta.3", + "version": "1.6.17-beta.4", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 7fc6c7138af07c50f0a5f4a1ea1a9ccd7a466d3d Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 17 Jan 2023 16:48:03 +0530 Subject: [PATCH 17/93] add cross-env package to set env variable when running yarn script --- package.json | 3 ++- yarn.lock | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index aeef1f4fa..ad066e854 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "start": "concurrently \"yarn start-main\" \"yarn start-renderer\"", "build-renderer": "cd ui && yarn install && yarn build && cd ..", "build": "yarn build-renderer && yarn build-main", - "test-release": "yarn build && electron-builder --config.compression=store" + "test-release": "cross-env IS_TEST_RELEASE=true yarn build && electron-builder --config.compression=store" }, "author": "ente ", "devDependencies": { @@ -83,6 +83,7 @@ "@typescript-eslint/eslint-plugin": "^5.28.0", "@typescript-eslint/parser": "^5.28.0", "concurrently": "^7.0.0", + "cross-env": "^7.0.3", "electron": "^21.2.2", "electron-builder": "^23.0.3", "electron-builder-notarize": "^1.2.0", diff --git a/yarn.lock b/yarn.lock index 8dd73a05c..a406a638e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1199,6 +1199,13 @@ crc@^3.8.0: dependencies: buffer "^5.1.0" +cross-env@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" + integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== + dependencies: + cross-spawn "^7.0.1" + cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" From 05165c6943be16c2e3258ee89363b8b724d5f672 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 17 Jan 2023 16:49:11 +0530 Subject: [PATCH 18/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index b7d8fc630..af70334f9 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit b7d8fc63017c73447209db3d7a2c4a6acff37183 +Subproject commit af70334f9a8288546899ca80cf9632dad3d1596e From ac08b8279a084e35413eda9dc4c5aad73d46890f Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 17 Jan 2023 16:56:26 +0530 Subject: [PATCH 19/93] add log per second --- src/utils/processStats.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 25710dbd2..923e3ea56 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -43,6 +43,11 @@ async function logSpikeMainMemoryUsage() { processMemoryInfo.residentSet ?? 0, processMemoryInfo.private ); + ElectronLog.log( + 'main ProcessMemory', + convertBytesToHumanReadable(currentMemoryUsage) + ); + const previousMemoryUsage = Math.max( previousMainProcessMemoryInfo.residentSet ?? 0, previousMainProcessMemoryInfo.private @@ -95,6 +100,10 @@ async function logSpikeRendererMemoryUsage() { processMemoryInfo.residentSet ?? 0, processMemoryInfo.private ); + ElectronLog.log( + 'renderer ProcessMemory', + convertBytesToHumanReadable(currentMemoryUsage) + ); const previousMemoryUsage = Math.max( previousRendererProcessMemoryInfo.private, From 2a6beae32bb24f9028ba38ca59654fb4b6268b29 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 17 Jan 2023 17:51:26 +0530 Subject: [PATCH 20/93] fix unit --- src/utils/processStats.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 923e3ea56..1ee83d94f 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -45,7 +45,7 @@ async function logSpikeMainMemoryUsage() { ); ElectronLog.log( 'main ProcessMemory', - convertBytesToHumanReadable(currentMemoryUsage) + convertBytesToHumanReadable(currentMemoryUsage * 1024) ); const previousMemoryUsage = Math.max( @@ -102,7 +102,7 @@ async function logSpikeRendererMemoryUsage() { ); ElectronLog.log( 'renderer ProcessMemory', - convertBytesToHumanReadable(currentMemoryUsage) + convertBytesToHumanReadable(currentMemoryUsage * 1024) ); const previousMemoryUsage = Math.max( From 753b8d178e1e96e3bbab8f3af9d693335d7a7cd7 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 17 Jan 2023 17:52:31 +0530 Subject: [PATCH 21/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index af70334f9..22566d98f 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit af70334f9a8288546899ca80cf9632dad3d1596e +Subproject commit 22566d98f869a73d38968244288ecedca30a015a From 63c5965c13d795c98e784817053db01bbb0759bf Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 19 Jan 2023 16:59:47 +0530 Subject: [PATCH 22/93] Revert "add log per second" This reverts commit ac08b8279a084e35413eda9dc4c5aad73d46890f. --- src/utils/processStats.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 1ee83d94f..25710dbd2 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -43,11 +43,6 @@ async function logSpikeMainMemoryUsage() { processMemoryInfo.residentSet ?? 0, processMemoryInfo.private ); - ElectronLog.log( - 'main ProcessMemory', - convertBytesToHumanReadable(currentMemoryUsage * 1024) - ); - const previousMemoryUsage = Math.max( previousMainProcessMemoryInfo.residentSet ?? 0, previousMainProcessMemoryInfo.private @@ -100,10 +95,6 @@ async function logSpikeRendererMemoryUsage() { processMemoryInfo.residentSet ?? 0, processMemoryInfo.private ); - ElectronLog.log( - 'renderer ProcessMemory', - convertBytesToHumanReadable(currentMemoryUsage * 1024) - ); const previousMemoryUsage = Math.max( previousRendererProcessMemoryInfo.private, From 420e8590179dbd6329b3f3a5337bac0c30697fc9 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 18 Jan 2023 09:33:06 +0530 Subject: [PATCH 23/93] added api to log renderer memory usage --- src/preload.ts | 6 +++++- src/utils/processStats.ts | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/preload.ts b/src/preload.ts index 03120429b..26365d881 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -50,7 +50,10 @@ import { fixHotReloadNext12 } from './utils/preload'; import { isFolder, getDirFiles } from './api/fs'; import { convertHEIC, generateImageThumbnail } from './api/imageProcessor'; import { setupLogging } from './utils/logging'; -import { setupRendererProcessStatsLogger } from './utils/processStats'; +import { + setupRendererProcessStatsLogger, + logRendererProcessMemoryUsage, +} from './utils/processStats'; import { runFFmpegCmd } from './api/ffmpeg'; fixHotReloadNext12(); @@ -105,4 +108,5 @@ windowObject['ElectronAPIs'] = { getAppVersion, runFFmpegCmd, generateImageThumbnail, + logRendererProcessMemoryUsage, }; diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 25710dbd2..00b3a71d1 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -169,6 +169,19 @@ export function setupRendererProcessStatsLogger() { setInterval(logRendererProcessStats, LOGGING_INTERVAL_IN_MICROSECONDS); } +export async function logRendererProcessMemoryUsage(message: string) { + const processMemoryInfo = await process.getProcessMemoryInfo(); + const processMemory = Math.max( + processMemoryInfo.private, + processMemoryInfo.residentSet ?? 0 + ); + ElectronLog.log( + 'renderer ProcessMemory', + message, + convertBytesToHumanReadable(processMemory * 1024) + ); +} + const getNormalizedProcessMemoryInfo = async ( processMemoryInfo: Electron.ProcessMemoryInfo ) => { From 4bb3a439e831fe23f277bbbf3da276f96bde728f Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 19 Jan 2023 20:56:40 +0530 Subject: [PATCH 24/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 22566d98f..934f7be31 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 22566d98f869a73d38968244288ecedca30a015a +Subproject commit 934f7be3147f6d01fe4b328960132ed68bff3584 From 8c17bc6136b146432ffdb53e06d91d1b57cd55f1 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 19 Jan 2023 20:57:24 +0530 Subject: [PATCH 25/93] v1.6.17-alpha.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad066e854..88cff1d23 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-beta.4", + "version": "1.6.17-alpha.6", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 8ebd58881a46dd3f295e78ac4f0625f29b2150ca Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 20 Jan 2023 12:08:58 +0530 Subject: [PATCH 26/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 934f7be31..077235be2 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 934f7be3147f6d01fe4b328960132ed68bff3584 +Subproject commit 077235be27b5cbdc0deb258ba43498b336192d8a From 6e6ade3fc26786cd79ce689fe24d66466911fddb Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 20 Jan 2023 12:12:23 +0530 Subject: [PATCH 27/93] v1.6.17-alpha.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 88cff1d23..e4affcee0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-alpha.6", + "version": "1.6.17-alpha.7", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 2932a1903896b52ecf445ac6fecdb4da595df498 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 20 Jan 2023 14:02:48 +0530 Subject: [PATCH 28/93] v1.6.17-beta.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e4affcee0..e71778eb2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-alpha.7", + "version": "1.6.17-beta.5", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 5876c1e402619e15b6222c254de4b1a50a89aaf6 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 20 Jan 2023 19:43:30 +0530 Subject: [PATCH 29/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 077235be2..094f9d5fd 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 077235be27b5cbdc0deb258ba43498b336192d8a +Subproject commit 094f9d5fdbdcc7a89deeadc9141fccd23053de0f From d870723b7d6d3c372a98d5fb6c7ad1b8ed6ed29d Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 20 Jan 2023 19:44:02 +0530 Subject: [PATCH 30/93] v1.6.17-beta.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e71778eb2..f4529376b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-beta.5", + "version": "1.6.17-beta.6", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 27bda5449b4a439e15d5a7b180898049365e8b7a Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 20 Jan 2023 19:44:50 +0530 Subject: [PATCH 31/93] v1.6.17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f4529376b..1d6850775 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17-beta.6", + "version": "1.6.17", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 0bd4d0e20016cb6c5ec0ee735f4182518db5ce9a Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 21 Jan 2023 20:24:29 +0530 Subject: [PATCH 32/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 3a37be3e4..15228a671 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 3a37be3e4f4c6372a6ffd1ec53b588e6a93649f0 +Subproject commit 15228a6710e0c576713e350bda281f841c3530dd From 2b76cc232f2ed63f06a850c70fd14e73743066c9 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 21 Jan 2023 20:37:01 +0530 Subject: [PATCH 33/93] v1.6.18-beta.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d6850775..aa5f715ea 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.17", + "version": "1.6.18-beta.1", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 90e5fa77cebccac8033e57d9994f4c26dcfc3955 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 21 Jan 2023 20:57:23 +0530 Subject: [PATCH 34/93] only build app image for linux beta --- package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index aa5f715ea..dbe2ae892 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,7 @@ "artifactName": "${productName}-${version}.${ext}", "linux": { "target": [ - "AppImage", - "deb", - "rpm", - "pacman", - "tar.gz" + "AppImage" ], "icon": "./build/icon.icns", "category": "Photography" From 764b81b5ac685b1a7a829ffb855cfe02826cc9b9 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 21 Jan 2023 21:32:45 +0530 Subject: [PATCH 35/93] add log to render-process-gone --- src/utils/createWindow.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/createWindow.ts b/src/utils/createWindow.ts index db356d467..91477e04a 100644 --- a/src/utils/createWindow.ts +++ b/src/utils/createWindow.ts @@ -6,6 +6,7 @@ import { PROD_HOST_URL } from '../config'; import { isPlatform } from './main'; import { getHideDockIconPreference } from '../services/userPreference'; import autoLauncher from '../services/autoLauncher'; +import ElectronLog from 'electron-log'; export async function createWindow(): Promise { const appImgPath = isDev @@ -64,6 +65,9 @@ export async function createWindow(): Promise { // ignore } }); + mainWindow.webContents.on('render-process-gone', (event, details) => { + ElectronLog.log('render-process-gone', details); + }); setTimeout(() => { try { splash.destroy(); From a826de6d9a42e45c3e2c1e4f04e54cf806d6d881 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 21 Jan 2023 21:34:14 +0530 Subject: [PATCH 36/93] add per second log --- src/utils/processStats.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 00b3a71d1..9507df096 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -100,6 +100,12 @@ async function logSpikeRendererMemoryUsage() { previousRendererProcessMemoryInfo.private, previousRendererProcessMemoryInfo.residentSet ?? 0 ); + + ElectronLog.log( + 'renderer process memory usage', + convertBytesToHumanReadable(currentMemoryUsage * 1024) + ); + const isSpiking = currentMemoryUsage - previousMemoryUsage >= RENDERER_MEMORY_USAGE_DIFF_IN_KILOBYTES_CONSIDERED_AS_SPIKE; From 9194b16147befea4ecfc92b4adc75f6aa06aa236 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 21 Jan 2023 21:36:53 +0530 Subject: [PATCH 37/93] add destroyed and unresponsive event --- src/utils/createWindow.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils/createWindow.ts b/src/utils/createWindow.ts index 91477e04a..8ad7b81cd 100644 --- a/src/utils/createWindow.ts +++ b/src/utils/createWindow.ts @@ -66,8 +66,15 @@ export async function createWindow(): Promise { } }); mainWindow.webContents.on('render-process-gone', (event, details) => { - ElectronLog.log('render-process-gone', details); + ElectronLog.log('webContents event render-process-gone', details); }); + mainWindow.webContents.on('destroyed', () => { + ElectronLog.log('webContents event destroyed'); + }); + mainWindow.webContents.on('unresponsive', () => { + ElectronLog.log('webContents event unresponsive'); + }); + setTimeout(() => { try { splash.destroy(); From c75dbed6e22d4f312fc18a6a3314b9d1146df9d8 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 21 Jan 2023 21:37:21 +0530 Subject: [PATCH 38/93] v1.6.18-beta.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dbe2ae892..4fdb1c3ff 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.18-beta.1", + "version": "1.6.18-beta.2", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From f9d34d3fd401be445facf9c44c42f958e4e637b0 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 21 Jan 2023 21:40:30 +0530 Subject: [PATCH 39/93] update workflow to only run on linux --- .github/workflows/build-old.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-old.yml b/.github/workflows/build-old.yml index 35019a2f9..de3a5259d 100644 --- a/.github/workflows/build-old.yml +++ b/.github/workflows/build-old.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [ubuntu-latest] steps: - name: Check out Git repository From d4079e28de2b7c2e1c2a9886989d3544559316b0 Mon Sep 17 00:00:00 2001 From: vishnukvmd Date: Sat, 21 Jan 2023 22:51:40 +0530 Subject: [PATCH 40/93] Update title --- build/error.html | 2 +- build/splash.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/error.html b/build/error.html index a0199f702..54b787357 100644 --- a/build/error.html +++ b/build/error.html @@ -5,7 +5,7 @@ - ente.io | encrypted photo storage - loading failed + ente Photos diff --git a/build/splash.html b/build/splash.html index a06f23d8e..776f375f8 100644 --- a/build/splash.html +++ b/build/splash.html @@ -5,7 +5,7 @@ - ente.io | encrypted photo storage + ente Photos From 8090c40ced16572f6f36e8a7d0348df9fc440060 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 25 Jan 2023 13:42:26 +0530 Subject: [PATCH 41/93] reload window if render gone , also forcefully crash the renderer if its unresponsive --- src/utils/createWindow.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/createWindow.ts b/src/utils/createWindow.ts index 8ad7b81cd..d03f9799b 100644 --- a/src/utils/createWindow.ts +++ b/src/utils/createWindow.ts @@ -66,12 +66,14 @@ export async function createWindow(): Promise { } }); mainWindow.webContents.on('render-process-gone', (event, details) => { + mainWindow.webContents.reload(); ElectronLog.log('webContents event render-process-gone', details); }); mainWindow.webContents.on('destroyed', () => { ElectronLog.log('webContents event destroyed'); }); mainWindow.webContents.on('unresponsive', () => { + mainWindow.webContents.forcefullyCrashRenderer(); ElectronLog.log('webContents event unresponsive'); }); From 9b1aeb455db8860078d21410e0a6d467fa5c20ee Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 25 Jan 2023 13:42:39 +0530 Subject: [PATCH 42/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 15228a671..7729099e5 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 15228a6710e0c576713e350bda281f841c3530dd +Subproject commit 7729099e5df4a64f2e60cc51e807f2c23a3a6e23 From 55b02959c05f2c6a28f566ab696c5bc9daa7761f Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 25 Jan 2023 15:02:48 +0530 Subject: [PATCH 43/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 7729099e5..f8e87dcf8 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 7729099e5df4a64f2e60cc51e807f2c23a3a6e23 +Subproject commit f8e87dcf8be8f95ed5adecace474e6f631052768 From 3b0e35f80e239504b02629daf18b3b80f3f1e4ae Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 25 Jan 2023 15:18:38 +0530 Subject: [PATCH 44/93] v1.6.18-beta.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4fdb1c3ff..2939d6ff9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.18-beta.2", + "version": "1.6.18-beta.3", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 2cc4a7f485744a209ad4b29d4542481c0931d5f6 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 27 Jan 2023 14:21:36 +0530 Subject: [PATCH 45/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index f8e87dcf8..00ef6a548 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit f8e87dcf8be8f95ed5adecace474e6f631052768 +Subproject commit 00ef6a548522dd59538845cba63a941b5312a99b From b32b4c292ac21cbf0201caeccf7309387792e410 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 27 Jan 2023 14:21:56 +0530 Subject: [PATCH 46/93] v1.6.18-beta.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2939d6ff9..0566abb33 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.18-beta.3", + "version": "1.6.18-beta.4", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 3b541d3ec9b18a5a23bd75f86936e1d0eb210494 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 27 Jan 2023 16:25:37 +0530 Subject: [PATCH 47/93] add eslintignore --- .eslintignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..2de7858a3 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +ui/* \ No newline at end of file From c44abb8d429213677bc40766830dcb732a427778 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 27 Jan 2023 16:27:13 +0530 Subject: [PATCH 48/93] add EOL newline --- .eslintignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 2de7858a3..d5314d13e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1 @@ -ui/* \ No newline at end of file +ui/* From 669e33be5d7bde8645d5b982736aef334120eba9 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 30 Jan 2023 17:25:22 +0530 Subject: [PATCH 49/93] added and thrown custom error for unsupported OS errors --- src/constants/errors.ts | 5 +++++ src/services/imageProcessor.ts | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/constants/errors.ts diff --git a/src/constants/errors.ts b/src/constants/errors.ts new file mode 100644 index 000000000..4ad2a465f --- /dev/null +++ b/src/constants/errors.ts @@ -0,0 +1,5 @@ +export const CustomErrors = { + WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED: + 'Windows native image processing is not supported', + INVALID_OS: 'Invalid OS', +}; diff --git a/src/services/imageProcessor.ts b/src/services/imageProcessor.ts index e211e2b64..3ba16c5f4 100644 --- a/src/services/imageProcessor.ts +++ b/src/services/imageProcessor.ts @@ -9,6 +9,7 @@ import { isPlatform } from '../utils/main'; import { isDev } from '../utils/common'; import path from 'path'; import log from 'electron-log'; +import { CustomErrors } from '../constants/errors'; const shellescape = require('any-shell-escape'); const asyncExec = util.promisify(exec); @@ -82,6 +83,11 @@ export async function convertHEIC( let tempInputFilePath: string; let tempOutputFilePath: string; try { + if (isPlatform('windows')) { + throw Error( + CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED + ); + } tempInputFilePath = await generateTempFilePath('input.heic'); tempOutputFilePath = await generateTempFilePath('output.jpeg'); @@ -157,7 +163,7 @@ function constructConvertCommand( } ); } else { - Error(`${process.platform} native heic convert not supported yet`); + throw Error(CustomErrors.INVALID_OS); } return convertCmd; } @@ -170,6 +176,11 @@ export async function generateImageThumbnail( let tempOutputFilePath: string; let quality = MAX_QUALITY; try { + if (isPlatform('windows')) { + throw Error( + CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED + ); + } tempOutputFilePath = await generateTempFilePath('thumb.jpeg'); let thumbnail: Uint8Array; do { @@ -271,7 +282,7 @@ function constructThumbnailGenerationCommand( return cmdPart; }); } else { - Error( + throw Error( `${process.platform} native thumbnail generation not supported yet` ); } From 91ff49c17ac467b5b8060050df262c3b84b83457 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 30 Jan 2023 17:32:24 +0530 Subject: [PATCH 50/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 3a37be3e4..1c3dc048b 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 3a37be3e4f4c6372a6ffd1ec53b588e6a93649f0 +Subproject commit 1c3dc048baa572264cbcafea0a114ed1c956fb14 From b32aece47f5a9170d80f7aa353ca23b037cfefb3 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 30 Jan 2023 18:56:24 +0530 Subject: [PATCH 51/93] move isPlatform out of try catch to avoid logging it --- src/services/imageProcessor.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/services/imageProcessor.ts b/src/services/imageProcessor.ts index 3ba16c5f4..ee17114a7 100644 --- a/src/services/imageProcessor.ts +++ b/src/services/imageProcessor.ts @@ -82,12 +82,10 @@ export async function convertHEIC( ): Promise { let tempInputFilePath: string; let tempOutputFilePath: string; + if (isPlatform('windows')) { + throw Error(CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED); + } try { - if (isPlatform('windows')) { - throw Error( - CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED - ); - } tempInputFilePath = await generateTempFilePath('input.heic'); tempOutputFilePath = await generateTempFilePath('output.jpeg'); @@ -175,12 +173,10 @@ export async function generateImageThumbnail( ): Promise { let tempOutputFilePath: string; let quality = MAX_QUALITY; + if (isPlatform('windows')) { + throw Error(CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED); + } try { - if (isPlatform('windows')) { - throw Error( - CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED - ); - } tempOutputFilePath = await generateTempFilePath('thumb.jpeg'); let thumbnail: Uint8Array; do { From fdef4b8482c51dcf9430c6e9098511c8ec36515b Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 30 Jan 2023 18:59:33 +0530 Subject: [PATCH 52/93] better error --- src/constants/errors.ts | 2 +- src/services/imageProcessor.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/constants/errors.ts b/src/constants/errors.ts index 4ad2a465f..43e4773d8 100644 --- a/src/constants/errors.ts +++ b/src/constants/errors.ts @@ -1,5 +1,5 @@ export const CustomErrors = { WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED: 'Windows native image processing is not supported', - INVALID_OS: 'Invalid OS', + INVALID_OS: (os: string) => `Invalid OS - ${os}`, }; diff --git a/src/services/imageProcessor.ts b/src/services/imageProcessor.ts index ee17114a7..1e9a58c83 100644 --- a/src/services/imageProcessor.ts +++ b/src/services/imageProcessor.ts @@ -161,7 +161,7 @@ function constructConvertCommand( } ); } else { - throw Error(CustomErrors.INVALID_OS); + throw Error(CustomErrors.INVALID_OS(process.platform)); } return convertCmd; } @@ -278,9 +278,7 @@ function constructThumbnailGenerationCommand( return cmdPart; }); } else { - throw Error( - `${process.platform} native thumbnail generation not supported yet` - ); + throw Error(CustomErrors.INVALID_OS(process.platform)); } return thumbnailGenerationCmd; } From e0dd06125908f3bb52375907d7110ab8961ae1b8 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 30 Jan 2023 19:03:18 +0530 Subject: [PATCH 53/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 1c3dc048b..197b5f35f 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 1c3dc048baa572264cbcafea0a114ed1c956fb14 +Subproject commit 197b5f35f3588e142558636ccc1854f44b725861 From 41e784aa6f222ef5dd2d14758b13614c4ddd1cea Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 30 Jan 2023 19:28:15 +0530 Subject: [PATCH 54/93] moved isPlatform util to common/platform --- src/services/appUpdater.ts | 2 +- src/services/autoLauncher.ts | 2 +- src/utils/{common.ts => common/index.ts} | 0 src/utils/common/platform.ts | 11 +++++++++++ src/utils/createWindow.ts | 2 +- src/utils/main.ts | 13 +------------ src/utils/menu.ts | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) rename src/utils/{common.ts => common/index.ts} (100%) create mode 100644 src/utils/common/platform.ts diff --git a/src/services/appUpdater.ts b/src/services/appUpdater.ts index 84a2bfeba..99ecef8b9 100644 --- a/src/services/appUpdater.ts +++ b/src/services/appUpdater.ts @@ -12,7 +12,7 @@ import { import fetch from 'node-fetch'; import { logErrorSentry } from './sentry'; import ElectronLog from 'electron-log'; -import { isPlatform } from '../utils/main'; +import { isPlatform } from '../utils/common/platform'; const FIVE_MIN_IN_MICROSECOND = 5 * 60 * 1000; const ONE_DAY_IN_MICROSECOND = 1 * 24 * 60 * 60 * 1000; diff --git a/src/services/autoLauncher.ts b/src/services/autoLauncher.ts index c28eb177c..139d5166c 100644 --- a/src/services/autoLauncher.ts +++ b/src/services/autoLauncher.ts @@ -1,4 +1,4 @@ -import { isPlatform } from '../utils/main'; +import { isPlatform } from '../utils/common/platform'; import { AutoLauncherClient } from '../types/autoLauncher'; import linuxAutoLauncher from './autoLauncherClients/linuxAutoLauncher'; import macAndWindowsAutoLauncher from './autoLauncherClients/macAndWindowsAutoLauncher'; diff --git a/src/utils/common.ts b/src/utils/common/index.ts similarity index 100% rename from src/utils/common.ts rename to src/utils/common/index.ts diff --git a/src/utils/common/platform.ts b/src/utils/common/platform.ts new file mode 100644 index 000000000..2ee705d5f --- /dev/null +++ b/src/utils/common/platform.ts @@ -0,0 +1,11 @@ +export function isPlatform(platform: 'mac' | 'windows' | 'linux') { + if (process.platform === 'darwin') { + return platform === 'mac'; + } else if (process.platform === 'win32') { + return platform === 'windows'; + } else if (process.platform === 'linux') { + return platform === 'linux'; + } else { + return false; + } +} diff --git a/src/utils/createWindow.ts b/src/utils/createWindow.ts index db356d467..d2e02dffd 100644 --- a/src/utils/createWindow.ts +++ b/src/utils/createWindow.ts @@ -3,7 +3,7 @@ import * as path from 'path'; import { isDev } from './common'; import { isAppQuitting } from '../main'; import { PROD_HOST_URL } from '../config'; -import { isPlatform } from './main'; +import { isPlatform } from './common/platform'; import { getHideDockIconPreference } from '../services/userPreference'; import autoLauncher from '../services/autoLauncher'; diff --git a/src/utils/main.ts b/src/utils/main.ts index 81fedbf7a..729bc3d3b 100644 --- a/src/utils/main.ts +++ b/src/utils/main.ts @@ -11,6 +11,7 @@ import { getHideDockIconPreference } from '../services/userPreference'; import { setupAutoUpdater } from '../services/appUpdater'; import ElectronLog from 'electron-log'; import os from 'os'; +import { isPlatform } from './common/platform'; export function handleUpdates(mainWindow: BrowserWindow) { if (!isDev) { @@ -84,18 +85,6 @@ export function setupNextElectronServe() { }); } -export function isPlatform(platform: 'mac' | 'windows' | 'linux') { - if (process.platform === 'darwin') { - return platform === 'mac'; - } else if (process.platform === 'win32') { - return platform === 'windows'; - } else if (process.platform === 'linux') { - return platform === 'linux'; - } else { - return false; - } -} - export async function handleDockIconHideOnAutoLaunch() { const shouldHideDockIcon = getHideDockIconPreference(); const wasAutoLaunched = await autoLauncher.wasAutoLaunched(); diff --git a/src/utils/menu.ts b/src/utils/menu.ts index 5002a1205..6ecb8459b 100644 --- a/src/utils/menu.ts +++ b/src/utils/menu.ts @@ -11,7 +11,7 @@ import { } from '../services/userPreference'; import { setIsAppQuitting } from '../main'; import autoLauncher from '../services/autoLauncher'; -import { isPlatform } from './main'; +import { isPlatform } from './common/platform'; import ElectronLog from 'electron-log'; export function buildContextMenu( From edf62747509a1542c6bd7995362457a470fbe583 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 30 Jan 2023 19:30:27 +0530 Subject: [PATCH 55/93] moved platform check logic to API layer --- src/api/imageProcessor.ts | 10 ++++++++++ src/services/imageProcessor.ts | 8 +------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/api/imageProcessor.ts b/src/api/imageProcessor.ts index 61b0ae529..b4464233f 100644 --- a/src/api/imageProcessor.ts +++ b/src/api/imageProcessor.ts @@ -1,10 +1,15 @@ +import { CustomErrors } from '../constants/errors'; import { ipcRenderer } from 'electron/renderer'; import { existsSync } from 'fs'; import { writeStream } from '../services/fs'; import { logError } from '../services/logging'; import { ElectronFile } from '../types'; +import { isPlatform } from '../utils/common/platform'; export async function convertHEIC(fileData: Uint8Array): Promise { + if (isPlatform('windows')) { + throw Error(CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED); + } const convertedFileData = await ipcRenderer.invoke( 'convert-heic', fileData @@ -20,6 +25,11 @@ export async function generateImageThumbnail( let inputFilePath = null; let createdTempInputFile = null; try { + if (isPlatform('windows')) { + throw Error( + CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED + ); + } if (!existsSync(inputFile.path)) { const tempFilePath = await ipcRenderer.invoke( 'get-temp-file-path', diff --git a/src/services/imageProcessor.ts b/src/services/imageProcessor.ts index 1e9a58c83..05b252ba7 100644 --- a/src/services/imageProcessor.ts +++ b/src/services/imageProcessor.ts @@ -5,7 +5,7 @@ import { existsSync, rmSync } from 'fs'; import { readFile, writeFile } from 'promise-fs'; import { generateTempFilePath } from '../utils/temp'; import { logErrorSentry } from './sentry'; -import { isPlatform } from '../utils/main'; +import { isPlatform } from '../utils/common/platform'; import { isDev } from '../utils/common'; import path from 'path'; import log from 'electron-log'; @@ -82,9 +82,6 @@ export async function convertHEIC( ): Promise { let tempInputFilePath: string; let tempOutputFilePath: string; - if (isPlatform('windows')) { - throw Error(CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED); - } try { tempInputFilePath = await generateTempFilePath('input.heic'); tempOutputFilePath = await generateTempFilePath('output.jpeg'); @@ -173,9 +170,6 @@ export async function generateImageThumbnail( ): Promise { let tempOutputFilePath: string; let quality = MAX_QUALITY; - if (isPlatform('windows')) { - throw Error(CustomErrors.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED); - } try { tempOutputFilePath = await generateTempFilePath('thumb.jpeg'); let thumbnail: Uint8Array; From 3a2dadb3f897e7feb223adedf0cf9d175ff1c937 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 2 Feb 2023 10:15:59 +0530 Subject: [PATCH 56/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 00ef6a548..87bb01108 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 00ef6a548522dd59538845cba63a941b5312a99b +Subproject commit 87bb01108a85780a8244e765b3763d3cfa6a807c From 78d3fb3d64b5f946f3d9f0cc7da5e927dfade896 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 4 Feb 2023 09:43:00 +0530 Subject: [PATCH 57/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 87bb01108..a685b93dd 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 87bb01108a85780a8244e765b3763d3cfa6a807c +Subproject commit a685b93dd01ec5defc0b94b25d2e8bd2cfa37c01 From 255f2d4eff71d903ed24e8d2297378173c5af944 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sun, 5 Feb 2023 11:56:53 +0530 Subject: [PATCH 58/93] Revert "only build app image for linux beta" This reverts commit 90e5fa77cebccac8033e57d9994f4c26dcfc3955. --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0566abb33..4018d6328 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,11 @@ "artifactName": "${productName}-${version}.${ext}", "linux": { "target": [ - "AppImage" + "AppImage", + "deb", + "rpm", + "pacman", + "tar.gz" ], "icon": "./build/icon.icns", "category": "Photography" From a1286cc5bb9a9cfc4eced154e2bf1dc53657d17d Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sun, 5 Feb 2023 11:57:06 +0530 Subject: [PATCH 59/93] Revert "update workflow to only run on linux" This reverts commit f9d34d3fd401be445facf9c44c42f958e4e637b0. --- .github/workflows/build-old.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-old.yml b/.github/workflows/build-old.yml index de3a5259d..35019a2f9 100644 --- a/.github/workflows/build-old.yml +++ b/.github/workflows/build-old.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest] + os: [macos-latest, ubuntu-latest, windows-latest] steps: - name: Check out Git repository From 1b245cc28279f62da6564539f85fd9609ffad984 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sun, 5 Feb 2023 11:59:54 +0530 Subject: [PATCH 60/93] Revert "add per second log" This reverts commit a826de6d9a42e45c3e2c1e4f04e54cf806d6d881. --- src/utils/processStats.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/utils/processStats.ts b/src/utils/processStats.ts index 9507df096..00b3a71d1 100644 --- a/src/utils/processStats.ts +++ b/src/utils/processStats.ts @@ -100,12 +100,6 @@ async function logSpikeRendererMemoryUsage() { previousRendererProcessMemoryInfo.private, previousRendererProcessMemoryInfo.residentSet ?? 0 ); - - ElectronLog.log( - 'renderer process memory usage', - convertBytesToHumanReadable(currentMemoryUsage * 1024) - ); - const isSpiking = currentMemoryUsage - previousMemoryUsage >= RENDERER_MEMORY_USAGE_DIFF_IN_KILOBYTES_CONSIDERED_AS_SPIKE; From f3bd5ccf686629a757658722b6270ab9bc8e26fe Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sun, 5 Feb 2023 12:02:49 +0530 Subject: [PATCH 61/93] remove destroyed event as its also called when app is closed by user --- src/utils/createWindow.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/createWindow.ts b/src/utils/createWindow.ts index 163e89841..391a8e285 100644 --- a/src/utils/createWindow.ts +++ b/src/utils/createWindow.ts @@ -7,6 +7,7 @@ import { isPlatform } from './common/platform'; import { getHideDockIconPreference } from '../services/userPreference'; import autoLauncher from '../services/autoLauncher'; import ElectronLog from 'electron-log'; +import { logErrorSentry } from '../services/sentry'; export async function createWindow(): Promise { const appImgPath = isDev @@ -67,11 +68,13 @@ export async function createWindow(): Promise { }); mainWindow.webContents.on('render-process-gone', (event, details) => { mainWindow.webContents.reload(); + logErrorSentry( + Error('render-process-gone'), + 'webContents event render-process-gone', + { details } + ); ElectronLog.log('webContents event render-process-gone', details); }); - mainWindow.webContents.on('destroyed', () => { - ElectronLog.log('webContents event destroyed'); - }); mainWindow.webContents.on('unresponsive', () => { mainWindow.webContents.forcefullyCrashRenderer(); ElectronLog.log('webContents event unresponsive'); From 4cbbab8e43e0b88184a8c36edfe06aec44813deb Mon Sep 17 00:00:00 2001 From: Manav Date: Sun, 5 Feb 2023 18:45:10 +0530 Subject: [PATCH 62/93] Sibling PRs https://github.com/ente-io/auth/pull/11 https://github.com/ente-io/photos-app/pull/788 https://github.com/ente-io/photos-web/pull/918 Have also added @enteio's PAT to the GitHub secrets for this repo (needed by this action). --- .github/workflows/cla.yaml | 38 +++++++++++++++ CLA.md | 98 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 .github/workflows/cla.yaml create mode 100644 CLA.md diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml new file mode 100644 index 000000000..25340ec9f --- /dev/null +++ b/.github/workflows/cla.yaml @@ -0,0 +1,38 @@ +name: "CLA Assistant" +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened, closed, synchronize] + +jobs: + CLAAssistant: + # This job only runs for pull request comments + if: ${{ github.event.issue.pull_request }} + runs-on: ubuntu-latest + steps: + - name: "CLA Assistant" + if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' + # Beta Release + uses: contributor-assistant/github-action@v2.2.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # the below token should have repo scope and must be manually added by you in the repository's secret + PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + with: + path-to-signatures: "signatures/version1/cla.json" + path-to-document: "https://github.com/ente-io/cla/blob/main/CLA.md" # e.g. a CLA or a DCO document + # branch should not be protected + branch: "main" + allowlist: enteio + + # the followings are the optional inputs - If the optional inputs are not given, then default values will be taken + #remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository) + remote-repository-name: cla + #create-file-commit-message: 'For example: Creating file for storing CLA Signatures' + #signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo' + #custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign' + #custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA' + #custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.' + #lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) + #use-dco-flag: true - If you are using DCO instead of CLA diff --git a/CLA.md b/CLA.md new file mode 100644 index 000000000..71c216537 --- /dev/null +++ b/CLA.md @@ -0,0 +1,98 @@ +## Contributor License Agreement + +Thank you for your contribution to ente projects. + +This contributor license agreement documents the rights granted by contributors +to Ente Technologies, Inc ("ente"). This license is for your protection as a +Contributor as well as the protection of ente, its users, and its licensees; you +may still license your own Contributions under other terms. + +In exchange for the ability to participate in the ente community and for other +good consideration, the receipt of which is hereby acknowledged, you accept and +agree to the following terms and conditions for Your present and future +Contributions submitted to ente. Except for the license granted herein to ente +and recipients of software distributed by ente, You reserve all right, title, +and interest in and to Your Contributions. + +1. Definitions. + + "You" (or "Your") shall mean the copyright owner or legal entity authorized + by the copyright owner that is making this Agreement with ente. For legal + entities, the entity making a Contribution and all other entities that + control, are controlled by, or are under common control with that entity are + considered to be a single Contributor. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the direction or + management of such entity, whether by contract or otherwise, or (ii) + ownership of fifty percent (50%) or more of the outstanding shares, or (iii) + beneficial ownership of such entity. + + "Contribution" shall mean any original work of authorship or invention, + including any modifications or additions to an existing work, that is + intentionally submitted by You to ente for inclusion in, or documentation of, + any of the products owned or managed by ente (the "Work"). For the purposes + of this definition, "submitted" means any form of electronic, verbal, or + written communication sent to ente or its representatives, including but not + limited to communication on electronic mailing lists, source code control + systems, and issue tracking systems that are managed by, or on behalf of, + ente for the purpose of discussing and improving the Work, but excluding + communication that is conspicuously marked or otherwise designated in writing + by You as "Not a Contribution." + +2. Grant of Copyright License. Subject to the terms and conditions of this + Agreement, You hereby grant to ente and to recipients of software distributed + by ente a perpetual, worldwide, non-exclusive, no-charge, royalty-free, + irrevocable copyright license to reproduce, prepare derivative works of, + publicly display, publicly perform, and distribute Your Contributions and + such derivative works. + +3. Grant of Patent License. Subject to the terms and conditions of this + Agreement, You hereby grant to ente and to recipients of software distributed + by ente a perpetual, worldwide, non-exclusive, no-charge, royalty-free, + irrevocable (except as stated in this section) patent license to make, have + made, use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable by You that + are necessarily infringed by Your Contribution(s) alone or by combination of + Your Contribution(s) with the Work to which such Contribution(s) was + submitted. If any entity institutes patent litigation against You or any + other entity (including a cross-claim or counterclaim in a lawsuit) alleging + that your Contribution, or the Work to which you have contributed, + constitutes direct or contributory patent infringement, then any patent + licenses granted to that entity under this Agreement for that Contribution or + Work shall terminate as of the date such litigation is filed. + +4. You represent that you are legally entitled to grant the above license. If + your employer(s) has rights to intellectual property that you create that + includes your Contributions, you represent that you have received permission + to make Contributions on behalf of that employer, that your employer has + waived such rights for your contributions to ente, or that your employer has + executed with ente a separate contributor license agreement substantially + similar to this Agreement. If You are a current employee or contractor of + ente, then the terms of your existing Employment Agreement or Consulting + Services Agreement shall supersede this CLA, and remain in full effect. + +5. You represent that each of Your Contributions is Your original creation (see + section 7 for submissions on behalf of others). You represent that Your + Contribution submissions include complete details of any third-party license + or other restriction (including, but not limited to, related patents and + trademarks) of which you are personally aware and which are associated with + any part of Your Contributions. + +6. You are not expected to provide support for Your Contributions, except to the + extent You desire to provide support. You may provide support for free, for + a fee, or not at all. Unless required by applicable law or agreed to in + writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, + without limitation, any warranties or conditions of title, non-infringement, + merchantability, or fitness for a particular purpose. + +7. Should You wish to submit work that is not Your original creation, You may + submit it to ente separately from any Contribution, identifying the complete + details of its source and of any license or other restriction (including, but + not limited to, related patents, trademarks, and license agreements) of which + you are personally aware, and conspicuously marking the work as "Not a + Contribution". Third-party materials licensed pursuant to: [license name(s) + here]" (substituting the bracketed text with the appropriate license + name(s)). + +8. You agree to notify ente of any facts or circumstances of which you become + aware that would make these representations inaccurate in any respect. From 0afabaa9f82de1d6eabdcf7b524490be14296784 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 11:26:19 +0530 Subject: [PATCH 63/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 06c5f816e..ff2ccbc36 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 06c5f816e8375bb079feddebb2102063db707cc6 +Subproject commit ff2ccbc3602897428d792198d1339a0c98f6246b From 11cd1e8e21d99f0457992673acb30760e68ecbcc Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 14:53:48 +0530 Subject: [PATCH 64/93] update build workflow to align with changes done to build-old workflow --- .github/workflows/build.yml | 85 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26602518b..1cabc416a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build/release +name: Build/release-old on: push: @@ -6,53 +6,52 @@ on: - v* jobs: - release: - runs-on: ${{ matrix.os }} + release: + runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] - steps: - - name: Check out Git repository - uses: actions/checkout@v2 - with: - submodules: recursive + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + with: + submodules: recursive - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v2.1.5 - with: - node-version: 14 + - name: Install Node.js, NPM and Yarn + uses: actions/setup-node@v3 + with: + node-version: 16 - - name: Prepare for app notarization - if: startsWith(matrix.os, 'macos') - # Import Apple API key for app notarization on macOS - run: | - mkdir -p ~/private_keys/ - echo '${{ secrets.api_key }}' > ~/private_keys/AuthKey_${{ secrets.api_key_id }}.p8 + - name: Prepare for app notarization + if: startsWith(matrix.os, 'macos') + # Import Apple API key for app notarization on macOS + run: | + mkdir -p ~/private_keys/ + echo '${{ secrets.api_key }}' > ~/private_keys/AuthKey_${{ secrets.api_key_id }}.p8 - - name: Install libarchive-tools for pacman build # Related https://github.com/electron-userland/electron-builder/issues/4181 - if: startsWith(matrix.os, 'ubuntu') - run: sudo apt-get install libarchive-tools + - name: Install libarchive-tools for pacman build # Related https://github.com/electron-userland/electron-builder/issues/4181 + if: startsWith(matrix.os, 'ubuntu') + run: sudo apt-get install libarchive-tools - - name: Electron Builder Action - uses: samuelmeuli/action-electron-builder@v1.6.0 - with: - # GitHub token, automatically provided to the action - # (No need to define this secret in the repo settings) - github_token: ${{ secrets.github_token }} + - name: Ente Electron Builder Action + uses: ente-io/action-electron-builder@v1.0.0 + with: + # GitHub token, automatically provided to the action + # (No need to define this secret in the repo settings) + github_token: ${{ secrets.github_token }} - # If the commit is tagged with a version (e.g. "v1.0.0"), - # release the app after building - release: ${{ startsWith(github.ref, 'refs/tags/v') }} - - mac_certs: ${{ secrets.mac_certs }} - mac_certs_password: ${{ secrets.mac_certs_password }} - env: - # macOS notarization API key - API_KEY_ID: ${{ secrets.api_key_id }} - API_KEY_ISSUER_ID: ${{ secrets.api_key_issuer_id }} - # setry crash reporting token - SENTRY_AUTH_TOKEN: ${{secrets.sentry_auth_token}} - USE_HARD_LINKS: false + # If the commit is tagged with a version (e.g. "v1.0.0"), + # release the app after building + release: ${{ startsWith(github.ref, 'refs/tags/v') }} + mac_certs: ${{ secrets.mac_certs }} + mac_certs_password: ${{ secrets.mac_certs_password }} + env: + # macOS notarization API key + API_KEY_ID: ${{ secrets.api_key_id }} + API_KEY_ISSUER_ID: ${{ secrets.api_key_issuer_id}} + # setry crash reporting token + SENTRY_AUTH_TOKEN: ${{secrets.sentry_auth_token}} + USE_HARD_LINKS: false From d6a30c83e5259806c5d9d812299fedffb7a35931 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:00:13 +0530 Subject: [PATCH 65/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index ff2ccbc36..a698d7cba 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit ff2ccbc3602897428d792198d1339a0c98f6246b +Subproject commit a698d7cba07fcc42b86401c5a843d4a038fa22af From 9407b698a3c01bd5cb294653e531810c76d2c96e Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:03:07 +0530 Subject: [PATCH 66/93] don't change workflow name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cabc416a..cc1f66b0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build/release-old +name: Build/release on: push: From b11aeb58a5100f34c7d56c7a41516532ae83566d Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:07:52 +0530 Subject: [PATCH 67/93] change the matrix to macOS for testing --- .github/workflows/build-old.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-old.yml b/.github/workflows/build-old.yml index 35019a2f9..77de65a1b 100644 --- a/.github/workflows/build-old.yml +++ b/.github/workflows/build-old.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [macos-latest] steps: - name: Check out Git repository From 393c08596777cc2b373bbe8bdfa99ce623da1f74 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:08:04 +0530 Subject: [PATCH 68/93] v1.6.18-beta.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4018d6328..5e8ffa1ad 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.18-beta.4", + "version": "1.6.18-beta.5", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From a121abb593b72d31352988c67732f6e0cdb8f26b Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:11:00 +0530 Subject: [PATCH 69/93] change release workflow matrix for testing --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc1f66b0f..f817c724a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [macos-latest] steps: - name: Check out Git repository From 2f9f28e49ac0472d593077218188441f34aaf6b4 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:11:15 +0530 Subject: [PATCH 70/93] v1.6.18-beta.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5e8ffa1ad..e0daf117c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.18-beta.5", + "version": "1.6.18-beta.6", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 4d74cf74dba967c1de6034e77c411c3869ed18a3 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:46:04 +0530 Subject: [PATCH 71/93] Revert "change release workflow matrix for testing" This reverts commit a121abb593b72d31352988c67732f6e0cdb8f26b. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f817c724a..cc1f66b0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - os: [macos-latest] + os: [macos-latest, ubuntu-latest, windows-latest] steps: - name: Check out Git repository From 07203524512fdf7696b7e0d017d96e26918d6e2b Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:46:16 +0530 Subject: [PATCH 72/93] Revert "change the matrix to macOS for testing" This reverts commit b11aeb58a5100f34c7d56c7a41516532ae83566d. --- .github/workflows/build-old.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-old.yml b/.github/workflows/build-old.yml index 77de65a1b..35019a2f9 100644 --- a/.github/workflows/build-old.yml +++ b/.github/workflows/build-old.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - os: [macos-latest] + os: [macos-latest, ubuntu-latest, windows-latest] steps: - name: Check out Git repository From bf59ca9b6943ce2a4fcb751cb3a503a23aba2d75 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 15:46:59 +0530 Subject: [PATCH 73/93] v1.6.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0daf117c..2567b3350 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.18-beta.6", + "version": "1.6.18", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 171c4c531c2762ea0aee06603a5d8467a727c958 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 18:47:53 +0530 Subject: [PATCH 74/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index a698d7cba..b13b61bf1 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit a698d7cba07fcc42b86401c5a843d4a038fa22af +Subproject commit b13b61bf1068ae1a5c9bb5e581e231cee6cf6643 From 7023d363b9475b254299e1f0b0dd89c7088ac1ff Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 18:52:12 +0530 Subject: [PATCH 75/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index b13b61bf1..ce74fb91b 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit b13b61bf1068ae1a5c9bb5e581e231cee6cf6643 +Subproject commit ce74fb91b3b1beb73b9efa964975df695c651944 From 49ada0de72ad2e4542395976b0753265ca6ddfc5 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 18:57:31 +0530 Subject: [PATCH 76/93] v1.6.19 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2567b3350..41bb51628 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.18", + "version": "1.6.19", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From e90499ce070d8350bd23f04f2ed4905597b6718b Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 22:37:27 +0530 Subject: [PATCH 77/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index ce74fb91b..570f96b33 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit ce74fb91b3b1beb73b9efa964975df695c651944 +Subproject commit 570f96b3315346b868678f5ede065e5ebfe3d7c3 From 24b3da36a68441ef5468089274b1968bcc057ac9 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 22:39:05 +0530 Subject: [PATCH 78/93] v1.6.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 41bb51628..ca78edd61 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.19", + "version": "1.6.20", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 01fd0d618a0106d2c4fad4305f121b6359ea8a0f Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 12:46:23 +0530 Subject: [PATCH 79/93] add selected dir logs --- src/utils/ipcComms.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/utils/ipcComms.ts b/src/utils/ipcComms.ts index ef5093f2d..f0bb84d83 100644 --- a/src/utils/ipcComms.ts +++ b/src/utils/ipcComms.ts @@ -26,6 +26,7 @@ import { } from '../services/appUpdater'; import { deleteTempFile, runFFmpegCmd } from '../services/ffmpeg'; import { generateTempFilePath } from './temp'; +import ElectronLog from 'electron-log'; export default function setupIpcComs( tray: Tray, @@ -37,7 +38,17 @@ export default function setupIpcComs( properties: ['openDirectory'], }); if (result.filePaths && result.filePaths.length > 0) { - return result.filePaths[0]?.split(path.sep)?.join(path.posix.sep); + const folderPath = result.filePaths[0]; + if (folderPath) { + ElectronLog.log('Selected folder: ' + folderPath); + const unixLikeFolderPath = folderPath + .split(path.sep) + .join(path.posix.sep); + ElectronLog.log( + 'Selected folder (unix): ' + unixLikeFolderPath + ); + return unixLikeFolderPath; + } } }); From 4836bf6699b5d4445ee5f27740f9f0819e3f3a3e Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 12:46:29 +0530 Subject: [PATCH 80/93] update UI --- ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui b/ui index 570f96b33..79f25d455 160000 --- a/ui +++ b/ui @@ -1 +1 @@ -Subproject commit 570f96b3315346b868678f5ede065e5ebfe3d7c3 +Subproject commit 79f25d455f26650ad78147f3c6d8100ae16a4ca1 From d475f4c4990a9c68f217d91fdde59f4a0a9d588a Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 12:47:09 +0530 Subject: [PATCH 81/93] only build on windows for testing --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc1f66b0f..9a16468de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [windows-latest] steps: - name: Check out Git repository From e697109355effbb9232262571619c2c27a115ac7 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 12:49:56 +0530 Subject: [PATCH 82/93] v1.6.21-alpha.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ca78edd61..c728d9116 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.20", + "version": "1.6.21-alpha.1", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 8ac3523c13e699335a5a7ea1c3f8f154ed1c39b9 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 13:29:59 +0530 Subject: [PATCH 83/93] add logs on addWatchMapping --- src/api/watch.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api/watch.ts b/src/api/watch.ts index d8ff2d1d3..b991be2c8 100644 --- a/src/api/watch.ts +++ b/src/api/watch.ts @@ -4,13 +4,16 @@ import { ipcRenderer } from 'electron'; import { ElectronFile, WatchMapping } from '../types'; import { getElectronFile } from '../services/fs'; import { getWatchMappings, setWatchMappings } from '../services/watch'; +import ElectronLog from 'electron-log'; export async function addWatchMapping( rootFolderName: string, folderPath: string, uploadStrategy: number ) { + ElectronLog.log(`Adding watch mapping: ${folderPath}`); folderPath = path.normalize(folderPath); + ElectronLog.log(`Adding watch mapping (normalized): ${folderPath}`); const watchMappings = getWatchMappings(); if (isMappingPresent(watchMappings, folderPath)) { throw new Error(`Watch mapping already exists`); From 26675f750a15eaaa39b0f6aa207fd9f74bbf7336 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 13:30:11 +0530 Subject: [PATCH 84/93] fix isFolder --- src/services/fs.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/fs.ts b/src/services/fs.ts index 9565cb086..c3ee16f9d 100644 --- a/src/services/fs.ts +++ b/src/services/fs.ts @@ -184,12 +184,12 @@ export const getZipFileStream = async ( }; export async function isFolder(dirPath: string) { - return await fs - .stat(dirPath) - .then((stats) => { - return stats.isDirectory(); - }) - .catch(() => false); + try { + const stats = await fs.stat(dirPath); + return stats.isDirectory(); + } catch (e) { + return false; + } } export const convertBrowserStreamToNode = ( From b312f5ad9fe3940705ce594ed8ab1cde9f8284df Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 13:37:19 +0530 Subject: [PATCH 85/93] v1.6.21-alpha.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c728d9116..9352de0aa 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.21-alpha.1", + "version": "1.6.21-alpha.2", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From c3b7442e290e73f032a898eb678317f17d32856a Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 13:48:54 +0530 Subject: [PATCH 86/93] remove unnecessary normalize --- src/api/watch.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/api/watch.ts b/src/api/watch.ts index b991be2c8..fdba4cdf9 100644 --- a/src/api/watch.ts +++ b/src/api/watch.ts @@ -12,8 +12,6 @@ export async function addWatchMapping( uploadStrategy: number ) { ElectronLog.log(`Adding watch mapping: ${folderPath}`); - folderPath = path.normalize(folderPath); - ElectronLog.log(`Adding watch mapping (normalized): ${folderPath}`); const watchMappings = getWatchMappings(); if (isMappingPresent(watchMappings, folderPath)) { throw new Error(`Watch mapping already exists`); @@ -98,21 +96,17 @@ export function registerWatcherFunctions( ipcRenderer.removeAllListeners('watch-change'); ipcRenderer.removeAllListeners('watch-unlink'); ipcRenderer.on('watch-add', async (_, filePath: string) => { - filePath = path.normalize( - filePath.split(path.sep).join(path.posix.sep) - ); + filePath = filePath.split(path.sep).join(path.posix.sep); + await addFile(await getElectronFile(filePath)); }); ipcRenderer.on('watch-unlink', async (_, filePath: string) => { - filePath = path.normalize( - filePath.split(path.sep).join(path.posix.sep) - ); + filePath = filePath.split(path.sep).join(path.posix.sep); + await removeFile(filePath); }); ipcRenderer.on('watch-unlink-dir', async (_, folderPath: string) => { - folderPath = path.normalize( - folderPath.split(path.sep).join(path.posix.sep) - ); + folderPath = folderPath.split(path.sep).join(path.posix.sep); await removeFolder(folderPath); }); } From 5c286610e4e6342e97df58dd0fc353a1ed2b4c02 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 13:49:25 +0530 Subject: [PATCH 87/93] fix watch-unlink-dir removeAllListeners --- src/api/watch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/watch.ts b/src/api/watch.ts index fdba4cdf9..20008375e 100644 --- a/src/api/watch.ts +++ b/src/api/watch.ts @@ -94,7 +94,7 @@ export function registerWatcherFunctions( ) { ipcRenderer.removeAllListeners('watch-add'); ipcRenderer.removeAllListeners('watch-change'); - ipcRenderer.removeAllListeners('watch-unlink'); + ipcRenderer.removeAllListeners('watch-unlink-dir'); ipcRenderer.on('watch-add', async (_, filePath: string) => { filePath = filePath.split(path.sep).join(path.posix.sep); From 11903fc3bb2dba0ab792f5289efba426ba59f137 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 14:36:13 +0530 Subject: [PATCH 88/93] Revert "only build on windows for testing" This reverts commit d475f4c4990a9c68f217d91fdde59f4a0a9d588a. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a16468de..cc1f66b0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - os: [windows-latest] + os: [macos-latest, ubuntu-latest, windows-latest] steps: - name: Check out Git repository From 0b6141314e921d0b97f8f982c2000311224d51fa Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 14:37:13 +0530 Subject: [PATCH 89/93] Revert "add selected dir logs" This reverts commit 01fd0d618a0106d2c4fad4305f121b6359ea8a0f. --- src/utils/ipcComms.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/utils/ipcComms.ts b/src/utils/ipcComms.ts index f0bb84d83..ef5093f2d 100644 --- a/src/utils/ipcComms.ts +++ b/src/utils/ipcComms.ts @@ -26,7 +26,6 @@ import { } from '../services/appUpdater'; import { deleteTempFile, runFFmpegCmd } from '../services/ffmpeg'; import { generateTempFilePath } from './temp'; -import ElectronLog from 'electron-log'; export default function setupIpcComs( tray: Tray, @@ -38,17 +37,7 @@ export default function setupIpcComs( properties: ['openDirectory'], }); if (result.filePaths && result.filePaths.length > 0) { - const folderPath = result.filePaths[0]; - if (folderPath) { - ElectronLog.log('Selected folder: ' + folderPath); - const unixLikeFolderPath = folderPath - .split(path.sep) - .join(path.posix.sep); - ElectronLog.log( - 'Selected folder (unix): ' + unixLikeFolderPath - ); - return unixLikeFolderPath; - } + return result.filePaths[0]?.split(path.sep)?.join(path.posix.sep); } }); From b3ccfe9d34d594efe3cf341dbfb18ab354fbd06d Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 14:47:17 +0530 Subject: [PATCH 90/93] revert version change --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9352de0aa..ca78edd61 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ente", "productName": "ente", - "version": "1.6.21-alpha.2", + "version": "1.6.20", "private": true, "description": "Desktop client for ente.io", "main": "app/main.js", From 11f2ce71109fa3b89c1ccd366dde1331c49a979b Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 15:23:58 +0530 Subject: [PATCH 91/93] log error expect file doesn't exist --- src/services/fs.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/fs.ts b/src/services/fs.ts index c3ee16f9d..e87b72a17 100644 --- a/src/services/fs.ts +++ b/src/services/fs.ts @@ -188,6 +188,10 @@ export async function isFolder(dirPath: string) { const stats = await fs.stat(dirPath); return stats.isDirectory(); } catch (e) { + // ENOENT means the file does not exist + if (e?.code !== 'ENOENT') { + logError(e, 'isFolder failed '); + } return false; } } From 3287ae587e0541dae20147e11d11437cf43c29f4 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 15:35:32 +0530 Subject: [PATCH 92/93] improve isFolder logging --- src/services/fs.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/services/fs.ts b/src/services/fs.ts index e87b72a17..03899d519 100644 --- a/src/services/fs.ts +++ b/src/services/fs.ts @@ -188,11 +188,16 @@ export async function isFolder(dirPath: string) { const stats = await fs.stat(dirPath); return stats.isDirectory(); } catch (e) { - // ENOENT means the file does not exist - if (e?.code !== 'ENOENT') { - logError(e, 'isFolder failed '); + // if code is defined, it's an error from fs.stat + if (typeof e.code !== 'undefined') { + // ENOENT means the file does not exist + if (e.code === 'ENOENT') { + return false; + } + throw Error(`fs error code: ${e.code}`); + } else { + throw e; } - return false; } } From 4c695f83c64b8a389837495336f6ec64180fdbc1 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 7 Feb 2023 16:02:10 +0530 Subject: [PATCH 93/93] don't throw error --- src/services/fs.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/services/fs.ts b/src/services/fs.ts index 03899d519..b5ef8eb11 100644 --- a/src/services/fs.ts +++ b/src/services/fs.ts @@ -188,16 +188,17 @@ export async function isFolder(dirPath: string) { const stats = await fs.stat(dirPath); return stats.isDirectory(); } catch (e) { + let err = e; // if code is defined, it's an error from fs.stat if (typeof e.code !== 'undefined') { // ENOENT means the file does not exist if (e.code === 'ENOENT') { return false; } - throw Error(`fs error code: ${e.code}`); - } else { - throw e; + err = Error(`fs error code: ${e.code}`); } + logError(err, 'isFolder failed'); + return false; } }