@lvce-editor/update-worker 1.8.0 → 1.9.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/README.md +1 -1
- package/dist/updateWorkerMain.js +11 -14
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/updateWorkerMain.js
CHANGED
|
@@ -889,20 +889,16 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
889
889
|
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
890
890
|
};
|
|
891
891
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
const UiStrings = {
|
|
896
|
-
DoYouWantToUpdate: 'Do you want to update to version {PH1}?',
|
|
897
|
-
DoYouWantToRestart: 'The Update has been downloaded. Do you want to restart now?'
|
|
898
|
-
};
|
|
892
|
+
const DoYouWantToUpdate = 'Do you want to update to version {PH1}?';
|
|
893
|
+
const DoYouWantToRestart = 'The Update has been downloaded. Do you want to restart now?';
|
|
894
|
+
|
|
899
895
|
const promptMessage = version => {
|
|
900
|
-
return i18nString(
|
|
896
|
+
return i18nString(DoYouWantToUpdate, {
|
|
901
897
|
PH1: version
|
|
902
898
|
});
|
|
903
899
|
};
|
|
904
900
|
const promptRestart = () => {
|
|
905
|
-
return i18nString(
|
|
901
|
+
return i18nString(DoYouWantToRestart);
|
|
906
902
|
};
|
|
907
903
|
|
|
908
904
|
const confirmPrompt = async message => {
|
|
@@ -1021,8 +1017,8 @@ const getLatestReleaseVersion = async repository => {
|
|
|
1021
1017
|
}
|
|
1022
1018
|
};
|
|
1023
1019
|
|
|
1024
|
-
const getUpdateUrl = (repository, version) => {
|
|
1025
|
-
const fileName =
|
|
1020
|
+
const getUpdateUrl = (repository, fileNameTemplate, version) => {
|
|
1021
|
+
const fileName = fileNameTemplate.replace('${version}', version);
|
|
1026
1022
|
const url = `https://github.com/${repository}/releases/download/v${version}/${fileName}`;
|
|
1027
1023
|
return url;
|
|
1028
1024
|
};
|
|
@@ -1083,7 +1079,7 @@ const shouldUpdate = async (updateSetting, version) => {
|
|
|
1083
1079
|
return shouldUpdate;
|
|
1084
1080
|
};
|
|
1085
1081
|
|
|
1086
|
-
const doCheckForUpdates = async (updateSetting, repository, bucketName, cacheName) => {
|
|
1082
|
+
const doCheckForUpdates = async (updateSetting, repository, fileNameTemplate, bucketName, cacheName) => {
|
|
1087
1083
|
try {
|
|
1088
1084
|
if (!isOnline()) {
|
|
1089
1085
|
return {
|
|
@@ -1105,7 +1101,7 @@ const doCheckForUpdates = async (updateSetting, repository, bucketName, cacheNam
|
|
|
1105
1101
|
error: undefined
|
|
1106
1102
|
};
|
|
1107
1103
|
}
|
|
1108
|
-
const downloadUrl = getUpdateUrl(repository, info.version);
|
|
1104
|
+
const downloadUrl = getUpdateUrl(repository, fileNameTemplate, info.version);
|
|
1109
1105
|
|
|
1110
1106
|
// @ts-ignore
|
|
1111
1107
|
await invoke('Layout.setUpdateState', {
|
|
@@ -1159,6 +1155,7 @@ const checkForUpdates = async (updateSetting, repository) => {
|
|
|
1159
1155
|
const lockName = 'electron-updates';
|
|
1160
1156
|
const bucketName = 'electron-updates';
|
|
1161
1157
|
const cacheName = 'electron-updates';
|
|
1158
|
+
const fileNameTemplate = `Lvce-Setup-v\${version}-x64.exe`;
|
|
1162
1159
|
const result = await requestLock(lockName, async lock => {
|
|
1163
1160
|
if (!lock) {
|
|
1164
1161
|
return {
|
|
@@ -1166,7 +1163,7 @@ const checkForUpdates = async (updateSetting, repository) => {
|
|
|
1166
1163
|
error: undefined
|
|
1167
1164
|
};
|
|
1168
1165
|
}
|
|
1169
|
-
const result = await doCheckForUpdates(updateSetting, repository, bucketName, cacheName);
|
|
1166
|
+
const result = await doCheckForUpdates(updateSetting, repository, fileNameTemplate, bucketName, cacheName);
|
|
1170
1167
|
return result;
|
|
1171
1168
|
});
|
|
1172
1169
|
return result;
|