chore: format

This commit is contained in:
老周部落 2024-03-29 00:26:52 +08:00
parent 51c3dde159
commit 96a430bf5e
No known key found for this signature in database
GPG key ID: C72181CD85C6B738
105 changed files with 295 additions and 615 deletions

View file

@ -1,11 +1,11 @@
import type { entities } from "firefish-js";
import { defineAsyncComponent } from "vue";
import { i18n } from "./i18n";
import { apiUrl } from "@/config"; import { apiUrl } from "@/config";
import { me } from "@/me"; import { me } from "@/me";
import { alert, api, popup, popupMenu, waiting } from "@/os"; import { alert, api, popup, popupMenu, waiting } from "@/os";
import { del, get, set } from "@/scripts/idb-proxy"; import { del, get, set } from "@/scripts/idb-proxy";
import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; import { reloadChannel, unisonReload } from "@/scripts/unison-reload";
import type { entities } from "firefish-js";
import { defineAsyncComponent } from "vue";
import { i18n } from "./i18n";
// TODO: 他のタブと永続化されたstateを同期 // TODO: 他のタブと永続化されたstateを同期

View file

@ -179,8 +179,7 @@ async function renderActiveUsersChart() {
enabled: false, enabled: false,
callbacks: { callbacks: {
title(context) { title(context) {
const v = const v = context[0].dataset.data[context[0].dataIndex];
context[0].dataset.data[context[0].dataIndex];
return v.d; return v.d;
}, },
label(context) { label(context) {

View file

@ -83,9 +83,7 @@ function getMenu() {
text: props.file.isSensitive text: props.file.isSensitive
? i18n.ts.unmarkAsSensitive ? i18n.ts.unmarkAsSensitive
: i18n.ts.markAsSensitive, : i18n.ts.markAsSensitive,
icon: props.file.isSensitive icon: props.file.isSensitive ? "ph-eye ph-lg" : "ph-eye-slash ph-lg",
? "ph-eye ph-lg"
: "ph-eye-slash ph-lg",
action: toggleSensitive, action: toggleSensitive,
}, },
{ {
@ -129,9 +127,7 @@ function onClick(ev: MouseEvent) {
} else { } else {
os.popupMenu( os.popupMenu(
getMenu(), getMenu(),
(ev.currentTarget ?? ev.target ?? undefined) as (ev.currentTarget ?? ev.target ?? undefined) as HTMLElement | undefined,
| HTMLElement
| undefined,
); );
} }
} }

View file

@ -451,9 +451,7 @@ function chooseFile(file: entities.DriveFile) {
const isAlreadySelected = selectedFiles.value.some((f) => f.id === file.id); const isAlreadySelected = selectedFiles.value.some((f) => f.id === file.id);
if (props.multiple) { if (props.multiple) {
if (isAlreadySelected) { if (isAlreadySelected) {
selectedFiles.value = selectedFiles.value.filter( selectedFiles.value = selectedFiles.value.filter((f) => f.id !== file.id);
(f) => f.id !== file.id,
);
} else { } else {
selectedFiles.value.push(file); selectedFiles.value.push(file);
} }

View file

@ -284,9 +284,7 @@ watch(q, () => {
keywords.every( keywords.every(
(keyword) => (keyword) =>
emoji.name.includes(keyword) || emoji.name.includes(keyword) ||
emoji.aliases.some((alias) => emoji.aliases.some((alias) => alias.includes(keyword)),
alias.includes(keyword),
),
) )
) { ) {
matches.add(emoji); matches.add(emoji);
@ -356,9 +354,7 @@ watch(q, () => {
keywords.every( keywords.every(
(keyword) => (keyword) =>
emoji.slug.includes(keyword) || emoji.slug.includes(keyword) ||
emoji.keywords?.some((alias) => emoji.keywords?.some((alias) => alias.includes(keyword)),
alias.includes(keyword),
),
) )
) { ) {
matches.add(emoji); matches.add(emoji);
@ -375,9 +371,7 @@ watch(q, () => {
if (matches.size >= max) return matches; if (matches.size >= max) return matches;
for (const emoji of emojis) { for (const emoji of emojis) {
if ( if (emoji.keywords?.some((keyword) => keyword.startsWith(newQ))) {
emoji.keywords?.some((keyword) => keyword.startsWith(newQ))
) {
matches.add(emoji); matches.add(emoji);
if (matches.size >= max) break; if (matches.size >= max) break;
} }
@ -428,8 +422,7 @@ function getKey(
function chosen(emoji: any, ev?: MouseEvent) { function chosen(emoji: any, ev?: MouseEvent) {
const el = const el =
ev && ev && ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
if (el) { if (el) {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const x = rect.left + el.offsetWidth / 2; const x = rect.left + el.offsetWidth / 2;

View file

@ -58,9 +58,7 @@ export default defineComponent({
showBody: showBody:
this.persistKey && this.persistKey &&
localStorage.getItem(localStoragePrefix + this.persistKey) localStorage.getItem(localStoragePrefix + this.persistKey)
? localStorage.getItem( ? localStorage.getItem(localStoragePrefix + this.persistKey) === "t"
localStoragePrefix + this.persistKey,
) === "t"
: this.expanded, : this.expanded,
animation: defaultStore.state.animation, animation: defaultStore.state.animation,
}; };

View file

@ -112,8 +112,7 @@ if (props.user.isFollowing == null) {
function onFollowChange(user: entities.UserDetailed) { function onFollowChange(user: entities.UserDetailed) {
if (user.id === props.user.id) { if (user.id === props.user.id) {
isFollowing.value = user.isFollowing; isFollowing.value = user.isFollowing;
hasPendingFollowRequestFromYou.value = hasPendingFollowRequestFromYou.value = user.hasPendingFollowRequestFromYou;
user.hasPendingFollowRequestFromYou;
} }
} }
@ -172,10 +171,7 @@ async function onClick() {
} }
function menu(ev) { function menu(ev) {
os.popupMenu( os.popupMenu(getUserMenu(props.user, router), ev.currentTarget ?? ev.target);
getUserMenu(props.user, router),
ev.currentTarget ?? ev.target,
);
} }
onMounted(() => { onMounted(() => {

View file

@ -38,9 +38,7 @@ const instance = props.instance ?? {
faviconUrl: Instance.faviconUrl || Instance.iconUrl || "/favicon.ico", faviconUrl: Instance.faviconUrl || Instance.iconUrl || "/favicon.ico",
name: instanceName, name: instanceName,
themeColor: ( themeColor: (
document.querySelector( document.querySelector('meta[name="theme-color-orig"]') as HTMLMetaElement
'meta[name="theme-color-orig"]',
) as HTMLMetaElement
)?.content, )?.content,
softwareName: Instance.softwareName ?? "Firefish", softwareName: Instance.softwareName ?? "Firefish",
softwareVersion: version, softwareVersion: version,

View file

@ -40,9 +40,7 @@ const el = ref();
useTooltip(el, (showing) => { useTooltip(el, (showing) => {
os.popup( os.popup(
defineAsyncComponent( defineAsyncComponent(() => import("@/components/MkUrlPreviewPopup.vue")),
() => import("@/components/MkUrlPreviewPopup.vue"),
),
{ {
showing, showing,
url: props.url, url: props.url,

View file

@ -58,9 +58,7 @@ export default {
{ {
class: $style.text, class: $style.text,
style: { style: {
animationDirection: reverse animationDirection: reverse ? "reverse" : undefined,
? "reverse"
: undefined,
}, },
}, },
$slots.default(), $slots.default(),

View file

@ -113,7 +113,7 @@ 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;
@ -150,8 +150,7 @@ watch(
hide.value = hide.value =
defaultStore.state.nsfw === "force" defaultStore.state.nsfw === "force"
? true ? true
: props.media.isSensitive && : props.media.isSensitive && defaultStore.state.nsfw !== "ignore";
defaultStore.state.nsfw !== "ignore";
}, },
{ {
deep: true, deep: true,

View file

@ -75,8 +75,7 @@ const audioEl = ref<HTMLAudioElement | null>();
const hide = ref(true); const hide = ref(true);
function volumechange() { function volumechange() {
if (audioEl.value) if (audioEl.value) ColdDeviceStorage.set("mediaVolume", audioEl.value.volume);
ColdDeviceStorage.set("mediaVolume", audioEl.value.volume);
} }
onMounted(() => { onMounted(() => {

View file

@ -183,12 +183,8 @@ export default defineComponent({
}, },
caption() { caption() {
const img = document.getElementById( const img = document.getElementById("imgtocaption") as HTMLImageElement;
"imgtocaption", const ta = document.getElementById("captioninput") as HTMLTextAreaElement;
) as HTMLImageElement;
const ta = document.getElementById(
"captioninput",
) as HTMLTextAreaElement;
os.api("drive/files/caption-image", { os.api("drive/files/caption-image", {
url: img.src, url: img.src,
}).then((text) => { }).then((text) => {

View file

@ -311,11 +311,7 @@ function getRow(pattern: number, rowOffset: number) {
const ops: string[] = []; const ops: string[] = [];
for (let channel = 0; channel < nbChannels.value; channel++) { for (let channel = 0; channel < nbChannels.value; channel++) {
const part = player.value.getPatternRowChannel( const part = player.value.getPatternRowChannel(pattern, rowOffset, channel);
pattern,
rowOffset,
channel,
);
notes.push(part.substring(0, 3)); notes.push(part.substring(0, 3));
insts.push(part.substring(4, 6)); insts.push(part.substring(4, 6));

View file

@ -286,8 +286,7 @@ const align = () => {
left = window.innerWidth - width + window.scrollX - 1; left = window.innerWidth - width + window.scrollX - 1;
} }
const underSpace = const underSpace = window.innerHeight - MARGIN - (top - window.pageYOffset);
window.innerHeight - MARGIN - (top - window.pageYOffset);
const upperSpace = srcRect.top - MARGIN; const upperSpace = srcRect.top - MARGIN;
// //
@ -300,12 +299,7 @@ const align = () => {
top = window.scrollY + (upperSpace + MARGIN - height); top = window.scrollY + (upperSpace + MARGIN - height);
} }
} else { } else {
top = top = window.innerHeight - MARGIN - height + window.pageYOffset - 1;
window.innerHeight -
MARGIN -
height +
window.pageYOffset -
1;
} }
} else { } else {
maxHeight.value = underSpace; maxHeight.value = underSpace;

View file

@ -403,8 +403,7 @@ async function translate() {
lang != null && lang != null &&
translateLang !== lang && translateLang !== lang &&
(!translation.value || (!translation.value ||
translation.value.sourceLang.toLowerCase() === translation.value.sourceLang.toLowerCase() === translateLang.slice(0, 2))
translateLang.slice(0, 2))
) )
translation.value = await translate_(appearNote.value.id, lang); translation.value = await translate_(appearNote.value.id, lang);
translating.value = false; translating.value = false;
@ -504,10 +503,7 @@ function onContextmenu(ev: MouseEvent): void {
icon: `${icon("ph-arrows-out-simple")}`, icon: `${icon("ph-arrows-out-simple")}`,
text: i18n.ts.showInPage, text: i18n.ts.showInPage,
action: () => { action: () => {
router.push( router.push(notePage(appearNote.value), "forcePage");
notePage(appearNote.value),
"forcePage",
);
}, },
} }
: undefined, : undefined,
@ -531,10 +527,7 @@ function onContextmenu(ev: MouseEvent): void {
type: "a", type: "a",
icon: `${icon("ph-arrow-square-up-right")}`, icon: `${icon("ph-arrow-square-up-right")}`,
text: i18n.ts.showOnRemote, text: i18n.ts.showOnRemote,
href: href: appearNote.value.url ?? appearNote.value.uri ?? "",
appearNote.value.url ??
appearNote.value.uri ??
"",
target: "_blank", target: "_blank",
} }
: undefined, : undefined,

View file

@ -70,8 +70,7 @@ const note = ref(props.note);
const showTicker = const showTicker =
defaultStore.state.instanceTicker === "always" || defaultStore.state.instanceTicker === "always" ||
(defaultStore.state.instanceTicker === "remote" && (defaultStore.state.instanceTicker === "remote" && note.value.user.instance);
note.value.user.instance);
function openServerInfo() { function openServerInfo() {
if (!props.canOpenServerInfo || !defaultStore.state.openServerInfo) return; if (!props.canOpenServerInfo || !defaultStore.state.openServerInfo) return;

View file

@ -280,8 +280,7 @@ const replies: entities.Note[] =
props.conversation props.conversation
?.filter( ?.filter(
(item) => (item) =>
item.replyId === props.note.id || item.replyId === props.note.id || item.renoteId === props.note.id,
item.renoteId === props.note.id,
) )
.reverse() ?? []; .reverse() ?? [];
const enableEmojiReactions = defaultStore.state.enableEmojiReactions; const enableEmojiReactions = defaultStore.state.enableEmojiReactions;
@ -319,8 +318,7 @@ async function translate() {
lang != null && lang != null &&
translateLang !== lang && translateLang !== lang &&
(!translation.value || (!translation.value ||
translation.value.sourceLang.toLowerCase() === translation.value.sourceLang.toLowerCase() === translateLang.slice(0, 2))
translateLang.slice(0, 2))
) )
translation.value = await translate_(appearNote.value.id, lang); translation.value = await translate_(appearNote.value.id, lang);
translating.value = false; translating.value = false;
@ -421,10 +419,7 @@ function onContextmenu(ev: MouseEvent): void {
icon: `${icon("ph-arrows-out-simple")}`, icon: `${icon("ph-arrows-out-simple")}`,
text: i18n.ts.showInPage, text: i18n.ts.showInPage,
action: () => { action: () => {
router.push( router.push(notePage(appearNote.value), "forcePage");
notePage(appearNote.value),
"forcePage",
);
}, },
} }
: undefined, : undefined,

View file

@ -84,9 +84,7 @@ function ok() {
} else { } else {
emit("done", { emit("done", {
includingTypes: ( includingTypes: (
Object.keys( Object.keys(typesMap.value) as (typeof notificationTypes)[number][]
typesMap.value,
) as (typeof notificationTypes)[number][]
).filter((type) => typesMap.value[type]), ).filter((type) => typesMap.value[type]),
}); });
} }

View file

@ -71,9 +71,7 @@ const pagination: Paging = {
limit: 10, limit: 10,
params: computed(() => ({ params: computed(() => ({
includeTypes: props.includeTypes ?? undefined, includeTypes: props.includeTypes ?? undefined,
excludeTypes: props.includeTypes excludeTypes: props.includeTypes ? undefined : me.mutingNotificationTypes,
? undefined
: me.mutingNotificationTypes,
unreadOnly: props.unreadOnly, unreadOnly: props.unreadOnly,
})), })),
}; };
@ -114,20 +112,12 @@ onMounted(() => {
connection.on("readNotifications", (notificationIds) => { connection.on("readNotifications", (notificationIds) => {
if (pagingComponent.value) { if (pagingComponent.value) {
for (let i = 0; i < pagingComponent.value.queue.length; i++) { for (let i = 0; i < pagingComponent.value.queue.length; i++) {
if ( if (notificationIds.includes(pagingComponent.value.queue[i].id)) {
notificationIds.includes(pagingComponent.value.queue[i].id)
) {
pagingComponent.value.queue[i].isRead = true; pagingComponent.value.queue[i].isRead = true;
} }
} }
for ( for (let i = 0; i < (pagingComponent.value.items || []).length; i++) {
let i = 0; if (notificationIds.includes(pagingComponent.value.items[i].id)) {
i < (pagingComponent.value.items || []).length;
i++
) {
if (
notificationIds.includes(pagingComponent.value.items[i].id)
) {
pagingComponent.value.items[i].isRead = true; pagingComponent.value.items[i].isRead = true;
} }
} }

View file

@ -165,14 +165,10 @@ const init = async (): Promise<void> => {
res.length > (props.pagination.limit || 10) res.length > (props.pagination.limit || 10)
) { ) {
res.pop(); res.pop();
items.value = props.pagination.reversed items.value = props.pagination.reversed ? [...res].reverse() : res;
? [...res].reverse()
: res;
more.value = true; more.value = true;
} else { } else {
items.value = props.pagination.reversed items.value = props.pagination.reversed ? [...res].reverse() : res;
? [...res].reverse()
: res;
more.value = false; more.value = false;
} }
offset.value = res.length; offset.value = res.length;
@ -382,8 +378,7 @@ const prepend = (item: Item): void => {
const isTop = const isTop =
isBackTop.value || isBackTop.value ||
(document.body.contains(rootEl.value) && (document.body.contains(rootEl.value) && isTopVisible(rootEl.value));
isTopVisible(rootEl.value));
if (isTop) { if (isTop) {
// Prepend the item // Prepend the item

View file

@ -74,8 +74,7 @@ const closed = computed(() => remaining.value === 0);
const isLocal = computed(() => !props.note.uri); const isLocal = computed(() => !props.note.uri);
const isVoted = computed( const isVoted = computed(
() => () =>
!props.note.poll.multiple && !props.note.poll.multiple && props.note.poll.choices.some((c) => c.isVoted),
props.note.poll.choices.some((c) => c.isVoted),
); );
const timer = computed(() => const timer = computed(() =>
i18n.t( i18n.t(
@ -101,10 +100,8 @@ const showResult = ref(props.readOnly || isVoted.value);
if (props.note.poll.expiresAt) { if (props.note.poll.expiresAt) {
const tick = () => { const tick = () => {
remaining.value = Math.floor( remaining.value = Math.floor(
Math.max( Math.max(new Date(props.note.poll.expiresAt).getTime() - Date.now(), 0) /
new Date(props.note.poll.expiresAt).getTime() - Date.now(), 1000,
0,
) / 1000,
); );
if (remaining.value === 0) { if (remaining.value === 0) {
showResult.value = true; showResult.value = true;

View file

@ -527,9 +527,7 @@ if (
(props.reply.user.host != null && props.reply.user.host !== host)) (props.reply.user.host != null && props.reply.user.host !== host))
) { ) {
text.value = `@${props.reply.user.username}${ text.value = `@${props.reply.user.username}${
props.reply.user.host != null props.reply.user.host != null ? "@" + toASCII(props.reply.user.host) : ""
? "@" + toASCII(props.reply.user.host)
: ""
} `; } `;
} }
@ -589,11 +587,9 @@ if (
} }
if (props.reply.userId !== me.id) { if (props.reply.userId !== me.id) {
os.api("users/show", { userId: props.reply.userId }).then( os.api("users/show", { userId: props.reply.userId }).then((user) => {
(user) => { pushVisibleUser(user);
pushVisibleUser(user); });
},
);
} }
} }
} }
@ -732,9 +728,7 @@ function setVisibility() {
} }
os.popup( os.popup(
defineAsyncComponent( defineAsyncComponent(() => import("@/components/MkVisibilityPicker.vue")),
() => import("@/components/MkVisibilityPicker.vue"),
),
{ {
currentVisibility: visibility.value, currentVisibility: visibility.value,
currentLocalOnly: localOnly.value, currentLocalOnly: localOnly.value,
@ -834,8 +828,7 @@ function setLanguage() {
for (const lang of langs) { for (const lang of langs) {
if (lang === language.value) continue; if (lang === language.value) continue;
if (defaultStore.state.recentlyUsedPostLanguages.includes(lang)) if (defaultStore.state.recentlyUsedPostLanguages.includes(lang)) continue;
continue;
actions.push({ actions.push({
text: langmap[lang].nativeName, text: langmap[lang].nativeName,
danger: false, danger: false,
@ -1072,8 +1065,7 @@ async function post() {
let postData = { let postData = {
editId: props.editId ? props.editId : undefined, editId: props.editId ? props.editId : undefined,
text: processedText === "" ? undefined : processedText, text: processedText === "" ? undefined : processedText,
fileIds: fileIds: files.value.length > 0 ? files.value.map((f) => f.id) : undefined,
files.value.length > 0 ? files.value.map((f) => f.id) : undefined,
replyId: props.reply ? props.reply.id : undefined, replyId: props.reply ? props.reply.id : undefined,
renoteId: props.renote renoteId: props.renote
? props.renote.id ? props.renote.id
@ -1085,8 +1077,7 @@ async function post() {
cw: useCw.value ? cw.value || "" : undefined, cw: useCw.value ? cw.value || "" : undefined,
lang: language.value ? language.value : undefined, lang: language.value ? language.value : undefined,
localOnly: localOnly.value, localOnly: localOnly.value,
visibility: visibility: visibility.value === "private" ? "specified" : visibility.value,
visibility.value === "private" ? "specified" : visibility.value,
visibleUserIds: visibleUserIds:
visibility.value === "private" visibility.value === "private"
? [] ? []
@ -1101,9 +1092,7 @@ async function post() {
.split(" ") .split(" ")
.map((x) => (x.startsWith("#") ? x : "#" + x)) .map((x) => (x.startsWith("#") ? x : "#" + x))
.join(" "); .join(" ");
postData.text = postData.text postData.text = postData.text ? `${postData.text} ${hashtags_}` : hashtags_;
? `${postData.text} ${hashtags_}`
: hashtags_;
} }
// plugin // plugin
@ -1117,9 +1106,7 @@ async function post() {
if (postAccount.value) { if (postAccount.value) {
const storedAccounts = await getAccounts(); const storedAccounts = await getAccounts();
token = storedAccounts.find( token = storedAccounts.find((x) => x.id === postAccount.value.id)?.token;
(x) => x.id === postAccount.value.id,
)?.token;
} }
posting.value = true; posting.value = true;
@ -1165,14 +1152,9 @@ async function post() {
"recentlyUsedPostLanguages", "recentlyUsedPostLanguages",
[language.value] [language.value]
.concat( .concat(
defaultStore.state.recentlyUsedPostLanguages.filter( defaultStore.state.recentlyUsedPostLanguages.filter((lang) => {
(lang) => { return lang !== language.value && languages.includes(lang);
return ( }),
lang !== language.value &&
languages.includes(lang)
);
},
),
) )
.slice(0, maxLength), .slice(0, maxLength),
); );
@ -1268,9 +1250,7 @@ onMounted(() => {
visibility.value = draft.data.visibility; visibility.value = draft.data.visibility;
localOnly.value = draft.data.localOnly; localOnly.value = draft.data.localOnly;
language.value = draft.data.lang; language.value = draft.data.lang;
files.value = (draft.data.files || []).filter( files.value = (draft.data.files || []).filter((draftFile) => draftFile);
(draftFile) => draftFile,
);
if (draft.data.poll) { if (draft.data.poll) {
poll.value = draft.data.poll; poll.value = draft.data.poll;
} }

View file

@ -107,8 +107,7 @@ async function describe(file) {
{ {
done: (result) => { done: (result) => {
if (!result || result.canceled) return; if (!result || result.canceled) return;
const comment = const comment = result.result.length === 0 ? null : result.result;
result.result.length === 0 ? null : result.result;
os.api("drive/files/update", { os.api("drive/files/update", {
fileId: file.id, fileId: file.id,
comment, comment,

View file

@ -102,8 +102,7 @@ function moveBySystem(to: number): Promise<void> {
return; return;
} }
const nextHeight = const nextHeight =
initialHeight - initialHeight - (overHeight / RELEASE_TRANSITION_DURATION) * time;
(overHeight / RELEASE_TRANSITION_DURATION) * time;
if (pullDistance.value < nextHeight) return; if (pullDistance.value < nextHeight) return;
pullDistance.value = nextHeight; pullDistance.value = nextHeight;
}, 1); }, 1);

View file

@ -94,17 +94,14 @@ const pushRegistrationInServer = ref<
>(); >();
function subscribe() { function subscribe() {
if (!registration.value || !supported.value || !instance.swPublickey) if (!registration.value || !supported.value || !instance.swPublickey) return;
return;
// SEE: https://developer.mozilla.org/en-US/docs/Web/API/PushManager/subscribe#Parameters // SEE: https://developer.mozilla.org/en-US/docs/Web/API/PushManager/subscribe#Parameters
return promiseDialog( return promiseDialog(
registration.value.pushManager registration.value.pushManager
.subscribe({ .subscribe({
userVisibleOnly: true, userVisibleOnly: true,
applicationServerKey: urlBase64ToUint8Array( applicationServerKey: urlBase64ToUint8Array(instance.swPublickey),
instance.swPublickey,
),
}) })
.then( .then(
async (subscription) => { async (subscription) => {
@ -121,9 +118,7 @@ function subscribe() {
// When subscribe failed // When subscribe failed
// //
if (err?.name === "NotAllowedError") { if (err?.name === "NotAllowedError") {
console.info( console.info("User denied the notification permission request.");
"User denied the notification permission request.",
);
return; return;
} }
@ -171,9 +166,7 @@ function encode(buffer: ArrayBuffer | null) {
*/ */
function urlBase64ToUint8Array(base64String: string): Uint8Array { function urlBase64ToUint8Array(base64String: string): Uint8Array {
const padding = "=".repeat((4 - (base64String.length % 4)) % 4); const padding = "=".repeat((4 - (base64String.length % 4)) % 4);
const base64 = (base64String + padding) const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
.replace(/-/g, "+")
.replace(/_/g, "/");
const rawData = window.atob(base64); const rawData = window.atob(base64);
const outputArray = new Uint8Array(rawData.length); const outputArray = new Uint8Array(rawData.length);

View file

@ -102,10 +102,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
hasRenotedBefore.value = true; hasRenotedBefore.value = true;
const el = const el =
ev && ev &&
((ev.currentTarget ?? ev.target) as ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
| HTMLElement
| null
| undefined);
if (el) { if (el) {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const x = rect.left + el.offsetWidth / 2; const x = rect.left + el.offsetWidth / 2;
@ -129,10 +126,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
hasRenotedBefore.value = true; hasRenotedBefore.value = true;
const el = const el =
ev && ev &&
((ev.currentTarget ?? ev.target) as ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
| HTMLElement
| null
| undefined);
if (el) { if (el) {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const x = rect.left + el.offsetWidth / 2; const x = rect.left + el.offsetWidth / 2;
@ -157,10 +151,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
hasRenotedBefore.value = true; hasRenotedBefore.value = true;
const el = const el =
ev && ev &&
((ev.currentTarget ?? ev.target) as ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
| HTMLElement
| null
| undefined);
if (el) { if (el) {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const x = rect.left + el.offsetWidth / 2; const x = rect.left + el.offsetWidth / 2;
@ -182,10 +173,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
hasRenotedBefore.value = true; hasRenotedBefore.value = true;
const el = const el =
ev && ev &&
((ev.currentTarget ?? ev.target) as ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
| HTMLElement
| null
| undefined);
if (el) { if (el) {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const x = rect.left + el.offsetWidth / 2; const x = rect.left + el.offsetWidth / 2;
@ -221,10 +209,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
hasRenotedBefore.value = true; hasRenotedBefore.value = true;
const el = const el =
ev && ev &&
((ev.currentTarget ?? ev.target) as ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
| HTMLElement
| null
| undefined);
if (el) { if (el) {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const x = rect.left + el.offsetWidth / 2; const x = rect.left + el.offsetWidth / 2;

View file

@ -198,9 +198,7 @@ function openDescription(kind: "words" | "users" | "range"): void {
}; };
popup( popup(
defineAsyncComponent( defineAsyncComponent(() => import("@/components/MkSimpleTextWindow.vue")),
() => import("@/components/MkSimpleTextWindow.vue"),
),
{ {
title: i18n.ts.help, title: i18n.ts.help,
description: descriptions[kind], description: descriptions[kind],

View file

@ -205,13 +205,11 @@ function queryKey() {
.get({ .get({
publicKey: { publicKey: {
challenge: byteify(challengeData.value.challenge, "base64"), challenge: byteify(challengeData.value.challenge, "base64"),
allowCredentials: challengeData.value.securityKeys.map( allowCredentials: challengeData.value.securityKeys.map((key) => ({
(key) => ({ id: byteify(key.id, "hex"),
id: byteify(key.id, "hex"), type: "public-key",
type: "public-key", transports: ["usb", "nfc", "ble", "internal"],
transports: ["usb", "nfc", "ble", "internal"], })),
}),
),
timeout: 60 * 1000, timeout: 60 * 1000,
}, },
}) })
@ -226,9 +224,7 @@ function queryKey() {
username: username.value, username: username.value,
password: password.value, password: password.value,
signature: hexify(credential.response.signature), signature: hexify(credential.response.signature),
authenticatorData: hexify( authenticatorData: hexify(credential.response.authenticatorData),
credential.response.authenticatorData,
),
clientDataJSON: hexify(credential.response.clientDataJSON), clientDataJSON: hexify(credential.response.clientDataJSON),
credentialId: credential.id, credentialId: credential.id,
challengeId: challengeData.value.challengeId, challengeId: challengeData.value.challengeId,
@ -277,9 +273,7 @@ function onSubmit() {
"hcaptcha-response": hCaptchaResponse.value, "hcaptcha-response": hCaptchaResponse.value,
"g-recaptcha-response": reCaptchaResponse.value, "g-recaptcha-response": reCaptchaResponse.value,
token: token:
user.value && user.value.twoFactorEnabled user.value && user.value.twoFactorEnabled ? token.value : undefined,
? token.value
: undefined,
}) })
.then((res) => { .then((res) => {
emit("login", res); emit("login", res);

View file

@ -104,9 +104,7 @@ onMounted(() => {
}; };
particles.value.push(particle); particles.value.push(particle);
window.setTimeout(() => { window.setTimeout(() => {
particles.value = particles.value.filter( particles.value = particles.value.filter((x) => x.id !== particle.id);
(x) => x.id !== particle.id,
);
}, particle.dur - 100); }, particle.dur - 100);
window.setTimeout( window.setTimeout(

View file

@ -60,13 +60,10 @@ function star(ev?: MouseEvent): void {
os.api("notes/reactions/create", { os.api("notes/reactions/create", {
noteId: props.note.id, noteId: props.note.id,
reaction: reaction:
defaultStore.state.woozyMode === true defaultStore.state.woozyMode === true ? "🥴" : instance.defaultReaction,
? "🥴"
: instance.defaultReaction,
}); });
const el = const el =
ev && ev && ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
if (el) { if (el) {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const x = rect.left + el.offsetWidth / 2; const x = rect.left + el.offsetWidth / 2;

View file

@ -66,8 +66,7 @@ function toggleStar(ev?: MouseEvent): void {
reaction: instance.defaultReaction, reaction: instance.defaultReaction,
}); });
const el = const el =
ev && ev && ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
if (el) { if (el) {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const x = rect.left + el.offsetWidth / 2; const x = rect.left + el.offsetWidth / 2;

View file

@ -32,14 +32,9 @@ export default defineComponent({
role: "tab", role: "tab",
key: option.key, key: option.key,
"aria-selected": "aria-selected":
this.modelValue === option.props?.value this.modelValue === option.props?.value ? "true" : "false",
? "true"
: "false",
onClick: () => { onClick: () => {
this.$emit( this.$emit("update:modelValue", option.props?.value);
"update:modelValue",
option.props?.value,
);
}, },
}, },
option.children, option.children,

View file

@ -25,18 +25,12 @@ const SAFE_FOR_HTML_ID = "abcdefghijklmnopqrstuvwxyz";
const computedStyle = getComputedStyle(document.documentElement); const computedStyle = getComputedStyle(document.documentElement);
const idForCanvas = Array.from(Array(16)) const idForCanvas = Array.from(Array(16))
.map( .map(
() => () => SAFE_FOR_HTML_ID[Math.floor(Math.random() * SAFE_FOR_HTML_ID.length)],
SAFE_FOR_HTML_ID[
Math.floor(Math.random() * SAFE_FOR_HTML_ID.length)
],
) )
.join(""); .join("");
const idForTags = Array.from(Array(16)) const idForTags = Array.from(Array(16))
.map( .map(
() => () => SAFE_FOR_HTML_ID[Math.floor(Math.random() * SAFE_FOR_HTML_ID.length)],
SAFE_FOR_HTML_ID[
Math.floor(Math.random() * SAFE_FOR_HTML_ID.length)
],
) )
.join(""); .join("");
const available = ref(false); const available = ref(false);

View file

@ -203,9 +203,7 @@ function onContextmenu(ev: MouseEvent) {
// //
function top() { function top() {
if (rootEl.value) { if (rootEl.value) {
rootEl.value.style.zIndex = os.claimZIndex( rootEl.value.style.zIndex = os.claimZIndex(props.front ? "middle" : "low");
props.front ? "middle" : "low",
);
} }
} }
@ -310,13 +308,9 @@ function onHeaderMousedown(evt: MouseEvent) {
// //
dragListen((me) => { dragListen((me) => {
const x = const x =
me.touches && me.touches.length > 0 me.touches && me.touches.length > 0 ? me.touches[0].clientX : me.clientX;
? me.touches[0].clientX
: me.clientX;
const y = const y =
me.touches && me.touches.length > 0 me.touches && me.touches.length > 0 ? me.touches[0].clientY : me.clientY;
? me.touches[0].clientY
: me.clientY;
move(x, y); move(x, y);
}); });

View file

@ -146,14 +146,12 @@ useInterval(
() => { () => {
if (prefixEl.value) { if (prefixEl.value) {
if (prefixEl.value.offsetWidth) { if (prefixEl.value.offsetWidth) {
inputEl.value.style.paddingLeft = inputEl.value.style.paddingLeft = prefixEl.value.offsetWidth + "px";
prefixEl.value.offsetWidth + "px";
} }
} }
if (suffixEl.value) { if (suffixEl.value) {
if (suffixEl.value.offsetWidth) { if (suffixEl.value.offsetWidth) {
inputEl.value.style.paddingRight = inputEl.value.style.paddingRight = suffixEl.value.offsetWidth + "px";
suffixEl.value.offsetWidth + "px";
} }
} }
}, },

View file

@ -60,8 +60,7 @@ export default defineComponent({
value: option.props?.value, value: option.props?.value,
disabled: option.props?.disabled, disabled: option.props?.disabled,
modelValue: this.value, modelValue: this.value,
"onUpdate:modelValue": (value) => "onUpdate:modelValue": (value) => (this.value = value),
(this.value = value),
}, },
option.children, option.children,
), ),

View file

@ -120,14 +120,12 @@ useInterval(
() => { () => {
if (prefixEl.value) { if (prefixEl.value) {
if (prefixEl.value.offsetWidth) { if (prefixEl.value.offsetWidth) {
inputEl.value.style.paddingLeft = inputEl.value.style.paddingLeft = prefixEl.value.offsetWidth + "px";
prefixEl.value.offsetWidth + "px";
} }
} }
if (suffixEl.value) { if (suffixEl.value) {
if (suffixEl.value.offsetWidth) { if (suffixEl.value.offsetWidth) {
inputEl.value.style.paddingRight = inputEl.value.style.paddingRight = suffixEl.value.offsetWidth + "px";
suffixEl.value.offsetWidth + "px";
} }
} }
}, },

View file

@ -88,9 +88,7 @@ const choseAd = (): Ad | null => {
return widgetAds; return widgetAds;
} else if (ads.length === 0) { } else if (ads.length === 0) {
if (lowPriorityAds.length !== 0) { if (lowPriorityAds.length !== 0) {
return lowPriorityAds[ return lowPriorityAds[Math.floor(Math.random() * lowPriorityAds.length)];
Math.floor(Math.random() * lowPriorityAds.length)
];
} else { } else {
return null; return null;
} }

View file

@ -51,9 +51,7 @@ const el = ref();
useTooltip(el, (showing) => { useTooltip(el, (showing) => {
os.popup( os.popup(
defineAsyncComponent( defineAsyncComponent(() => import("@/components/MkUrlPreviewPopup.vue")),
() => import("@/components/MkUrlPreviewPopup.vue"),
),
{ {
showing, showing,
url: props.url, url: props.url,

View file

@ -36,11 +36,9 @@ export default defineComponent({
const note: Ref<Record<string, any> | null> = ref(null); const note: Ref<Record<string, any> | null> = ref(null);
onMounted(() => { onMounted(() => {
os.api("notes/show", { noteId: props.block.note }).then( os.api("notes/show", { noteId: props.block.note }).then((result) => {
(result) => { note.value = result;
note.value = result; });
},
);
}); });
return { return {

View file

@ -63,10 +63,7 @@ export default defineComponent({
const formData = new FormData(); const formData = new FormData();
formData.append("file", blob); formData.append("file", blob);
if (this.defaultStore.state.uploadFolder) { if (this.defaultStore.state.uploadFolder) {
formData.append( formData.append("folderId", this.defaultStore.state.uploadFolder);
"folderId",
this.defaultStore.state.uploadFolder,
);
} }
fetch(apiUrl + "/drive/files/create", { fetch(apiUrl + "/drive/files/create", {
@ -87,9 +84,7 @@ export default defineComponent({
}, },
async post() { async post() {
this.posting = true; this.posting = true;
const file = this.block.attachCanvasImage const file = this.block.attachCanvasImage ? await this.upload() : null;
? await this.upload()
: null;
os.apiWithDialog("notes/create", { os.apiWithDialog("notes/create", {
text: this.text === "" ? null : this.text, text: this.text === "" ? null : this.text,
fileIds: file ? [file.id] : undefined, fileIds: file ? [file.id] : undefined,

View file

@ -1,5 +1,5 @@
import { markRaw } from "vue";
import { locale } from "@/config"; import { locale } from "@/config";
import { markRaw } from "vue";
class I18n<T extends Record<string, any>> { class I18n<T extends Record<string, any>> {
public ts: T; public ts: T;

View file

@ -22,6 +22,7 @@ if (accounts) {
} }
// #endregion // #endregion
import { set } from "@/scripts/idb-proxy";
import { import {
computed, computed,
createApp, createApp,
@ -30,7 +31,6 @@ import {
version as vueVersion, version as vueVersion,
watch, watch,
} from "vue"; } from "vue";
import { set } from "@/scripts/idb-proxy";
import { refreshAccount, signIn, signOut, updateAccount } from "@/account"; import { refreshAccount, signIn, signOut, updateAccount } from "@/account";
import components from "@/components"; import components from "@/components";

View file

@ -1,5 +1,5 @@
import { reactive } from "vue";
import type { Account } from "@/account"; import type { Account } from "@/account";
import { reactive } from "vue";
const accountData = localStorage.getItem("account"); const accountData = localStorage.getItem("account");

View file

@ -1,4 +1,3 @@
import { computed, reactive } from "vue";
import { ui } from "@/config"; import { ui } from "@/config";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { isSignedIn, me } from "@/me"; import { isSignedIn, me } from "@/me";
@ -6,6 +5,7 @@ import * as os from "@/os";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
import { search } from "@/scripts/search"; import { search } from "@/scripts/search";
import { unisonReload } from "@/scripts/unison-reload"; import { unisonReload } from "@/scripts/unison-reload";
import { computed, reactive } from "vue";
export const navbarItemDef = reactive({ export const navbarItemDef = reactive({
notifications: { notifications: {

View file

@ -1,10 +1,10 @@
// NIRAX --- A lightweight router // NIRAX --- A lightweight router
import { pleaseLogin } from "@/scripts/please-login";
import { safeURIDecode } from "@/scripts/safe-uri-decode";
import { EventEmitter } from "eventemitter3"; import { EventEmitter } from "eventemitter3";
import type { Component, ShallowRef } from "vue"; import type { Component, ShallowRef } from "vue";
import { shallowRef } from "vue"; import { shallowRef } from "vue";
import { safeURIDecode } from "@/scripts/safe-uri-decode";
import { pleaseLogin } from "@/scripts/please-login";
interface RouteDef { interface RouteDef {
path: string; path: string;

View file

@ -1,18 +1,18 @@
// TODO: なんでもかんでもos.tsに突っ込むのやめたいのでよしなに分割する // TODO: なんでもかんでもos.tsに突っ込むのやめたいのでよしなに分割する
import MkDialog from "@/components/MkDialog.vue";
import MkPostFormDialog from "@/components/MkPostFormDialog.vue";
import MkToast from "@/components/MkToast.vue";
import MkWaitingDialog from "@/components/MkWaitingDialog.vue";
import { url, apiUrl } from "@/config";
import { me } from "@/me";
import type { MenuItem } from "@/types/menu";
import { EventEmitter } from "eventemitter3"; import { EventEmitter } from "eventemitter3";
import { type entities, api as firefishApi } from "firefish-js"; import { type entities, api as firefishApi } from "firefish-js";
import insertTextAtCursor from "insert-text-at-cursor"; import insertTextAtCursor from "insert-text-at-cursor";
import type { Component, Ref } from "vue"; import type { Component, Ref } from "vue";
import { defineAsyncComponent, markRaw, ref } from "vue"; import { defineAsyncComponent, markRaw, ref } from "vue";
import { i18n } from "./i18n"; import { i18n } from "./i18n";
import MkDialog from "@/components/MkDialog.vue";
import MkPostFormDialog from "@/components/MkPostFormDialog.vue";
import MkToast from "@/components/MkToast.vue";
import MkWaitingDialog from "@/components/MkWaitingDialog.vue";
import { apiUrl, url } from "@/config";
import { me } from "@/me";
import type { MenuItem } from "@/types/menu";
export const pendingApiRequestsCount = ref(0); export const pendingApiRequestsCount = ref(0);

View file

@ -94,10 +94,7 @@ export default defineComponent({
methods: { methods: {
search() { search() {
if ( if ((this.q === "" || this.q == null) && this.selectedTags.size === 0) {
(this.q === "" || this.q == null) &&
this.selectedTags.size === 0
) {
this.searchEmojis = null; this.searchEmojis = null;
return; return;
} }
@ -105,17 +102,13 @@ export default defineComponent({
if (this.selectedTags.size === 0) { if (this.selectedTags.size === 0) {
this.searchEmojis = this.customEmojis.filter( this.searchEmojis = this.customEmojis.filter(
(emoji) => (emoji) =>
emoji.name.includes(this.q) || emoji.name.includes(this.q) || emoji.aliases.includes(this.q),
emoji.aliases.includes(this.q),
); );
} else { } else {
this.searchEmojis = this.customEmojis.filter( this.searchEmojis = this.customEmojis.filter(
(emoji) => (emoji) =>
(emoji.name.includes(this.q) || (emoji.name.includes(this.q) || emoji.aliases.includes(this.q)) &&
emoji.aliases.includes(this.q)) && [...this.selectedTags].every((t) => emoji.aliases.includes(t)),
[...this.selectedTags].every((t) =>
emoji.aliases.includes(t),
),
); );
} }
}, },

View file

@ -276,9 +276,7 @@ function easterEgg() {
setTimeout(() => { setTimeout(() => {
if (iconClicks % 6 === 0) { if (iconClicks % 6 === 0) {
iconSrc.value = iconSrc.value =
instance.iconUrl || instance.iconUrl || instance.faviconUrl || "/favicon.ico";
instance.faviconUrl ||
"/favicon.ico";
} else { } else {
iconSrc.value = "/static-assets/woozy.png"; iconSrc.value = "/static-assets/woozy.png";
} }

View file

@ -254,9 +254,7 @@ const headerTabs = computed(() => [
definePageMetadata( definePageMetadata(
computed(() => ({ computed(() => ({
title: file.value title: file.value ? i18n.ts.file + ": " + file.value.name : i18n.ts.file,
? i18n.ts.file + ": " + file.value.name
: i18n.ts.file,
icon: `${icon("ph-file")}`, icon: `${icon("ph-file")}`,
})), })),
); );

View file

@ -169,12 +169,10 @@ onMounted(() => {
if (tabEl && tabHighlightEl.value) { if (tabEl && tabHighlightEl.value) {
// offsetWidth offsetLeft getBoundingClientRect 使 // offsetWidth offsetLeft getBoundingClientRect 使
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4 // https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
const parentRect = const parentRect = tabEl.parentElement.getBoundingClientRect();
tabEl.parentElement.getBoundingClientRect();
const rect = tabEl.getBoundingClientRect(); const rect = tabEl.getBoundingClientRect();
tabHighlightEl.value.style.width = rect.width + "px"; tabHighlightEl.value.style.width = rect.width + "px";
tabHighlightEl.value.style.left = tabHighlightEl.value.style.left = rect.left - parentRect.left + "px";
rect.left - parentRect.left + "px";
} }
}); });
}, },

View file

@ -97,9 +97,7 @@ function remove(announcement) {
text: i18n.t("removeAreYouSure", { x: announcement.title }), text: i18n.t("removeAreYouSure", { x: announcement.title }),
}).then(({ canceled }) => { }).then(({ canceled }) => {
if (canceled) return; if (canceled) return;
announcements.value = announcements.value.filter( announcements.value = announcements.value.filter((x) => x !== announcement);
(x) => x !== announcement,
);
os.api("admin/announcements/delete", announcement); os.api("admin/announcements/delete", announcement);
}); });
} }

View file

@ -46,9 +46,7 @@ import icon from "@/scripts/icon";
const databasePromiseFactory = () => const databasePromiseFactory = () =>
os os
.api("admin/get-table-stats") .api("admin/get-table-stats")
.then((res) => .then((res) => Object.entries(res).sort((a, b) => b[1].size - a[1].size));
Object.entries(res).sort((a, b) => b[1].size - a[1].size),
);
const headerActions = computed(() => []); const headerActions = computed(() => []);

View file

@ -184,9 +184,7 @@ const remotePagination = {
limit: 30, limit: 30,
params: computed(() => ({ params: computed(() => ({
query: query:
queryRemote.value && queryRemote.value !== "" queryRemote.value && queryRemote.value !== "" ? queryRemote.value : null,
? queryRemote.value
: null,
host: host.value && host.value !== "" ? host.value : null, host: host.value && host.value !== "" ? host.value : null,
})), })),
}; };
@ -203,9 +201,7 @@ const selectAll = () => {
const toggleSelect = (emoji) => { const toggleSelect = (emoji) => {
if (selectedEmojis.value.includes(emoji.id)) { if (selectedEmojis.value.includes(emoji.id)) {
selectedEmojis.value = selectedEmojis.value.filter( selectedEmojis.value = selectedEmojis.value.filter((x) => x !== emoji.id);
(x) => x !== emoji.id,
);
} else { } else {
selectedEmojis.value.push(emoji.id); selectedEmojis.value.push(emoji.id);
} }
@ -305,9 +301,7 @@ const menu = (ev: MouseEvent) => {
icon: `${icon("ph-upload-simple")}`, icon: `${icon("ph-upload-simple")}`,
text: i18n.ts.importZip, text: i18n.ts.importZip,
action: async () => { action: async () => {
const file = await selectFile( const file = await selectFile(ev.currentTarget ?? ev.target);
ev.currentTarget ?? ev.target,
);
os.api("admin/emoji/import-zip", { os.api("admin/emoji/import-zip", {
fileId: file.id, fileId: file.id,
}) })
@ -329,10 +323,7 @@ const menu = (ev: MouseEvent) => {
icon: `${icon("ph-info")}`, icon: `${icon("ph-info")}`,
text: i18n.ts.emojiPackCreator, text: i18n.ts.emojiPackCreator,
action: () => { action: () => {
window.open( window.open("https://firefish.dev/firefish/emoji-gen", "_blank");
"https://firefish.dev/firefish/emoji-gen",
"_blank",
);
}, },
}, },
], ],

View file

@ -103,9 +103,7 @@ const pagination = {
userId: userId.value && userId.value !== "" ? userId.value : null, userId: userId.value && userId.value !== "" ? userId.value : null,
origin: origin.value, origin: origin.value,
hostname: hostname:
searchHost.value && searchHost.value !== "" searchHost.value && searchHost.value !== "" ? searchHost.value : null,
? searchHost.value
: null,
})), })),
}; };

View file

@ -46,8 +46,7 @@ async function init() {
function save() { function save() {
os.apiWithDialog("admin/update-meta", { os.apiWithDialog("admin/update-meta", {
hiddenTags: hiddenTags: hiddenTags.value.split("\n").map((h: string) => h.trim()) || [],
hiddenTags.value.split("\n").map((h: string) => h.trim()) || [],
}).then(() => { }).then(() => {
fetchInstance(); fetchInstance();
}); });

View file

@ -221,31 +221,25 @@ const menuDef = computed(() => [
icon: `${icon("ph-gear-six")}`, icon: `${icon("ph-gear-six")}`,
text: i18n.ts.general, text: i18n.ts.general,
to: "/admin/settings", to: "/admin/settings",
active: active: currentPage.value?.route.name === "settings",
currentPage.value?.route.name === "settings",
}, },
{ {
icon: `${icon("ph-envelope-simple-open")}`, icon: `${icon("ph-envelope-simple-open")}`,
text: i18n.ts.emailServer, text: i18n.ts.emailServer,
to: "/admin/email-settings", to: "/admin/email-settings",
active: active: currentPage.value?.route.name === "email-settings",
currentPage.value?.route.name ===
"email-settings",
}, },
{ {
icon: `${icon("ph-cloud")}`, icon: `${icon("ph-cloud")}`,
text: i18n.ts.objectStorage, text: i18n.ts.objectStorage,
to: "/admin/object-storage", to: "/admin/object-storage",
active: active: currentPage.value?.route.name === "object-storage",
currentPage.value?.route.name ===
"object-storage",
}, },
{ {
icon: `${icon("ph-lock")}`, icon: `${icon("ph-lock")}`,
text: i18n.ts.security, text: i18n.ts.security,
to: "/admin/security", to: "/admin/security",
active: active: currentPage.value?.route.name === "security",
currentPage.value?.route.name === "security",
}, },
{ {
icon: `${icon("ph-arrows-merge")}`, icon: `${icon("ph-arrows-merge")}`,
@ -257,38 +251,31 @@ const menuDef = computed(() => [
icon: `${icon("ph-prohibit")}`, icon: `${icon("ph-prohibit")}`,
text: i18n.ts.instanceBlocking, text: i18n.ts.instanceBlocking,
to: "/admin/instance-block", to: "/admin/instance-block",
active: active: currentPage.value?.route.name === "instance-block",
currentPage.value?.route.name ===
"instance-block",
}, },
{ {
icon: `${icon("ph-hash")}`, icon: `${icon("ph-hash")}`,
text: i18n.ts.hiddenTags, text: i18n.ts.hiddenTags,
to: "/admin/hashtags", to: "/admin/hashtags",
active: active: currentPage.value?.route.name === "hashtags",
currentPage.value?.route.name === "hashtags",
}, },
{ {
icon: `${icon("ph-ghost")}`, icon: `${icon("ph-ghost")}`,
text: i18n.ts.proxyAccount, text: i18n.ts.proxyAccount,
to: "/admin/proxy-account", to: "/admin/proxy-account",
active: active: currentPage.value?.route.name === "proxy-account",
currentPage.value?.route.name ===
"proxy-account",
}, },
{ {
icon: `${icon("ph-database")}`, icon: `${icon("ph-database")}`,
text: i18n.ts.database, text: i18n.ts.database,
to: "/admin/database", to: "/admin/database",
active: active: currentPage.value?.route.name === "database",
currentPage.value?.route.name === "database",
}, },
{ {
icon: `${icon("ph-flask")}`, icon: `${icon("ph-flask")}`,
text: i18n.ts._experiments.title, text: i18n.ts._experiments.title,
to: "/admin/experiments", to: "/admin/experiments",
active: active: currentPage.value?.route.name === "experiments",
currentPage.value?.route.name === "experiments",
}, },
], ],
}, },

View file

@ -70,8 +70,7 @@ async function init() {
function save() { function save() {
os.apiWithDialog("admin/update-meta", { os.apiWithDialog("admin/update-meta", {
blockedHosts: blockedHosts.value.split("\n").map((h) => h.trim()) || [], blockedHosts: blockedHosts.value.split("\n").map((h) => h.trim()) || [],
silencedHosts: silencedHosts: silencedHosts.value.split("\n").map((h) => h.trim()) || [],
silencedHosts.value.split("\n").map((h) => h.trim()) || [],
}).then(() => { }).then(() => {
fetchInstance(); fetchInstance();
}); });

View file

@ -530,7 +530,8 @@ function isValidHttpUrl(src: string) {
function parseMoreUrls(src: string): { name: string; url: string }[] { function parseMoreUrls(src: string): { name: string; url: string }[] {
const toReturn: { name: string; url: string }[] = []; const toReturn: { name: string; url: string }[] = [];
const pattern = /"(.+)"\s*:\s*(http.+)/; const pattern = /"(.+)"\s*:\s*(http.+)/;
src.trim() src
.trim()
.split("\n") .split("\n")
.forEach((line) => { .forEach((line) => {
const match = pattern.exec(line); const match = pattern.exec(line);
@ -590,9 +591,7 @@ async function init() {
defaultReaction.value = ["⭐", "👍", "❤️"].includes(meta.defaultReaction) defaultReaction.value = ["⭐", "👍", "❤️"].includes(meta.defaultReaction)
? meta.defaultReaction ? meta.defaultReaction
: "custom"; : "custom";
defaultReactionCustom.value = ["⭐", "👍", "❤️"].includes( defaultReactionCustom.value = ["⭐", "👍", "❤️"].includes(meta.defaultReaction)
meta.defaultReaction,
)
? "" ? ""
: meta.defaultReaction; : meta.defaultReaction;
enableServerMachineStats.value = meta.enableServerMachineStats; enableServerMachineStats.value = meta.enableServerMachineStats;

View file

@ -72,11 +72,9 @@ onMounted(() => {
fetching.value = false; fetching.value = false;
if (session.value.app.isAuthorized) { if (session.value.app.isAuthorized) {
os.api("auth/accept", { token: session.value.token }).then( os.api("auth/accept", { token: session.value.token }).then(() => {
() => { accepted();
accepted(); });
},
);
} else { } else {
state.value = "waiting"; state.value = "waiting";
} }

View file

@ -75,28 +75,25 @@ const headerActions = computed(() =>
icon: `${icon("ph-pencil")}`, icon: `${icon("ph-pencil")}`,
text: i18n.ts.toEdit, text: i18n.ts.toEdit,
handler: async (): Promise<void> => { handler: async (): Promise<void> => {
const { canceled, result } = await os.form( const { canceled, result } = await os.form(clip.value.name, {
clip.value.name, name: {
{ type: "string",
name: { label: i18n.ts.name,
type: "string", default: clip.value.name,
label: i18n.ts.name,
default: clip.value.name,
},
description: {
type: "string",
required: false,
multiline: true,
label: i18n.ts.description,
default: clip.value.description,
},
isPublic: {
type: "boolean",
label: i18n.ts.public,
default: clip.value.isPublic,
},
}, },
); description: {
type: "string",
required: false,
multiline: true,
label: i18n.ts.description,
default: clip.value.description,
},
isPublic: {
type: "boolean",
label: i18n.ts.public,
default: clip.value.isPublic,
},
});
if (canceled) return; if (canceled) return;
os.apiWithDialog("clips/update", { os.apiWithDialog("clips/update", {

View file

@ -37,14 +37,12 @@ function menu(ev) {
text: i18n.ts.license, text: i18n.ts.license,
icon: `${icon("ph-info")}`, icon: `${icon("ph-info")}`,
action: () => { action: () => {
os.apiGet("emoji", { name: props.emoji.name }).then( os.apiGet("emoji", { name: props.emoji.name }).then((res) => {
(res) => { os.alert({
os.alert({ type: "info",
type: "info", text: `${res.license || i18n.ts.notSet}`,
text: `${res.license || i18n.ts.notSet}`, });
}); });
},
);
}, },
}, },
], ],

View file

@ -182,8 +182,7 @@ function onMessage(message): void {
!( !(
(m.recipientId === message.recipientId && (m.recipientId === message.recipientId &&
m.userId === message.userId) || m.userId === message.userId) ||
(m.recipientId === message.userId && (m.recipientId === message.userId && m.userId === message.recipientId)
m.userId === message.recipientId)
), ),
); );
@ -267,8 +266,7 @@ onMounted(() => {
const _messages = userMessages.concat(groupMessages); const _messages = userMessages.concat(groupMessages);
_messages.sort( _messages.sort(
(a, b) => (a, b) =>
new Date(b.createdAt).getTime() - new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),
new Date(a.createdAt).getTime(),
); );
messages.value = _messages; messages.value = _messages;
}, },

View file

@ -90,8 +90,7 @@ const draftKey = computed(() =>
props.user ? "user:" + props.user.id : "group:" + props.group?.id, props.user ? "user:" + props.user.id : "group:" + props.group?.id,
); );
const canSend = computed( const canSend = computed(
() => () => (text.value != null && text.value.trim() !== "") || file.value != null,
(text.value != null && text.value.trim() !== "") || file.value != null,
); );
watch([text, file], saveDraft); watch([text, file], saveDraft);

View file

@ -280,9 +280,7 @@ function onRead(x) {
if (!Array.isArray(x)) x = [x]; if (!Array.isArray(x)) x = [x];
for (const id of x) { for (const id of x) {
if (pagingComponent.value.items.some((y) => y.id === id)) { if (pagingComponent.value.items.some((y) => y.id === id)) {
const exist = pagingComponent.value.items const exist = pagingComponent.value.items.map((y) => y.id).indexOf(id);
.map((y) => y.id)
.indexOf(id);
pagingComponent.value.items[exist] = { pagingComponent.value.items[exist] = {
...pagingComponent.value.items[exist], ...pagingComponent.value.items[exist],
isRead: true, isRead: true,
@ -292,15 +290,10 @@ function onRead(x) {
} else if (group.value) { } else if (group.value) {
for (const id of x.ids) { for (const id of x.ids) {
if (pagingComponent.value.items.some((y) => y.id === id)) { if (pagingComponent.value.items.some((y) => y.id === id)) {
const exist = pagingComponent.value.items const exist = pagingComponent.value.items.map((y) => y.id).indexOf(id);
.map((y) => y.id)
.indexOf(id);
pagingComponent.value.items[exist] = { pagingComponent.value.items[exist] = {
...pagingComponent.value.items[exist], ...pagingComponent.value.items[exist],
reads: [ reads: [...pagingComponent.value.items[exist].reads, x.userId],
...pagingComponent.value.items[exist].reads,
x.userId,
],
}; };
} }
} }

View file

@ -175,20 +175,15 @@ definePageMetadata(
appearNote.value appearNote.value
? { ? {
title: i18n.t("noteOf", { title: i18n.t("noteOf", {
user: user: appearNote.value.user.name || appearNote.value.user.username,
appearNote.value.user.name ||
appearNote.value.user.username,
}), }),
subtitle: new Date( subtitle: new Date(appearNote.value.createdAt).toLocaleString(),
appearNote.value.createdAt,
).toLocaleString(),
avatar: appearNote.value.user, avatar: appearNote.value.user,
path: `/notes/${appearNote.value.id}`, path: `/notes/${appearNote.value.id}`,
share: { share: {
title: i18n.t("noteOf", { title: i18n.t("noteOf", {
user: user:
appearNote.value.user.name || appearNote.value.user.name || appearNote.value.user.username,
appearNote.value.user.username,
}), }),
text: appearNote.value.text, text: appearNote.value.text,
}, },

View file

@ -164,9 +164,7 @@ export default defineComponent({
components: { components: {
XContainer, XContainer,
MkTextarea, MkTextarea,
XV: defineAsyncComponent( XV: defineAsyncComponent(() => import("./page-editor.script-block.vue")),
() => import("./page-editor.script-block.vue"),
),
}, },
inject: ["getScriptBlockList"], inject: ["getScriptBlockList"],
@ -228,12 +226,10 @@ export default defineComponent({
watch: { watch: {
slots: { slots: {
handler() { handler() {
this.modelValue.value.slots = this.slots this.modelValue.value.slots = this.slots.split("\n").map((x) => ({
.split("\n") name: x,
.map((x) => ({ type: null,
name: x, }));
type: null,
}));
}, },
deep: true, deep: true,
}, },
@ -243,9 +239,7 @@ export default defineComponent({
if (this.modelValue.value == null) this.modelValue.value = null; if (this.modelValue.value == null) this.modelValue.value = null;
if (this.modelValue.value && this.modelValue.value.slots) if (this.modelValue.value && this.modelValue.value.slots)
this.slots = this.modelValue.value.slots this.slots = this.modelValue.value.slots.map((x) => x.name).join("\n");
.map((x) => x.name)
.join("\n");
this.$watch( this.$watch(
() => this.modelValue.type, () => this.modelValue.type,
@ -261,10 +255,7 @@ export default defineComponent({
return; return;
} }
if ( if (this.modelValue.type && this.modelValue.type.startsWith("fn:")) {
this.modelValue.type &&
this.modelValue.type.startsWith("fn:")
) {
const fnName = this.modelValue.type.split(":")[1]; const fnName = this.modelValue.type.split(":")[1];
const fn = this.hpml.getVarByName(fnName); const fn = this.hpml.getVarByName(fnName);
@ -280,27 +271,17 @@ export default defineComponent({
if (isLiteralValue(this.modelValue)) return; if (isLiteralValue(this.modelValue)) return;
const empties = []; const empties = [];
for ( for (let i = 0; i < funcDefs[this.modelValue.type].in.length; i++) {
let i = 0;
i < funcDefs[this.modelValue.type].in.length;
i++
) {
const id = uuid(); const id = uuid();
empties.push({ id, type: null }); empties.push({ id, type: null });
} }
this.modelValue.args = empties; this.modelValue.args = empties;
for ( for (let i = 0; i < funcDefs[this.modelValue.type].in.length; i++) {
let i = 0;
i < funcDefs[this.modelValue.type].in.length;
i++
) {
const inType = funcDefs[this.modelValue.type].in[i]; const inType = funcDefs[this.modelValue.type].in[i];
if (typeof inType !== "number") { if (typeof inType !== "number") {
if (inType === "number") if (inType === "number") this.modelValue.args[i].type = "number";
this.modelValue.args[i].type = "number"; if (inType === "string") this.modelValue.args[i].type = "text";
if (inType === "string")
this.modelValue.args[i].type = "text";
} }
} }
}, },

View file

@ -64,9 +64,7 @@ function fetchKeys() {
os.api("i/registry/keys-with-type", { os.api("i/registry/keys-with-type", {
scope: scope.value, scope: scope.value,
}).then((res) => { }).then((res) => {
keys.value = Object.entries(res).sort((a, b) => keys.value = Object.entries(res).sort((a, b) => a[0].localeCompare(b[0]));
a[0].localeCompare(b[0]),
);
}); });
} }

View file

@ -56,9 +56,7 @@ async function save() {
onMounted(() => { onMounted(() => {
if (props.token == null) { if (props.token == null) {
os.popup( os.popup(
defineAsyncComponent( defineAsyncComponent(() => import("@/components/MkForgotPassword.vue")),
() => import("@/components/MkForgotPassword.vue"),
),
{}, {},
{}, {},
"closed", "closed",

View file

@ -89,10 +89,7 @@ async function run() {
out: (value) => { out: (value) => {
logs.value.push({ logs.value.push({
id: Math.random(), id: Math.random(),
text: text: value.type === "str" ? value.value : utils.valToString(value),
value.type === "str"
? value.value
: utils.valToString(value),
print: true, print: true,
}); });
}, },

View file

@ -78,8 +78,7 @@ const notesPagination = {
host: props.host == null ? undefined : getHost(props.host), host: props.host == null ? undefined : getHost(props.host),
sinceDate: sinceDate:
props.since == null ? undefined : getUnixTime(props.since, false), props.since == null ? undefined : getUnixTime(props.since, false),
untilDate: untilDate: props.until == null ? undefined : getUnixTime(props.until, true),
props.until == null ? undefined : getUnixTime(props.until, true),
withFiles: props.withFiles === "1", withFiles: props.withFiles === "1",
searchCwAndAlt: props.searchCwAndAlt === "1", searchCwAndAlt: props.searchCwAndAlt === "1",
channelId: props.channel, channelId: props.channel,

View file

@ -107,8 +107,7 @@ async function install() {
return; return;
} }
const { name, version, author, description, permissions, config } = const { name, version, author, description, permissions, config } = metadata;
metadata;
if (name == null || version == null || author == null) { if (name == null || version == null || author == null) {
os.alert({ os.alert({
type: "error", type: "error",
@ -123,29 +122,22 @@ async function install() {
: await new Promise((res, rej) => { : await new Promise((res, rej) => {
os.popup( os.popup(
defineAsyncComponent( defineAsyncComponent(
() => () => import("@/components/MkTokenGenerateWindow.vue"),
import(
"@/components/MkTokenGenerateWindow.vue"
),
), ),
{ {
title: i18n.ts.tokenRequested, title: i18n.ts.tokenRequested,
information: information: i18n.ts.pluginTokenRequestedDescription,
i18n.ts.pluginTokenRequestedDescription,
initialName: name, initialName: name,
initialPermissions: permissions, initialPermissions: permissions,
}, },
{ {
done: async (result) => { done: async (result) => {
const { name, permissions } = result; const { name, permissions } = result;
const { token } = await os.api( const { token } = await os.api("miauth/gen-token", {
"miauth/gen-token", session: null,
{ name,
session: null, permission: permissions,
name, });
permission: permissions,
},
);
res(token); res(token);
}, },
}, },

View file

@ -196,10 +196,7 @@ function validate(profile: unknown): void {
// Check if createdAt and updatedAt is Date // Check if createdAt and updatedAt is Date
// https://zenn.dev/lollipop_onl/articles/eoz-judge-js-invalid-date // https://zenn.dev/lollipop_onl/articles/eoz-judge-js-invalid-date
if ( if (!profile.createdAt || Number.isNaN(new Date(profile.createdAt).getTime()))
!profile.createdAt ||
Number.isNaN(new Date(profile.createdAt).getTime())
)
throw new Error("createdAt is falsy or not Date"); throw new Error("createdAt is falsy or not Date");
if (profile.updatedAt) { if (profile.updatedAt) {
if (Number.isNaN(new Date(profile.updatedAt).getTime())) { if (Number.isNaN(new Date(profile.updatedAt).getTime())) {
@ -228,10 +225,7 @@ function getSettings(): Profile["settings"] {
hot, hot,
cold, cold,
fontSize: localStorage.getItem("fontSize"), fontSize: localStorage.getItem("fontSize"),
useSystemFont: localStorage.getItem("useSystemFont") as useSystemFont: localStorage.getItem("useSystemFont") as "t" | "f" | null,
| "t"
| "f"
| null,
wallpaper: localStorage.getItem("wallpaper"), wallpaper: localStorage.getItem("wallpaper"),
}; };
} }
@ -468,12 +462,9 @@ function menu(ev: MouseEvent, profileId: string) {
text: i18n.ts.download, text: i18n.ts.download,
icon: `${icon("ph-download-simple")}`, icon: `${icon("ph-download-simple")}`,
href: URL.createObjectURL( href: URL.createObjectURL(
new Blob( new Blob([JSON.stringify(profiles.value[profileId], null, 2)], {
[JSON.stringify(profiles.value[profileId], null, 2)], type: "application/json",
{ }),
type: "application/json",
},
),
), ),
download: `${profiles.value[profileId].name}.json`, download: `${profiles.value[profileId].name}.json`,
}, },
@ -502,20 +493,17 @@ function menu(ev: MouseEvent, profileId: string) {
onMounted(() => { onMounted(() => {
// streaminguser storage update // streaminguser storage update
connection?.on( connection?.on("registryUpdated", ({ scope: recievedScope, key, value }) => {
"registryUpdated", if (
({ scope: recievedScope, key, value }) => { !recievedScope ||
if ( recievedScope.length !== scope.length ||
!recievedScope || recievedScope[0] !== scope[0]
recievedScope.length !== scope.length || )
recievedScope[0] !== scope[0] return;
) if (!profiles.value) return;
return;
if (!profiles.value) return;
profiles.value[key] = value; profiles.value[key] = value;
}, });
);
}); });
onUnmounted(() => { onUnmounted(() => {

View file

@ -213,9 +213,7 @@ while (fields.length < 4) {
function saveFields() { function saveFields() {
os.apiWithDialog("i/update", { os.apiWithDialog("i/update", {
fields: fields.filter( fields: fields.filter((field) => field.name !== "" && field.value !== ""),
(field) => field.name !== "" && field.value !== "",
),
}); });
} }

View file

@ -179,9 +179,7 @@ function remove(reaction, ev: MouseEvent) {
{ {
text: i18n.ts.remove, text: i18n.ts.remove,
action: () => { action: () => {
reactions.value = reactions.value.filter( reactions.value = reactions.value.filter((x) => x !== reaction);
(x) => x !== reaction,
);
save(); save();
}, },
}, },
@ -192,9 +190,7 @@ function remove(reaction, ev: MouseEvent) {
function preview(ev: MouseEvent) { function preview(ev: MouseEvent) {
os.popup( os.popup(
defineAsyncComponent( defineAsyncComponent(() => import("@/components/MkEmojiPickerDialog.vue")),
() => import("@/components/MkEmojiPickerDialog.vue"),
),
{ {
asReactionPicker: true, asReactionPicker: true,
src: ev.currentTarget ?? ev.target, src: ev.currentTarget ?? ev.target,

View file

@ -71,13 +71,11 @@ const pagination = {
}; };
async function change() { async function change() {
const { canceled: canceled1, result: currentPassword } = await os.inputText( const { canceled: canceled1, result: currentPassword } = await os.inputText({
{ title: i18n.ts.currentPassword,
title: i18n.ts.currentPassword, type: "password",
type: "password", autocomplete: "current-password",
autocomplete: "current-password", });
},
);
if (canceled1) return; if (canceled1) return;
const { canceled: canceled2, result: newPassword } = await os.inputText({ const { canceled: canceled2, result: newPassword } = await os.inputText({

View file

@ -193,9 +193,7 @@ watch(
watch(statusbar, save); watch(statusbar, save);
async function save() { async function save() {
const i = defaultStore.state.statusbars.findIndex( const i = defaultStore.state.statusbars.findIndex((x) => x.id === props._id);
(x) => x.id === props._id,
);
const statusbars = deepClone(defaultStore.state.statusbars); const statusbars = deepClone(defaultStore.state.statusbars);
statusbars[i] = deepClone(statusbar); statusbars[i] = deepClone(statusbar);
defaultStore.set("statusbars", statusbars); defaultStore.set("statusbars", statusbars);

View file

@ -179,9 +179,7 @@ const instanceLightTheme = computed(() =>
instance.defaultLightTheme ? JSON5.parse(instance.defaultLightTheme) : null, instance.defaultLightTheme ? JSON5.parse(instance.defaultLightTheme) : null,
); );
const installedLightThemes = computed(() => const installedLightThemes = computed(() =>
installedThemes.value.filter( installedThemes.value.filter((t) => t.base === "light" || t.kind === "light"),
(t) => t.base === "light" || t.kind === "light",
),
); );
const builtinLightThemes = computed(() => const builtinLightThemes = computed(() =>
builtinThemes.value.filter((t) => t.base === "light" || t.kind === "light"), builtinThemes.value.filter((t) => t.base === "light" || t.kind === "light"),

View file

@ -224,10 +224,7 @@ async function save() {
let softMutes, softMLangs, hardMWords, hardMPatterns; let softMutes, softMLangs, hardMWords, hardMPatterns;
try { try {
softMutes = parseSoftMutes( softMutes = parseSoftMutes(softMutedWords.value, i18n.ts._wordMute.soft);
softMutedWords.value,
i18n.ts._wordMute.soft,
);
softMLangs = parseMutedWords(softMutedLangs.value); softMLangs = parseMutedWords(softMutedLangs.value);
hardMWords = parseMutedWords(hardMutedWords.value); hardMWords = parseMutedWords(hardMutedWords.value);
hardMPatterns = parseMutedPatterns( hardMPatterns = parseMutedPatterns(

View file

@ -81,9 +81,7 @@ async function init() {
...(visibleUserIds ...(visibleUserIds
? visibleUserIds.split(",").map((userId) => ({ userId })) ? visibleUserIds.split(",").map((userId) => ({ userId }))
: []), : []),
...(visibleAccts ...(visibleAccts ? visibleAccts.split(",").map(acct.parse) : []),
? visibleAccts.split(",").map(acct.parse)
: []),
] ]
// TypeScript // TypeScript
.map((q) => .map((q) =>
@ -100,9 +98,7 @@ async function init() {
visibleUsers.value.push(user); visibleUsers.value.push(user);
}, },
() => { () => {
console.error( console.error(`Invalid user query: ${JSON.stringify(q)}`);
`Invalid user query: ${JSON.stringify(q)}`,
);
}, },
), ),
), ),

View file

@ -414,8 +414,7 @@ function createFetcher() {
emojiModPerm.value = info.value.emojiModPerm; emojiModPerm.value = info.value.emojiModPerm;
silenced.value = info.value.isSilenced; silenced.value = info.value.isSilenced;
suspended.value = info.value.isSuspended; suspended.value = info.value.isSuspended;
driveCapacityOverrideMb.value = driveCapacityOverrideMb.value = user.value.driveCapacityOverrideMb;
user.value.driveCapacityOverrideMb;
moderationNote.value = info.value.moderationNote; moderationNote.value = info.value.moderationNote;
watch(moderationNote, async () => { watch(moderationNote, async () => {

View file

@ -168,10 +168,7 @@ export default defineComponent({
text: i18n.ts.help, text: i18n.ts.help,
icon: `${icon("ph-question")}`, icon: `${icon("ph-question")}`,
action: () => { action: () => {
window.open( window.open(`https://misskey-hub.net/help.md`, "_blank");
`https://misskey-hub.net/help.md`,
"_blank",
);
}, },
}, },
], ],

View file

@ -1,10 +1,10 @@
// PIZZAX --- A lightweight store // PIZZAX --- A lightweight store
import { isSignedIn, me } from "@/me";
import type { Ref } from "vue"; import type { Ref } from "vue";
import { onUnmounted, ref, watch } from "vue"; import { onUnmounted, ref, watch } from "vue";
import { api } from "./os"; import { api } from "./os";
import { useStream } from "./stream"; import { useStream } from "./stream";
import { isSignedIn, me } from "@/me";
type StateDef = Record< type StateDef = Record<
string, string,

View file

@ -1,4 +1,3 @@
import { Interpreter, Parser, utils, values } from "@syuilo/aiscript";
import { inputText } from "@/os"; import { inputText } from "@/os";
import { createAiScriptEnv } from "@/scripts/aiscript/api"; import { createAiScriptEnv } from "@/scripts/aiscript/api";
import { import {
@ -8,6 +7,7 @@ import {
postFormActions, postFormActions,
userActions, userActions,
} from "@/store"; } from "@/store";
import { Interpreter, Parser, utils, values } from "@syuilo/aiscript";
const parser = new Parser(); const parser = new Parser();
const pluginContexts = new Map<string, Interpreter>(); const pluginContexts = new Map<string, Interpreter>();

View file

@ -1,9 +1,9 @@
import type { AsyncComponentLoader } from "vue";
import { defineAsyncComponent, inject } from "vue";
import { isEmojiMod, isModerator, me } from "@/me"; import { isEmojiMod, isModerator, me } from "@/me";
import { Router } from "@/nirax"; import { Router } from "@/nirax";
import MkError from "@/pages/_error_.vue"; import MkError from "@/pages/_error_.vue";
import MkLoading from "@/pages/_loading_.vue"; import MkLoading from "@/pages/_loading_.vue";
import type { AsyncComponentLoader } from "vue";
import { defineAsyncComponent, inject } from "vue";
const page = (loader: AsyncComponentLoader<any>) => const page = (loader: AsyncComponentLoader<any>) =>
defineAsyncComponent({ defineAsyncComponent({

View file

@ -1,7 +1,7 @@
import { Stream } from "firefish-js";
import { markRaw } from "vue";
import { url } from "@/config"; import { url } from "@/config";
import { me } from "@/me"; import { me } from "@/me";
import { Stream } from "firefish-js";
import { markRaw } from "vue";
let stream: Stream | null = null; let stream: Stream | null = null;
let timeoutHeartBeat: number | null = null; let timeoutHeartBeat: number | null = null;

View file

@ -1,6 +1,6 @@
import type { Theme } from "./scripts/theme";
import { isSignedIn, me } from "@/me"; import { isSignedIn, me } from "@/me";
import { api } from "@/os"; import { api } from "@/os";
import type { Theme } from "./scripts/theme";
const lsCacheKey = isSignedIn ? `themes:${me.id}` : ""; const lsCacheKey = isSignedIn ? `themes:${me.id}` : "";

View file

@ -178,8 +178,7 @@ const otherMenuItemIndicated = computed(() => {
const calcViewState = () => { const calcViewState = () => {
iconOnly.value = iconOnly.value =
window.innerWidth <= 1279 || window.innerWidth <= 1279 || defaultStore.state.menuDisplay === "sideIcon";
defaultStore.state.menuDisplay === "sideIcon";
}; };
calcViewState(); calcViewState();

View file

@ -216,9 +216,7 @@ const XStatusBars = defineAsyncComponent(
mainRouter.navHook = (path, flag): boolean => { mainRouter.navHook = (path, flag): boolean => {
if (flag === "forcePage") return false; if (flag === "forcePage") return false;
const noMainColumn = !deckStore.state.columns.some( const noMainColumn = !deckStore.state.columns.some((x) => x.type === "main");
(x) => x.type === "main",
);
if (deckStore.state.navWindow || noMainColumn) { if (deckStore.state.navWindow || noMainColumn) {
os.pageWindow(path); os.pageWindow(path);
return true; return true;

View file

@ -394,9 +394,7 @@ async function startGroup(): void {
onMounted(() => { onMounted(() => {
if (!isDesktop.value) { if (!isDesktop.value) {
matchMedia(`(min-width: ${DESKTOP_THRESHOLD - 1}px)`).onchange = ( matchMedia(`(min-width: ${DESKTOP_THRESHOLD - 1}px)`).onchange = (mql) => {
mql,
) => {
if (mql.matches) isDesktop.value = true; if (mql.matches) isDesktop.value = true;
}; };
} }

View file

@ -140,8 +140,7 @@ export default defineComponent({
window.addEventListener( window.addEventListener(
"resize", "resize",
() => { () => {
if (window.innerWidth >= DESKTOP_THRESHOLD) if (window.innerWidth >= DESKTOP_THRESHOLD) this.isDesktop = true;
this.isDesktop = true;
}, },
{ passive: true }, { passive: true },
); );

View file

@ -166,8 +166,7 @@ onMounted(() => {
window.addEventListener( window.addEventListener(
"resize", "resize",
() => { () => {
if (window.innerWidth >= DESKTOP_THRESHOLD) if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true;
isDesktop.value = true;
}, },
{ passive: true }, { passive: true },
); );

View file

@ -99,10 +99,7 @@ const run = async () => {
out: (value) => { out: (value) => {
logs.value.push({ logs.value.push({
id: Math.random().toString(), id: Math.random().toString(),
text: text: value.type === "str" ? value.value : utils.valToString(value),
value.type === "str"
? value.value
: utils.valToString(value),
print: true, print: true,
}); });
}, },

View file

@ -203,13 +203,10 @@ const tzAbbrev = computed(
? timezones.find( ? timezones.find(
(tz) => (tz) =>
tz.name.toLowerCase() === tz.name.toLowerCase() ===
Intl.DateTimeFormat() Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase(),
.resolvedOptions()
.timeZone.toLowerCase(),
)?.abbrev )?.abbrev
: timezones.find( : timezones.find((tz) => tz.name.toLowerCase() === widgetProps.timezone)
(tz) => tz.name.toLowerCase() === widgetProps.timezone, ?.abbrev) ?? "?",
)?.abbrev) ?? "?",
); );
const tzOffset = computed(() => const tzOffset = computed(() =>

View file

@ -83,13 +83,10 @@ const tzAbbrev = computed(
? timezones.find( ? timezones.find(
(tz) => (tz) =>
tz.name.toLowerCase() === tz.name.toLowerCase() ===
Intl.DateTimeFormat() Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase(),
.resolvedOptions()
.timeZone.toLowerCase(),
)?.abbrev )?.abbrev
: timezones.find( : timezones.find((tz) => tz.name.toLowerCase() === widgetProps.timezone)
(tz) => tz.name.toLowerCase() === widgetProps.timezone, ?.abbrev) ?? "?",
)?.abbrev) ?? "?",
); );
const tzOffset = computed(() => const tzOffset = computed(() =>

View file

@ -147,19 +147,13 @@ function onStats(connStats) {
viewBoxY.value viewBoxY.value
} ${memPolylinePoints.value} ${viewBoxX.value},${viewBoxY.value}`; } ${memPolylinePoints.value} ${viewBoxX.value},${viewBoxY.value}`;
cpuHeadX.value = cpuHeadX.value = cpuPolylinePointsStats[cpuPolylinePointsStats.length - 1][0];
cpuPolylinePointsStats[cpuPolylinePointsStats.length - 1][0]; cpuHeadY.value = cpuPolylinePointsStats[cpuPolylinePointsStats.length - 1][1];
cpuHeadY.value = memHeadX.value = memPolylinePointsStats[memPolylinePointsStats.length - 1][0];
cpuPolylinePointsStats[cpuPolylinePointsStats.length - 1][1]; memHeadY.value = memPolylinePointsStats[memPolylinePointsStats.length - 1][1];
memHeadX.value =
memPolylinePointsStats[memPolylinePointsStats.length - 1][0];
memHeadY.value =
memPolylinePointsStats[memPolylinePointsStats.length - 1][1];
cpuP.value = (connStats.cpu * 100).toFixed(0); cpuP.value = (connStats.cpu * 100).toFixed(0);
memP.value = ((connStats.mem.active / connStats.mem.total) * 100).toFixed( memP.value = ((connStats.mem.active / connStats.mem.total) * 100).toFixed(0);
0,
);
} }
function onStatsLog(statsLog) { function onStatsLog(statsLog) {

View file

@ -112,10 +112,8 @@ function onStats(connStats) {
inHeadX.value = inPolylinePointsStats[inPolylinePointsStats.length - 1][0]; inHeadX.value = inPolylinePointsStats[inPolylinePointsStats.length - 1][0];
inHeadY.value = inPolylinePointsStats[inPolylinePointsStats.length - 1][1]; inHeadY.value = inPolylinePointsStats[inPolylinePointsStats.length - 1][1];
outHeadX.value = outHeadX.value = outPolylinePointsStats[outPolylinePointsStats.length - 1][0];
outPolylinePointsStats[outPolylinePointsStats.length - 1][0]; outHeadY.value = outPolylinePointsStats[outPolylinePointsStats.length - 1][1];
outHeadY.value =
outPolylinePointsStats[outPolylinePointsStats.length - 1][1];
inRecent.value = connStats.net.rx; inRecent.value = connStats.net.rx;
outRecent.value = connStats.net.tx; outRecent.value = connStats.net.tx;

View file

@ -1,4 +1,4 @@
import Entity from "./entity"; import type Entity from "./entity";
namespace FilterContext { namespace FilterContext {
export const Home: Entity.FilterContext = "home"; export const Home: Entity.FilterContext = "home";

View file

@ -1,17 +1,17 @@
import Response from "./response"; import { RequestCanceledError, isCancel } from "./cancel";
import OAuth from "./oauth"; import Converter from "./converter";
import { isCancel, RequestCanceledError } from "./cancel"; import Entity from "./entity";
import { ProxyConfig } from "./proxy_config"; import FilterContext from "./filter_context";
import generator, { import generator, {
detector, detector,
MegalodonInterface, MegalodonInterface,
WebSocketInterface, WebSocketInterface,
} from "./megalodon"; } from "./megalodon";
import Misskey from "./misskey"; import Misskey from "./misskey";
import Entity from "./entity";
import NotificationType from "./notification"; import NotificationType from "./notification";
import FilterContext from "./filter_context"; import OAuth from "./oauth";
import Converter from "./converter"; import { ProxyConfig } from "./proxy_config";
import Response from "./response";
export { export {
Response, Response,

Some files were not shown because too many files have changed in this diff Show more