1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-02-17 08:30:04 +00:00
This commit is contained in:
nishiki 2015-02-08 22:43:35 +01:00
parent 68062fe728
commit 59f9a5d40f

View file

@ -34,7 +34,7 @@ module MPW
@sync = SyncSSH.new(@config.sync_host, @config.sync_user, @config.sync_pwd, @config.sync_path, @config.sync_port)
when 'ftp'
require "#{APP_ROOT}/lib/Sync/FTP"
@sync = SyncFTP.new
@sync = SyncFTP.new(@config.sync_host, @config.sync_user, @config.sync_pwd, @config.sync_path, @config.sync_port)
else
@error_msg = I18n.t('error.unknown_type')
return false
@ -74,11 +74,19 @@ module MPW
@remote.list.each do |r|
if item.id == r.id
if item.last_edit < r.last_edit
raise item.error_msg if not item.update(r.name, r.group, r.host, r.protocol, r.user, r.password, r.port, r.comment)
raise item.error_msg if not item.update(name: r.name,
group: r.group,
host: r.host,
protocol: r.protocol,
user: r.user,
password: r.password,
port: r.port,
comment: r.comment
)
end
update = true
data_remote.delete(j)
item.delete
break
end
@ -96,7 +104,15 @@ module MPW
# Add item
@remote.list.each do |r|
if r.last_edit > @config.last_update
item = Item.new(r.name, r.group, r.host, r.protocol, r.user, r.password, r.port, r.comment)
item = Item.new(name: r.name,
group: r.group,
host: r.host,
protocol: r.protocol,
user: r.user,
password: r.password,
port: r.port,
comment: r.comment
)
raise @local.error_msg if not @local.add(item)
end
end