chore: 🎨 format
This commit is contained in:
parent
6d1f93a022
commit
01c29cef20
6 changed files with 47 additions and 27 deletions
|
@ -223,7 +223,7 @@ export const startServer = () => {
|
||||||
|
|
||||||
server.listen({
|
server.listen({
|
||||||
port: config.port,
|
port: config.port,
|
||||||
host: config.bind
|
host: config.bind,
|
||||||
});
|
});
|
||||||
|
|
||||||
return server;
|
return server;
|
||||||
|
@ -260,8 +260,11 @@ export default () =>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen({
|
server.listen(
|
||||||
port: config.port,
|
{
|
||||||
host: config.bind
|
port: config.port,
|
||||||
}, () => resolve(undefined));
|
host: config.bind,
|
||||||
|
},
|
||||||
|
() => resolve(undefined),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -52,13 +52,15 @@ function urlPathJoin(
|
||||||
url.pathname.endsWith("/") ? url.pathname.slice(0, -1) : url.pathname,
|
url.pathname.endsWith("/") ? url.pathname.slice(0, -1) : url.pathname,
|
||||||
);
|
);
|
||||||
url.pathname = pathParts
|
url.pathname = pathParts
|
||||||
.filter((x) => x !== null && x.toString().length > 0).join("/");
|
.filter((x) => x !== null && x.toString().length > 0)
|
||||||
|
.join("/");
|
||||||
}
|
}
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
const baseParts = baseOrParts.concat(pathParts ?? []);
|
const baseParts = baseOrParts.concat(pathParts ?? []);
|
||||||
return baseParts
|
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(
|
const baseUrl = new URL(
|
||||||
meta.objectStorageBaseUrl ?? `/${meta.objectStorageBucket}`,
|
meta.objectStorageBaseUrl ?? `/${meta.objectStorageBucket}`,
|
||||||
`${meta.objectStorageUseSSL ? "https" : "http"}://${
|
`${meta.objectStorageUseSSL ? "https" : "http"}://${
|
||||||
meta.objectStorageEndpoint
|
meta.objectStorageEndpoint
|
||||||
}${meta.objectStoragePort ? `:${meta.objectStoragePort}` : ""}`,
|
}${meta.objectStoragePort ? `:${meta.objectStoragePort}` : ""}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -124,7 +126,10 @@ async function save(
|
||||||
const uploads = [upload(key, fs.createReadStream(path), type, name)];
|
const uploads = [upload(key, fs.createReadStream(path), type, name)];
|
||||||
|
|
||||||
if (alts.webpublic) {
|
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]);
|
webpublicUrl = urlPathJoin(baseUrl, [webpublicKey]);
|
||||||
|
|
||||||
logger.info(`uploading webpublic: ${webpublicKey}`);
|
logger.info(`uploading webpublic: ${webpublicKey}`);
|
||||||
|
@ -134,7 +139,10 @@ async function save(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alts.thumbnail) {
|
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]);
|
thumbnailUrl = urlPathJoin(baseUrl, [thumbnailKey]);
|
||||||
|
|
||||||
logger.info(`uploading thumbnail: ${thumbnailKey}`);
|
logger.info(`uploading thumbnail: ${thumbnailKey}`);
|
||||||
|
|
|
@ -26,6 +26,8 @@ export function getS3(meta: Meta) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} 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}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
:type="type"
|
:type="type"
|
||||||
:alt="alt"
|
:alt="alt"
|
||||||
:class="{
|
:class="{
|
||||||
cover,
|
cover,
|
||||||
wide: largestDimension === 'width',
|
wide: largestDimension === 'width',
|
||||||
tall: largestDimension === 'height'
|
tall: largestDimension === 'height',
|
||||||
}"
|
}"
|
||||||
:style="{ 'object-fit': cover ? 'cover' : null }"
|
:style="{ 'object-fit': cover ? 'cover' : null }"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
@load="onLoad"
|
@load="onLoad"
|
||||||
|
@ -36,7 +36,7 @@ const props = withDefaults(
|
||||||
title?: string | null;
|
title?: string | null;
|
||||||
size?: number;
|
size?: number;
|
||||||
cover?: boolean;
|
cover?: boolean;
|
||||||
largestDimension?: "width" | "height";
|
largestDimension?: "width" | "height";
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
src: null,
|
src: null,
|
||||||
|
@ -88,12 +88,12 @@ canvas {
|
||||||
img {
|
img {
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
|
||||||
&.wide {
|
&.wide {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tall {
|
&.tall {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
:alt="media.comment"
|
:alt="media.comment"
|
||||||
:type="media.type"
|
:type="media.type"
|
||||||
:cover="false"
|
:cover="false"
|
||||||
:largest-dimension="largestDimension"
|
:largest-dimension="largestDimension"
|
||||||
/>
|
/>
|
||||||
<div v-if="media.type === 'image/gif'" class="gif">GIF</div>
|
<div v-if="media.type === 'image/gif'" class="gif">GIF</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -121,10 +121,17 @@ const mediaType = computed(() => {
|
||||||
: props.media.type;
|
: 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) {
|
if (
|
||||||
largestDimension = props.media.properties.width > props.media.properties.height ? 'width' : 'height'
|
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() {
|
function captionPopup() {
|
||||||
os.alert({
|
os.alert({
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
v-if="defaultStore.state.woozyMode === true"
|
v-if="defaultStore.state.woozyMode === true"
|
||||||
style="transform: translateY(2px);"
|
style="transform: translateY(2px)"
|
||||||
width="1.1em"
|
width="1.1em"
|
||||||
height="1.1em"
|
height="1.1em"
|
||||||
viewBox="0 0 36 36"
|
viewBox="0 0 36 36"
|
||||||
|
|
Loading…
Reference in a new issue