Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
netdisc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rocosen
netdisc
Commits
ec9da2bf
Commit
ec9da2bf
authored
Dec 12, 2022
by
rocosen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:格式化
parent
8ea69e6b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
50 deletions
+51
-50
main.ts
src/main/main.ts
+14
-12
head.jsx
src/renderer/components/head.jsx
+7
-4
home.jsx
src/renderer/console/home.jsx
+11
-13
login.jsx
src/renderer/console/login.jsx
+19
-21
No files found.
src/main/main.ts
View file @
ec9da2bf
...
...
@@ -18,7 +18,7 @@ const nativeImage = require('electron').nativeImage;
const
positioner
=
require
(
'electron-traywindow-positioner'
);
const
storage
=
require
(
'electron-localstorage'
);
const
fs
=
require
(
'fs'
);
const
fse
=
require
(
'fs-extra'
)
const
fse
=
require
(
'fs-extra'
)
;
class
AppUpdater
{
constructor
()
{
log
.
transports
.
file
.
level
=
'info'
;
...
...
@@ -55,8 +55,8 @@ if (isMac) {
Menu
.
setApplicationMenu
(
null
);
const
USER_HOME
=
isMac
?
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'/bkunyun/'
:
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'/.bkunyun/'
;
?
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'/bkunyun/'
:
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'/.bkunyun/'
;
const
gotTheLock
=
app
.
requestSingleInstanceLock
();
if
(
!
gotTheLock
)
{
...
...
@@ -64,7 +64,9 @@ if (!gotTheLock) {
}
app
.
setLoginItemSettings
({
openAtLogin
:
storage
.
getItem
(
'Preferences'
)
&&
JSON
.
parse
(
storage
.
getItem
(
'Preferences'
))[
'selfStart'
],
openAtLogin
:
storage
.
getItem
(
'Preferences'
)
&&
JSON
.
parse
(
storage
.
getItem
(
'Preferences'
))[
'selfStart'
],
openAsHidden
:
false
,
path
:
process
.
execPath
,
args
:
[],
...
...
@@ -248,15 +250,15 @@ const createWindow = async () => {
fs
.
mkdir
(
USER_HOME
,
{
recursive
:
true
},
(
err
:
any
)
=>
{
if
(
err
)
return
;
async
function
copyFiles
()
{
try
{
await
fse
.
copy
(
getAssetPath
(
'/script'
),
USER_HOME
)
console
.
log
(
'success!'
)
}
catch
(
err
)
{
console
.
error
(
err
)
}
async
function
copyFiles
()
{
try
{
await
fse
.
copy
(
getAssetPath
(
'/script'
),
USER_HOME
);
console
.
log
(
'success!'
);
}
catch
(
err
)
{
console
.
error
(
err
);
}
}
copyFiles
()
copyFiles
()
;
});
mainWindow
.
once
(
'ready-to-show'
,
()
=>
{
...
...
src/renderer/components/head.jsx
View file @
ec9da2bf
...
...
@@ -3,9 +3,9 @@ import { shell } from 'electron';
//js
import
public
from
'commons/public'
;
import
{
getUserInfo
,
getUserToken
}
from
'../../commons/utils/publicMethod'
;
import
{
getUserInfo
,
getUserToken
}
from
'../../commons/utils/publicMethod'
;
import
{
Constants
}
from
'../../commons/utils/constants'
;
import
{
BACKEND_API_URI_PREFIX
}
from
'../../commons/utils/api_address'
import
{
BACKEND_API_URI_PREFIX
}
from
'../../commons/utils/api_address'
;
//ui
import
TextField
from
'@mui/material/TextField'
;
...
...
@@ -113,8 +113,11 @@ export default (props) => {
case
'2'
:
return
;
case
'3'
:
ipcSend
(
'asynchronous-message'
,
'3333333333333333333333333333333'
)
return
ipcSend
(
'asynchronous-message'
,
'3333333333333333333333333333333'
);
return
;
case
'4'
:
let
Token
=
localStorage
.
getItem
(
Constants
.
TOKEN_KEY
)
&&
...
...
src/renderer/console/home.jsx
View file @
ec9da2bf
...
...
@@ -32,22 +32,20 @@ export default (props) => {
setValue
(
newValue
);
};
useEffect
(()
=>
{
const
batDir
=
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'/.bkunyun/'
let
batOutDir
=
batDir
.
replace
(
/
\\
/g
,
'/'
);
let
srt
=
` @echo off\ncloudam.exe mount
${
getUserInfo
().
homeDirectoryMountPoint
}
:/ T: --file-perms=0777 --dir-perms=0777 --vfs-cache-mode=full --max-depth=1 --low-level-retries=2 --volname="Cloudam Drive" --human-readable --vfs-cache-poll-interval=0 --poll-interval=1m --vfs-read-chunk-size=20M --buffer-size=0 --vfs-fast-fingerprint --no-modtime --transfers=8 --cache-dir=~\\AppData\\Local\\cloudam`
fs
.
writeFile
(
batOutDir
+
'mount.bat'
,
srt
,
'utf8'
,
(
err
)
=>
{
useEffect
(()
=>
{
const
batDir
=
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'/.bkunyun/'
;
let
batOutDir
=
batDir
.
replace
(
/
\\
/g
,
'/'
);
let
srt
=
` @echo off\ncloudam.exe mount
${
getUserInfo
().
homeDirectoryMountPoint
}
:/ T: --file-perms=0777 --dir-perms=0777 --vfs-cache-mode=full --max-depth=1 --low-level-retries=2 --volname="Cloudam Drive" --human-readable --vfs-cache-poll-interval=0 --poll-interval=1m --vfs-read-chunk-size=20M --buffer-size=0 --vfs-fast-fingerprint --no-modtime --transfers=8 --cache-dir=~\\AppData\\Local\\cloudam`
;
fs
.
writeFile
(
batOutDir
+
'mount.bat'
,
srt
,
'utf8'
,
(
err
)
=>
{
if
(
err
)
{
}
else
{
shell
.
openPath
(
batOutDir
+
'start.vbs'
);
shell
.
openPath
(
batOutDir
+
'start.vbs'
);
}
}
);
},[])
});
},
[]);
return
(
<
Grid
className=
{
classes
.
initBody
}
>
...
...
src/renderer/console/login.jsx
View file @
ec9da2bf
...
...
@@ -9,8 +9,8 @@ import qs from 'qs';
import
{
Constants
}
from
'../../commons/utils/constants'
;
import
Axios
from
'../../commons/axios/Axios'
;
import
{
userInfo
}
from
'../../commons/utils/ajaxOption'
;
import
{
getUserToken
,
getUserInfo
}
from
'../../commons/utils/publicMethod'
;
import
{
BACKEND_API_URI_PREFIX
}
from
'../../commons/utils/api_address'
import
{
getUserToken
,
getUserInfo
}
from
'../../commons/utils/publicMethod'
;
import
{
BACKEND_API_URI_PREFIX
}
from
'../../commons/utils/api_address'
;
//ui
import
TextField
from
'@mui/material/TextField'
;
import
{
Button
,
Grid
}
from
'@mui/material'
;
...
...
@@ -65,7 +65,7 @@ const useStyles = makeStyles()((theme) => {
export
default
(
props
)
=>
{
const
{
classes
}
=
useStyles
();
const
{
render
,
navigate
,
setMessages
,
ipcSend
,
setOnloading
}
=
public
();
const
{
render
,
navigate
,
setMessages
,
ipcSend
,
setOnloading
}
=
public
();
const
[
username
,
setUsername
]
=
useState
(
''
);
const
[
usernameError
,
setUsernameError
]
=
useState
(
false
);
...
...
@@ -83,7 +83,7 @@ export default (props) => {
'Preferences'
,
JSON
.
stringify
({
selfStart
:
true
})
);
ipcSend
(
'openAtLogin-true'
)
ipcSend
(
'openAtLogin-true'
)
;
}
},
[]);
...
...
@@ -139,30 +139,28 @@ export default (props) => {
Constants
.
USER_INFO_TOKEN_KEY
,
JSON
.
stringify
(
data
.
res
)
);
const
dir
=
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'/AppData/Roaming/rclone/'
const
dir
=
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'/AppData/Roaming/rclone/'
;
let
mountDir
=
dir
.
replace
(
/
\\
/g
,
'/'
);
fs
.
mkdir
(
mountDir
,
{
recursive
:
true
},
(
err
)
=>
{
if
(
err
)
return
;
let
arg
=
`[
${
data
.
res
.
homeDirectoryMountPoint
}
]\ntype = cloudam\nurl =
${
BACKEND_API_URI_PREFIX
}
/\nusername =
${
data
.
res
.
homeDirectoryMountPoint
}
\nbearer_token =
${
getUserToken
().
access_token
}
\nrefresh_token =
${
getUserToken
().
refresh_token
}
`
fs
.
writeFile
(
mountDir
+
'rclone.conf'
,
arg
,
'utf8'
,
(
err
)
=>
{
if
(
err
)
return
;
let
arg
=
`[
${
data
.
res
.
homeDirectoryMountPoint
}
]\ntype = cloudam\nurl =
${
BACKEND_API_URI_PREFIX
}
/\nusername =
${
data
.
res
.
homeDirectoryMountPoint
}
\nbearer_token =
${
getUserToken
().
access_token
}
\nrefresh_token =
${
getUserToken
().
refresh_token
}
`
;
fs
.
writeFile
(
mountDir
+
'rclone.conf'
,
arg
,
'utf8'
,
(
err
)
=>
{
if
(
err
)
{
}
else
{
navigate
(
'/home'
);
ipcSend
(
'resize-home'
);
}
}
);
})
});
});
}
else
{
ipcSend
(
'openLogin-windown'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment