mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-21 18:02:35 +01:00
parent
b86c1b15e8
commit
a4190662b9
38
src/main/aboutPanel.ts
Normal file
38
src/main/aboutPanel.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
|
import { AboutPanelOptionsOptions, app } from 'electron';
|
||||||
|
|
||||||
|
import { appName, copyrightYear } from './common.js';
|
||||||
|
import { isLinux } from './util.js';
|
||||||
|
import isStoreBuild from './isStoreBuild.js';
|
||||||
|
import { githubLink, homepage } from './constants.js';
|
||||||
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/prefer-default-export
|
||||||
|
export function getAboutPanelOptions() {
|
||||||
|
const showVersion = !isStoreBuild;
|
||||||
|
|
||||||
|
const appVersion = app.getVersion();
|
||||||
|
|
||||||
|
const aboutPanelLines = [
|
||||||
|
isStoreBuild ? homepage : githubLink,
|
||||||
|
'',
|
||||||
|
`Copyright © 2016-${copyrightYear} Mikael Finstad ❤️ 🇳🇴`,
|
||||||
|
];
|
||||||
|
|
||||||
|
const aboutPanelOptions: AboutPanelOptionsOptions = {
|
||||||
|
applicationName: appName,
|
||||||
|
copyright: aboutPanelLines.join('\n'),
|
||||||
|
version: '', // not very useful (supported on MacOS only, and same as applicationVersion)
|
||||||
|
};
|
||||||
|
|
||||||
|
// https://github.com/electron/electron/issues/18918
|
||||||
|
// https://github.com/mifi/lossless-cut/issues/1537
|
||||||
|
if (isLinux) {
|
||||||
|
aboutPanelOptions.applicationVersion = appVersion;
|
||||||
|
} else if (!showVersion) {
|
||||||
|
// https://github.com/mifi/lossless-cut/issues/1882
|
||||||
|
aboutPanelOptions.applicationVersion = `${process.windowsStore ? 'Microsoft Store' : 'App Store'} edition, based on GitHub v${appVersion}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return aboutPanelOptions;
|
||||||
|
}
|
@ -3,7 +3,7 @@ process.traceProcessWarnings = true;
|
|||||||
|
|
||||||
/* eslint-disable import/first */
|
/* eslint-disable import/first */
|
||||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
import electron, { AboutPanelOptionsOptions, BrowserWindow, BrowserWindowConstructorOptions, nativeTheme, shell, app, ipcMain, Notification, NotificationConstructorOptions } from 'electron';
|
import electron, { BrowserWindow, BrowserWindowConstructorOptions, nativeTheme, shell, app, ipcMain, Notification, NotificationConstructorOptions } from 'electron';
|
||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import debounce from 'lodash.debounce';
|
import debounce from 'lodash.debounce';
|
||||||
import yargsParser from 'yargs-parser';
|
import yargsParser from 'yargs-parser';
|
||||||
@ -16,11 +16,13 @@ import timers from 'node:timers/promises';
|
|||||||
import logger from './logger.js';
|
import logger from './logger.js';
|
||||||
import menu from './menu.js';
|
import menu from './menu.js';
|
||||||
import * as configStore from './configStore.js';
|
import * as configStore from './configStore.js';
|
||||||
import { isLinux, isWindows } from './util.js';
|
import { isWindows } from './util.js';
|
||||||
import { appName, copyrightYear } from './common.js';
|
import { appName } from './common.js';
|
||||||
import attachContextMenu from './contextMenu.js';
|
import attachContextMenu from './contextMenu.js';
|
||||||
import HttpServer from './httpServer.js';
|
import HttpServer from './httpServer.js';
|
||||||
import isDev from './isDev.js';
|
import isDev from './isDev.js';
|
||||||
|
import isStoreBuild from './isStoreBuild.js';
|
||||||
|
import { getAboutPanelOptions } from './aboutPanel.js';
|
||||||
|
|
||||||
import { checkNewVersion } from './updateChecker.js';
|
import { checkNewVersion } from './updateChecker.js';
|
||||||
|
|
||||||
@ -67,8 +69,6 @@ app.commandLine.appendSwitch('enable-blink-features', 'AudioVideoTracks');
|
|||||||
remote.initialize();
|
remote.initialize();
|
||||||
|
|
||||||
|
|
||||||
const appVersion = app.getVersion();
|
|
||||||
|
|
||||||
app.name = appName;
|
app.name = appName;
|
||||||
|
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
@ -78,28 +78,8 @@ if (isWindows) {
|
|||||||
app.setAppUserModelId(app.name);
|
app.setAppUserModelId(app.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isStoreBuild = process.windowsStore || process.mas;
|
|
||||||
|
|
||||||
const showVersion = !isStoreBuild;
|
|
||||||
|
|
||||||
const aboutPanelOptions: AboutPanelOptionsOptions = {
|
|
||||||
applicationName: appName,
|
|
||||||
copyright: `Copyright © ${copyrightYear} Mikael Finstad ❤️ 🇳🇴`,
|
|
||||||
version: '', // not very useful (MacOS only, and same as applicationVersion)
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://github.com/electron/electron/issues/18918
|
|
||||||
// https://github.com/mifi/lossless-cut/issues/1537
|
|
||||||
if (isLinux) {
|
|
||||||
aboutPanelOptions.version = appVersion;
|
|
||||||
}
|
|
||||||
if (!showVersion) {
|
|
||||||
// https://github.com/mifi/lossless-cut/issues/1882
|
|
||||||
aboutPanelOptions.applicationVersion = `${process.windowsStore ? 'Microsoft Store' : 'App Store'} edition, based on GitHub v${appVersion}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://www.electronjs.org/docs/latest/api/app#appsetaboutpaneloptionsoptions
|
// https://www.electronjs.org/docs/latest/api/app#appsetaboutpaneloptionsoptions
|
||||||
app.setAboutPanelOptions(aboutPanelOptions);
|
app.setAboutPanelOptions(getAboutPanelOptions());
|
||||||
|
|
||||||
let filesToOpen: string[] = [];
|
let filesToOpen: string[] = [];
|
||||||
|
|
||||||
|
3
src/main/isStoreBuild.ts
Normal file
3
src/main/isStoreBuild.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const isStoreBuild = process.windowsStore || process.mas;
|
||||||
|
|
||||||
|
export default isStoreBuild;
|
Loading…
Reference in New Issue
Block a user