chore: format

This commit is contained in:
naskya 2023-11-29 04:05:57 +09:00
parent e473dfb10e
commit 7803aa80d0
No known key found for this signature in database
GPG key ID: 164DFF24E2D40139
25 changed files with 174 additions and 172 deletions

View file

@ -25,7 +25,8 @@ const assets = `${_dirname}/../../server/file/assets/`;
const MAX_BYTE_RANGES = 10; const MAX_BYTE_RANGES = 10;
const commonReadableHandlerGenerator = const commonReadableHandlerGenerator =
(ctx: Koa.Context) => (e: Error): void => { (ctx: Koa.Context) =>
(e: Error): void => {
serverLogger.error(e); serverLogger.error(e);
ctx.status = 500; ctx.status = 500;
ctx.set("Cache-Control", "max-age=300"); ctx.set("Cache-Control", "max-age=300");

View file

@ -175,7 +175,8 @@ export default async (
) => ) =>
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: FIXME // biome-ignore lint/suspicious/noAsyncPromiseExecutor: FIXME
new Promise<Note>(async (res, rej) => { new Promise<Note>(async (res, rej) => {
const dontFederateInitially = data.visibility?.startsWith("hidden") === true; const dontFederateInitially =
data.visibility?.startsWith("hidden") === true;
// If you reply outside the channel, match the scope of the target. // If you reply outside the channel, match the scope of the target.
// TODO (I think it's a process that could be done on the client side, but it's server side for now.) // TODO (I think it's a process that could be done on the client side, but it's server side for now.)

View file

@ -22,8 +22,8 @@
message.groupId message.groupId
? message.user ? message.user
: isMe(message) : isMe(message)
? message.recipient ? message.recipient
: message.user : message.user
" "
:show-indicator="true" :show-indicator="true"
disable-link disable-link

View file

@ -327,8 +327,8 @@ async function ok() {
const result = props.input const result = props.input
? inputValue.value ? inputValue.value
: props.select : props.select
? selectedValue.value ? selectedValue.value
: true; : true;
done(false, result); done(false, result);
} }

View file

@ -17,8 +17,8 @@
? i18n.ts.selectFiles ? i18n.ts.selectFiles
: i18n.ts.selectFolders : i18n.ts.selectFolders
: type === "file" : type === "file"
? i18n.ts.selectFile ? i18n.ts.selectFile
: i18n.ts.selectFolder : i18n.ts.selectFolder
}} }}
<span <span
v-if="selected.length > 0" v-if="selected.length > 0"

View file

@ -88,8 +88,8 @@ const preferedModalType =
deviceKind === "desktop" && props.src != null deviceKind === "desktop" && props.src != null
? "popup" ? "popup"
: deviceKind === "smartphone" : deviceKind === "smartphone"
? "drawer" ? "drawer"
: "dialog"; : "dialog";
const modal = ref<InstanceType<typeof MkModal>>(); const modal = ref<InstanceType<typeof MkModal>>();

View file

