From d883f6cc8596244ac97def8b540d10648c1b1165 Mon Sep 17 00:00:00 2001 From: nuomi Date: Fri, 31 Mar 2023 17:01:28 +0800 Subject: [PATCH 01/11] chore: update build scripts --- .electron-vue/build.js | 14 +++++++++----- .electron-vue/dev-runner.js | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.electron-vue/build.js b/.electron-vue/build.js index 37d77a72e..ba59a7770 100644 --- a/.electron-vue/build.js +++ b/.electron-vue/build.js @@ -120,16 +120,20 @@ function greeting () { const cols = process.stdout.columns let text = '' - if (cols > 85) text = 'lets-build' - else if (cols > 60) text = 'lets-|build' - else text = false + if (cols > 85) { + text = 'lets-build' + } else if (cols > 60) { + text = 'lets-|build' + } else { + text = false + } if (text && !isCI) { say(text, { - colors: ['yellow'], + colors: ['magentaBright'], font: 'simple3d', space: false }) - } else console.log(chalk.yellow.bold('\n lets-build')) + } else console.log(chalk.magentaBright.bold('\n lets-build')) console.log() } diff --git a/.electron-vue/dev-runner.js b/.electron-vue/dev-runner.js index 86a957c82..ab1738c83 100644 --- a/.electron-vue/dev-runner.js +++ b/.electron-vue/dev-runner.js @@ -128,17 +128,21 @@ function greeting () { const cols = process.stdout.columns let text = '' - if (cols > 104) text = 'electron-vue' - else if (cols > 76) text = 'electron-|vue' - else text = false + if (cols > 104) { + text = 'motrix-dev' + } else if (cols > 76) { + text = 'motrix-|dev' + } else { + text = false + } if (text) { say(text, { - colors: ['yellow'], + colors: ['magentaBright'], font: 'simple3d', space: false }) - } else console.log(chalk.yellow.bold('\n electron-vue')) + } else console.log(chalk.magentaBright.bold('\n motrix-dev')) console.log(chalk.blue(' getting ready...') + '\n') } From 7fa4393a91a7df1a6ac6940b8b3c56ec294873bb Mon Sep 17 00:00:00 2001 From: nuomi Date: Fri, 31 Mar 2023 17:07:21 +0800 Subject: [PATCH 02/11] fix: setup protocols client empty error --- src/main/Application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/Application.js b/src/main/Application.js index 990b60cb3..f9809087b 100644 --- a/src/main/Application.js +++ b/src/main/Application.js @@ -713,7 +713,7 @@ export default class Application extends EventEmitter { }) this.on('application:setup-protocols-client', (protocols) => { - if (is.dev() || is.mas()) { + if (is.dev() || is.mas() || !protocols) { return } logger.info('[Motrix] setup protocols client:', protocols) From b72b898f2bbf1c657ca5b237d1ad00ca86d57859 Mon Sep 17 00:00:00 2001 From: nuomi Date: Fri, 31 Mar 2023 17:07:42 +0800 Subject: [PATCH 03/11] refactor: auto change theme --- src/main/ui/ThemeManager.js | 5 ----- src/renderer/utils/native.js | 8 +------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/main/ui/ThemeManager.js b/src/main/ui/ThemeManager.js index b77dbc43f..e23856c8c 100644 --- a/src/main/ui/ThemeManager.js +++ b/src/main/ui/ThemeManager.js @@ -1,6 +1,5 @@ import { EventEmitter } from 'events' import { nativeTheme } from 'electron' -import is from 'electron-is' import { APP_THEME } from '@shared/constants' import logger from '../core/Logger' @@ -25,10 +24,6 @@ export default class ThemeManager extends EventEmitter { } handleEvents () { - if (!is.macOS()) { - return - } - nativeTheme.on('updated', () => { const theme = getSystemTheme() this.systemTheme = theme diff --git a/src/renderer/utils/native.js b/src/renderer/utils/native.js index 641679ae6..f0c851d57 100644 --- a/src/renderer/utils/native.js +++ b/src/renderer/utils/native.js @@ -1,4 +1,3 @@ -import is from 'electron-is' import { shell, nativeTheme } from '@electron/remote' import { access, constants } from 'fs' import { resolve } from 'path' @@ -110,12 +109,7 @@ export const moveTaskFilesToTrash = (task) => { } export function getSystemTheme () { - let result = APP_THEME.LIGHT - if (!is.macOS()) { - return result - } - result = nativeTheme.shouldUseDarkColors ? APP_THEME.DARK : APP_THEME.LIGHT - return result + return nativeTheme.shouldUseDarkColors ? APP_THEME.DARK : APP_THEME.LIGHT } export const delayDeleteTaskFiles = (task, delay) => { From 1b5cb62369b34fb22480f7cf3507ea5058133d32 Mon Sep 17 00:00:00 2001 From: nuomi Date: Fri, 31 Mar 2023 17:08:56 +0800 Subject: [PATCH 04/11] refactor: engine max connection per server --- src/renderer/components/Preference/Basic.vue | 7 +++++-- src/shared/constants.js | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/Preference/Basic.vue b/src/renderer/components/Preference/Basic.vue index 2d8cc7983..aa56ad395 100644 --- a/src/renderer/components/Preference/Basic.vue +++ b/src/renderer/components/Preference/Basic.vue @@ -202,7 +202,7 @@ v-model="form.maxConcurrentDownloads" controls-position="right" :min="1" - :max="10" + :max="maxConcurrentDownloads" :label="$t('preferences.max-concurrent-downloads')"> @@ -273,7 +273,7 @@ convertLineToComma, diffConfig } from '@shared/utils' - import { APP_RUN_MODE } from '@shared/constants' + import { APP_RUN_MODE, ENGINE_MAX_CONCURRENT_DOWNLOADS } from '@shared/constants' import { reduceTrackerString } from '@shared/utils/tracker' const initForm = (config) => { @@ -371,6 +371,9 @@ title () { return this.$t('preferences.basic') }, + maxConcurrentDownloads () { + return ENGINE_MAX_CONCURRENT_DOWNLOADS + }, runModes () { return [ { diff --git a/src/shared/constants.js b/src/shared/constants.js index f8246a38e..fc9daa53a 100644 --- a/src/shared/constants.js +++ b/src/shared/constants.js @@ -28,6 +28,8 @@ export const TASK_STATUS = { export const ENGINE_RPC_HOST = '127.0.0.1' export const ENGINE_RPC_PORT = 16800 +export const ENGINE_MAX_CONCURRENT_DOWNLOADS = 10 +export const ENGINE_MAX_CONNECTION_PER_SERVER = 64 export const UNKNOWN_PEERID = '%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00' export const UNKNOWN_PEERID_NAME = 'unknown' @@ -159,8 +161,6 @@ export const trackerSourceOptions = [ export const NONE_SELECTED_FILES = 'none' export const SELECTED_ALL_FILES = 'all' -export const ENGINE_MAX_CONNECTION_PER_SERVER = 64 - export const IP_VERSION = { V4: 4, V6: 6 From 9b2cc66c560d7be2364e2e8fa0a76de367ee53a4 Mon Sep 17 00:00:00 2001 From: nuomi Date: Fri, 31 Mar 2023 17:09:51 +0800 Subject: [PATCH 05/11] refactor: adjust add task dialog style --- src/renderer/components/Task/AddTask.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/Task/AddTask.vue b/src/renderer/components/Task/AddTask.vue index d380aa3c4..ffb0bf5fd 100644 --- a/src/renderer/components/Task/AddTask.vue +++ b/src/renderer/components/Task/AddTask.vue @@ -1,7 +1,7 @@