From 01c29cef207c841072b71cd3940ac8d3c63ae1e2 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Fri, 28 Jul 2023 11:35:58 -0700 Subject: [PATCH] chore: :art: format --- packages/backend/src/server/index.ts | 13 ++++++----- .../backend/src/services/drive/add-file.ts | 18 ++++++++++----- packages/backend/src/services/drive/s3.ts | 4 +++- .../src/components/MkImgWithBlurhash.vue | 22 +++++++++---------- packages/client/src/components/MkMedia.vue | 15 +++++++++---- .../client/src/components/MkStarButton.vue | 2 +- 6 files changed, 47 insertions(+), 27 deletions(-) diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index 6c205933d..92961d33d 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -223,7 +223,7 @@ export const startServer = () => { server.listen({ port: config.port, - host: config.bind + host: config.bind, }); return server; @@ -260,8 +260,11 @@ export default () => } }); - server.listen({ - port: config.port, - host: config.bind - }, () => resolve(undefined)); + server.listen( + { + port: config.port, + host: config.bind, + }, + () => resolve(undefined), + ); }); diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index ad2778619..9e8e57cc9 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -52,13 +52,15 @@ function urlPathJoin( url.pathname.endsWith("/") ? url.pathname.slice(0, -1) : url.pathname, ); url.pathname = pathParts - .filter((x) => x !== null && x.toString().length > 0).join("/"); + .filter((x) => x !== null && x.toString().length > 0) + .join("/"); } return url.toString(); } const baseParts = baseOrParts.concat(pathParts ?? []); return baseParts - .filter((x) => x !== null && x.toString().length > 0).join("/"); + .filter((x) => x !== null && x.toString().length > 0) + .join("/"); } /*** @@ -104,7 +106,7 @@ async function save( const baseUrl = new URL( meta.objectStorageBaseUrl ?? `/${meta.objectStorageBucket}`, `${meta.objectStorageUseSSL ? "https" : "http"}://${ - meta.objectStorageEndpoint + meta.objectStorageEndpoint }${meta.objectStoragePort ? `:${meta.objectStoragePort}` : ""}`, ); @@ -124,7 +126,10 @@ async function save( const uploads = [upload(key, fs.createReadStream(path), type, name)]; if (alts.webpublic) { - webpublicKey = urlPathJoin([meta.objectStoragePrefix, `webpublic-${uuid()}.${alts.webpublic.ext}`]); + webpublicKey = urlPathJoin([ + meta.objectStoragePrefix, + `webpublic-${uuid()}.${alts.webpublic.ext}`, + ]); webpublicUrl = urlPathJoin(baseUrl, [webpublicKey]); logger.info(`uploading webpublic: ${webpublicKey}`); @@ -134,7 +139,10 @@ async function save( } if (alts.thumbnail) { - thumbnailKey = urlPathJoin([meta.objectStoragePrefix, `thumbnail-${uuid()}.${alts.thumbnail.ext}`]); + thumbnailKey = urlPathJoin([ + meta.objectStoragePrefix, + `thumbnail-${uuid()}.${alts.thumbnail.ext}`, + ]); thumbnailUrl = urlPathJoin(baseUrl, [thumbnailKey]); logger.info(`uploading thumbnail: ${thumbnailKey}`); diff --git a/packages/backend/src/services/drive/s3.ts b/packages/backend/src/services/drive/s3.ts index 80a9dfece..9357be21c 100644 --- a/packages/backend/src/services/drive/s3.ts +++ b/packages/backend/src/services/drive/s3.ts @@ -26,6 +26,8 @@ export function getS3(meta: Meta) { }, }); } catch (e) { - throw new Error(`Failed to construct S3 client, assembled S3 URL: ${u}\n${e}`); + throw new Error( + `Failed to construct S3 client, assembled S3 URL: ${u}\n${e}`, + ); } } diff --git a/packages/client/src/components/MkImgWithBlurhash.vue b/packages/client/src/components/MkImgWithBlurhash.vue index d07542e43..fb7074a18 100644 --- a/packages/client/src/components/MkImgWithBlurhash.vue +++ b/packages/client/src/components/MkImgWithBlurhash.vue @@ -13,10 +13,10 @@ :type="type" :alt="alt" :class="{ - cover, - wide: largestDimension === 'width', - tall: largestDimension === 'height' - }" + cover, + wide: largestDimension === 'width', + tall: largestDimension === 'height', + }" :style="{ 'object-fit': cover ? 'cover' : null }" loading="lazy" @load="onLoad" @@ -36,7 +36,7 @@ const props = withDefaults( title?: string | null; size?: number; cover?: boolean; - largestDimension?: "width" | "height"; + largestDimension?: "width" | "height"; }>(), { src: null, @@ -88,12 +88,12 @@ canvas { img { object-fit: contain; - &.wide { - width: 100%; - } + &.wide { + width: 100%; + } - &.tall { - height: 100%; - } + &.tall { + height: 100%; + } } diff --git a/packages/client/src/components/MkMedia.vue b/packages/client/src/components/MkMedia.vue index 96b38e4fd..7d9e3f90d 100644 --- a/packages/client/src/components/MkMedia.vue +++ b/packages/client/src/components/MkMedia.vue @@ -26,7 +26,7 @@ :alt="media.comment" :type="media.type" :cover="false" - :largest-dimension="largestDimension" + :largest-dimension="largestDimension" />
GIF
@@ -121,10 +121,17 @@ const mediaType = computed(() => { : props.media.type; }); -let largestDimension: 'width'|'height'; +let largestDimension: "width" | "height"; -if (props.media.type.startsWith('image') && props.media.properties?.width && props.media.properties?.height) { - largestDimension = props.media.properties.width > props.media.properties.height ? 'width' : 'height' +if ( + props.media.type.startsWith("image") && + props.media.properties?.width && + props.media.properties?.height +) { + largestDimension = + props.media.properties.width > props.media.properties.height + ? "width" + : "height"; } function captionPopup() { os.alert({ diff --git a/packages/client/src/components/MkStarButton.vue b/packages/client/src/components/MkStarButton.vue index 19cff8e5b..cf549d366 100644 --- a/packages/client/src/components/MkStarButton.vue +++ b/packages/client/src/components/MkStarButton.vue @@ -6,7 +6,7 @@ >