@ -113,9 +113,9 @@ const url =
props.raw || defaultStore.state.loadRawImages props.raw || defaultStore.state.loadRawImages
? props.media.url ? props.media.url
: defaultStore.state.disableShowingAnimatedImages && : defaultStore.state.disableShowingAnimatedImages &&
props.media.type.startsWith("image") props.media.type.startsWith("image")
? getStaticImageUrl(props.media.thumbnailUrl) ? getStaticImageUrl(props.media.thumbnailUrl)
: props.media.thumbnailUrl; : props.media.thumbnailUrl;
const mediaType = computed(() => { const mediaType = computed(() => {
return props.media.type === "video/quicktime" return props.media.type === "video/quicktime"

View file

@ -169,22 +169,22 @@ const transitionName = computed(() =>
? useSendAnime.value ? useSendAnime.value
? "send" ? "send"
: type.value === "drawer" : type.value === "drawer"
? "modal-drawer" ? "modal-drawer"
: type.value === "popup" : type.value === "popup"
? "modal-popup" ? "modal-popup"
: "modal" : "modal"
: "", : "",
); );
const transitionDuration = computed(() => const transitionDuration = computed(() =>
transitionName.value === "send" transitionName.value === "send"
? 400 ? 400
: transitionName.value === "modal-popup" : transitionName.value === "modal-popup"
? 100 ? 100
: transitionName.value === "modal" : transitionName.value === "modal"
? 200 ? 200
: transitionName.value === "modal-drawer" : transitionName.value === "modal-drawer"
? 200 ? 200
: 0, : 0,
); );
let contentClicking = false; let contentClicking = false;

View file

@ -17,8 +17,8 @@
? `${props.height}px` ? `${props.height}px`
: null : null
: height : height
? `min(${props.height}px, 100%)` ? `min(${props.height}px, 100%)`
: '100%', : '100%',
}" }"
tabindex="-1" tabindex="-1"
> >

View file

@ -259,12 +259,12 @@ const fetchMore = async (): Promise<void> => {
offset: offset.value, offset: offset.value,
} }
: props.pagination.reversed : props.pagination.reversed
? { ? {
sinceId: items.value[0].id, sinceId: items.value[0].id,
} }
: { : {
untilId: items.value[items.value.length - 1].id, untilId: items.value[items.value.length - 1].id,
}), }),
}) })
.then( .then(
(res) => { (res) => {
@ -320,12 +320,12 @@ const fetchMoreAhead = async (): Promise<void> => {
offset: offset.value, offset: offset.value,
} }
: props.pagination.reversed : props.pagination.reversed
? { ? {
untilId: items.value[0].id, untilId: items.value[0].id,
} }
: { : {
sinceId: items.value[items.value.length - 1].id, sinceId: items.value[items.value.length - 1].id,
}), }),
}) })
.then( .then(
(res) => { (res) => {

View file

@ -81,10 +81,10 @@ const timer = computed(() =>
remaining.value >= 86400 remaining.value >= 86400
? "_poll.remainingDays" ? "_poll.remainingDays"
: remaining.value >= 3600 : remaining.value >= 3600
? "_poll.remainingHours" ? "_poll.remainingHours"
: remaining.value >= 60 : remaining.value >= 60
? "_poll.remainingMinutes" ? "_poll.remainingMinutes"
: "_poll.remainingSeconds", : "_poll.remainingSeconds",
{ {
s: Math.floor(remaining.value % 60), s: Math.floor(remaining.value % 60),
m: Math.floor(remaining.value / 60) % 60, m: Math.floor(remaining.value / 60) % 60,

View file

@ -171,8 +171,8 @@ function get() {
...(expiration.value === "at" ...(expiration.value === "at"
? { expiresAt: calcAt() } ? { expiresAt: calcAt() }
: expiration.value === "after" : expiration.value === "after"
? { expiredAfter: calcAfter() } ? { expiredAfter: calcAfter() }
: {}), : {}),
}; };
} }

View file

@ -72,8 +72,8 @@
reply reply
? 'ph-arrow-u-up-left' ? 'ph-arrow-u-up-left'
: renote : renote
? 'ph-quotes' ? 'ph-quotes'
: 'ph-paper-plane-tilt', : 'ph-paper-plane-tilt',
) )
" "
></i> ></i>
@ -400,10 +400,10 @@ const submitText = computed((): string => {
return props.editId return props.editId
? i18n.ts.edit ? i18n.ts.edit
: props.renote : props.renote
? i18n.ts.quote ? i18n.ts.quote
: props.reply : props.reply
? i18n.ts.reply ? i18n.ts.reply
: i18n.ts.note; : i18n.ts.note;
}); });
const textLength = computed((): number => { const textLength = computed((): number => {
@ -472,8 +472,8 @@ if (props.reply && props.reply.text != null) {
const mention = x.host const mention = x.host
? `@${x.username}@${toASCII(x.host)}` ? `@${x.username}@${toASCII(x.host)}`
: otherHost == null || otherHost === host : otherHost == null || otherHost === host
? `@${x.username}` ? `@${x.username}`
: `@${x.username}@${toASCII(otherHost)}`; : `@${x.username}@${toASCII(otherHost)}`;
// exclude me // exclude me
if ($i.username === x.username && (x.host == null || x.host === host)) if ($i.username === x.username && (x.host == null || x.host === host))
@ -865,8 +865,8 @@ async function post() {
renoteId: props.renote renoteId: props.renote
? props.renote.id ? props.renote.id
: quoteId.value : quoteId.value
? quoteId.value ? quoteId.value
: undefined, : undefined,
channelId: props.channel ? props.channel.id : undefined, channelId: props.channel ? props.channel.id : undefined,
poll: poll.value, poll: poll.value,
cw: useCw.value ? cw.value || "" : undefined, cw: useCw.value ? cw.value || "" : undefined,

View file

@ -371,10 +371,10 @@ function onChangeUsername(): void {
const err = !username.value.match(/^[a-zA-Z0-9_]+$/) const err = !username.value.match(/^[a-zA-Z0-9_]+$/)
? "invalid-format" ? "invalid-format"
: username.value.length < 1 : username.value.length < 1
? "min-range" ? "min-range"
: username.value.length > 20 : username.value.length > 20
? "max-range" ? "max-range"
: null; : null;
if (err) { if (err) {
usernameState.value = err; usernameState.value = err;
@ -410,16 +410,16 @@ function onChangeEmail(): void {
emailState.value = result.available emailState.value = result.available
? "ok" ? "ok"
: result.reason === "used" : result.reason === "used"
? "unavailable:used" ? "unavailable:used"
: result.reason === "format" : result.reason === "format"
? "unavailable:format" ? "unavailable:format"
: result.reason === "disposable" : result.reason === "disposable"
? "unavailable:disposable" ? "unavailable:disposable"
: result.reason === "mx" : result.reason === "mx"
? "unavailable:mx" ? "unavailable:mx"
: result.reason === "smtp" : result.reason === "smtp"
? "unavailable:smtp" ? "unavailable:smtp"
: "unavailable"; : "unavailable";
}) })
.catch(() => { .catch(() => {
emailState.value = "error"; emailState.value = "error";

View file

@ -29,11 +29,11 @@ const _time =
props.time == null props.time == null
? NaN ? NaN
: typeof props.time === "number" : typeof props.time === "number"
? props.time ? props.time
: (props.time instanceof Date : (props.time instanceof Date
? props.time ? props.time
: new Date(props.time) : new Date(props.time)
).getTime(); ).getTime();
const invalid = Number.isNaN(_time); const invalid = Number.isNaN(_time);
const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid; const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid;
@ -46,30 +46,30 @@ const relative = computed<string>(() => {
return ago >= 31536000 return ago >= 31536000
? i18n.t("_ago.yearsAgo", { n: Math.floor(ago / 31536000).toString() }) ? i18n.t("_ago.yearsAgo", { n: Math.floor(ago / 31536000).toString() })
: ago >= 2592000 : ago >= 2592000
? i18n.t("_ago.monthsAgo", { ? i18n.t("_ago.monthsAgo", {
n: Math.floor(ago / 2592000).toString(), n: Math.floor(ago / 2592000).toString(),
}) })
: ago >= 604800 : ago >= 604800
? i18n.t("_ago.weeksAgo", { ? i18n.t("_ago.weeksAgo", {
n: Math.floor(ago / 604800).toString(), n: Math.floor(ago / 604800).toString(),
}) })
: ago >= 86400 : ago >= 86400
? i18n.t("_ago.daysAgo", { ? i18n.t("_ago.daysAgo", {
n: Math.floor(ago / 86400).toString(), n: Math.floor(ago / 86400).toString(),
}) })
: ago >= 3600 : ago >= 3600
? i18n.t("_ago.hoursAgo", { ? i18n.t("_ago.hoursAgo", {
n: Math.floor(ago / 3600).toString(), n: Math.floor(ago / 3600).toString(),
}) })
: ago >= 60 : ago >= 60
? i18n.t("_ago.minutesAgo", { n: (~~(ago / 60)).toString() }) ? i18n.t("_ago.minutesAgo", { n: (~~(ago / 60)).toString() })
: ago >= 10 : ago >= 10
? i18n.t("_ago.secondsAgo", { ? i18n.t("_ago.secondsAgo", {
n: (~~(ago % 60)).toString(), n: (~~(ago % 60)).toString(),
}) })
: ago >= -1 : ago >= -1
? i18n.ts._ago.justNow ? i18n.ts._ago.justNow
: i18n.ts._ago.future; : i18n.ts._ago.future;
}); });
let tickId: number; let tickId: number;

View file

@ -127,18 +127,18 @@ const pagination = {
...(state.value === "federating" ...(state.value === "federating"
? { federating: true } ? { federating: true }
: state.value === "subscribing" : state.value === "subscribing"
? { subscribing: true } ? { subscribing: true }
: state.value === "publishing" : state.value === "publishing"
? { publishing: true } ? { publishing: true }
: state.value === "suspended" : state.value === "suspended"
? { suspended: true } ? { suspended: true }
: state.value === "blocked" : state.value === "blocked"
? { blocked: true } ? { blocked: true }
: state.value === "silenced" : state.value === "silenced"
? { silenced: true } ? { silenced: true }
: state.value === "notResponding" : state.value === "notResponding"
? { notResponding: true } ? { notResponding: true }
: {}), : {}),
})), })),
}; };

View file

@ -105,8 +105,8 @@ async function init() {
provider.value = meta.enableHcaptcha provider.value = meta.enableHcaptcha
? "hcaptcha" ? "hcaptcha"
: meta.enableRecaptcha : meta.enableRecaptcha
? "recaptcha" ? "recaptcha"
: null; : null;
} }
function save() { function save() {

View file

@ -51,23 +51,23 @@ const label =
props.type === "process" props.type === "process"
? "Process" ? "Process"
: props.type === "active" : props.type === "active"
? "Active" ? "Active"
: props.type === "delayed" : props.type === "delayed"
? "Delayed" ? "Delayed"
: props.type === "waiting" : props.type === "waiting"
? "Waiting" ? "Waiting"
: ("?" as never); : ("?" as never);
const color = const color =
props.type === "process" props.type === "process"
? "#c4a7e7" ? "#c4a7e7"
: props.type === "active" : props.type === "active"
? "#31748f" ? "#31748f"
: props.type === "delayed" : props.type === "delayed"
? "#eb6f92" ? "#eb6f92"
: props.type === "waiting" : props.type === "waiting"
? "#f6c177" ? "#f6c177"
: ("?" as never); : ("?" as never);
onMounted(() => { onMounted(() => {
const vLineColor = defaultStore.state.darkMode const vLineColor = defaultStore.state.darkMode

View file

@ -96,23 +96,23 @@ const label =
props.type === "process" props.type === "process"
? "Process" ? "Process"
: props.type === "active" : props.type === "active"
? "Active" ? "Active"
: props.type === "delayed" : props.type === "delayed"
? "Delayed" ? "Delayed"
: props.type === "waiting" : props.type === "waiting"
? "Waiting" ? "Waiting"
: ("?" as never); : ("?" as never);
const color = const color =
props.type === "process" props.type === "process"
? "#9ccfd8" ? "#9ccfd8"
: props.type === "active" : props.type === "active"
? "#31748f" ? "#31748f"
: props.type === "delayed" : props.type === "delayed"
? "#eb6f92" ? "#eb6f92"
: props.type === "waiting" : props.type === "waiting"
? "#f6c177" ? "#f6c177"
: ("?" as never); : ("?" as never);
onMounted(() => { onMounted(() => {
chartInstance = new Chart(chartEl.value, { chartInstance = new Chart(chartEl.value, {

View file

@ -117,8 +117,8 @@ onMounted(() => {
props.domain === "inbox" props.domain === "inbox"
? "admin/queue/inbox-delayed" ? "admin/queue/inbox-delayed"
: props.domain === "deliver" : props.domain === "deliver"
? "admin/queue/deliver-delayed" ? "admin/queue/deliver-delayed"
: null, : null,
{}, {},
).then((result) => { ).then((result) => {
jobs.value = result; jobs.value = result;

View file

@ -290,14 +290,14 @@ async function init() {
meta.sensitiveMediaDetectionSensitivity === "veryLow" meta.sensitiveMediaDetectionSensitivity === "veryLow"
? 0 ? 0
: meta.sensitiveMediaDetectionSensitivity === "low" : meta.sensitiveMediaDetectionSensitivity === "low"
? 1 ? 1
: meta.sensitiveMediaDetectionSensitivity === "medium" : meta.sensitiveMediaDetectionSensitivity === "medium"
? 2 ? 2
: meta.sensitiveMediaDetectionSensitivity === "high" : meta.sensitiveMediaDetectionSensitivity === "high"
? 3 ? 3
: meta.sensitiveMediaDetectionSensitivity === "veryHigh" : meta.sensitiveMediaDetectionSensitivity === "veryHigh"
? 4 ? 4
: 0; : 0;
setSensitiveFlagAutomatically.value = meta.setSensitiveFlagAutomatically; setSensitiveFlagAutomatically.value = meta.setSensitiveFlagAutomatically;
enableSensitiveMediaDetectionForVideos.value = enableSensitiveMediaDetectionForVideos.value =
meta.enableSensitiveMediaDetectionForVideos; meta.enableSensitiveMediaDetectionForVideos;
@ -317,14 +317,14 @@ function save() {
sensitiveMediaDetectionSensitivity.value === 0 sensitiveMediaDetectionSensitivity.value === 0
? "veryLow" ? "veryLow"
: sensitiveMediaDetectionSensitivity.value === 1 : sensitiveMediaDetectionSensitivity.value === 1
? "low" ? "low"
: sensitiveMediaDetectionSensitivity.value === 2 : sensitiveMediaDetectionSensitivity.value === 2
? "medium" ? "medium"
: sensitiveMediaDetectionSensitivity.value === 3 : sensitiveMediaDetectionSensitivity.value === 3
? "high" ? "high"
: sensitiveMediaDetectionSensitivity.value === 4 : sensitiveMediaDetectionSensitivity.value === 4
? "veryHigh" ? "veryHigh"
: 0, : 0,
setSensitiveFlagAutomatically: setSensitiveFlagAutomatically.value, setSensitiveFlagAutomatically: setSensitiveFlagAutomatically.value,
enableSensitiveMediaDetectionForVideos: enableSensitiveMediaDetectionForVideos:
enableSensitiveMediaDetectionForVideos.value, enableSensitiveMediaDetectionForVideos.value,

View file

@ -98,14 +98,14 @@ function onEndpointChange() {
p.type === "String" p.type === "String"
? "" ? ""
: p.type === "Number" : p.type === "Number"
? 0 ? 0
: p.type === "Boolean" : p.type === "Boolean"
? false ? false
: p.type === "Array" : p.type === "Array"
? [] ? []
: p.type === "Object" : p.type === "Object"
? {} ? {}
: null; : null;
} }
body.value = JSON5.stringify(endpointBody, null, 2); body.value = JSON5.stringify(endpointBody, null, 2);
}); });

View file

@ -90,8 +90,8 @@
color: color.forPreview color: color.forPreview
? color.forPreview ? color.forPreview
: theme.base === 'light' : theme.base === 'light'
? '#5f5f5f' ? '#5f5f5f'
: '#dadada', : '#dadada',
}" }"
> >
A A

View file

@ -270,12 +270,12 @@ definePageMetadata(
src.value === "local" src.value === "local"
? "ph-users ph-lg" ? "ph-users ph-lg"
: src.value === "social" : src.value === "social"
? "ph-handshake ph-lg" ? "ph-handshake ph-lg"
: src.value === "recommended" : src.value === "recommended"
? "ph-thumbs-up ph-lg" ? "ph-thumbs-up ph-lg"
: src.value === "global" : src.value === "global"
? "ph-planet ph-lg" ? "ph-planet ph-lg"
: "ph-house ph-lg", : "ph-house ph-lg",
})), })),
); );

View file

@ -35,8 +35,8 @@
widgetProps.src === "list" widgetProps.src === "list"
? widgetProps.list.name ? widgetProps.list.name
: widgetProps.src === "antenna" : widgetProps.src === "antenna"
? widgetProps.antenna.name ? widgetProps.antenna.name
: i18n.t("_timelines." + widgetProps.src) : i18n.t("_timelines." + widgetProps.src)
}}</span> }}</span>
<i <i
:class=" :class="
@ -57,8 +57,8 @@
widgetProps.src === 'list' widgetProps.src === 'list'
? `list:${widgetProps.list.id}` ? `list:${widgetProps.list.id}`
: widgetProps.src === 'antenna' : widgetProps.src === 'antenna'
? `antenna:${widgetProps.antenna.id}` ? `antenna:${widgetProps.antenna.id}`
: widgetProps.src : widgetProps.src
" "
:src="widgetProps.src" :src="widgetProps.src"
:list="widgetProps.list ? widgetProps.list.id : null" :list="widgetProps.list ? widgetProps.list.id : null"