mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-20 01:50:04 +00:00
disable sync if connect fail
This commit is contained in:
parent
213743bad2
commit
90086f3262
1 changed files with 12 additions and 0 deletions
12
lib/Sync.rb
12
lib/Sync.rb
|
@ -39,6 +39,10 @@ class Sync
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(gpg_password)
|
def get(gpg_password)
|
||||||
|
if !@sync
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
send_msg = {:action => 'get',
|
send_msg = {:action => 'get',
|
||||||
:gpg_key => @gpg_key,
|
:gpg_key => @gpg_key,
|
||||||
:password => @password,
|
:password => @password,
|
||||||
|
@ -72,6 +76,10 @@ class Sync
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(data)
|
def update(data)
|
||||||
|
if !@sync
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
send_msg = {:action => 'update',
|
send_msg = {:action => 'update',
|
||||||
:gpg_key => @gpg_key,
|
:gpg_key => @gpg_key,
|
||||||
:password => @password,
|
:password => @password,
|
||||||
|
@ -99,6 +107,10 @@ class Sync
|
||||||
end
|
end
|
||||||
|
|
||||||
def close()
|
def close()
|
||||||
|
if !@sync
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
send_msg = {:action => 'close'}
|
send_msg = {:action => 'close'}
|
||||||
@socket.puts send_msg.to_json
|
@socket.puts send_msg.to_json
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue