Skip to content

Commit 6be0afd

Browse files
authored
Merge pull request #998 from agalwood/feature/app_improve_20210530
2 parents 68ba920 + 2c269e3 commit 6be0afd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1466
-1087
lines changed

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Node.js, NPM and Yarn
2323
uses: actions/setup-node@v2
2424
with:
25-
node-version: 12
25+
node-version: 14
2626

2727
- name: Install Snapcraft
2828
uses: samuelmeuli/action-snapcraft@v1

package.json

+31-30
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@
193193
]
194194
},
195195
"dependencies": {
196-
"@babel/runtime": "^7.14.0",
197-
"@motrix/nat-api": "^0.3.1",
196+
"@babel/runtime": "^7.14.6",
197+
"@motrix/nat-api": "^0.3.2",
198198
"@panter/vue-i18next": "^0.15.2",
199199
"axios": "^0.21.1",
200200
"bittorrent-peerid": "^1.3.3",
@@ -205,71 +205,72 @@
205205
"electron-log": "^4.3.5",
206206
"electron-store": "^8.0.0",
207207
"electron-updater": "^4.3.9",
208-
"element-ui": "^2.15.2",
209-
"i18next": "^20.3.1",
208+
"element-ui": "^2.15.3",
209+
"i18next": "^20.3.2",
210210
"lodash": "^4.17.21",
211211
"node-fetch": "^2.6.1",
212212
"normalize.css": "^8.0.1",
213213
"parse-torrent": "^9.1.3",
214214
"randomatic": "^3.1.1",
215215
"svg-innerhtml": "^1.1.0",
216-
"vue": "^2.6.12",
216+
"vue": "^2.6.14",
217217
"vue-electron": "^1.0.6",
218-
"vue-router": "^3.5.1",
218+
"vue-router": "^3.5.2",
219+
"vue-selectable": "^0.5.0",
219220
"vuex": "^3.6.2",
220221
"vuex-router-sync": "^5.0.0",
221-
"ws": "^7.4.6"
222+
"ws": "^7.5.2"
222223
},
223224
"devDependencies": {
224-
"@babel/core": "^7.14.3",
225-
"@babel/plugin-proposal-class-properties": "^7.13.0",
226-
"@babel/plugin-transform-runtime": "^7.14.3",
227-
"@babel/preset-env": "^7.14.4",
228-
"@babel/register": "^7.13.16",
229-
"@electron/remote": "^1.1.0",
225+
"@babel/core": "^7.14.6",
226+
"@babel/plugin-proposal-class-properties": "^7.14.5",
227+
"@babel/plugin-transform-runtime": "^7.14.5",
228+
"@babel/preset-env": "^7.14.7",
229+
"@babel/register": "^7.14.5",
230+
"@electron/remote": "^1.2.0",
230231
"@motrix/multispinner": "^0.2.2",
231232
"@vue/eslint-config-standard": "^6.0.0",
232-
"ajv": "^8.5.0",
233+
"ajv": "^8.6.0",
233234
"babel-eslint": "^10.1.0",
234235
"babel-loader": "^8.2.2",
235236
"babel-plugin-component": "^1.1.1",
236-
"cfonts": "^2.9.2",
237+
"cfonts": "^2.9.3",
237238
"chalk": "^4.1.1",
238-
"copy-webpack-plugin": "^9.0.0",
239+
"copy-webpack-plugin": "^9.0.1",
239240
"cross-env": "^7.0.3",
240241
"css-loader": "^5.2.6",
241-
"css-minimizer-webpack-plugin": "^3.0.0",
242+
"css-minimizer-webpack-plugin": "^3.0.2",
242243
"del": "^6.0.0",
243-
"electron": "^11.4.7",
244-
"electron-builder": "22.10.5",
244+
"electron": "^11.4.9",
245+
"electron-builder": "^22.11.7",
245246
"electron-builder-notarize": "^1.2.0",
246247
"electron-devtools-installer": "^3.2.0",
247248
"electron-notarize": "^1.0.0",
248249
"electron-osx-sign": "^0.5.0",
249-
"eslint": "^7.27.0",
250+
"eslint": "^7.30.0",
250251
"eslint-friendly-formatter": "^4.0.1",
251-
"eslint-plugin-import": "^2.23.3",
252+
"eslint-plugin-import": "^2.23.4",
252253
"eslint-plugin-node": "^11.1.0",
253254
"eslint-plugin-promise": "^5.1.0",
254-
"eslint-plugin-vue": "^7.10.0",
255+
"eslint-plugin-vue": "^7.12.1",
255256
"eslint-webpack-plugin": "^2.5.4",
256257
"file-loader": "^6.2.0",
257-
"html-webpack-plugin": "^5.3.1",
258-
"mini-css-extract-plugin": "1.6.0",
258+
"html-webpack-plugin": "^5.3.2",
259+
"mini-css-extract-plugin": "2.0.0",
259260
"node-loader": "^2.0.0",
260261
"sass": "1.32.13",
261262
"sass-loader": "^11.1.1",
262-
"style-loader": "^2.0.0",
263-
"terser-webpack-plugin": "^5.1.2",
263+
"style-loader": "^3.0.0",
264+
"terser-webpack-plugin": "^5.1.4",
264265
"url-loader": "^4.1.1",
265266
"vue-loader": "^15.9.7",
266267
"vue-style-loader": "^4.1.3",
267-
"vue-template-compiler": "^2.6.12",
268-
"webpack": "^5.38.1",
269-
"webpack-cli": "^4.7.0",
268+
"vue-template-compiler": "^2.6.14",
269+
"webpack": "^5.42.0",
270+
"webpack-cli": "^4.7.2",
270271
"webpack-dev-server": "^3.11.2",
271272
"webpack-hot-middleware": "^2.25.0",
272-
"webpack-merge": "^5.7.3",
273+
"webpack-merge": "^5.8.0",
273274
"worker-loader": "^3.0.8"
274275
}
275276
}

