Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
shenyizhong
/
minsync
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit aa925ec0
authored
Jan 10, 2022
by
shenyizhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* code review
1 parent
7e265479
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
src/main.go
src/travremot/travremot.go
src/main.go
View file @
aa925ec
...
...
@@ -32,7 +32,7 @@ func isValidToken(token string) (bool, error) {
func
main
()
{
fmt
.
Println
(
"seetadm v0.0.
3
"
)
fmt
.
Println
(
"seetadm v0.0.
4
"
)
if
len
(
os
.
Args
)
<
6
{
printUsage
()
...
...
@@ -113,6 +113,7 @@ func main() {
fmt
.
Println
(
err
)
return
}
nodetree
.
StrSrc
+=
"/"
tmpstr
:=
nodetree
.
StrSrc
[
:
len
(
nodetree
.
StrSrc
)
-
1
]
idx
:=
strings
.
LastIndex
(
tmpstr
,
"/"
)
...
...
@@ -149,6 +150,12 @@ func main() {
}
else
if
nodetree
.
StrOp
==
"download"
{
nodetree
.
StrDst
,
err
=
filepath
.
Abs
(
nodetree
.
StrDst
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
nodetree
.
StrDst
+=
"/"
nodetree
.
StrSrc
=
"data"
+
nodetree
.
StrSrc
if
err
!=
nil
{
fmt
.
Println
(
err
)
...
...
@@ -159,9 +166,16 @@ func main() {
var
option_remot
nodetree
.
OptionRemot
option_remot
.
RootPath
=
[]
string
{
nodetree
.
StrSrc
}
resp_remot
,
err
:=
travremot
.
Explorer
(
option_remot
)
resp_remot
,
res
,
err
:=
travremot
.
Explorer
(
option_remot
)
if
err
!=
nil
{
log
.
Println
(
err
)
fmt
.
Println
(
"there are something wrong, check logger please"
)
return
}
else
if
res
!=
def
.
SUCCESS
{
if
res
==
def
.
ERR_NOT_LOGIN
{
fmt
.
Println
(
"invalid token"
)
}
return
}
b_remot
,
err
:=
json
.
Marshal
(
resp_remot
)
...
...
src/travremot/travremot.go
View file @
aa925ec
...
...
@@ -19,7 +19,7 @@ func init() {
log
.
Println
(
"minsync.travremot.init() called"
)
}
func
Explorer
(
option
nodetree
.
OptionRemot
)
(
nodetree
.
NodeRemot
,
error
)
{
func
Explorer
(
option
nodetree
.
OptionRemot
)
(
nodetree
.
NodeRemot
,
def
.
ErrCode
,
error
)
{
var
root
nodetree
.
NodeRemot
...
...
@@ -32,12 +32,17 @@ func Explorer(option nodetree.OptionRemot) (nodetree.NodeRemot, error) {
child
.
Name
=
p
exploreRecursive
(
&
child
,
&
option
)
res
,
err
:=
exploreRecursive
(
&
child
,
&
option
)
if
err
!=
nil
{
return
root
,
res
,
err
}
else
if
res
!=
def
.
SUCCESS
{
return
root
,
res
,
nil
}
root
.
Children
=
append
(
root
.
Children
,
&
child
)
}
return
root
,
nil
return
root
,
def
.
SUCCESS
,
nil
}
func
exploreRecursive
(
node
*
nodetree
.
NodeRemot
,
option
*
nodetree
.
OptionRemot
)
(
def
.
ErrCode
,
error
)
{
...
...
@@ -77,6 +82,10 @@ func exploreRecursive(node *nodetree.NodeRemot, option *nodetree.OptionRemot) (d
var
jsonRes
nodetree
.
DataRemot
json
.
Unmarshal
(
body
,
&
jsonRes
)
if
jsonRes
.
Msg
==
"user do not login"
{
return
def
.
ERR_NOT_LOGIN
,
nil
}
url
=
"http://"
url
+=
nodetree
.
StrHost
url
+=
":"
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment