key-screen-framework 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/installer.nsh +1 -1
- package/main/index.js +20 -5
- package/package.json +1 -1
- package/types/main/media-first-launch.d.ts +4 -2
package/installer.nsh
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
Abort
|
|
20
20
|
${EndIf}
|
|
21
21
|
|
|
22
|
-
${NSD_CreateLabel} 0 0 100% 36u "기본값은 기존 파일 보존입니다. 덮어쓰기를 선택하면
|
|
22
|
+
${NSD_CreateLabel} 0 0 100% 36u "기본값은 기존 파일 보존입니다. 덮어쓰기를 선택하면 사용자 추가 파일을 포함한 기존 media 폴더의 모든 파일을 삭제한 뒤 리소스를 설치합니다."
|
|
23
23
|
Pop $0
|
|
24
24
|
${NSD_CreateCheckbox} 0 44u 100% 20u "기존 리소스 덮어쓰기"
|
|
25
25
|
Pop $keyScreenMediaOverwriteCheckbox
|
package/main/index.js
CHANGED
|
@@ -1170,6 +1170,12 @@ class MediaManager {
|
|
|
1170
1170
|
if (!sourceRoot.isDirectory()) {
|
|
1171
1171
|
throw new Error("Media source root must be a directory.");
|
|
1172
1172
|
}
|
|
1173
|
+
if (options.overwrite) {
|
|
1174
|
+
if (isInsideDirectory(this.rootPath, sourceRootPath)) {
|
|
1175
|
+
throw new Error("Media source root must be outside of the media cleanup directory.");
|
|
1176
|
+
}
|
|
1177
|
+
await rm(this.rootPath, { recursive: true, force: true });
|
|
1178
|
+
}
|
|
1173
1179
|
await this.ensureDirectories();
|
|
1174
1180
|
await Promise.all(
|
|
1175
1181
|
MEDIA_TYPES.map(async (type) => {
|
|
@@ -1461,8 +1467,16 @@ function resolveMainRuntimePaths(overrides, context) {
|
|
|
1461
1467
|
defaultMediaRoot: overrides?.defaultMediaRoot ?? defaultMediaRoot
|
|
1462
1468
|
};
|
|
1463
1469
|
}
|
|
1470
|
+
async function getMediaInstallationId(executablePath) {
|
|
1471
|
+
const file = await stat(executablePath, { bigint: true });
|
|
1472
|
+
return ["v1", file.dev, file.ino, file.birthtimeNs, file.mtimeNs, file.size].join(":");
|
|
1473
|
+
}
|
|
1464
1474
|
async function installMediaOnFirstLaunch(options) {
|
|
1465
|
-
if (options.platform !== "darwin" || !options.isPackaged || options.isDev
|
|
1475
|
+
if (options.platform !== "darwin" || !options.isPackaged || options.isDev) {
|
|
1476
|
+
return true;
|
|
1477
|
+
}
|
|
1478
|
+
const installationId = await options.getInstallationId();
|
|
1479
|
+
if (options.completedInstallationId === installationId) {
|
|
1466
1480
|
return true;
|
|
1467
1481
|
}
|
|
1468
1482
|
const overwrite = await options.askOverwrite();
|
|
@@ -1470,7 +1484,7 @@ async function installMediaOnFirstLaunch(options) {
|
|
|
1470
1484
|
return false;
|
|
1471
1485
|
}
|
|
1472
1486
|
await options.install(overwrite);
|
|
1473
|
-
options.markCompleted();
|
|
1487
|
+
options.markCompleted(installationId);
|
|
1474
1488
|
return true;
|
|
1475
1489
|
}
|
|
1476
1490
|
const requireMainDependency = createRequire(import.meta.url);
|
|
@@ -1956,13 +1970,14 @@ function startKeyScreenMain(options) {
|
|
|
1956
1970
|
platform: process.platform,
|
|
1957
1971
|
isPackaged: app.isPackaged,
|
|
1958
1972
|
isDev,
|
|
1959
|
-
|
|
1973
|
+
completedInstallationId: store.get("mediaInstallationId"),
|
|
1974
|
+
getInstallationId: () => getMediaInstallationId(app.getPath("exe")),
|
|
1960
1975
|
askOverwrite: async () => {
|
|
1961
1976
|
const result = await dialog.showMessageBox({
|
|
1962
1977
|
type: "question",
|
|
1963
1978
|
title: "리소스 설치 옵션",
|
|
1964
1979
|
message: "최초 실행에 필요한 media 리소스를 설치합니다.",
|
|
1965
|
-
detail: "기본값은 기존 파일 보존입니다. 덮어쓰기를 선택하면
|
|
1980
|
+
detail: "기본값은 기존 파일 보존입니다. 덮어쓰기를 선택하면 사용자 추가 파일을 포함한 기존 media 폴더의 모든 파일을 삭제한 뒤 앱에 포함된 리소스를 설치합니다.",
|
|
1966
1981
|
checkboxLabel: "기존 리소스 덮어쓰기",
|
|
1967
1982
|
checkboxChecked: false,
|
|
1968
1983
|
buttons: ["리소스 설치", "종료"],
|
|
@@ -1972,7 +1987,7 @@ function startKeyScreenMain(options) {
|
|
|
1972
1987
|
return result.response === 0 ? result.checkboxChecked : null;
|
|
1973
1988
|
},
|
|
1974
1989
|
install: (overwrite) => mediaManager.seedFrom(runtimePaths.defaultMediaRoot, { overwrite }),
|
|
1975
|
-
markCompleted: () => store.set("
|
|
1990
|
+
markCompleted: (installationId) => store.set("mediaInstallationId", installationId)
|
|
1976
1991
|
});
|
|
1977
1992
|
if (!ready) {
|
|
1978
1993
|
app.quit();
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export declare function getMediaInstallationId(executablePath: string): Promise<string>;
|
|
1
2
|
export declare function installMediaOnFirstLaunch(options: {
|
|
2
3
|
platform: string;
|
|
3
4
|
isPackaged: boolean;
|
|
4
5
|
isDev: boolean;
|
|
5
|
-
|
|
6
|
+
completedInstallationId?: string;
|
|
7
|
+
getInstallationId: () => Promise<string>;
|
|
6
8
|
askOverwrite: () => Promise<boolean | null>;
|
|
7
9
|
install: (overwrite: boolean) => Promise<void>;
|
|
8
|
-
markCompleted: () => void;
|
|
10
|
+
markCompleted: (installationId: string) => void;
|
|
9
11
|
}): Promise<boolean>;
|