From 8c84451dcd70b63f8ed5c5b2ca86f04fe80a089f Mon Sep 17 00:00:00 2001
From: VirtualHotBar <96966978+VirtualHotBar@users.noreply.github.com>
Date: Sat, 1 Jun 2024 20:28:23 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E5=9C=A8=E5=AE=89=E8=A3=85winfsp=E5=90=8E?=
=?UTF-8?q?=E9=87=8D=E5=90=AF=E8=BD=AF=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 2 +-
src-tauri/Cargo.lock | 2 +-
src-tauri/Cargo.toml | 2 +-
src/controller/language/pack/en.json | 4 +++-
src/controller/language/pack/zh-cn.json | 4 +++-
src/controller/language/pack/zh-hant.json | 3 ++-
src/controller/test.ts | 3 +++
src/page/mount/mount.tsx | 23 ++++++++++++++++++++---
8 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/package.json b/package.json
index 7ee3594..ff96bbc 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "netmount-gui",
"private": true,
- "version": "1.0.5",
+ "version": "1.0.6",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index e2c5652..fb42e3c 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -75,7 +75,7 @@ checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3"
[[package]]
name = "app"
-version = "1.0.5"
+version = "1.0.6"
dependencies = [
"directories",
"flate2",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 18e6c24..4f0ef36 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "app"
description = "NetMount"
-version = "1.0.5"
+version = "1.0.6"
authors = ["VirtualHotBar"]
license = ""
repository = ""
diff --git a/src/controller/language/pack/en.json b/src/controller/language/pack/en.json
index 66b3a21..b07a291 100644
--- a/src/controller/language/pack/en.json
+++ b/src/controller/language/pack/en.json
@@ -485,5 +485,7 @@
"description.lark": "Lark Drive lets you save and manage all your content in cloud storage anytime, anywhere, on any device.",
"description.neteasemusic": "NetEase Cloud Music is a music product focused on discovering and sharing.",
"description.thunderx": "Thunder X",
- "description.thunderxexpert": "Thunder X Expert Edition"
+ "description.thunderxexpert": "Thunder X Expert Edition",
+
+ "restart_to_take_effect": "Restart to take effect"
}
\ No newline at end of file
diff --git a/src/controller/language/pack/zh-cn.json b/src/controller/language/pack/zh-cn.json
index c59faa8..09e1b1c 100644
--- a/src/controller/language/pack/zh-cn.json
+++ b/src/controller/language/pack/zh-cn.json
@@ -554,5 +554,7 @@
"description.lark": "Lark Drive允许您随时随地在任何设备上保存和管理云存储中的所有内容。",
"description.neteasemusic":"网易云音乐是一款专注于发现与分享的音乐产品。",
"description.thunderx": "迅雷X",
- "description.thunderxexpert": "迅雷X专家版"
+ "description.thunderxexpert": "迅雷X专家版",
+
+ "restart_to_take_effect": "重启以使更改生效"
}
\ No newline at end of file
diff --git a/src/controller/language/pack/zh-hant.json b/src/controller/language/pack/zh-hant.json
index 808bfd0..3087151 100644
--- a/src/controller/language/pack/zh-hant.json
+++ b/src/controller/language/pack/zh-hant.json
@@ -554,6 +554,7 @@
"description.lark": "Lark Drive讓您隨時隨地在任何裝置上保存和管理雲端儲存的所有內容。",
"description.neteasemusic": "網易雲音樂是一款專注於發現與分享的音樂產品。",
"description.thunderx": "迅雷X",
- "description.thunderxexpert": "迅雷X專家版"
+ "description.thunderxexpert": "迅雷X專家版",
+ "restart_to_take_effect": "更改設定需要重新啟動應用程式才能生效。"
}
diff --git a/src/controller/test.ts b/src/controller/test.ts
index 8d1c043..f3f9e6b 100644
--- a/src/controller/test.ts
+++ b/src/controller/test.ts
@@ -18,6 +18,7 @@ import { alistInfo } from "../services/alist";
import { addAlistInRclone } from "../utils/alist/alist";
import { restartRclone } from "../utils/rclone/process";
import { restartAlist } from "../utils/alist/process";
+import { exit } from "./main";
export async function Test() {
console.log(nmConfig);
@@ -27,6 +28,8 @@ export async function Test() {
console.log(await rclone_api_post('/options/get'));
console.log(await rclone_api_post('/rc/list'),);
+ exit(true)
+
/* console.log(await rclone_api_post('/operations/publiclink',{
fs: convertStoragePath('S3_new',undefined,undefined,undefined,true),
remote :convertStoragePath('S3_new','Package/HotPE-V2.7.240201.7z',undefined,true,false),
diff --git a/src/page/mount/mount.tsx b/src/page/mount/mount.tsx
index a0f69d1..1e479a7 100644
--- a/src/page/mount/mount.tsx
+++ b/src/page/mount/mount.tsx
@@ -1,4 +1,4 @@
-import { Alert, Button, Grid, Message, Space, Table, TableColumnProps, Typography } from '@arco-design/web-react'
+import { Alert, Button, Grid, Message, Modal, Space, Table, TableColumnProps, Typography } from '@arco-design/web-react'
import React, { useEffect, useReducer, useState } from 'react'
import { rcloneInfo } from '../../services/rclone'
import { delMountStorage, isMounted, mountStorage, reupMount, unmountStorage } from '../../controller/storage/mount/mount'
@@ -14,6 +14,13 @@ import { restartRclone } from '../../utils/rclone/process'
const Row = Grid.Row;
const Col = Grid.Col;
+
+
+
+
+
+
+
function Mount_page() {
const { t } = useTranslation()
const [ignored, forceUpdate] = useReducer(x => x + 1, 0);//刷新组件
@@ -86,8 +93,18 @@ function Mount_page() {
>} />
@@ -124,21 +124,21 @@ function Mount_page() {
const mounted = isMounted(item.mountPath)
return {
...item,
- mountPath_:
{item.mountPath}{rcloneInfo.endpoint.isLocal&&osInfo.osType==='Windows_NT' &&mounted&&
- }
,
+ mountPath_: {item.mountPath}{rcloneInfo.endpoint.isLocal && osInfo.osType === 'Windows_NT' && mounted &&
+ }
,
mounted: mounted ? t('mounted') : t('unmounted'),
actions:
{
- mounted ? <>
+ mounted ? <>
> :
<>
-
+
- >
+ >
}
}
diff --git a/src/utils/alist/process.ts b/src/utils/alist/process.ts
index 4ecc1ce..4a75424 100644
--- a/src/utils/alist/process.ts
+++ b/src/utils/alist/process.ts
@@ -1,7 +1,7 @@
import { invoke } from "@tauri-apps/api";
import { Command } from "@tauri-apps/api/shell";
import { rcloneInfo } from "../../services/rclone";
-import { formatPath, randomString, sleep } from "../utils";
+import { formatPath, getAvailablePorts, randomString, sleep } from "../utils";
import { alistInfo } from "../../services/alist";
import { homeDir } from "@tauri-apps/api/path";
import { nmConfig, osInfo, roConfig } from "../../services/config";
@@ -9,7 +9,7 @@ import { getAlistToken, modifyAlistConfig, setAlistPass } from "./alist";
import { alist_api_ping } from "./request";
const alistDataDir = () => {
- return formatPath(roConfig.env.path.homeDir + '/.netmount/alist/',osInfo.osType==='Windows_NT')
+ return formatPath(roConfig.env.path.homeDir + '/.netmount/alist/', osInfo.osType === 'Windows_NT')
}
const addParams = (): string[] => {
@@ -21,7 +21,10 @@ const addParams = (): string[] => {
async function startAlist() {
- alistInfo.endpoint.url='http://localhost:'+(alistInfo.alistConfig.scheme?.http_port||5573)
+ //自动分配端口
+ alistInfo.alistConfig.scheme!.http_port != (await getAvailablePorts(2))[1]
+
+ alistInfo.endpoint.url = 'http://localhost:' + (alistInfo.alistConfig.scheme?.http_port || 5573)
await setAlistPass(nmConfig.framework.alist.password)
alistInfo.endpoint.auth.token = await getAlistToken()
@@ -46,7 +49,7 @@ async function startAlist() {
while (true) {
await sleep(500)
- if (await alist_api_ping()&&alistInfo.process.log.includes('start HTTP server')) {
+ if (await alist_api_ping() && alistInfo.process.log.includes('start HTTP server')) {
break;
}
}
@@ -56,9 +59,9 @@ async function stopAlist() {
alistInfo.process.child && await alistInfo.process.child.kill()
}
- async function restartAlist() {
+async function restartAlist() {
await stopAlist()
await startAlist()
}
-export { addParams, startAlist, stopAlist, alistDataDir ,restartAlist}
+export { addParams, startAlist, stopAlist, alistDataDir, restartAlist }
diff --git a/src/utils/rclone/process.ts b/src/utils/rclone/process.ts
index ff4f82e..1f686ea 100644
--- a/src/utils/rclone/process.ts
+++ b/src/utils/rclone/process.ts
@@ -2,7 +2,7 @@ import { invoke } from "@tauri-apps/api";
import { Command } from "@tauri-apps/api/shell";
import { rcloneInfo } from "../../services/rclone";
import { rclone_api_noop, rclone_api_post } from "./request";
-import { formatPath, randomString, sleep } from "../utils";
+import { formatPath, getAvailablePorts, randomString, sleep } from "../utils";
import { alistInfo } from "../../services/alist";
import { delStorage } from "../../controller/storage/storage";
import { nmConfig, osInfo, roConfig } from "../../services/config";
@@ -21,6 +21,9 @@ async function startRclone() {
rcloneInfo.endpoint.auth.pass = randomString(128)
} */
+ //自动分配端口
+ rcloneInfo.endpoint.localhost.port = (await getAvailablePorts(2))[1]
+
rcloneInfo.endpoint.url = 'http://localhost:' + rcloneInfo.endpoint.localhost.port.toString()
let args: string[] = [
@@ -31,7 +34,7 @@ async function startRclone() {
`--rc-user=${nmConfig.framework.rclone.user}`,
`--rc-pass=${nmConfig.framework.rclone.password}`,
'--rc-allow-origin=' + window.location.origin || '*',
- '--config=' +formatPath( rcloneDataDir() + '/rclone.conf', osInfo.osType === 'Windows_NT'),
+ '--config=' + formatPath(rcloneDataDir() + '/rclone.conf', osInfo.osType === 'Windows_NT'),
];
if (nmConfig.framework.rclone.user === '') {
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index 5893160..a7282a9 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -210,4 +210,9 @@ export async function showPathInExplorer(path: string, isDir?: boolean) {
export async function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+
+export async function getAvailablePorts(count: number = 1) {
+ return await invoke('get_available_ports',{count:count}) as number[]
}
\ No newline at end of file
From 99a255b47c418f1b832c0a3e9222aed1e5ef826d Mon Sep 17 00:00:00 2001
From: VirtualHotBar <96966978+VirtualHotBar@users.noreply.github.com>
Date: Sat, 1 Jun 2024 21:23:12 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E5=85=B7=E4=BD=93=E9=80=9F=E5=BA=A6=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/controller/language/pack/en.json | 3 ++-
src/controller/language/pack/zh-cn.json | 3 ++-
src/controller/language/pack/zh-hant.json | 3 ++-
src/controller/stats/stats.ts | 2 +-
src/controller/test.ts | 2 +-
src/page/transmit/transmit.tsx | 18 ++++++++++++++----
6 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/src/controller/language/pack/en.json b/src/controller/language/pack/en.json
index bbbcb4e..47c17eb 100644
--- a/src/controller/language/pack/en.json
+++ b/src/controller/language/pack/en.json
@@ -487,5 +487,6 @@
"description.thunderx": "Thunder X",
"description.thunderxexpert": "Thunder X Expert Edition",
- "restartself_to_take_effect": "Restart to take effect"
+ "restartself_to_take_effect": "Restart to take effect",
+ "unable_to_obtain_transmission_speed":"The specific transmission speed may not be available at present, but the transmission is still in progress."
}
\ No newline at end of file
diff --git a/src/controller/language/pack/zh-cn.json b/src/controller/language/pack/zh-cn.json
index b78cc4a..d7b70f7 100644
--- a/src/controller/language/pack/zh-cn.json
+++ b/src/controller/language/pack/zh-cn.json
@@ -556,5 +556,6 @@
"description.thunderx": "迅雷X",
"description.thunderxexpert": "迅雷X专家版",
- "restartself_to_take_effect": "重启软件以使更改生效"
+ "restartself_to_take_effect": "重启软件以使更改生效",
+ "unable_to_obtain_transmission_speed":"当前可能无法获取具体传输速度,但传输仍在进行。"
}
\ No newline at end of file
diff --git a/src/controller/language/pack/zh-hant.json b/src/controller/language/pack/zh-hant.json
index 1d88812..4c52ae8 100644
--- a/src/controller/language/pack/zh-hant.json
+++ b/src/controller/language/pack/zh-hant.json
@@ -556,5 +556,6 @@
"description.thunderx": "迅雷X",
"description.thunderxexpert": "迅雷X專家版",
- "restartself_to_take_effect": "更改設定需要重新啟動程式才能生效。"
+ "restartself_to_take_effect": "更改設定需要重新啟動程式才能生效。",
+ "unable_to_obtain_transmission_speed":"當前可能無法獲取具體傳送速率,但傳輸仍在進行。"
}
diff --git a/src/controller/stats/stats.ts b/src/controller/stats/stats.ts
index f983bdd..418e5b2 100644
--- a/src/controller/stats/stats.ts
+++ b/src/controller/stats/stats.ts
@@ -18,7 +18,7 @@ async function reupStats() {
rcloneInfo.stats = {
...stats,
- realSpeed: realSpeed
+ realSpeed: realSpeed/* ||stats.speed */
}
//历史状态
diff --git a/src/controller/test.ts b/src/controller/test.ts
index cc661d5..75ecfd3 100644
--- a/src/controller/test.ts
+++ b/src/controller/test.ts
@@ -28,7 +28,7 @@ export async function Test() {
console.log(await rclone_api_post('/options/get'));
console.log(await rclone_api_post('/rc/list'),);
- console.log(await getAvailablePorts() );
+ console.log((await getAvailablePorts(2))[1]);
//exit(true)
diff --git a/src/page/transmit/transmit.tsx b/src/page/transmit/transmit.tsx
index d737964..62a25bc 100644
--- a/src/page/transmit/transmit.tsx
+++ b/src/page/transmit/transmit.tsx
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'
import { rcloneInfo, rcloneStatsHistory } from '../../services/rclone'
import { hooks } from '../../services/hook'
import { RcloneTransferItem } from '../../type/rclone/stats'
-import { Card, Descriptions, List, Progress, Space, Statistic, Grid, Typography } from '@arco-design/web-react'
+import { Card, Descriptions, List, Progress, Space, Statistic, Grid, Typography, Alert } from '@arco-design/web-react'
import { formatETA, formatSize } from '../../utils/utils'
import { Area } from '@ant-design/charts'
import { NoData_module } from '../other/noData'
@@ -32,7 +32,17 @@ function Transmit_page() {
title={t('overview')}
bordered={false}
>
+
+ {
+ transmitList.length > 0 && rcloneInfo.stats.realSpeed === 0 &&
+
+ }
+
{rcloneInfo.stats.bytes > 0 && }
{
return
-
-
+
+
-
+
{item.name}
Date: Sat, 1 Jun 2024 21:23:37 +0800
Subject: [PATCH 5/5] Update stats.ts
---
src/controller/stats/stats.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/controller/stats/stats.ts b/src/controller/stats/stats.ts
index 418e5b2..0e05a49 100644
--- a/src/controller/stats/stats.ts
+++ b/src/controller/stats/stats.ts
@@ -18,7 +18,7 @@ async function reupStats() {
rcloneInfo.stats = {
...stats,
- realSpeed: realSpeed/* ||stats.speed */
+ realSpeed: realSpeed||0/* stats.speed */
}
//历史状态