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) {
...
@@ -32,7 +32,7 @@ func isValidToken(token string) (bool, error) {
func
main
()
{
func
main
()
{
fmt
.
Println
(
"seetadm v0.0.
3
"
)
fmt
.
Println
(
"seetadm v0.0.
4
"
)
if
len
(
os
.
Args
)
<
6
{
if
len
(
os
.
Args
)
<
6
{
printUsage
()
printUsage
()
...
@@ -113,6 +113,7 @@ func main() {
...
@@ -113,6 +113,7 @@ func main() {
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
return
return
}
}
nodetree
.
StrSrc
+=
"/"
tmpstr
:=
nodetree
.
StrSrc
[
:
len
(
nodetree
.
StrSrc
)
-
1
]
tmpstr
:=
nodetree
.
StrSrc
[
:
len
(
nodetree
.
StrSrc
)
-
1
]
idx
:=
strings
.
LastIndex
(
tmpstr
,
"/"
)
idx
:=
strings
.
LastIndex
(
tmpstr
,
"/"
)
...
@@ -149,6 +150,12 @@ func main() {
...
@@ -149,6 +150,12 @@ func main() {
}
else
if
nodetree
.
StrOp
==
"download"
{
}
else
if
nodetree
.
StrOp
==
"download"
{
nodetree
.
StrDst
,
err
=
filepath
.
Abs
(
nodetree
.
StrDst
)
nodetree
.
StrDst
,
err
=
filepath
.
Abs
(
nodetree
.
StrDst
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
nodetree
.
StrDst
+=
"/"
nodetree
.
StrSrc
=
"data"
+
nodetree
.
StrSrc
nodetree
.
StrSrc
=
"data"
+
nodetree
.
StrSrc
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
...
@@ -159,9 +166,16 @@ func main() {
...
@@ -159,9 +166,16 @@ func main() {
var
option_remot
nodetree
.
OptionRemot
var
option_remot
nodetree
.
OptionRemot
option_remot
.
RootPath
=
[]
string
{
nodetree
.
StrSrc
}
option_remot
.
RootPath
=
[]
string
{
nodetree
.
StrSrc
}
resp_remot
,
err
:=
travremot
.
Explorer
(
option_remot
)
resp_remot
,
res
,
err
:=
travremot
.
Explorer
(
option_remot
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Println
(
err
)
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
)
b_remot
,
err
:=
json
.
Marshal
(
resp_remot
)
...
...
src/travremot/travremot.go
View file @
aa925ec
...
@@ -19,7 +19,7 @@ func init() {
...
@@ -19,7 +19,7 @@ func init() {
log
.
Println
(
"minsync.travremot.init() called"
)
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
var
root
nodetree
.
NodeRemot
...
@@ -32,12 +32,17 @@ func Explorer(option nodetree.OptionRemot) (nodetree.NodeRemot, error) {
...
@@ -32,12 +32,17 @@ func Explorer(option nodetree.OptionRemot) (nodetree.NodeRemot, error) {
child
.
Name
=
p
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
)
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
)
{
func
exploreRecursive
(
node
*
nodetree
.
NodeRemot
,
option
*
nodetree
.
OptionRemot
)
(
def
.
ErrCode
,
error
)
{
...
@@ -77,6 +82,10 @@ func exploreRecursive(node *nodetree.NodeRemot, option *nodetree.OptionRemot) (d
...
@@ -77,6 +82,10 @@ func exploreRecursive(node *nodetree.NodeRemot, option *nodetree.OptionRemot) (d
var
jsonRes
nodetree
.
DataRemot
var
jsonRes
nodetree
.
DataRemot
json
.
Unmarshal
(
body
,
&
jsonRes
)
json
.
Unmarshal
(
body
,
&
jsonRes
)
if
jsonRes
.
Msg
==
"user do not login"
{
return
def
.
ERR_NOT_LOGIN
,
nil
}
url
=
"http://"
url
=
"http://"
url
+=
nodetree
.
StrHost
url
+=
nodetree
.
StrHost
url
+=
":"
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