From 4e7f9d650ed77db5c2ff7388a140fed790e2d784 Mon Sep 17 00:00:00 2001 From: Yury Date: Wed, 15 May 2024 11:41:10 +0300 Subject: [PATCH 1/8] feat: changed MIME type of the uploaded file to sigit --- src/utils/misc.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/misc.ts b/src/utils/misc.ts index 6f5922c..1dde474 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -18,8 +18,8 @@ export const uploadToFileStorage = async ( const unixNow = Math.floor(Date.now() / 1000) // Create a File object with the Blob data - const file = new File([blob], `zipped-${unixNow}.zip`, { - type: 'application/zip' + const file = new File([blob], `compressed-${unixNow}.sigit`, { + type: 'application/sigit' }) // Define event metadata for authorization @@ -39,13 +39,13 @@ export const uploadToFileStorage = async ( const authEvent = await nostrController.signEvent(event) // URL of the file storage service - const FILE_STORAGE_URL = 'https://blossom.sigit.io' + const FILE_STORAGE_URL = 'https://blossom.sigit.io' // REFACTOR: should be an env // Upload the file to the file storage service using Axios const response = await axios.put(`${FILE_STORAGE_URL}/upload`, file, { headers: { Authorization: 'Nostr ' + btoa(JSON.stringify(authEvent)), // Set authorization header - 'Content-Type': 'application/zip' // Set content type header + 'Content-Type': 'application/sigit' // Set content type header } }) From 819902eafbd1a0af0ae5880440abd3e2f9fa8f87 Mon Sep 17 00:00:00 2001 From: Yury Date: Wed, 15 May 2024 11:50:21 +0300 Subject: [PATCH 2/8] chore: fixed code formatting --- .prettierrc | 7 ++++++ package.json | 2 ++ src/App.tsx | 2 +- src/components/AppBar/AppBar.tsx | 12 ++++----- src/components/username.tsx | 14 +++++------ src/controllers/MetadataController.ts | 10 +++----- src/controllers/NostrController.ts | 10 +++----- src/layouts/Main.tsx | 4 +-- src/pages/decrypt/index.tsx | 12 ++++----- src/pages/home/index.tsx | 4 +-- src/pages/landing/LandingPage.tsx | 12 ++++----- src/pages/login/index.tsx | 19 +++++++------- src/pages/profile/index.tsx | 31 +++++++++++++---------- src/pages/sign/index.tsx | 36 +++++++++++++-------------- src/pages/verify/index.tsx | 36 +++++++++++++-------------- src/types/errors/DecryptionError.ts | 13 +++++----- src/utils/crypto.ts | 4 +-- src/utils/misc.ts | 4 ++- 18 files changed, 122 insertions(+), 110 deletions(-) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..5b429c3 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "trailingComma": "none", + "tabWidth": 2, + "semi": false, + "singleQuote": true, + "endOfLine": "auto" +} diff --git a/package.json b/package.json index 6d1ea04..75a6c85 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,8 @@ "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint:fix": "eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "formatter:check": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"", + "formatter:fix": "npx prettier --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"", "preview": "vite preview" }, "dependencies": { diff --git a/src/App.tsx b/src/App.tsx index 6b2a50d..58f0c71 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -67,7 +67,7 @@ const App = () => { })} { const isAuthenticated = authState?.loggedIn === true return ( - + - Logo navigate('/')} /> + Logo navigate('/')} /> @@ -99,7 +99,7 @@ export const AppBar = () => { onClick={() => { navigate(appPublicRoutes.login) }} - variant='contained' + variant="contained" > Sign in @@ -113,7 +113,7 @@ export const AppBar = () => { handleClick={handleOpenUserMenu} /> { display: { md: 'none' } }} > - {username} + {username} { { return ( user-avatar { }} /> { if (res.status === 'rejected') { - failedPublishes.push( - { - relay: relays[index], - error: res.reason.message - } - ) + failedPublishes.push({ + relay: relays[index], + error: res.reason.message + }) } }) diff --git a/src/layouts/Main.tsx b/src/layouts/Main.tsx index 8d1bd81..b452354 100644 --- a/src/layouts/Main.tsx +++ b/src/layouts/Main.tsx @@ -59,13 +59,13 @@ export const MainLayout = () => { setIsLoading(false) }, [dispatch]) - if (isLoading) return + if (isLoading) return return ( <> - + { <> {isLoading && } - + Select encrypted zip file @@ -104,11 +104,11 @@ export const DecryptZip = () => { > {isDraggingOver && ( - Drop file here + Drop file here )} setSelectedFile(value)} InputProps={{ @@ -119,8 +119,8 @@ export const DecryptZip = () => { /> setEncryptionKey(e.target.value)} /> @@ -129,7 +129,7 @@ export const DecryptZip = () => { diff --git a/src/pages/landing/LandingPage.tsx b/src/pages/landing/LandingPage.tsx index 5a03ddb..9a24f04 100644 --- a/src/pages/landing/LandingPage.tsx +++ b/src/pages/landing/LandingPage.tsx @@ -57,7 +57,7 @@ export const LandingPage = () => { ? theme.palette.getContrastText(bodyBackgroundColor) : '' }} - variant='h4' + variant="h4" > What is Nostr? @@ -67,14 +67,14 @@ export const LandingPage = () => { ? theme.palette.getContrastText(bodyBackgroundColor) : '' }} - variant='body1' + variant="body1" > Nostr is a decentralised messaging protocol where YOU own your identity. To get started, you must have an existing{' '} Nostr account @@ -95,7 +95,7 @@ export const LandingPage = () => {