@lvce-editor/about-view 7.3.0 → 7.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/dist/aboutWorkerMain.js +75 -29
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
|
@@ -125,12 +125,13 @@ const {
|
|
|
125
125
|
wrapCommand
|
|
126
126
|
} = create$a();
|
|
127
127
|
|
|
128
|
-
const create$9 = uid => {
|
|
128
|
+
const create$9 = (uid, useNewLoadConfig = false) => {
|
|
129
129
|
const state = {
|
|
130
130
|
focusId: 0,
|
|
131
131
|
lines: [],
|
|
132
132
|
productName: '',
|
|
133
|
-
uid
|
|
133
|
+
uid,
|
|
134
|
+
useNewLoadConfig
|
|
134
135
|
};
|
|
135
136
|
set$3(uid, state, state);
|
|
136
137
|
};
|
|
@@ -1349,8 +1350,12 @@ const create = rpcId => {
|
|
|
1349
1350
|
};
|
|
1350
1351
|
|
|
1351
1352
|
const {
|
|
1353
|
+
invoke: invoke$1,
|
|
1352
1354
|
set: set$1
|
|
1353
1355
|
} = create(FileSystemWorker);
|
|
1356
|
+
const readFile = async uri => {
|
|
1357
|
+
return invoke$1('FileSystem.readFile', uri);
|
|
1358
|
+
};
|
|
1354
1359
|
|
|
1355
1360
|
const {
|
|
1356
1361
|
invoke,
|
|
@@ -1764,32 +1769,61 @@ const getDetailStringWeb = () => {
|
|
|
1764
1769
|
return lines;
|
|
1765
1770
|
};
|
|
1766
1771
|
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1769
|
-
const getChromeVersion = getChromeVersion$1;
|
|
1770
|
-
const getVersion = async () => {
|
|
1771
|
-
return version;
|
|
1772
|
+
const getConfigJsonPath = async () => {
|
|
1773
|
+
return invoke('ProcessPaths.getConfigJsonPath');
|
|
1772
1774
|
};
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1775
|
+
|
|
1776
|
+
const getString = (config, key) => {
|
|
1777
|
+
const value = config[key];
|
|
1778
|
+
if (typeof value !== 'string') {
|
|
1779
|
+
return '';
|
|
1780
|
+
}
|
|
1781
|
+
return value;
|
|
1779
1782
|
};
|
|
1780
|
-
const
|
|
1781
|
-
const
|
|
1782
|
-
|
|
1783
|
+
const loadConfig = async _state => {
|
|
1784
|
+
const configJsonPath = await getConfigJsonPath();
|
|
1785
|
+
// FileSystemWorker.readFile is a custom RPC that already returns a string.
|
|
1786
|
+
// eslint-disable-next-line unicorn/consistent-json-file-read
|
|
1787
|
+
const content = await readFile(configJsonPath);
|
|
1788
|
+
const config = JSON.parse(content);
|
|
1789
|
+
return {
|
|
1790
|
+
commit: getString(config, 'commit'),
|
|
1791
|
+
date: getString(config, 'date'),
|
|
1792
|
+
productName: getString(config, 'productName'),
|
|
1793
|
+
version: getString(config, 'version')
|
|
1794
|
+
};
|
|
1783
1795
|
};
|
|
1784
1796
|
|
|
1797
|
+
const getContentFromConfig = async state => {
|
|
1798
|
+
const now = Date.now();
|
|
1799
|
+
try {
|
|
1800
|
+
const config = await loadConfig(state);
|
|
1801
|
+
const resolvedVersion = config.version || version;
|
|
1802
|
+
const resolvedCommit = config.commit || commit;
|
|
1803
|
+
const resolvedDate = config.date || commitDate;
|
|
1804
|
+
const formattedDate = formatAboutDate(resolvedDate, now);
|
|
1805
|
+
const browser = getBrowser();
|
|
1806
|
+
return {
|
|
1807
|
+
lines: [`Version: ${resolvedVersion}`, `Commit: ${resolvedCommit}`, `Date: ${formattedDate}`, `Browser: ${browser}`],
|
|
1808
|
+
productName: config.productName || state.productName
|
|
1809
|
+
};
|
|
1810
|
+
} catch {
|
|
1811
|
+
return {
|
|
1812
|
+
lines: getDetailStringWeb(),
|
|
1813
|
+
productName: state.productName
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1785
1817
|
const loadContent2 = async state => {
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1818
|
+
const content = state.useNewLoadConfig ? await getContentFromConfig(state) : {
|
|
1819
|
+
lines: getDetailStringWeb(),
|
|
1820
|
+
productName: state.productName
|
|
1821
|
+
};
|
|
1788
1822
|
return {
|
|
1789
1823
|
...state,
|
|
1790
1824
|
focusId: Ok$2,
|
|
1791
|
-
lines,
|
|
1792
|
-
productName
|
|
1825
|
+
lines: content.lines,
|
|
1826
|
+
productName: content.productName
|
|
1793
1827
|
};
|
|
1794
1828
|
};
|
|
1795
1829
|
|
|
@@ -2053,17 +2087,10 @@ const showAboutDefault = async () => {
|
|
|
2053
2087
|
|
|
2054
2088
|
const getWindowId = getWindowId$1;
|
|
2055
2089
|
|
|
2056
|
-
const productNameLong = 'Lvce Editor - OSS';
|
|
2057
|
-
const getProductNameLong = () => {
|
|
2058
|
-
return productNameLong;
|
|
2059
|
-
};
|
|
2060
|
-
|
|
2061
2090
|
const showMessageBox = async options => {
|
|
2062
|
-
const productName = getProductNameLong();
|
|
2063
2091
|
const windowId = await getWindowId();
|
|
2064
2092
|
const finalOptions = {
|
|
2065
2093
|
...options,
|
|
2066
|
-
productName,
|
|
2067
2094
|
windowId
|
|
2068
2095
|
};
|
|
2069
2096
|
return showMessageBox$1(finalOptions);
|
|
@@ -2071,6 +2098,20 @@ const showMessageBox = async options => {
|
|
|
2071
2098
|
|
|
2072
2099
|
const Info = 'info';
|
|
2073
2100
|
|
|
2101
|
+
const getElectronVersion = getElectronVersion$1;
|
|
2102
|
+
const getNodeVersion = getNodeVersion$1;
|
|
2103
|
+
const getChromeVersion = getChromeVersion$1;
|
|
2104
|
+
const getVersion = async () => {
|
|
2105
|
+
return version;
|
|
2106
|
+
};
|
|
2107
|
+
const getCommit = async () => {
|
|
2108
|
+
return commit;
|
|
2109
|
+
};
|
|
2110
|
+
const getV8Version = getV8Version$1;
|
|
2111
|
+
const getDate = () => {
|
|
2112
|
+
return commitDate;
|
|
2113
|
+
};
|
|
2114
|
+
|
|
2074
2115
|
/* eslint-disable @typescript-eslint/await-thenable */
|
|
2075
2116
|
const getDetailString = async () => {
|
|
2076
2117
|
const [electronVersion, nodeVersion, chromeVersion, version, commit, v8Version, date] = await Promise.all([getElectronVersion(), getNodeVersion(), getChromeVersion(), getVersion(), getCommit(), getV8Version(), getDate()]);
|
|
@@ -2080,14 +2121,19 @@ const getDetailString = async () => {
|
|
|
2080
2121
|
return joinLines(lines);
|
|
2081
2122
|
};
|
|
2082
2123
|
|
|
2124
|
+
const getProductName = async () => {
|
|
2125
|
+
const config = await loadConfig();
|
|
2126
|
+
return config.productName;
|
|
2127
|
+
};
|
|
2083
2128
|
const showAboutElectron = async () => {
|
|
2084
2129
|
const windowId = await getWindowId();
|
|
2085
2130
|
const detail = await getDetailString();
|
|
2086
|
-
const
|
|
2131
|
+
const productName = await getProductName();
|
|
2087
2132
|
const options = {
|
|
2088
2133
|
buttons: [copy(), ok()],
|
|
2089
2134
|
detail,
|
|
2090
|
-
message:
|
|
2135
|
+
message: productName,
|
|
2136
|
+
productName,
|
|
2091
2137
|
type: Info,
|
|
2092
2138
|
windowId
|
|
2093
2139
|
};
|