src/index.ejs

+30-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,42 @@
1010
</script>
1111
<% } %>
1212
</head>
13+
14+
<style>
15+
.skeleton-aside {
16+
background-color: rgba(0, 0, 0, 0.8);
17+
width: 78px;
18+
}
19+
.skeleton-subnav {
20+
background-color: #f4f5f7;
21+
width: 200px;
22+
}
23+
.skeleton-main {
24+
background-color: #fff;
25+
}
26+
27+
@media (prefers-color-scheme: dark) {
28+
.skeleton-aside {
29+
background-color: rgba(0, 0, 0, 0.9);
30+
}
31+
.skeleton-subnav {
32+
background-color: #2D2D2D;
33+
}
34+
.skeleton-main {
35+
background-color: #343434;
36+
}
37+
}
38+
</style>
39+
1340
<body>
1441
<div id="app">
1542
<div class="title-bar"></div>
1643
<section class="el-container" id="container">
17-
<aside class="el-aside aside" style="width: 78px;">
44+
<aside class="el-aside skeleton-aside hidden-sm-and-down">
1845
</aside>
19-
<aside class="el-aside subnav" style="width: 200px;">
46+
<aside class="el-aside skeleton-subnav hidden-xs-only">
2047
</aside>
21-
<section class="el-container main">
48+
<section class="el-container skeleton-main">
2249
</section>
2350
</section>
2451
</div>

src/main/Application.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
import { checkIsNeedRun } from '@shared/utils'
1414
import {
1515
convertTrackerDataToComma,
16-
fetchBtTrackerFromSource
16+
fetchBtTrackerFromSource,
17+
reduceTrackerString
1718
} from '@shared/utils/tracker'
1819
import logger from './core/Logger'
1920
import ConfigManager from './core/ConfigManager'
@@ -316,7 +317,8 @@ export default class Application extends EventEmitter {
316317
return
317318
}
318319

