Skip to content

Commit

Permalink
fix: import
Browse files Browse the repository at this point in the history
  • Loading branch information
canwdev committed Jun 6, 2023
1 parent b1a58d2 commit a23e869
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
11 changes: 9 additions & 2 deletions electron/src/common/keepass/kdbx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,23 @@ export class KdbxHelper {
}
console.log(`[db] updateEntry ${uuid}`)
const entry = this.getEntry(uuid)
let isAutoUpdateTime = true
updates.forEach((obj) => {
// eslint-disable-next-line prefer-const
let {path, value} = obj
if (path.indexOf('creationTime') > 0) {
if (path === 'times.creationTime') {
// need convert time format to Date!
value = new Date(value)
}
if (path === 'times.lastModTime') {
value = new Date(value)
isAutoUpdateTime = false
}
setValDot(entry, path, value)
})
entry.times.update()
if (isAutoUpdateTime) {
entry.times.update()
}
this.isChanged = true
return new EntryItem(entry, true)
}
Expand Down
11 changes: 9 additions & 2 deletions nest/src/common/keepass/kdbx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,23 @@ export class KdbxHelper {
}
console.log(`[db] updateEntry ${uuid}`)
const entry = this.getEntry(uuid)
let isAutoUpdateTime = true
updates.forEach((obj) => {
// eslint-disable-next-line prefer-const
let {path, value} = obj
if (path.indexOf('creationTime') > 0) {
if (path === 'times.creationTime') {
// need convert time format to Date!
value = new Date(value)
}
if (path === 'times.lastModTime') {
value = new Date(value)
isAutoUpdateTime = false
}
setValDot(entry, path, value)
})
entry.times.update()
if (isAutoUpdateTime) {
entry.times.update()
}
this.isChanged = true
return new EntryItem(entry, true)
}
Expand Down
2 changes: 1 addition & 1 deletion vue/src/components/NoteViews/use-common-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const useCommonActions = (options) => {
},
},
isMultiple && {
label: '📃 Export JSON (Unencrypted)',
label: '📃 Export JSON (no attachments)',
props: {
onClick: () => {
handleExportJson()
Expand Down
2 changes: 2 additions & 0 deletions vue/src/utils/export-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export const importEntryListJson = async (groupUuid) => {

const entryItems: EntryItem[] = (await handleReadSelectedFile(file, true)) as EntryItem[]

entryItems.reverse()

console.log('[entryItems]', entryItems)
for (let i = 0; i < entryItems.length; i++) {
const entryDetail = entryItems[i]
Expand Down
2 changes: 1 addition & 1 deletion vue/src/views/Note/DetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default defineComponent({
const params = getEntryItemUpdateParams({
uuid: entryDetail.value.uuid,
entryDetail: entryDetail.value,
isSetModTime: true,
isSetModTime: false,
})
await kService.updateEntry(params)
Expand Down

0 comments on commit a23e869

Please sign in to comment.