Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Import page fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Sep 28, 2022
1 parent 77a8665 commit dccc473
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion interface/windows/import/import.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="transparent-800 mb-5 flex w-full flex-row items-center justify-between rounded-xl p-5 text-left">
<div>
<h2>Import from images</h2>
<h3>Choose images that contain a 2FA QR code.</h3>
<h3>Choose images that contain compatible QR codes.</h3>
</div>
<div class="ml-10 flex gap-3">
<button class="button" on:click={chooseImages}>
Expand Down
22 changes: 17 additions & 5 deletions interface/windows/import/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { fs, dialog } from "@tauri-apps/api"
import { getState, setState } from "../../stores/state"
import { totpImageConverter, migrationImageConverter } from "../../utils/convert"
import { navigate } from "../../utils/navigate"
import logger from "interface/utils/logger"

/**
* Choose images, then read QR codes
Expand Down Expand Up @@ -209,12 +210,17 @@ export const captureScreen = async () => {
} else {
// Wrong QR code found
dialog.message("Wrong QR code found on the picture! \n\nPlease try again with another picture!", { type: "error" })
console.error("Wrong QR code found on the picture:", res)
logger.error(`Wrong QR code found on the picture: ${JSON.stringify(res)}`)

dialogElement.close()
reader.stop()
track.stop()
}
} catch (err) {
console.error(`Error: ${err}`)

logger.error(`Error during screen capture: ${err}`)
dialog.message(`Error occurred during the screen capture: \n\n${err}`, { type: "error" })

dialogElement.close()
}
}

Expand Down Expand Up @@ -287,12 +293,18 @@ export const useWebcam = async () => {
} else {
// Wrong QR code found
dialog.message("Wrong QR code found on the picture! \n\nPlease try again with another picture!", { type: "error" })
console.error("Wrong QR code found on the picture:", res)
logger.error(`Wrong QR code found on the picture: ${JSON.stringify(res)}`)

dialogElement.close()
reader.stop()
}
} catch (err) {
// Unknown error
dialog.message(`Error occurred while using the webcam: \n\n${err}`, { type: "error" })
console.error(`Error during webcam import: ${err}`)
logger.error(`Error during webcam import: ${err}`)

dialogElement.close()
reader.stop()
}
}
}

0 comments on commit dccc473

Please sign in to comment.