319-
const tracker = convertTrackerDataToComma(data)
320+
let tracker = convertTrackerDataToComma(data)
321+
tracker = reduceTrackerString(tracker)
320322
this.savePreference({
321323
system: {
322324
'bt-tracker': tracker

src/main/configs/page.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
title: 'Motrix',
77
width: 1024,
88
height: 768,
9-
minWidth: 400,
9+
minWidth: 478,
1010
minHeight: 420,
1111
// backgroundColor: '#FFFFFF',
1212
transparent: !is.windows()

src/main/core/ConfigManager.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
NGOSANG_TRACKERS_BEST_URL_CDN
2020
} from '@shared/constants'
2121
import { separateConfig } from '@shared/utils'
22+
import { reduceTrackerString } from '@shared/utils/tracker'
2223

2324
export default class ConfigManager {
2425
constructor () {
@@ -59,8 +60,8 @@ export default class ConfigManager {
5960
'dht-file-path6': getDhtPath(IP_VERSION.V6),
6061
'dht-listen-port': 26701,
6162
'dir': getUserDownloadsPath(),
62-
'follow-metalink': false,
63-
'follow-torrent': false,
63+
'follow-metalink': true,
64+
'follow-torrent': true,
6465
'listen-port': 21301,
6566
'max-concurrent-downloads': 5,
6667
'max-connection-per-server': getMaxConnectionPerServer(),
@@ -70,6 +71,7 @@ export default class ConfigManager {
7071
'min-split-size': '1M',
7172
'no-proxy': EMPTY_STRING,
7273
'pause': true,
74+
'pause-metadata': false,
7375
'rpc-listen-port': 16800,
7476
'rpc-secret': EMPTY_STRING,
7577
'seed-ratio': 1,
@@ -142,6 +144,10 @@ export default class ConfigManager {
142144
Object.keys(others).forEach(key => {
143145
this.systemConfig.delete(key)
144146
})
147+
148+
// Fix spawn ENAMETOOLONG on Windows
149+
const tracker = reduceTrackerString(this.systemConfig.get('bt-tracker'))
150+
this.setSystemConfig('bt-tracker', tracker)
145151
}
146152

147153
fixUserConfig () {

src/renderer/components/DragSelect/Index.vue

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
</template>
99

1010
<script>
11+
const getCoords = (e, containerRect) => ({
12+
x: e.clientX - containerRect.left,
13+
y: e.clientY - containerRect.top
14+
})
15+
1116
const getDimensions = (p1, p2) => ({
1217
width: Math.abs(p1.x - p2.x),
1318
height: Math.abs(p1.y - p2.y)
@@ -51,12 +56,6 @@
5156
const self = this
5257
5358
let containerRect = container.getBoundingClientRect()
54-
55-
const getCoords = e => ({
56-
x: e.clientX - containerRect.left,
57-
y: e.clientY - containerRect.top
58-
})
59-
6059
const box = this.createBox()
6160
let start = { x: 0, y: 0 }
6261
let end = { x: 0, y: 0 }
@@ -74,7 +73,7 @@
7473
function startDrag (e) {
7574
containerRect = container.getBoundingClientRect()
7675
self.children = container.childNodes
77-
start = getCoords(e)
76+
start = getCoords(e, containerRect)
7877
end = start
7978
document.addEventListener('mousemove', drag)
8079
document.addEventListener('touchmove', touchMove)
@@ -87,7 +86,7 @@
8786
}
8887
8988
function drag (e) {
90-
end = getCoords(e)
89+
end = getCoords(e, containerRect)
9190
const dimensions = getDimensions(start, end)
9291
9392
if (end.x < start.x) {

src/renderer/components/Main.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<style lang="scss">
5858
.mo-speedometer {
5959
position: fixed;
60-
right: 36px;
60+
right: 16px;
6161
bottom: 24px;
6262
z-index: 20;
6363
}

src/renderer/components/Preference/Advanced.vue

+43-8
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,26 @@
6060
v-if="form.useProxy"
6161
style="margin-top: -16px;"
6262
>
63-
<el-col class="form-item-sub" :span="16">
63+
<el-col
64+
class="form-item-sub"
65+
:xs="24"
66+
:sm="20"
67+
:md="16"
68+
:lg="16"
69+
>
6470
<el-input
6571
placeholder="[http://][USER:PASSWORD@]HOST[:PORT]"
6672
@change="onAllProxyBackupChange"
6773
v-model="form.allProxyBackup">
6874
</el-input>
6975
</el-col>
70-
<el-col class="form-item-sub" :span="20">
76+
<el-col
77+
class="form-item-sub"
78+
:xs="24"
79+
:sm="24"
80+
:md="20"
81+
:lg="20"
82+
>
7183
<el-input
7284
type="textarea"
7385
rows="2"
@@ -182,7 +194,13 @@
182194
:label-width="formLabelWidth"
183195
>
184196
<el-row style="margin-bottom: 8px;">
185-
<el-col class="form-item-sub" :span="12">
197+
<el-col
198+
class="form-item-sub"
199+
:xs="24"
200+
:sm="18"
201+
:md="12"
202+
:lg="12"
203+
>
186204
<el-switch
187205
v-model="form.enableUpnp"
188206
active-text="UPnP/NAT-PMP"
@@ -191,7 +209,12 @@
191209
</el-col>
192210
</el-row>
193211
<el-row style="margin-bottom: 8px;">
194-
<el-col class="form-item-sub" :span="10">
212+
<el-col class="form-item-sub"
213+
:xs="24"
214+
:sm="18"
215+
:md="10"
216+
:lg="10"
217+
>
195218
{{ $t('preferences.bt-port') }}
196219
<el-input
197220
placeholder="BT Port"
@@ -205,7 +228,13 @@
205228
</el-col>
206229
</el-row>
207230
<el-row>
208-
<el-col class="form-item-sub" :span="10">
231+
<el-col
232+
class="form-item-sub"
233+
:xs="24"
234+
:sm="18"
235+
:md="10"
236+
:lg="10"
237+
>
209238
{{ $t('preferences.dht-port') }}
210239
<el-input
211240
placeholder="DHT Port"
@@ -261,7 +290,13 @@
261290
<el-button @click="() => changeUA('du')">du</el-button>
262291
</el-button-group>
263292
</el-col>
264-
<el-col class="form-item-sub" :span="18">
293+
<el-col
294+
class="form-item-sub"
295+
:xs="24"
296+
:sm="18"
297+
:md="18"
298+
:lg="18"
299+
>
265300
{{ $t('preferences.rpc-secret') }}
266301
<el-input
267302
:show-password="hideRpcSecret"
@@ -352,7 +387,7 @@
352387
diffConfig,
353388
getRandomInt
354389
} from '@shared/utils'
355-
import { convertTrackerDataToLine } from '@shared/utils/tracker'
390+
import { convertTrackerDataToLine, reduceTrackerString } from '@shared/utils/tracker'
356391
import '@/components/Icons/dice'
357392
import '@/components/Icons/sync'
358393
import '@/components/Icons/refresh'
@@ -578,7 +613,7 @@
578613
579614
const { btTracker, noProxy } = changed
580615
if (btTracker) {
581-
data.btTracker = convertLineToComma(btTracker)
616+
data.btTracker = reduceTrackerString(convertLineToComma(btTracker))
582617
}
583618
584619
if (noProxy) {

0 commit comments

Comments
 (0)