A full-featured download manager.
feat: release support arm arch linux (#1434)
Dr_rOot493df2b333f5
diff --git a/electron-builder.json b/electron-builder.jsonindex b1014977..b3e36b04 100644--- a/electron-builder.json+++ b/electron-builder.json@@ -127,13 +127,37 @@"linux": {"category": "Network","target": [- "AppImage",- "deb",- "rpm",- "snap"+ {+ "target": "AppImage",+ "arch": [+ "x64",+ "arm64",+ "armv7l"+ ]+ },+ {+ "target": "deb",+ "arch": [+ "x64",+ "arm64",+ "armv7l"+ ]+ },+ {+ "target": "rpm",+ "arch": [+ "x64"+ ]+ },+ {+ "target": "snap",+ "arch": [+ "x64"+ ]+ }],"extraResources": {- "from": "./extra/linux/",+ "from": "./extra/linux/${arch}/","to": "./","filter": ["**/*"diff --git a/extra/linux/engine/aria2.conf b/extra/linux/arm64/engine/aria2.confsimilarity index 100%rename from extra/linux/engine/aria2.confrename to extra/linux/arm64/engine/aria2.confdiff --git a/extra/linux/arm64/engine/aria2c b/extra/linux/arm64/engine/aria2cnew file mode 100755index 00000000..208091e8Binary files /dev/null and b/extra/linux/arm64/engine/aria2c differdiff --git a/extra/linux/armv7l/engine/aria2.conf b/extra/linux/armv7l/engine/aria2.confnew file mode 100644index 00000000..2dd6af55--- /dev/null+++ b/extra/linux/armv7l/engine/aria2.conf@@ -0,0 +1,91 @@+###############################+# Motrix Linux Aria2 config file+#+# @see https://aria2.github.io/manual/en/html/aria2c.html+#+###############################+++################ RPC ################+# Enable JSON-RPC/XML-RPC server.+enable-rpc=true+# Add Access-Control-Allow-Origin header field with value * to the RPC response.+rpc-allow-origin-all=true+# Listen incoming JSON-RPC/XML-RPC requests on all network interfaces.+rpc-listen-all=true+++################ File system ################+# Save a control file(*.aria2) every SEC seconds.+auto-save-interval=10+# Enable disk cache.+disk-cache=64M+# Specify file allocation method.+file-allocation=trunc+# No file allocation is made for files whose size is smaller than SIZE+no-file-allocation-limit=64M+# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds.+save-session-interval=10+++################ Task ################+# Exclude seed only downloads when counting concurrent active downloads+bt-detach-seed-only=true+# Verify the peer using certificates specified in --ca-certificate option.+check-certificate=false+# If aria2 receives "file not found" status from the remote HTTP/FTP servers NUM times+# without getting a single byte, then force the download to fail.+max-file-not-found=10+# Set number of tries.+max-tries=0+# Set the seconds to wait between retries. When SEC > 0, aria2 will retry downloads when the HTTP server returns a 503 response.+retry-wait=10+# Set the connect timeout in seconds to establish connection to HTTP/FTP/proxy server. After the connection is established, this option makes no effect and --timeout option is used instead.+connect-timeout=10+# Set timeout in seconds.+timeout=10+# aria2 does not split less than 2*SIZE byte range.+min-split-size=1M+# Send Accept: deflate, gzip request header.+http-accept-gzip=true+# Retrieve timestamp of the remote file from the remote HTTP/FTP server and if it is available, apply it to the local file.+remote-time=true+# Set interval in seconds to output download progress summary. Setting 0 suppresses the output.+summary-interval=0+# Handle quoted string in Content-Disposition header as UTF-8 instead of ISO-8859-1, for example, the filename parameter, but not the extended version filename*.+content-disposition-default-utf8=true+++################ BT Task ################+# Enable Local Peer Discovery.+bt-enable-lpd=true+# Requires BitTorrent message payload encryption with arc4.+# bt-force-encryption=true+# If true is given, after hash check using --check-integrity option and file is complete, continue to seed file.+bt-hash-check-seed=true+# Specify the maximum number of peers per torrent.+bt-max-peers=128+# Try to download first and last pieces of each file first. This is useful for previewing files.+bt-prioritize-piece=head+# Removes the unselected files when download is completed in BitTorrent.+bt-remove-unselected-file=true+# Seed previously downloaded files without verifying piece hashes.+bt-seed-unverified=false+# Set the connect timeout in seconds to establish connection to tracker. After the connection is established, this option makes no effect and --bt-tracker-timeout option is used instead.+bt-tracker-connect-timeout=10+# Set timeout in seconds.+bt-tracker-timeout=10+# Set host and port as an entry point to IPv4 DHT network.+dht-entry-point=dht.transmissionbt.com:6881+# Set host and port as an entry point to IPv6 DHT network.+dht-entry-point6=dht.transmissionbt.com:6881+# Enable IPv4 DHT functionality. It also enables UDP tracker support.+enable-dht=true+# Enable IPv6 DHT functionality.+enable-dht6=true+# Enable Peer Exchange extension.+enable-peer-exchange=true+# Specify the string used during the bitorrent extended handshake for the peer's client version.+peer-agent=Transmission/3.00+# Specify the prefix of peer ID.+peer-id-prefix=-TR3000-diff --git a/extra/linux/armv7l/engine/aria2c b/extra/linux/armv7l/engine/aria2cnew file mode 100755index 00000000..b08e1e16Binary files /dev/null and b/extra/linux/armv7l/engine/aria2c differdiff --git a/extra/linux/x64/engine/aria2.conf b/extra/linux/x64/engine/aria2.confnew file mode 100644index 00000000..2dd6af55--- /dev/null+++ b/extra/linux/x64/engine/aria2.conf@@ -0,0 +1,91 @@+###############################+# Motrix Linux Aria2 config file+#+# @see https://aria2.github.io/manual/en/html/aria2c.html+#+###############################+++################ RPC ################+# Enable JSON-RPC/XML-RPC server.+enable-rpc=true+# Add Access-Control-Allow-Origin header field with value * to the RPC response.+rpc-allow-origin-all=true+# Listen incoming JSON-RPC/XML-RPC requests on all network interfaces.+rpc-listen-all=true+++################ File system ################+# Save a control file(*.aria2) every SEC seconds.+auto-save-interval=10+# Enable disk cache.+disk-cache=64M+# Specify file allocation method.+file-allocation=trunc+# No file allocation is made for files whose size is smaller than SIZE+no-file-allocation-limit=64M+# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds.+save-session-interval=10+++################ Task ################+# Exclude seed only downloads when counting concurrent active downloads+bt-detach-seed-only=true+# Verify the peer using certificates specified in --ca-certificate option.+check-certificate=false+# If aria2 receives "file not found" status from the remote HTTP/FTP servers NUM times+# without getting a single byte, then force the download to fail.+max-file-not-found=10+# Set number of tries.+max-tries=0+# Set the seconds to wait between retries. When SEC > 0, aria2 will retry downloads when the HTTP server returns a 503 response.+retry-wait=10+# Set the connect timeout in seconds to establish connection to HTTP/FTP/proxy server. After the connection is established, this option makes no effect and --timeout option is used instead.+connect-timeout=10+# Set timeout in seconds.+timeout=10+# aria2 does not split less than 2*SIZE byte range.+min-split-size=1M+# Send Accept: deflate, gzip request header.+http-accept-gzip=true+# Retrieve timestamp of the remote file from the remote HTTP/FTP server and if it is available, apply it to the local file.+remote-time=true+# Set interval in seconds to output download progress summary. Setting 0 suppresses the output.+summary-interval=0+# Handle quoted string in Content-Disposition header as UTF-8 instead of ISO-8859-1, for example, the filename parameter, but not the extended version filename*.+content-disposition-default-utf8=true+++################ BT Task ################+# Enable Local Peer Discovery.+bt-enable-lpd=true+# Requires BitTorrent message payload encryption with arc4.+# bt-force-encryption=true+# If true is given, after hash check using --check-integrity option and file is complete, continue to seed file.+bt-hash-check-seed=true+# Specify the maximum number of peers per torrent.+bt-max-peers=128+# Try to download first and last pieces of each file first. This is useful for previewing files.+bt-prioritize-piece=head+# Removes the unselected files when download is completed in BitTorrent.+bt-remove-unselected-file=true+# Seed previously downloaded files without verifying piece hashes.+bt-seed-unverified=false+# Set the connect timeout in seconds to establish connection to tracker. After the connection is established, this option makes no effect and --bt-tracker-timeout option is used instead.+bt-tracker-connect-timeout=10+# Set timeout in seconds.+bt-tracker-timeout=10+# Set host and port as an entry point to IPv4 DHT network.+dht-entry-point=dht.transmissionbt.com:6881+# Set host and port as an entry point to IPv6 DHT network.+dht-entry-point6=dht.transmissionbt.com:6881+# Enable IPv4 DHT functionality. It also enables UDP tracker support.+enable-dht=true+# Enable IPv6 DHT functionality.+enable-dht6=true+# Enable Peer Exchange extension.+enable-peer-exchange=true+# Specify the string used during the bitorrent extended handshake for the peer's client version.+peer-agent=Transmission/3.00+# Specify the prefix of peer ID.+peer-id-prefix=-TR3000-diff --git a/extra/linux/engine/aria2c b/extra/linux/x64/engine/aria2csimilarity index 57%rename from extra/linux/engine/aria2crename to extra/linux/x64/engine/aria2cindex f35069c9..b1ae0b44 100755Binary files a/extra/linux/engine/aria2c and b/extra/linux/x64/engine/aria2c differdiff --git a/src/main/configs/engine.js b/src/main/configs/engine.jsindex 0ea0474a..a8aedbf5 100644--- a/src/main/configs/engine.js+++ b/src/main/configs/engine.js@@ -1,5 +1,22 @@-export default {+export const engineBinMap = {darwin: 'aria2c',win32: 'aria2c.exe',linux: 'aria2c'}++export const engineArchMap = {+ darwin: {+ x64: 'x64',+ arm64: 'arm64'+ },+ win32: {+ ia32: 'ia32',+ x64: 'x64',+ arm64: 'x64'+ },+ linux: {+ x64: 'x64',+ arm: 'armv7l',+ arm64: 'arm64'+ }+}diff --git a/src/main/core/Engine.js b/src/main/core/Engine.jsindex df4cffe7..e8d67847 100644--- a/src/main/core/Engine.js+++ b/src/main/core/Engine.js@@ -8,6 +8,7 @@ import logger from './Logger'import { getI18n } from '../ui/Locale'import {getEngineBin,+ getEngineArch,getEnginePidPath,getSessionPath,transformConfig@@ -100,15 +101,17 @@ export default class Engine {}getBasePath () {- let result = resolve(app.getAppPath(), '..')+ const result = is.dev()+ ? this.getDevBasePath()+ : resolve(app.getAppPath(), '..')- if (is.dev()) {- const base = platform === 'linux'- ? `../../../extra/${platform}`- : `../../../extra/${platform}/${arch}`- result = resolve(__dirname, base)- }+ return result+ }+ getDevBasePath () {+ const ah = getEngineArch(platform, arch)+ const base = `../../../extra/${platform}/${ah}`+ const result = resolve(__dirname, base)return result}diff --git a/src/main/utils/index.js b/src/main/utils/index.jsindex 54c5ce29..79654b25 100644--- a/src/main/utils/index.js+++ b/src/main/utils/index.js@@ -8,7 +8,7 @@ import {ENGINE_MAX_CONNECTION_PER_SERVER,IP_VERSION} from '@shared/constants'-import engineBinMap from '../configs/engine'+import { engineBinMap, engineArchMap } from '../configs/engine'export function getLogPath () {return app.getPath('logs')@@ -40,6 +40,15 @@ export function getEngineBin (platform) {return result}+export function getEngineArch (platform, arch) {+ if (!['darwin', 'win32', 'linux'].includes(platform)) {+ return ''+ }++ const result = engineArchMap[platform][arch]+ return result+}+export function transformConfig (config) {const result = []for (const [k, v] of Object.entries(config)) {