diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3630f58..c60ca3d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -26,8 +26,12 @@ jobs:
node-version: lts/*
- name: get version
- run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
+ run: |
+ PACKAGE_VERSION=$(node -p "require('./package.json').version")
+ sed -i "s/^version = \".*\"/version = \"$PACKAGE_VERSION\"/" src-tauri/Cargo.toml
+ echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
+
- name: create release
id: create-release
uses: actions/github-script@v7
diff --git a/package.json b/package.json
index d705efc..de078bf 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "netmount-gui",
"private": true,
- "version": "1.0.0beta",
+ "version": "1.0.1",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/page/setting/setting.tsx b/src/page/setting/setting.tsx
index 1ce3cc4..fc54161 100644
--- a/src/page/setting/setting.tsx
+++ b/src/page/setting/setting.tsx
@@ -103,7 +103,7 @@ export default function Setting_page() {
{/* {t('technology_stack')}:Tauri,TypeScript,Vite,React,Arco Design,Rust
*/}
Copyright © 2024-Present
- { openUrlInBrowser(roConfig.url.docs ) }}>VirtualHotBar
+ { openUrlInBrowser(roConfig.url.vhbBlog ) }}>VirtualHotBar
{ openUrlInBrowser(roConfig.url.website) }}> NetMount
diff --git a/src/page/transmit/transmit.tsx b/src/page/transmit/transmit.tsx
index 79a552a..d91898d 100644
--- a/src/page/transmit/transmit.tsx
+++ b/src/page/transmit/transmit.tsx
@@ -27,7 +27,7 @@ function Transmit_page() {
}, [])
return (
-
+
0 && }
0 ? [
{
- label:t('used_time'),
+ label: t('used_time'),
value: formatETA(rcloneInfo.stats.transferTime)
}
] : []),
@@ -77,7 +77,7 @@ function Transmit_page() {
bordered={false}
>
-
}>
+
}>
{
transmitList.map((item, index) => {
return
@@ -102,7 +102,7 @@ function Transmit_page() {
},
{
label: t('source'),
- value: item.srcFs.replace(alistInfo.markInRclone+':','')
+ value: (item.srcFs || '').replace(alistInfo.markInRclone + ':', '')
},
{
label: t('speed_avg'),
@@ -117,7 +117,7 @@ function Transmit_page() {
...(item.dstFs ? [
{
label: t('target'),
- value: item.dstFs.replace(alistInfo.markInRclone+':','')
+ value: (item.dstFs || '').replace(alistInfo.markInRclone + ':', '')
}
] : []),
]} />
diff --git a/src/services/alist.ts b/src/services/alist.ts
index c05f29b..8a9902f 100644
--- a/src/services/alist.ts
+++ b/src/services/alist.ts
@@ -9,8 +9,8 @@ let alistInfo: AlistInfo = {
url: '',
isLocal: true,
auth: {
- user: 'admin',
- password: randomString(16) ,//process.env.NODE_ENV === 'development' ? 'admin' : randomString(32),!!!!!密码长度为32时rclone会报错
+ //user: 'admin',
+ //password: randomString(16) ,//process.env.NODE_ENV === 'development' ? 'admin' : randomString(32),!!!!!密码长度为32时rclone会报错
token: ''
}
},
diff --git a/src/services/config.ts b/src/services/config.ts
index 44a0951..dc75126 100644
--- a/src/services/config.ts
+++ b/src/services/config.ts
@@ -1,5 +1,6 @@
import { invoke } from "@tauri-apps/api"
import { NMConfig, OSInfo } from "../type/config"
+import { randomString } from "../utils/utils"
const roConfig = {
url: {
@@ -65,6 +66,16 @@ let nmConfig: NMConfig = {
themeMode: roConfig.options.setting.themeMode.select[roConfig.options.setting.themeMode.defIndex],
startHide: false,
},
+ framework:{
+ rclone:{
+ user: process.env.NODE_ENV != 'development'?randomString(32):'',
+ password: process.env.NODE_ENV != 'development'?randomString(128):'',
+ },
+ alist:{
+ user: 'admin',
+ password: randomString(16) ,//process.env.NODE_ENV === 'development' ? 'admin' : randomString(32),!!!!!密码长度为32时rclone会报错
+ }
+ }
}
const setNmConfig = (config: NMConfig) => {
diff --git a/src/type/alist/alistInfo.d.ts b/src/type/alist/alistInfo.d.ts
index 0a62fd4..727eaeb 100644
--- a/src/type/alist/alistInfo.d.ts
+++ b/src/type/alist/alistInfo.d.ts
@@ -6,8 +6,8 @@ interface AlistInfo {
url: string,
isLocal: true,
auth: {
- user: string;
- password: string;
+ //user: string;
+ //password: string;
token: string;
};
};
diff --git a/src/type/config.d.ts b/src/type/config.d.ts
index c72ccb8..c10e461 100644
--- a/src/type/config.d.ts
+++ b/src/type/config.d.ts
@@ -12,10 +12,20 @@ interface NMConfig {
},
settings: {
themeMode: 'dark' | 'light' | 'auto' | string,
- startHide:boolean,
- language?:string
+ startHide: boolean,
+ language?: string
},
- notice?:Notice
+ notice?: Notice,
+ framework: {
+ rclone: {
+ user: string,
+ password: string,
+ },
+ alist: {
+ user: string,
+ password: string,
+ }
+ }
}
@@ -28,7 +38,7 @@ interface MountListItem {
interface TaskListItem {
name: string,
- taskType: 'copy' | 'move' | 'delete' | 'sync' |'bisync'| string,
+ taskType: 'copy' | 'move' | 'delete' | 'sync' | 'bisync' | string,
source: {
storageName: string,
path: string,
@@ -41,7 +51,7 @@ interface TaskListItem {
enable: boolean
run: {
runId?: number,//任务id,setTimeout或setInterval的返回值
- mode: 'time' | 'interval' | 'start' |'disposable'| string,//start:软件启动时执行,time:定时执行,interval:间隔执行 , disposable:一次性执行(执行后删除任务)
+ mode: 'time' | 'interval' | 'start' | 'disposable' | string,//start:软件启动时执行,time:定时执行,interval:间隔执行 , disposable:一次性执行(执行后删除任务)
time: {
intervalDays: number,//间隔天数
h: number,//小时
@@ -51,7 +61,7 @@ interface TaskListItem {
interval?: number,//周期执行,单位ms
},
runInfo: {
- error?:boolean
+ error?: boolean
msg?: string,
}
}
diff --git a/src/type/rclone/rcloneInfo.d.ts b/src/type/rclone/rcloneInfo.d.ts
index 83b8fda..1895832 100644
--- a/src/type/rclone/rcloneInfo.d.ts
+++ b/src/type/rclone/rcloneInfo.d.ts
@@ -11,8 +11,8 @@ interface RcloneInfo {
url: string,
isLocal: boolean,// 是否为本地地址
auth: {
- user: string,
- pass: string,
+ //user: string,
+ //pass: string,
},
localhost: {
port: number,
diff --git a/src/utils/alist/alist.ts b/src/utils/alist/alist.ts
index 5cbca67..1929dc1 100644
--- a/src/utils/alist/alist.ts
+++ b/src/utils/alist/alist.ts
@@ -4,6 +4,7 @@ import { addParams, alistDataDir } from "./process"
import { alistInfo } from "../../services/alist"
import { createStorage } from "../../controller/storage/create"
import { delStorage } from "../../controller/storage/storage"
+import { nmConfig } from "../../services/config"
@@ -30,8 +31,8 @@ async function addAlistInRclone(){
await createStorage(alistInfo.markInRclone,'webdav',{
'url':alistInfo.endpoint.url+'/dav',
'vendor':'other',
- 'user':alistInfo.endpoint.auth.user,
- 'pass':alistInfo.endpoint.auth.password,
+ 'user':nmConfig.framework.alist.user,
+ 'pass':nmConfig.framework.alist.password,
})
}
diff --git a/src/utils/alist/process.ts b/src/utils/alist/process.ts
index d60a271..824f452 100644
--- a/src/utils/alist/process.ts
+++ b/src/utils/alist/process.ts
@@ -4,7 +4,7 @@ import { rcloneInfo } from "../../services/rclone";
import { formatPath, randomString } from "../utils";
import { alistInfo } from "../../services/alist";
import { homeDir } from "@tauri-apps/api/path";
-import { osInfo, roConfig } from "../../services/config";
+import { nmConfig, osInfo, roConfig } from "../../services/config";
import { getAlistToken, modifyAlistConfig, setAlistPass } from "./alist";
import { alist_api_ping } from "./request";
@@ -22,7 +22,7 @@ const addParams = (): string[] => {
async function startAlist() {
alistInfo.endpoint.url='http://localhost:'+(alistInfo.alistConfig.scheme?.http_port||5573)
- await setAlistPass(alistInfo.endpoint.auth.password)
+ await setAlistPass(nmConfig.framework.alist.password)
alistInfo.endpoint.auth.token = await getAlistToken()
await modifyAlistConfig()
diff --git a/src/utils/rclone/process.ts b/src/utils/rclone/process.ts
index ef0dcf7..e2fdfca 100644
--- a/src/utils/rclone/process.ts
+++ b/src/utils/rclone/process.ts
@@ -5,10 +5,10 @@ import { rclone_api_noop, rclone_api_post } from "./request";
import { formatPath, randomString } from "../utils";
import { alistInfo } from "../../services/alist";
import { delStorage } from "../../controller/storage/storage";
-import { osInfo, roConfig } from "../../services/config";
+import { nmConfig, osInfo, roConfig } from "../../services/config";
const rcloneDataDir = () => {
- return formatPath(roConfig.env.path.homeDir + '/.netmount/',osInfo.osType==='Windows_NT')
+ return formatPath(roConfig.env.path.homeDir + '/.netmount/', osInfo.osType === 'Windows_NT')
}
async function startRclone() {
@@ -16,23 +16,25 @@ async function startRclone() {
await stopRclone()
}
- if (process.env.NODE_ENV != 'development') {
- rcloneInfo.endpoint.auth.user = randomString(32)
- rcloneInfo.endpoint.auth.pass = randomString(128)
- }
+ /* if (process.env.NODE_ENV != 'development') {
+ rcloneInfo.endpoint.auth.user = randomString(32)
+ rcloneInfo.endpoint.auth.pass = randomString(128)
+ } */
rcloneInfo.endpoint.url = 'http://localhost:' + rcloneInfo.endpoint.localhost.port.toString()
let args: string[] = [
'rcd',
`--rc-addr=:${rcloneInfo.endpoint.localhost.port.toString()}`,
- `--rc-user=${rcloneInfo.endpoint.auth.user}`,
- `--rc-pass=${rcloneInfo.endpoint.auth.pass}`,
- '--rc-allow-origin='+window.location.origin||'*',
- '--config='+rcloneDataDir()+'/rclone.conf',
+ /*`--rc-user=${rcloneInfo.endpoint.auth.user}`,
+ `--rc-pass=${rcloneInfo.endpoint.auth.pass}`, */
+ `--rc-user=${nmConfig.framework.rclone.user}`,
+ `--rc-pass=${nmConfig.framework.rclone.password}`,
+ '--rc-allow-origin=' + window.location.origin || '*',
+ '--config=' + rcloneDataDir() + '/rclone.conf',
];
- if (rcloneInfo.endpoint.auth.user === '') {
+ if (nmConfig.framework.rclone.user === '') {
args.push('--rc-no-auth')
}
@@ -71,4 +73,4 @@ async function restartRclone() {
await startRclone();
}
-export { startRclone, stopRclone,restartRclone }
\ No newline at end of file
+export { startRclone, stopRclone, restartRclone }
\ No newline at end of file
diff --git a/src/utils/rclone/request.ts b/src/utils/rclone/request.ts
index 15d0b8f..cf48535 100644
--- a/src/utils/rclone/request.ts
+++ b/src/utils/rclone/request.ts
@@ -1,8 +1,9 @@
import { Message } from "@arco-design/web-react";
import { rcloneInfo } from "../../services/rclone";
+import { nmConfig } from "../../services/config";
let rcloneApiHeaders = {
- Authorization: `Basic ${btoa(`${rcloneInfo.endpoint.auth.user}:${rcloneInfo.endpoint.auth.pass}`)}`,
+ Authorization: `Basic ${btoa(`${nmConfig.framework.rclone.user}:${nmConfig.framework.rclone.password}`)}`,
'Content-Type': 'application/json'
};
@@ -17,7 +18,7 @@ async function rclone_api_noop(): Promise {
function rclone_api_post(path: string, bodyData: object = {}, ignoreError?: boolean) {
// 以 base64 编码的方式来设置账密字符串
- const base64Credentials = btoa(`${rcloneInfo.endpoint.auth.user}:${rcloneInfo.endpoint.auth.pass}`);
+ const base64Credentials = btoa(`${nmConfig.framework.rclone.user}:${nmConfig.framework.rclone.password}`);
// 定义请求头部,包括授权头部
rcloneApiHeaders = {