Skip to content

Commit

Permalink
Fix logo ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed May 12, 2024
1 parent e523658 commit 4771cb2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion electron/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ unhandled();
const trayMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [new MenuItem({ label: 'Quit App', role: 'quit' })];
const appMenuBarMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [
{ role: process.platform === 'darwin' ? 'appMenu' : 'fileMenu' },
// { role: 'viewMenu' },
{ role: 'viewMenu' },
{
label: "Edit",
submenu: [
Expand Down
7 changes: 6 additions & 1 deletion src/components/account/AccountToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function round(num: number) {
<template>
<div>
<div class="c-account-item" style="text-align: center" >
<img class="c-account-item__icon" :src="item.content.image" alt="icon" style="height: 64px">
<img class="c-account-item__icon" :src="item.content.image" alt="icon" style="">

<h2 class="c-account-item__title">{{ item.content.title }}</h2>

Expand Down Expand Up @@ -126,6 +126,11 @@ function round(num: number) {

<style scoped lang="scss">
.c-account-item {
&__icon {
max-width: 120px;
height: 64px;
object-fit: contain;
}
&__title {
font-size: 1.25rem;
Expand Down
23 changes: 15 additions & 8 deletions src/components/account/edit/LogoSelect.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import apiClient from '@/service/api-client';
import { isElectron } from '@/store/main-store';
import { simpleAlert, simpleToast } from '@/utilities/alert';
import useLoading from '@/utilities/loading';
import { Clipboard } from '@capacitor/clipboard';
Expand Down Expand Up @@ -75,7 +76,7 @@ watch(currentColor, () => {
async function pasteImage() {
let imgDataUri: string | null = null;
if (Capacitor.isNativePlatform()) {
if (Capacitor.isNativePlatform() && !isElectron.value) {
imgDataUri = await readImageFromDevice();
} else {
imgDataUri = await readImageFromBrowser();
Expand Down Expand Up @@ -181,19 +182,25 @@ async function resizeImage(imgDataUri: string) {
const img = document.createElement('img');
img.addEventListener('load', (evt) => {
const canvas = document.createElement("canvas");
canvas.width = 96;
canvas.height = 96;
const ctx = canvas.getContext("2d")!;
const maxWidth = canvas.width;
const maxHeight = canvas.height;
let width = img.width;
let height = img.height;
let x = 0;
let y = 0;
if (width > height) {
canvas.width = 120;
canvas.height = 120 / width * height;
} else {
canvas.width = 96;
canvas.height = 96;
}
const ctx = canvas.getContext("2d")!;
const maxWidth = canvas.width;
const maxHeight = canvas.height;
// Resize
if (width > height) {
if (width > maxWidth) {
Expand Down
10 changes: 9 additions & 1 deletion src/service/encryption-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ export default new class EncryptionService {
async getMasterKey(kek?: Uint8Array | string) {
await sodium.ready;

kek = kek || secretToolkit.decode(kekStorage.value);
try {
kek = kek || secretToolkit.decode(kekStorage.value);
} catch (e) {
console.warn(
'Invalid KEK, debug info:',
kekStorage.value
);
throw new Error('Invalid KEK', { cause: e });
}

const secret = await sodiumCipher.decrypt(base64UrlDecode(encSecretStorage.value), kek);

Expand Down
5 changes: 3 additions & 2 deletions src/views/AccountsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@ async function deleteAccounts(accounts: Account[]) {
}
&__icon img {
width: 56px;
aspect-ratio: 1;
width: 120px;
height: 56px;
object-fit: contain;
}
}
</style>

0 comments on commit 4771cb2

Please sign in to comment.