chore: format
This commit is contained in:
parent
51c3dde159
commit
96a430bf5e
105 changed files with 295 additions and 615 deletions
|
@ -1,11 +1,11 @@
|
|||
import type { entities } from "firefish-js";
|
||||
import { defineAsyncComponent } from "vue";
|
||||
import { i18n } from "./i18n";
|
||||
import { apiUrl } from "@/config";
|
||||
import { me } from "@/me";
|
||||
import { alert, api, popup, popupMenu, waiting } from "@/os";
|
||||
import { del, get, set } from "@/scripts/idb-proxy";
|
||||
import { reloadChannel, unisonReload } from "@/scripts/unison-reload";
|
||||
import type { entities } from "firefish-js";
|
||||
import { defineAsyncComponent } from "vue";
|
||||
import { i18n } from "./i18n";
|
||||
|
||||
// TODO: 他のタブと永続化されたstateを同期
|
||||
|
||||
|
|
|
@ -179,8 +179,7 @@ async function renderActiveUsersChart() {
|
|||
enabled: false,
|
||||
callbacks: {
|
||||
title(context) {
|
||||
const v =
|
||||
context[0].dataset.data[context[0].dataIndex];
|
||||
const v = context[0].dataset.data[context[0].dataIndex];
|
||||
return v.d;
|
||||
},
|
||||
label(context) {
|
||||
|
|
|
@ -83,9 +83,7 @@ function getMenu() {
|
|||
text: props.file.isSensitive
|
||||
? i18n.ts.unmarkAsSensitive
|
||||
: i18n.ts.markAsSensitive,
|
||||
icon: props.file.isSensitive
|
||||
? "ph-eye ph-lg"
|
||||
: "ph-eye-slash ph-lg",
|
||||
icon: props.file.isSensitive ? "ph-eye ph-lg" : "ph-eye-slash ph-lg",
|
||||
action: toggleSensitive,
|
||||
},
|
||||
{
|
||||
|
@ -129,9 +127,7 @@ function onClick(ev: MouseEvent) {
|
|||
} else {
|
||||
os.popupMenu(
|
||||
getMenu(),
|
||||
(ev.currentTarget ?? ev.target ?? undefined) as
|
||||
| HTMLElement
|
||||
| undefined,
|
||||
(ev.currentTarget ?? ev.target ?? undefined) as HTMLElement | undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -451,9 +451,7 @@ function chooseFile(file: entities.DriveFile) {
|
|||
const isAlreadySelected = selectedFiles.value.some((f) => f.id === file.id);
|
||||
if (props.multiple) {
|
||||
if (isAlreadySelected) {
|
||||
selectedFiles.value = selectedFiles.value.filter(
|
||||
(f) => f.id !== file.id,
|
||||
);
|
||||
selectedFiles.value = selectedFiles.value.filter((f) => f.id !== file.id);
|
||||
} else {
|
||||
selectedFiles.value.push(file);
|
||||
}
|
||||
|
|
|
@ -284,9 +284,7 @@ watch(q, () => {
|
|||
keywords.every(
|
||||
(keyword) =>
|
||||
emoji.name.includes(keyword) ||
|
||||
emoji.aliases.some((alias) =>
|
||||
alias.includes(keyword),
|
||||
),
|
||||
emoji.aliases.some((alias) => alias.includes(keyword)),
|
||||
)
|
||||
) {
|
||||
matches.add(emoji);
|
||||
|
@ -356,9 +354,7 @@ watch(q, () => {
|
|||
keywords.every(
|
||||
(keyword) =>
|
||||
emoji.slug.includes(keyword) ||
|
||||
emoji.keywords?.some((alias) =>
|
||||
alias.includes(keyword),
|
||||
),
|
||||
emoji.keywords?.some((alias) => alias.includes(keyword)),
|
||||
)
|
||||
) {
|
||||
matches.add(emoji);
|
||||
|
@ -375,9 +371,7 @@ watch(q, () => {
|
|||
if (matches.size >= max) return matches;
|
||||
|
||||
for (const emoji of emojis) {
|
||||
if (
|
||||
emoji.keywords?.some((keyword) => keyword.startsWith(newQ))
|
||||
) {
|
||||
if (emoji.keywords?.some((keyword) => keyword.startsWith(newQ))) {
|
||||
matches.add(emoji);
|
||||
if (matches.size >= max) break;
|
||||
}
|
||||
|
@ -428,8 +422,7 @@ function getKey(
|
|||
|
||||
function chosen(emoji: any, ev?: MouseEvent) {
|
||||
const el =
|
||||
ev &&
|
||||
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
ev && ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = rect.left + el.offsetWidth / 2;
|
||||
|
|
|
@ -58,9 +58,7 @@ export default defineComponent({
|
|||
showBody:
|
||||
this.persistKey &&
|
||||
localStorage.getItem(localStoragePrefix + this.persistKey)
|
||||
? localStorage.getItem(
|
||||
localStoragePrefix + this.persistKey,
|
||||
) === "t"
|
||||
? localStorage.getItem(localStoragePrefix + this.persistKey) === "t"
|
||||
: this.expanded,
|
||||
animation: defaultStore.state.animation,
|
||||
};
|
||||
|
|
|
@ -112,8 +112,7 @@ if (props.user.isFollowing == null) {
|
|||
function onFollowChange(user: entities.UserDetailed) {
|
||||
if (user.id === props.user.id) {
|
||||
isFollowing.value = user.isFollowing;
|
||||
hasPendingFollowRequestFromYou.value =
|
||||
user.hasPendingFollowRequestFromYou;
|
||||
hasPendingFollowRequestFromYou.value = user.hasPendingFollowRequestFromYou;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,10 +171,7 @@ async function onClick() {
|
|||
}
|
||||
|
||||
function menu(ev) {
|
||||
os.popupMenu(
|
||||
getUserMenu(props.user, router),
|
||||
ev.currentTarget ?? ev.target,
|
||||
);
|
||||
os.popupMenu(getUserMenu(props.user, router), ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
@ -38,9 +38,7 @@ const instance = props.instance ?? {
|
|||
faviconUrl: Instance.faviconUrl || Instance.iconUrl || "/favicon.ico",
|
||||
name: instanceName,
|
||||
themeColor: (
|
||||
document.querySelector(
|
||||
'meta[name="theme-color-orig"]',
|
||||
) as HTMLMetaElement
|
||||
document.querySelector('meta[name="theme-color-orig"]') as HTMLMetaElement
|
||||
)?.content,
|
||||
softwareName: Instance.softwareName ?? "Firefish",
|
||||
softwareVersion: version,
|
||||
|
|
|
@ -40,9 +40,7 @@ const el = ref();
|
|||
|
||||
useTooltip(el, (showing) => {
|
||||
os.popup(
|
||||
defineAsyncComponent(
|
||||
() => import("@/components/MkUrlPreviewPopup.vue"),
|
||||
),
|
||||
defineAsyncComponent(() => import("@/components/MkUrlPreviewPopup.vue")),
|
||||
{
|
||||
showing,
|
||||
url: props.url,
|
||||
|
|
|
@ -58,9 +58,7 @@ export default {
|
|||
{
|
||||
class: $style.text,
|
||||
style: {
|
||||
animationDirection: reverse
|
||||
? "reverse"
|
||||
: undefined,
|
||||
animationDirection: reverse ? "reverse" : undefined,
|
||||
},
|
||||
},
|
||||
$slots.default(),
|
||||
|
|
|
@ -113,7 +113,7 @@ const url =
|
|||
props.raw || defaultStore.state.loadRawImages
|
||||
? props.media.url
|
||||
: defaultStore.state.disableShowingAnimatedImages &&
|
||||
props.media.type.startsWith("image")
|
||||
props.media.type.startsWith("image")
|
||||
? getStaticImageUrl(props.media.thumbnailUrl)
|
||||
: props.media.thumbnailUrl;
|
||||
|
||||
|
@ -150,8 +150,7 @@ watch(
|
|||
hide.value =
|
||||
defaultStore.state.nsfw === "force"
|
||||
? true
|
||||
: props.media.isSensitive &&
|
||||
defaultStore.state.nsfw !== "ignore";
|
||||
: props.media.isSensitive && defaultStore.state.nsfw !== "ignore";
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
|
|
|
@ -75,8 +75,7 @@ const audioEl = ref<HTMLAudioElement | null>();
|
|||
const hide = ref(true);
|
||||
|
||||
function volumechange() {
|
||||
if (audioEl.value)
|
||||
ColdDeviceStorage.set("mediaVolume", audioEl.value.volume);
|
||||
if (audioEl.value) ColdDeviceStorage.set("mediaVolume", audioEl.value.volume);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
@ -183,12 +183,8 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
caption() {
|
||||
const img = document.getElementById(
|
||||
"imgtocaption",
|
||||
) as HTMLImageElement;
|
||||
const ta = document.getElementById(
|
||||
"captioninput",
|
||||
) as HTMLTextAreaElement;
|
||||
const img = document.getElementById("imgtocaption") as HTMLImageElement;
|
||||
const ta = document.getElementById("captioninput") as HTMLTextAreaElement;
|
||||
os.api("drive/files/caption-image", {
|
||||
url: img.src,
|
||||
}).then((text) => {
|
||||
|
|
|
@ -311,11 +311,7 @@ function getRow(pattern: number, rowOffset: number) {
|
|||
const ops: string[] = [];
|
||||
|
||||
for (let channel = 0; channel < nbChannels.value; channel++) {
|
||||
const part = player.value.getPatternRowChannel(
|
||||
pattern,
|
||||
rowOffset,
|
||||
channel,
|
||||
);
|
||||
const part = player.value.getPatternRowChannel(pattern, rowOffset, channel);
|
||||
|
||||
notes.push(part.substring(0, 3));
|
||||
insts.push(part.substring(4, 6));
|
||||
|
|
|
@ -286,8 +286,7 @@ const align = () => {
|
|||
left = window.innerWidth - width + window.scrollX - 1;
|
||||
}
|
||||
|
||||
const underSpace =
|
||||
window.innerHeight - MARGIN - (top - window.pageYOffset);
|
||||
const underSpace = window.innerHeight - MARGIN - (top - window.pageYOffset);
|
||||
const upperSpace = srcRect.top - MARGIN;
|
||||
|
||||
// 画面から縦にはみ出る場合
|
||||
|
@ -300,12 +299,7 @@ const align = () => {
|
|||
top = window.scrollY + (upperSpace + MARGIN - height);
|
||||
}
|
||||
} else {
|
||||
top =
|
||||
window.innerHeight -
|
||||
MARGIN -
|
||||
height +
|
||||
window.pageYOffset -
|
||||
1;
|
||||
top = window.innerHeight - MARGIN - height + window.pageYOffset - 1;
|
||||
}
|
||||
} else {
|
||||
maxHeight.value = underSpace;
|
||||
|
|
|
@ -403,8 +403,7 @@ async function translate() {
|
|||
lang != null &&
|
||||
translateLang !== lang &&
|
||||
(!translation.value ||
|
||||
translation.value.sourceLang.toLowerCase() ===
|
||||
translateLang.slice(0, 2))
|
||||
translation.value.sourceLang.toLowerCase() === translateLang.slice(0, 2))
|
||||
)
|
||||
translation.value = await translate_(appearNote.value.id, lang);
|
||||
translating.value = false;
|
||||
|
@ -504,10 +503,7 @@ function onContextmenu(ev: MouseEvent): void {
|
|||
icon: `${icon("ph-arrows-out-simple")}`,
|
||||
text: i18n.ts.showInPage,
|
||||
action: () => {
|
||||
router.push(
|
||||
notePage(appearNote.value),
|
||||
"forcePage",
|
||||
);
|
||||
router.push(notePage(appearNote.value), "forcePage");
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
|
@ -531,10 +527,7 @@ function onContextmenu(ev: MouseEvent): void {
|
|||
type: "a",
|
||||
icon: `${icon("ph-arrow-square-up-right")}`,
|
||||
text: i18n.ts.showOnRemote,
|
||||
href:
|
||||
appearNote.value.url ??
|
||||
appearNote.value.uri ??
|
||||
"",
|
||||
href: appearNote.value.url ?? appearNote.value.uri ?? "",
|
||||
target: "_blank",
|
||||
}
|
||||
: undefined,
|
||||
|
|
|
@ -70,8 +70,7 @@ const note = ref(props.note);
|
|||
|
||||
const showTicker =
|
||||
defaultStore.state.instanceTicker === "always" ||
|
||||
(defaultStore.state.instanceTicker === "remote" &&
|
||||
note.value.user.instance);
|
||||
(defaultStore.state.instanceTicker === "remote" && note.value.user.instance);
|
||||
|
||||
function openServerInfo() {
|
||||
if (!props.canOpenServerInfo || !defaultStore.state.openServerInfo) return;
|
||||
|
|
|
@ -280,8 +280,7 @@ const replies: entities.Note[] =
|
|||
props.conversation
|
||||
?.filter(
|
||||
(item) =>
|
||||
item.replyId === props.note.id ||
|
||||
item.renoteId === props.note.id,
|
||||
item.replyId === props.note.id || item.renoteId === props.note.id,
|
||||
)
|
||||
.reverse() ?? [];
|
||||
const enableEmojiReactions = defaultStore.state.enableEmojiReactions;
|
||||
|
@ -319,8 +318,7 @@ async function translate() {
|
|||
lang != null &&
|
||||
translateLang !== lang &&
|
||||
(!translation.value ||
|
||||
translation.value.sourceLang.toLowerCase() ===
|
||||
translateLang.slice(0, 2))
|
||||
translation.value.sourceLang.toLowerCase() === translateLang.slice(0, 2))
|
||||
)
|
||||
translation.value = await translate_(appearNote.value.id, lang);
|
||||
translating.value = false;
|
||||
|
@ -421,10 +419,7 @@ function onContextmenu(ev: MouseEvent): void {
|
|||
icon: `${icon("ph-arrows-out-simple")}`,
|
||||
text: i18n.ts.showInPage,
|
||||
action: () => {
|
||||
router.push(
|
||||
notePage(appearNote.value),
|
||||
"forcePage",
|
||||
);
|
||||
router.push(notePage(appearNote.value), "forcePage");
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
|
|
|
@ -84,9 +84,7 @@ function ok() {
|
|||
} else {
|
||||
emit("done", {
|
||||
includingTypes: (
|
||||
Object.keys(
|
||||
typesMap.value,
|
||||
) as (typeof notificationTypes)[number][]
|
||||
Object.keys(typesMap.value) as (typeof notificationTypes)[number][]
|
||||
).filter((type) => typesMap.value[type]),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -71,9 +71,7 @@ const pagination: Paging = {
|
|||
limit: 10,
|
||||
params: computed(() => ({
|
||||
includeTypes: props.includeTypes ?? undefined,
|
||||
excludeTypes: props.includeTypes
|
||||
? undefined
|
||||
: me.mutingNotificationTypes,
|
||||
excludeTypes: props.includeTypes ? undefined : me.mutingNotificationTypes,
|
||||
unreadOnly: props.unreadOnly,
|
||||
})),
|
||||
};
|
||||
|
@ -114,20 +112,12 @@ onMounted(() => {
|
|||
connection.on("readNotifications", (notificationIds) => {
|
||||
if (pagingComponent.value) {
|
||||
for (let i = 0; i < pagingComponent.value.queue.length; i++) {
|
||||
if (
|
||||
notificationIds.includes(pagingComponent.value.queue[i].id)
|
||||
) {
|
||||
if (notificationIds.includes(pagingComponent.value.queue[i].id)) {
|
||||
pagingComponent.value.queue[i].isRead = true;
|
||||
}
|
||||
}
|
||||
for (
|
||||
let i = 0;
|
||||
i < (pagingComponent.value.items || []).length;
|
||||
i++
|
||||
) {
|
||||
if (
|
||||
notificationIds.includes(pagingComponent.value.items[i].id)
|
||||
) {
|
||||
for (let i = 0; i < (pagingComponent.value.items || []).length; i++) {
|
||||
if (notificationIds.includes(pagingComponent.value.items[i].id)) {
|
||||
pagingComponent.value.items[i].isRead = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,14 +165,10 @@ const init = async (): Promise<void> => {
|
|||
res.length > (props.pagination.limit || 10)
|
||||
) {
|
||||
res.pop();
|
||||
items.value = props.pagination.reversed
|
||||
? [...res].reverse()
|
||||
: res;
|
||||
items.value = props.pagination.reversed ? [...res].reverse() : res;
|
||||
more.value = true;
|
||||
} else {
|
||||
items.value = props.pagination.reversed
|
||||
? [...res].reverse()
|
||||
: res;
|
||||
items.value = props.pagination.reversed ? [...res].reverse() : res;
|
||||
more.value = false;
|
||||
}
|
||||
offset.value = res.length;
|
||||
|
@ -382,8 +378,7 @@ const prepend = (item: Item): void => {
|
|||
|
||||
const isTop =
|
||||
isBackTop.value ||
|
||||
(document.body.contains(rootEl.value) &&
|
||||
isTopVisible(rootEl.value));
|
||||
(document.body.contains(rootEl.value) && isTopVisible(rootEl.value));
|
||||
|
||||
if (isTop) {
|
||||
// Prepend the item
|
||||
|
|
|
@ -74,8 +74,7 @@ const closed = computed(() => remaining.value === 0);
|
|||
const isLocal = computed(() => !props.note.uri);
|
||||
const isVoted = computed(
|
||||
() =>
|
||||
!props.note.poll.multiple &&
|
||||
props.note.poll.choices.some((c) => c.isVoted),
|
||||
!props.note.poll.multiple && props.note.poll.choices.some((c) => c.isVoted),
|
||||
);
|
||||
const timer = computed(() =>
|
||||
i18n.t(
|
||||
|
@ -101,10 +100,8 @@ const showResult = ref(props.readOnly || isVoted.value);
|
|||
if (props.note.poll.expiresAt) {
|
||||
const tick = () => {
|
||||
remaining.value = Math.floor(
|
||||
Math.max(
|
||||
new Date(props.note.poll.expiresAt).getTime() - Date.now(),
|
||||
0,
|
||||
) / 1000,
|
||||
Math.max(new Date(props.note.poll.expiresAt).getTime() - Date.now(), 0) /
|
||||
1000,
|
||||
);
|
||||
if (remaining.value === 0) {
|
||||
showResult.value = true;
|
||||
|
|
|
@ -527,9 +527,7 @@ if (
|
|||
(props.reply.user.host != null && props.reply.user.host !== host))
|
||||
) {
|
||||
text.value = `@${props.reply.user.username}${
|
||||
props.reply.user.host != null
|
||||
? "@" + toASCII(props.reply.user.host)
|
||||
: ""
|
||||
props.reply.user.host != null ? "@" + toASCII(props.reply.user.host) : ""
|
||||
} `;
|
||||
}
|
||||
|
||||
|
@ -589,11 +587,9 @@ if (
|
|||
}
|
||||
|
||||
if (props.reply.userId !== me.id) {
|
||||
os.api("users/show", { userId: props.reply.userId }).then(
|
||||
(user) => {
|
||||
pushVisibleUser(user);
|
||||
},
|
||||
);
|
||||
os.api("users/show", { userId: props.reply.userId }).then((user) => {
|
||||
pushVisibleUser(user);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -732,9 +728,7 @@ function setVisibility() {
|
|||
}
|
||||
|
||||
os.popup(
|
||||
defineAsyncComponent(
|
||||
() => import("@/components/MkVisibilityPicker.vue"),
|
||||
),
|
||||
defineAsyncComponent(() => import("@/components/MkVisibilityPicker.vue")),
|
||||
{
|
||||
currentVisibility: visibility.value,
|
||||
currentLocalOnly: localOnly.value,
|
||||
|
@ -834,8 +828,7 @@ function setLanguage() {
|
|||
|
||||
for (const lang of langs) {
|
||||
if (lang === language.value) continue;
|
||||
if (defaultStore.state.recentlyUsedPostLanguages.includes(lang))
|
||||
continue;
|
||||
if (defaultStore.state.recentlyUsedPostLanguages.includes(lang)) continue;
|
||||
actions.push({
|
||||
text: langmap[lang].nativeName,
|
||||
danger: false,
|
||||
|
@ -1072,8 +1065,7 @@ async function post() {
|
|||
let postData = {
|
||||
editId: props.editId ? props.editId : undefined,
|
||||
text: processedText === "" ? undefined : processedText,
|
||||
fileIds:
|
||||
files.value.length > 0 ? files.value.map((f) => f.id) : undefined,
|
||||
fileIds: files.value.length > 0 ? files.value.map((f) => f.id) : undefined,
|
||||
replyId: props.reply ? props.reply.id : undefined,
|
||||
renoteId: props.renote
|
||||
? props.renote.id
|
||||
|
@ -1085,8 +1077,7 @@ async function post() {
|
|||
cw: useCw.value ? cw.value || "" : undefined,
|
||||
lang: language.value ? language.value : undefined,
|
||||
localOnly: localOnly.value,
|
||||
visibility:
|
||||
visibility.value === "private" ? "specified" : visibility.value,
|
||||
visibility: visibility.value === "private" ? "specified" : visibility.value,
|
||||
visibleUserIds:
|
||||
visibility.value === "private"
|
||||
? []
|
||||
|
@ -1101,9 +1092,7 @@ async function post() {
|
|||
.split(" ")
|
||||
.map((x) => (x.startsWith("#") ? x : "#" + x))
|
||||
.join(" ");
|
||||
postData.text = postData.text
|
||||
? `${postData.text} ${hashtags_}`
|
||||
: hashtags_;
|
||||
postData.text = postData.text ? `${postData.text} ${hashtags_}` : hashtags_;
|
||||
}
|
||||
|
||||
// plugin
|
||||
|
@ -1117,9 +1106,7 @@ async function post() {
|
|||
|
||||
if (postAccount.value) {
|
||||
const storedAccounts = await getAccounts();
|
||||
token = storedAccounts.find(
|
||||
(x) => x.id === postAccount.value.id,
|
||||
)?.token;
|
||||
token = storedAccounts.find((x) => x.id === postAccount.value.id)?.token;
|
||||
}
|
||||
|
||||
posting.value = true;
|
||||
|
@ -1165,14 +1152,9 @@ async function post() {
|
|||
"recentlyUsedPostLanguages",
|
||||
[language.value]
|
||||
.concat(
|
||||
defaultStore.state.recentlyUsedPostLanguages.filter(
|
||||
(lang) => {
|
||||
return (
|
||||
lang !== language.value &&
|
||||
languages.includes(lang)
|
||||
);
|
||||
},
|
||||
),
|
||||
defaultStore.state.recentlyUsedPostLanguages.filter((lang) => {
|
||||
return lang !== language.value && languages.includes(lang);
|
||||
}),
|
||||
)
|
||||
.slice(0, maxLength),
|
||||
);
|
||||
|
@ -1268,9 +1250,7 @@ onMounted(() => {
|
|||
visibility.value = draft.data.visibility;
|
||||
localOnly.value = draft.data.localOnly;
|
||||
language.value = draft.data.lang;
|
||||
files.value = (draft.data.files || []).filter(
|
||||
(draftFile) => draftFile,
|
||||
);
|
||||
files.value = (draft.data.files || []).filter((draftFile) => draftFile);
|
||||
if (draft.data.poll) {
|
||||
poll.value = draft.data.poll;
|
||||
}
|
||||
|
|
|
@ -107,8 +107,7 @@ async function describe(file) {
|
|||
{
|
||||
done: (result) => {
|
||||
if (!result || result.canceled) return;
|
||||
const comment =
|
||||
result.result.length === 0 ? null : result.result;
|
||||
const comment = result.result.length === 0 ? null : result.result;
|
||||
os.api("drive/files/update", {
|
||||
fileId: file.id,
|
||||
comment,
|
||||
|
|
|
@ -102,8 +102,7 @@ function moveBySystem(to: number): Promise<void> {
|
|||
return;
|
||||
}
|
||||
const nextHeight =
|
||||
initialHeight -
|
||||
(overHeight / RELEASE_TRANSITION_DURATION) * time;
|
||||
initialHeight - (overHeight / RELEASE_TRANSITION_DURATION) * time;
|
||||
if (pullDistance.value < nextHeight) return;
|
||||
pullDistance.value = nextHeight;
|
||||
}, 1);
|
||||
|
|
|
@ -94,17 +94,14 @@ const pushRegistrationInServer = ref<
|
|||
>();
|
||||
|
||||
function subscribe() {
|
||||
if (!registration.value || !supported.value || !instance.swPublickey)
|
||||
return;
|
||||
if (!registration.value || !supported.value || !instance.swPublickey) return;
|
||||
|
||||
// SEE: https://developer.mozilla.org/en-US/docs/Web/API/PushManager/subscribe#Parameters
|
||||
return promiseDialog(
|
||||
registration.value.pushManager
|
||||
.subscribe({
|
||||
userVisibleOnly: true,
|
||||
applicationServerKey: urlBase64ToUint8Array(
|
||||
instance.swPublickey,
|
||||
),
|
||||
applicationServerKey: urlBase64ToUint8Array(instance.swPublickey),
|
||||
})
|
||||
.then(
|
||||
async (subscription) => {
|
||||
|
@ -121,9 +118,7 @@ function subscribe() {
|
|||
// When subscribe failed
|
||||
// 通知が許可されていなかったとき
|
||||
if (err?.name === "NotAllowedError") {
|
||||
console.info(
|
||||
"User denied the notification permission request.",
|
||||
);
|
||||
console.info("User denied the notification permission request.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -171,9 +166,7 @@ function encode(buffer: ArrayBuffer | null) {
|
|||
*/
|
||||
function urlBase64ToUint8Array(base64String: string): Uint8Array {
|
||||
const padding = "=".repeat((4 - (base64String.length % 4)) % 4);
|
||||
const base64 = (base64String + padding)
|
||||
.replace(/-/g, "+")
|
||||
.replace(/_/g, "/");
|
||||
const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
|
||||
|
||||
const rawData = window.atob(base64);
|
||||
const outputArray = new Uint8Array(rawData.length);
|
||||
|
|
|
@ -102,10 +102,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
hasRenotedBefore.value = true;
|
||||
const el =
|
||||
ev &&
|
||||
((ev.currentTarget ?? ev.target) as
|
||||
| HTMLElement
|
||||
| null
|
||||
| undefined);
|
||||
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = rect.left + el.offsetWidth / 2;
|
||||
|
@ -129,10 +126,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
hasRenotedBefore.value = true;
|
||||
const el =
|
||||
ev &&
|
||||
((ev.currentTarget ?? ev.target) as
|
||||
| HTMLElement
|
||||
| null
|
||||
| undefined);
|
||||
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = rect.left + el.offsetWidth / 2;
|
||||
|
@ -157,10 +151,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
hasRenotedBefore.value = true;
|
||||
const el =
|
||||
ev &&
|
||||
((ev.currentTarget ?? ev.target) as
|
||||
| HTMLElement
|
||||
| null
|
||||
| undefined);
|
||||
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = rect.left + el.offsetWidth / 2;
|
||||
|
@ -182,10 +173,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
hasRenotedBefore.value = true;
|
||||
const el =
|
||||
ev &&
|
||||
((ev.currentTarget ?? ev.target) as
|
||||
| HTMLElement
|
||||
| null
|
||||
| undefined);
|
||||
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = rect.left + el.offsetWidth / 2;
|
||||
|
@ -221,10 +209,7 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
hasRenotedBefore.value = true;
|
||||
const el =
|
||||
ev &&
|
||||
((ev.currentTarget ?? ev.target) as
|
||||
| HTMLElement
|
||||
| null
|
||||
| undefined);
|
||||
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = rect.left + el.offsetWidth / 2;
|
||||
|
|
|
@ -198,9 +198,7 @@ function openDescription(kind: "words" | "users" | "range"): void {
|
|||
};
|
||||
|
||||
popup(
|
||||
defineAsyncComponent(
|
||||
() => import("@/components/MkSimpleTextWindow.vue"),
|
||||
),
|
||||
defineAsyncComponent(() => import("@/components/MkSimpleTextWindow.vue")),
|
||||
{
|
||||
title: i18n.ts.help,
|
||||
description: descriptions[kind],
|
||||
|
|
|
@ -205,13 +205,11 @@ function queryKey() {
|
|||
.get({
|
||||
publicKey: {
|
||||
challenge: byteify(challengeData.value.challenge, "base64"),
|
||||
allowCredentials: challengeData.value.securityKeys.map(
|
||||
(key) => ({
|
||||
id: byteify(key.id, "hex"),
|
||||
type: "public-key",
|
||||
transports: ["usb", "nfc", "ble", "internal"],
|
||||
}),
|
||||
),
|
||||
allowCredentials: challengeData.value.securityKeys.map((key) => ({
|
||||
id: byteify(key.id, "hex"),
|
||||
type: "public-key",
|
||||
transports: ["usb", "nfc", "ble", "internal"],
|
||||
})),
|
||||
timeout: 60 * 1000,
|
||||
},
|
||||
})
|
||||
|
@ -226,9 +224,7 @@ function queryKey() {
|
|||
username: username.value,
|
||||
password: password.value,
|
||||
signature: hexify(credential.response.signature),
|
||||
authenticatorData: hexify(
|
||||
credential.response.authenticatorData,
|
||||
),
|
||||
authenticatorData: hexify(credential.response.authenticatorData),
|
||||
clientDataJSON: hexify(credential.response.clientDataJSON),
|
||||
credentialId: credential.id,
|
||||
challengeId: challengeData.value.challengeId,
|
||||
|
@ -277,9 +273,7 @@ function onSubmit() {
|
|||
"hcaptcha-response": hCaptchaResponse.value,
|
||||
"g-recaptcha-response": reCaptchaResponse.value,
|
||||
token:
|
||||
user.value && user.value.twoFactorEnabled
|
||||
? token.value
|
||||
: undefined,
|
||||
user.value && user.value.twoFactorEnabled ? token.value : undefined,
|
||||
})
|
||||
.then((res) => {
|
||||
emit("login", res);
|
||||
|
|
|
@ -104,9 +104,7 @@ onMounted(() => {
|
|||
};
|
||||
particles.value.push(particle);
|
||||
window.setTimeout(() => {
|
||||
particles.value = particles.value.filter(
|
||||
(x) => x.id !== particle.id,
|
||||
);
|
||||
particles.value = particles.value.filter((x) => x.id !== particle.id);
|
||||
}, particle.dur - 100);
|
||||
|
||||
window.setTimeout(
|
||||
|
|
|
@ -60,13 +60,10 @@ function star(ev?: MouseEvent): void {
|
|||
os.api("notes/reactions/create", {
|
||||
noteId: props.note.id,
|
||||
reaction:
|
||||
defaultStore.state.woozyMode === true
|
||||
? "🥴"
|
||||
: instance.defaultReaction,
|
||||
defaultStore.state.woozyMode === true ? "🥴" : instance.defaultReaction,
|
||||
});
|
||||
const el =
|
||||
ev &&
|
||||
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
ev && ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = rect.left + el.offsetWidth / 2;
|
||||
|
|
|
@ -66,8 +66,7 @@ function toggleStar(ev?: MouseEvent): void {
|
|||
reaction: instance.defaultReaction,
|
||||
});
|
||||
const el =
|
||||
ev &&
|
||||
((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
ev && ((ev.currentTarget ?? ev.target) as HTMLElement | null | undefined);
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = rect.left + el.offsetWidth / 2;
|
||||
|
|
|
@ -32,14 +32,9 @@ export default defineComponent({
|
|||
role: "tab",
|
||||
key: option.key,
|
||||
"aria-selected":
|
||||
this.modelValue === option.props?.value
|
||||
? "true"
|
||||
: "false",
|
||||
this.modelValue === option.props?.value ? "true" : "false",
|
||||
onClick: () => {
|
||||
this.$emit(
|
||||
"update:modelValue",
|
||||
option.props?.value,
|
||||
);
|
||||
this.$emit("update:modelValue", option.props?.value);
|
||||
},
|
||||
},
|
||||
option.children,
|
||||
|
|
|
@ -25,18 +25,12 @@ const SAFE_FOR_HTML_ID = "abcdefghijklmnopqrstuvwxyz";
|
|||
const computedStyle = getComputedStyle(document.documentElement);
|
||||
const idForCanvas = Array.from(Array(16))
|
||||
.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("");
|
||||
const idForTags = Array.from(Array(16))
|
||||
.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("");
|
||||
const available = ref(false);
|
||||
|
|
|
@ -203,9 +203,7 @@ function onContextmenu(ev: MouseEvent) {
|
|||
// 最前面へ移動
|
||||
function top() {
|
||||
if (rootEl.value) {
|
||||
rootEl.value.style.zIndex = os.claimZIndex(
|
||||
props.front ? "middle" : "low",
|
||||
);
|
||||
rootEl.value.style.zIndex = os.claimZIndex(props.front ? "middle" : "low");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,13 +308,9 @@ function onHeaderMousedown(evt: MouseEvent) {
|
|||
// 動かした時
|
||||
dragListen((me) => {
|
||||
const x =
|
||||
me.touches && me.touches.length > 0
|
||||
? me.touches[0].clientX
|
||||
: me.clientX;
|
||||
me.touches && me.touches.length > 0 ? me.touches[0].clientX : me.clientX;
|
||||
const y =
|
||||
me.touches && me.touches.length > 0
|
||||
? me.touches[0].clientY
|
||||
: me.clientY;
|
||||
me.touches && me.touches.length > 0 ? me.touches[0].clientY : me.clientY;
|
||||
|
||||
move(x, y);
|
||||
});
|
||||
|
|
|
@ -146,14 +146,12 @@ useInterval(
|
|||
() => {
|
||||
if (prefixEl.value) {
|
||||
if (prefixEl.value.offsetWidth) {
|
||||
inputEl.value.style.paddingLeft =
|
||||
prefixEl.value.offsetWidth + "px";
|
||||
inputEl.value.style.paddingLeft = prefixEl.value.offsetWidth + "px";
|
||||
}
|
||||
}
|
||||
if (suffixEl.value) {
|
||||
if (suffixEl.value.offsetWidth) {
|
||||
inputEl.value.style.paddingRight =
|
||||
suffixEl.value.offsetWidth + "px";
|
||||
inputEl.value.style.paddingRight = suffixEl.value.offsetWidth + "px";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -60,8 +60,7 @@ export default defineComponent({
|
|||
value: option.props?.value,
|
||||
disabled: option.props?.disabled,
|
||||
modelValue: this.value,
|
||||
"onUpdate:modelValue": (value) =>
|
||||
(this.value = value),
|
||||
"onUpdate:modelValue": (value) => (this.value = value),
|
||||
},
|
||||
option.children,
|
||||
),
|
||||
|
|
|
@ -120,14 +120,12 @@ useInterval(
|
|||
() => {
|
||||
if (prefixEl.value) {
|
||||
if (prefixEl.value.offsetWidth) {
|
||||
inputEl.value.style.paddingLeft =
|
||||
prefixEl.value.offsetWidth + "px";
|
||||
inputEl.value.style.paddingLeft = prefixEl.value.offsetWidth + "px";
|
||||
}
|
||||
}
|
||||
if (suffixEl.value) {
|
||||
if (suffixEl.value.offsetWidth) {
|
||||
inputEl.value.style.paddingRight =
|
||||
suffixEl.value.offsetWidth + "px";
|
||||
inputEl.value.style.paddingRight = suffixEl.value.offsetWidth + "px";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -88,9 +88,7 @@ const choseAd = (): Ad | null => {
|
|||
return widgetAds;
|
||||
} else if (ads.length === 0) {
|
||||
if (lowPriorityAds.length !== 0) {
|
||||
return lowPriorityAds[
|
||||
Math.floor(Math.random() * lowPriorityAds.length)
|
||||
];
|
||||
return lowPriorityAds[Math.floor(Math.random() * lowPriorityAds.length)];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -51,9 +51,7 @@ const el = ref();
|
|||
|
||||
useTooltip(el, (showing) => {
|
||||
os.popup(
|
||||
defineAsyncComponent(
|
||||
() => import("@/components/MkUrlPreviewPopup.vue"),
|
||||
),
|
||||
defineAsyncComponent(() => import("@/components/MkUrlPreviewPopup.vue")),
|
||||
{
|
||||
showing,
|
||||
url: props.url,
|
||||
|
|
|
@ -36,11 +36,9 @@ export default defineComponent({
|
|||
const note: Ref<Record<string, any> | null> = ref(null);
|
||||
|
||||
onMounted(() => {
|
||||
os.api("notes/show", { noteId: props.block.note }).then(
|
||||
(result) => {
|
||||
note.value = result;
|
||||
},
|
||||
);
|
||||
os.api("notes/show", { noteId: props.block.note }).then((result) => {
|
||||
note.value = result;
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
|
@ -63,10 +63,7 @@ export default defineComponent({
|
|||
const formData = new FormData();
|
||||
formData.append("file", blob);
|
||||
if (this.defaultStore.state.uploadFolder) {
|
||||
formData.append(
|
||||
"folderId",
|
||||
this.defaultStore.state.uploadFolder,
|
||||
);
|
||||
formData.append("folderId", this.defaultStore.state.uploadFolder);
|
||||
}
|
||||
|
||||
fetch(apiUrl + "/drive/files/create", {
|
||||
|
@ -87,9 +84,7 @@ export default defineComponent({
|
|||
},
|
||||
async post() {
|
||||
this.posting = true;
|
||||
const file = this.block.attachCanvasImage
|
||||
? await this.upload()
|
||||
: null;
|
||||
const file = this.block.attachCanvasImage ? await this.upload() : null;
|
||||
os.apiWithDialog("notes/create", {
|
||||
text: this.text === "" ? null : this.text,
|
||||
fileIds: file ? [file.id] : undefined,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { markRaw } from "vue";
|
||||
import { locale } from "@/config";
|
||||
import { markRaw } from "vue";
|
||||
|
||||
class I18n<T extends Record<string, any>> {
|
||||
public ts: T;
|
||||
|
|
|
@ -22,6 +22,7 @@ if (accounts) {
|
|||
}
|
||||
// #endregion
|
||||
|
||||
import { set } from "@/scripts/idb-proxy";
|
||||
import {
|
||||
computed,
|
||||
createApp,
|
||||
|
@ -30,7 +31,6 @@ import {
|
|||
version as vueVersion,
|
||||
watch,
|
||||
} from "vue";
|
||||
import { set } from "@/scripts/idb-proxy";
|
||||
|
||||
import { refreshAccount, signIn, signOut, updateAccount } from "@/account";
|
||||
import components from "@/components";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { reactive } from "vue";
|
||||
import type { Account } from "@/account";
|
||||
import { reactive } from "vue";
|
||||
|
||||
const accountData = localStorage.getItem("account");
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { computed, reactive } from "vue";
|
||||
import { ui } from "@/config";
|
||||
import { i18n } from "@/i18n";
|
||||
import { isSignedIn, me } from "@/me";
|
||||
|
@ -6,6 +5,7 @@ import * as os from "@/os";
|
|||
import icon from "@/scripts/icon";
|
||||
import { search } from "@/scripts/search";
|
||||
import { unisonReload } from "@/scripts/unison-reload";
|
||||
import { computed, reactive } from "vue";
|
||||
|
||||
export const navbarItemDef = reactive({
|
||||
notifications: {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// NIRAX --- A lightweight router
|
||||
|
||||
import { pleaseLogin } from "@/scripts/please-login";
|
||||
import { safeURIDecode } from "@/scripts/safe-uri-decode";
|
||||
import { EventEmitter } from "eventemitter3";
|
||||
import type { Component, ShallowRef } from "vue";
|
||||
import { shallowRef } from "vue";
|
||||
import { safeURIDecode } from "@/scripts/safe-uri-decode";
|
||||
import { pleaseLogin } from "@/scripts/please-login";
|
||||
|
||||
interface RouteDef {
|
||||
path: string;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// 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 { type entities, api as firefishApi } from "firefish-js";
|
||||
import insertTextAtCursor from "insert-text-at-cursor";
|
||||
import type { Component, Ref } from "vue";
|
||||
import { defineAsyncComponent, markRaw, ref } from "vue";
|
||||
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);
|
||||
|
||||
|
|
|
@ -94,10 +94,7 @@ export default defineComponent({
|
|||
|
||||
methods: {
|
||||
search() {
|
||||
if (
|
||||
(this.q === "" || this.q == null) &&
|
||||
this.selectedTags.size === 0
|
||||
) {
|
||||
if ((this.q === "" || this.q == null) && this.selectedTags.size === 0) {
|
||||
this.searchEmojis = null;
|
||||
return;
|
||||
}
|
||||
|
@ -105,17 +102,13 @@ export default defineComponent({
|
|||
if (this.selectedTags.size === 0) {
|
||||
this.searchEmojis = this.customEmojis.filter(
|
||||
(emoji) =>
|
||||
emoji.name.includes(this.q) ||
|
||||
emoji.aliases.includes(this.q),
|
||||
emoji.name.includes(this.q) || emoji.aliases.includes(this.q),
|
||||
);
|
||||
} else {
|
||||
this.searchEmojis = this.customEmojis.filter(
|
||||
(emoji) =>
|
||||
(emoji.name.includes(this.q) ||
|
||||
emoji.aliases.includes(this.q)) &&
|
||||
[...this.selectedTags].every((t) =>
|
||||
emoji.aliases.includes(t),
|
||||
),
|
||||
(emoji.name.includes(this.q) || emoji.aliases.includes(this.q)) &&
|
||||
[...this.selectedTags].every((t) => emoji.aliases.includes(t)),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -276,9 +276,7 @@ function easterEgg() {
|
|||
setTimeout(() => {
|
||||
if (iconClicks % 6 === 0) {
|
||||
iconSrc.value =
|
||||
instance.iconUrl ||
|
||||
instance.faviconUrl ||
|
||||
"/favicon.ico";
|
||||
instance.iconUrl || instance.faviconUrl || "/favicon.ico";
|
||||
} else {
|
||||
iconSrc.value = "/static-assets/woozy.png";
|
||||
}
|
||||
|
|
|
@ -254,9 +254,7 @@ const headerTabs = computed(() => [
|
|||
|
||||
definePageMetadata(
|
||||
computed(() => ({
|
||||
title: file.value
|
||||
? i18n.ts.file + ": " + file.value.name
|
||||
: i18n.ts.file,
|
||||
title: file.value ? i18n.ts.file + ": " + file.value.name : i18n.ts.file,
|
||||
icon: `${icon("ph-file")}`,
|
||||
})),
|
||||
);
|
||||
|
|
|
@ -169,12 +169,10 @@ onMounted(() => {
|
|||
if (tabEl && tabHighlightEl.value) {
|
||||
// offsetWidth や offsetLeft は少数を丸めてしまうため getBoundingClientRect を使う必要がある
|
||||
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
|
||||
const parentRect =
|
||||
tabEl.parentElement.getBoundingClientRect();
|
||||
const parentRect = tabEl.parentElement.getBoundingClientRect();
|
||||
const rect = tabEl.getBoundingClientRect();
|
||||
tabHighlightEl.value.style.width = rect.width + "px";
|
||||
tabHighlightEl.value.style.left =
|
||||
rect.left - parentRect.left + "px";
|
||||
tabHighlightEl.value.style.left = rect.left - parentRect.left + "px";
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -97,9 +97,7 @@ function remove(announcement) {
|
|||
text: i18n.t("removeAreYouSure", { x: announcement.title }),
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
announcements.value = announcements.value.filter(
|
||||
(x) => x !== announcement,
|
||||
);
|
||||
announcements.value = announcements.value.filter((x) => x !== announcement);
|
||||
os.api("admin/announcements/delete", announcement);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -46,9 +46,7 @@ import icon from "@/scripts/icon";
|
|||
const databasePromiseFactory = () =>
|
||||
os
|
||||
.api("admin/get-table-stats")
|
||||
.then((res) =>
|
||||
Object.entries(res).sort((a, b) => b[1].size - a[1].size),
|
||||
);
|
||||
.then((res) => Object.entries(res).sort((a, b) => b[1].size - a[1].size));
|
||||
|
||||
const headerActions = computed(() => []);
|
||||
|
||||
|
|
|
@ -184,9 +184,7 @@ const remotePagination = {
|
|||
limit: 30,
|
||||
params: computed(() => ({
|
||||
query:
|
||||
queryRemote.value && queryRemote.value !== ""
|
||||
? queryRemote.value
|
||||
: null,
|
||||
queryRemote.value && queryRemote.value !== "" ? queryRemote.value : null,
|
||||
host: host.value && host.value !== "" ? host.value : null,
|
||||
})),
|
||||
};
|
||||
|
@ -203,9 +201,7 @@ const selectAll = () => {
|
|||
|
||||
const toggleSelect = (emoji) => {
|
||||
if (selectedEmojis.value.includes(emoji.id)) {
|
||||
selectedEmojis.value = selectedEmojis.value.filter(
|
||||
(x) => x !== emoji.id,
|
||||
);
|
||||
selectedEmojis.value = selectedEmojis.value.filter((x) => x !== emoji.id);
|
||||
} else {
|
||||
selectedEmojis.value.push(emoji.id);
|
||||
}
|
||||
|
@ -305,9 +301,7 @@ const menu = (ev: MouseEvent) => {
|
|||
icon: `${icon("ph-upload-simple")}`,
|
||||
text: i18n.ts.importZip,
|
||||
action: async () => {
|
||||
const file = await selectFile(
|
||||
ev.currentTarget ?? ev.target,
|
||||
);
|
||||
const file = await selectFile(ev.currentTarget ?? ev.target);
|
||||
os.api("admin/emoji/import-zip", {
|
||||
fileId: file.id,
|
||||
})
|
||||
|
@ -329,10 +323,7 @@ const menu = (ev: MouseEvent) => {
|
|||
icon: `${icon("ph-info")}`,
|
||||
text: i18n.ts.emojiPackCreator,
|
||||
action: () => {
|
||||
window.open(
|
||||
"https://firefish.dev/firefish/emoji-gen",
|
||||
"_blank",
|
||||
);
|
||||
window.open("https://firefish.dev/firefish/emoji-gen", "_blank");
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -103,9 +103,7 @@ const pagination = {
|
|||
userId: userId.value && userId.value !== "" ? userId.value : null,
|
||||
origin: origin.value,
|
||||
hostname:
|
||||
searchHost.value && searchHost.value !== ""
|
||||
? searchHost.value
|
||||
: null,
|
||||
searchHost.value && searchHost.value !== "" ? searchHost.value : null,
|
||||
})),
|
||||
};
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ async function init() {
|
|||
|
||||
function save() {
|
||||
os.apiWithDialog("admin/update-meta", {
|
||||
hiddenTags:
|
||||
hiddenTags.value.split("\n").map((h: string) => h.trim()) || [],
|
||||
hiddenTags: hiddenTags.value.split("\n").map((h: string) => h.trim()) || [],
|
||||
}).then(() => {
|
||||
fetchInstance();
|
||||
});
|
||||
|
|
|
@ -221,31 +221,25 @@ const menuDef = computed(() => [
|
|||
icon: `${icon("ph-gear-six")}`,
|
||||
text: i18n.ts.general,
|
||||
to: "/admin/settings",
|
||||
active:
|
||||
currentPage.value?.route.name === "settings",
|
||||
active: currentPage.value?.route.name === "settings",
|
||||
},
|
||||
{
|
||||
icon: `${icon("ph-envelope-simple-open")}`,
|
||||
text: i18n.ts.emailServer,
|
||||
to: "/admin/email-settings",
|
||||
active:
|
||||
currentPage.value?.route.name ===
|
||||
"email-settings",
|
||||
active: currentPage.value?.route.name === "email-settings",
|
||||
},
|
||||
{
|
||||
icon: `${icon("ph-cloud")}`,
|
||||
text: i18n.ts.objectStorage,
|
||||
to: "/admin/object-storage",
|
||||
active:
|
||||
currentPage.value?.route.name ===
|
||||
"object-storage",
|
||||
active: currentPage.value?.route.name === "object-storage",
|
||||
},
|
||||
{
|
||||
icon: `${icon("ph-lock")}`,
|
||||
text: i18n.ts.security,
|
||||
to: "/admin/security",
|
||||
active:
|
||||
currentPage.value?.route.name === "security",
|
||||
active: currentPage.value?.route.name === "security",
|
||||
},
|
||||
{
|
||||
icon: `${icon("ph-arrows-merge")}`,
|
||||
|
@ -257,38 +251,31 @@ const menuDef = computed(() => [
|
|||
icon: `${icon("ph-prohibit")}`,
|
||||
text: i18n.ts.instanceBlocking,
|
||||
to: "/admin/instance-block",
|
||||
active:
|
||||
currentPage.value?.route.name ===
|
||||
"instance-block",
|
||||
active: currentPage.value?.route.name === "instance-block",
|
||||
},
|
||||
{
|
||||
icon: `${icon("ph-hash")}`,
|
||||
text: i18n.ts.hiddenTags,
|
||||
to: "/admin/hashtags",
|
||||
active:
|
||||
currentPage.value?.route.name === "hashtags",
|
||||
active: currentPage.value?.route.name === "hashtags",
|
||||
},
|
||||
{
|
||||
icon: `${icon("ph-ghost")}`,
|
||||
text: i18n.ts.proxyAccount,
|
||||
to: "/admin/proxy-account",
|
||||
active:
|
||||
currentPage.value?.route.name ===
|
||||
"proxy-account",
|
||||
active: currentPage.value?.route.name === "proxy-account",
|
||||
},
|
||||
{
|
||||
icon: `${icon("ph-database")}`,
|
||||
text: i18n.ts.database,
|
||||
to: "/admin/database",
|
||||
active:
|
||||
currentPage.value?.route.name === "database",
|
||||
active: currentPage.value?.route.name === "database",
|
||||
},
|
||||
{
|
||||
icon: `${icon("ph-flask")}`,
|
||||
text: i18n.ts._experiments.title,
|
||||
to: "/admin/experiments",
|
||||
active:
|
||||
currentPage.value?.route.name === "experiments",
|
||||
active: currentPage.value?.route.name === "experiments",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -70,8 +70,7 @@ async function init() {
|
|||
function save() {
|
||||
os.apiWithDialog("admin/update-meta", {
|
||||
blockedHosts: blockedHosts.value.split("\n").map((h) => h.trim()) || [],
|
||||
silencedHosts:
|
||||
silencedHosts.value.split("\n").map((h) => h.trim()) || [],
|
||||
silencedHosts: silencedHosts.value.split("\n").map((h) => h.trim()) || [],
|
||||
}).then(() => {
|
||||
fetchInstance();
|
||||
});
|
||||
|
|
|
@ -530,7 +530,8 @@ function isValidHttpUrl(src: string) {
|
|||
function parseMoreUrls(src: string): { name: string; url: string }[] {
|
||||
const toReturn: { name: string; url: string }[] = [];
|
||||
const pattern = /"(.+)"\s*:\s*(http.+)/;
|
||||
src.trim()
|
||||
src
|
||||
.trim()
|
||||
.split("\n")
|
||||
.forEach((line) => {
|
||||
const match = pattern.exec(line);
|
||||
|
@ -590,9 +591,7 @@ async function init() {
|
|||
defaultReaction.value = ["⭐", "👍", "❤️"].includes(meta.defaultReaction)
|
||||
? meta.defaultReaction
|
||||
: "custom";
|
||||
defaultReactionCustom.value = ["⭐", "👍", "❤️"].includes(
|
||||
meta.defaultReaction,
|
||||
)
|
||||
defaultReactionCustom.value = ["⭐", "👍", "❤️"].includes(meta.defaultReaction)
|
||||
? ""
|
||||
: meta.defaultReaction;
|
||||
enableServerMachineStats.value = meta.enableServerMachineStats;
|
||||
|
|
|
@ -72,11 +72,9 @@ onMounted(() => {
|
|||
fetching.value = false;
|
||||
|
||||
if (session.value.app.isAuthorized) {
|
||||
os.api("auth/accept", { token: session.value.token }).then(
|
||||
() => {
|
||||
accepted();
|
||||
},
|
||||
);
|
||||
os.api("auth/accept", { token: session.value.token }).then(() => {
|
||||
accepted();
|
||||
});
|
||||
} else {
|
||||
state.value = "waiting";
|
||||
}
|
||||
|
|
|
@ -75,28 +75,25 @@ const headerActions = computed(() =>
|
|||
icon: `${icon("ph-pencil")}`,
|
||||
text: i18n.ts.toEdit,
|
||||
handler: async (): Promise<void> => {
|
||||
const { canceled, result } = await os.form(
|
||||
clip.value.name,
|
||||
{
|
||||
name: {
|
||||
type: "string",
|
||||
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,
|
||||
},
|
||||
const { canceled, result } = await os.form(clip.value.name, {
|
||||
name: {
|
||||
type: "string",
|
||||
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,
|
||||
},
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
os.apiWithDialog("clips/update", {
|
||||
|
|
|
@ -37,14 +37,12 @@ function menu(ev) {
|
|||
text: i18n.ts.license,
|
||||
icon: `${icon("ph-info")}`,
|
||||
action: () => {
|
||||
os.apiGet("emoji", { name: props.emoji.name }).then(
|
||||
(res) => {
|
||||
os.alert({
|
||||
type: "info",
|
||||
text: `${res.license || i18n.ts.notSet}`,
|
||||
});
|
||||
},
|
||||
);
|
||||
os.apiGet("emoji", { name: props.emoji.name }).then((res) => {
|
||||
os.alert({
|
||||
type: "info",
|
||||
text: `${res.license || i18n.ts.notSet}`,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -182,8 +182,7 @@ function onMessage(message): void {
|
|||
!(
|
||||
(m.recipientId === message.recipientId &&
|
||||
m.userId === message.userId) ||
|
||||
(m.recipientId === message.userId &&
|
||||
m.userId === message.recipientId)
|
||||
(m.recipientId === message.userId && m.userId === message.recipientId)
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -267,8 +266,7 @@ onMounted(() => {
|
|||
const _messages = userMessages.concat(groupMessages);
|
||||
_messages.sort(
|
||||
(a, b) =>
|
||||
new Date(b.createdAt).getTime() -
|
||||
new Date(a.createdAt).getTime(),
|
||||
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),
|
||||
);
|
||||
messages.value = _messages;
|
||||
},
|
||||
|
|
|
@ -90,8 +90,7 @@ const draftKey = computed(() =>
|
|||
props.user ? "user:" + props.user.id : "group:" + props.group?.id,
|
||||
);
|
||||
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);
|
||||
|
|
|
@ -280,9 +280,7 @@ function onRead(x) {
|
|||
if (!Array.isArray(x)) x = [x];
|
||||
for (const id of x) {
|
||||
if (pagingComponent.value.items.some((y) => y.id === id)) {
|
||||
const exist = pagingComponent.value.items
|
||||
.map((y) => y.id)
|
||||
.indexOf(id);
|
||||
const exist = pagingComponent.value.items.map((y) => y.id).indexOf(id);
|
||||
pagingComponent.value.items[exist] = {
|
||||
...pagingComponent.value.items[exist],
|
||||
isRead: true,
|
||||
|
@ -292,15 +290,10 @@ function onRead(x) {
|
|||
} else if (group.value) {
|
||||
for (const id of x.ids) {
|
||||
if (pagingComponent.value.items.some((y) => y.id === id)) {
|
||||
const exist = pagingComponent.value.items
|
||||
.map((y) => y.id)
|
||||
.indexOf(id);
|
||||
const exist = pagingComponent.value.items.map((y) => y.id).indexOf(id);
|
||||
pagingComponent.value.items[exist] = {
|
||||
...pagingComponent.value.items[exist],
|
||||
reads: [
|
||||
...pagingComponent.value.items[exist].reads,
|
||||
x.userId,
|
||||
],
|
||||
reads: [...pagingComponent.value.items[exist].reads, x.userId],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,20 +175,15 @@ definePageMetadata(
|
|||
appearNote.value
|
||||
? {
|
||||
title: i18n.t("noteOf", {
|
||||
user:
|
||||
appearNote.value.user.name ||
|
||||
appearNote.value.user.username,
|
||||
user: appearNote.value.user.name || appearNote.value.user.username,
|
||||
}),
|
||||
subtitle: new Date(
|
||||
appearNote.value.createdAt,
|
||||
).toLocaleString(),
|
||||
subtitle: new Date(appearNote.value.createdAt).toLocaleString(),
|
||||
avatar: appearNote.value.user,
|
||||
path: `/notes/${appearNote.value.id}`,
|
||||
share: {
|
||||
title: i18n.t("noteOf", {
|
||||
user:
|
||||
appearNote.value.user.name ||
|
||||
appearNote.value.user.username,
|
||||
appearNote.value.user.name || appearNote.value.user.username,
|
||||
}),
|
||||
text: appearNote.value.text,
|
||||
},
|
||||
|
|
|
@ -164,9 +164,7 @@ export default defineComponent({
|
|||
components: {
|
||||
XContainer,
|
||||
MkTextarea,
|
||||
XV: defineAsyncComponent(
|
||||
() => import("./page-editor.script-block.vue"),
|
||||
),
|
||||
XV: defineAsyncComponent(() => import("./page-editor.script-block.vue")),
|
||||
},
|
||||
|
||||
inject: ["getScriptBlockList"],
|
||||
|
@ -228,12 +226,10 @@ export default defineComponent({
|
|||
watch: {
|
||||
slots: {
|
||||
handler() {
|
||||
this.modelValue.value.slots = this.slots
|
||||
.split("\n")
|
||||
.map((x) => ({
|
||||
name: x,
|
||||
type: null,
|
||||
}));
|
||||
this.modelValue.value.slots = this.slots.split("\n").map((x) => ({
|
||||
name: x,
|
||||
type: null,
|
||||
}));
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
|
@ -243,9 +239,7 @@ export default defineComponent({
|
|||
if (this.modelValue.value == null) this.modelValue.value = null;
|
||||
|
||||
if (this.modelValue.value && this.modelValue.value.slots)
|
||||
this.slots = this.modelValue.value.slots
|
||||
.map((x) => x.name)
|
||||
.join("\n");
|
||||
this.slots = this.modelValue.value.slots.map((x) => x.name).join("\n");
|
||||
|
||||
this.$watch(
|
||||
() => this.modelValue.type,
|
||||
|
@ -261,10 +255,7 @@ export default defineComponent({
|
|||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
this.modelValue.type &&
|
||||
this.modelValue.type.startsWith("fn:")
|
||||
) {
|
||||
if (this.modelValue.type && this.modelValue.type.startsWith("fn:")) {
|
||||
const fnName = this.modelValue.type.split(":")[1];
|
||||
const fn = this.hpml.getVarByName(fnName);
|
||||
|
||||
|
@ -280,27 +271,17 @@ export default defineComponent({
|
|||
if (isLiteralValue(this.modelValue)) return;
|
||||
|
||||
const empties = [];
|
||||
for (
|
||||
let i = 0;
|
||||
i < funcDefs[this.modelValue.type].in.length;
|
||||
i++
|
||||
) {
|
||||
for (let i = 0; i < funcDefs[this.modelValue.type].in.length; i++) {
|
||||
const id = uuid();
|
||||
empties.push({ id, type: null });
|
||||
}
|
||||
this.modelValue.args = empties;
|
||||
|
||||
for (
|
||||
let i = 0;
|
||||
i < funcDefs[this.modelValue.type].in.length;
|
||||
i++
|
||||
) {
|
||||
for (let i = 0; i < funcDefs[this.modelValue.type].in.length; i++) {
|
||||
const inType = funcDefs[this.modelValue.type].in[i];
|
||||
if (typeof inType !== "number") {
|
||||
if (inType === "number")
|
||||
this.modelValue.args[i].type = "number";
|
||||
if (inType === "string")
|
||||
this.modelValue.args[i].type = "text";
|
||||
if (inType === "number") this.modelValue.args[i].type = "number";
|
||||
if (inType === "string") this.modelValue.args[i].type = "text";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -64,9 +64,7 @@ function fetchKeys() {
|
|||
os.api("i/registry/keys-with-type", {
|
||||
scope: scope.value,
|
||||
}).then((res) => {
|
||||
keys.value = Object.entries(res).sort((a, b) =>
|
||||
a[0].localeCompare(b[0]),
|
||||
);
|
||||
keys.value = Object.entries(res).sort((a, b) => a[0].localeCompare(b[0]));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -56,9 +56,7 @@ async function save() {
|
|||
onMounted(() => {
|
||||
if (props.token == null) {
|
||||
os.popup(
|
||||
defineAsyncComponent(
|
||||
() => import("@/components/MkForgotPassword.vue"),
|
||||
),
|
||||
defineAsyncComponent(() => import("@/components/MkForgotPassword.vue")),
|
||||
{},
|
||||
{},
|
||||
"closed",
|
||||
|
|
|
@ -89,10 +89,7 @@ async function run() {
|
|||
out: (value) => {
|
||||
logs.value.push({
|
||||
id: Math.random(),
|
||||
text:
|
||||
value.type === "str"
|
||||
? value.value
|
||||
: utils.valToString(value),
|
||||
text: value.type === "str" ? value.value : utils.valToString(value),
|
||||
print: true,
|
||||
});
|
||||
},
|
||||
|
|
|
@ -78,8 +78,7 @@ const notesPagination = {
|
|||
host: props.host == null ? undefined : getHost(props.host),
|
||||
sinceDate:
|
||||
props.since == null ? undefined : getUnixTime(props.since, false),
|
||||
untilDate:
|
||||
props.until == null ? undefined : getUnixTime(props.until, true),
|
||||
untilDate: props.until == null ? undefined : getUnixTime(props.until, true),
|
||||
withFiles: props.withFiles === "1",
|
||||
searchCwAndAlt: props.searchCwAndAlt === "1",
|
||||
channelId: props.channel,
|
||||
|
|
|
@ -107,8 +107,7 @@ async function install() {
|
|||
return;
|
||||
}
|
||||
|
||||
const { name, version, author, description, permissions, config } =
|
||||
metadata;
|
||||
const { name, version, author, description, permissions, config } = metadata;
|
||||
if (name == null || version == null || author == null) {
|
||||
os.alert({
|
||||
type: "error",
|
||||
|
@ -123,29 +122,22 @@ async function install() {
|
|||
: await new Promise((res, rej) => {
|
||||
os.popup(
|
||||
defineAsyncComponent(
|
||||
() =>
|
||||
import(
|
||||
"@/components/MkTokenGenerateWindow.vue"
|
||||
),
|
||||
() => import("@/components/MkTokenGenerateWindow.vue"),
|
||||
),
|
||||
{
|
||||
title: i18n.ts.tokenRequested,
|
||||
information:
|
||||
i18n.ts.pluginTokenRequestedDescription,
|
||||
information: i18n.ts.pluginTokenRequestedDescription,
|
||||
initialName: name,
|
||||
initialPermissions: permissions,
|
||||
},
|
||||
{
|
||||
done: async (result) => {
|
||||
const { name, permissions } = result;
|
||||
const { token } = await os.api(
|
||||
"miauth/gen-token",
|
||||
{
|
||||
session: null,
|
||||
name,
|
||||
permission: permissions,
|
||||
},
|
||||
);
|
||||
const { token } = await os.api("miauth/gen-token", {
|
||||
session: null,
|
||||
name,
|
||||
permission: permissions,
|
||||
});
|
||||
res(token);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -196,10 +196,7 @@ function validate(profile: unknown): void {
|
|||
|
||||
// Check if createdAt and updatedAt is Date
|
||||
// https://zenn.dev/lollipop_onl/articles/eoz-judge-js-invalid-date
|
||||
if (
|
||||
!profile.createdAt ||
|
||||
Number.isNaN(new Date(profile.createdAt).getTime())
|
||||
)
|
||||
if (!profile.createdAt || Number.isNaN(new Date(profile.createdAt).getTime()))
|
||||
throw new Error("createdAt is falsy or not Date");
|
||||
if (profile.updatedAt) {
|
||||
if (Number.isNaN(new Date(profile.updatedAt).getTime())) {
|
||||
|
@ -228,10 +225,7 @@ function getSettings(): Profile["settings"] {
|
|||
hot,
|
||||
cold,
|
||||
fontSize: localStorage.getItem("fontSize"),
|
||||
useSystemFont: localStorage.getItem("useSystemFont") as
|
||||
| "t"
|
||||
| "f"
|
||||
| null,
|
||||
useSystemFont: localStorage.getItem("useSystemFont") as "t" | "f" | null,
|
||||
wallpaper: localStorage.getItem("wallpaper"),
|
||||
};
|
||||
}
|
||||
|
@ -468,12 +462,9 @@ function menu(ev: MouseEvent, profileId: string) {
|
|||
text: i18n.ts.download,
|
||||
icon: `${icon("ph-download-simple")}`,
|
||||
href: URL.createObjectURL(
|
||||
new Blob(
|
||||
[JSON.stringify(profiles.value[profileId], null, 2)],
|
||||
{
|
||||
type: "application/json",
|
||||
},
|
||||
),
|
||||
new Blob([JSON.stringify(profiles.value[profileId], null, 2)], {
|
||||
type: "application/json",
|
||||
}),
|
||||
),
|
||||
download: `${profiles.value[profileId].name}.json`,
|
||||
},
|
||||
|
@ -502,20 +493,17 @@ function menu(ev: MouseEvent, profileId: string) {
|
|||
|
||||
onMounted(() => {
|
||||
// streamingのuser storage updateイベントを監視して更新
|
||||
connection?.on(
|
||||
"registryUpdated",
|
||||
({ scope: recievedScope, key, value }) => {
|
||||
if (
|
||||
!recievedScope ||
|
||||
recievedScope.length !== scope.length ||
|
||||
recievedScope[0] !== scope[0]
|
||||
)
|
||||
return;
|
||||
if (!profiles.value) return;
|
||||
connection?.on("registryUpdated", ({ scope: recievedScope, key, value }) => {
|
||||
if (
|
||||
!recievedScope ||
|
||||
recievedScope.length !== scope.length ||
|
||||
recievedScope[0] !== scope[0]
|
||||
)
|
||||
return;
|
||||
if (!profiles.value) return;
|
||||
|
||||
profiles.value[key] = value;
|
||||
},
|
||||
);
|
||||
profiles.value[key] = value;
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
|
@ -213,9 +213,7 @@ while (fields.length < 4) {
|
|||
|
||||
function saveFields() {
|
||||
os.apiWithDialog("i/update", {
|
||||
fields: fields.filter(
|
||||
(field) => field.name !== "" && field.value !== "",
|
||||
),
|
||||
fields: fields.filter((field) => field.name !== "" && field.value !== ""),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -179,9 +179,7 @@ function remove(reaction, ev: MouseEvent) {
|
|||
{
|
||||
text: i18n.ts.remove,
|
||||
action: () => {
|
||||
reactions.value = reactions.value.filter(
|
||||
(x) => x !== reaction,
|
||||
);
|
||||
reactions.value = reactions.value.filter((x) => x !== reaction);
|
||||
save();
|
||||
},
|
||||
},
|
||||
|
@ -192,9 +190,7 @@ function remove(reaction, ev: MouseEvent) {
|
|||
|
||||
function preview(ev: MouseEvent) {
|
||||
os.popup(
|
||||
defineAsyncComponent(
|
||||
() => import("@/components/MkEmojiPickerDialog.vue"),
|
||||
),
|
||||
defineAsyncComponent(() => import("@/components/MkEmojiPickerDialog.vue")),
|
||||
{
|
||||
asReactionPicker: true,
|
||||
src: ev.currentTarget ?? ev.target,
|
||||
|
|
|
@ -71,13 +71,11 @@ const pagination = {
|
|||
};
|
||||
|
||||
async function change() {
|
||||
const { canceled: canceled1, result: currentPassword } = await os.inputText(
|
||||
{
|
||||
title: i18n.ts.currentPassword,
|
||||
type: "password",
|
||||
autocomplete: "current-password",
|
||||
},
|
||||
);
|
||||
const { canceled: canceled1, result: currentPassword } = await os.inputText({
|
||||
title: i18n.ts.currentPassword,
|
||||
type: "password",
|
||||
autocomplete: "current-password",
|
||||
});
|
||||
if (canceled1) return;
|
||||
|
||||
const { canceled: canceled2, result: newPassword } = await os.inputText({
|
||||
|
|
|
@ -193,9 +193,7 @@ watch(
|
|||
watch(statusbar, save);
|
||||
|
||||
async function save() {
|
||||
const i = defaultStore.state.statusbars.findIndex(
|
||||
(x) => x.id === props._id,
|
||||
);
|
||||
const i = defaultStore.state.statusbars.findIndex((x) => x.id === props._id);
|
||||
const statusbars = deepClone(defaultStore.state.statusbars);
|
||||
statusbars[i] = deepClone(statusbar);
|
||||
defaultStore.set("statusbars", statusbars);
|
||||
|
|
|
@ -179,9 +179,7 @@ const instanceLightTheme = computed(() =>
|
|||
instance.defaultLightTheme ? JSON5.parse(instance.defaultLightTheme) : null,
|
||||
);
|
||||
const installedLightThemes = computed(() =>
|
||||
installedThemes.value.filter(
|
||||
(t) => t.base === "light" || t.kind === "light",
|
||||
),
|
||||
installedThemes.value.filter((t) => t.base === "light" || t.kind === "light"),
|
||||
);
|
||||
const builtinLightThemes = computed(() =>
|
||||
builtinThemes.value.filter((t) => t.base === "light" || t.kind === "light"),
|
||||
|
|
|
@ -224,10 +224,7 @@ async function save() {
|
|||
|
||||
let softMutes, softMLangs, hardMWords, hardMPatterns;
|
||||
try {
|
||||
softMutes = parseSoftMutes(
|
||||
softMutedWords.value,
|
||||
i18n.ts._wordMute.soft,
|
||||
);
|
||||
softMutes = parseSoftMutes(softMutedWords.value, i18n.ts._wordMute.soft);
|
||||
softMLangs = parseMutedWords(softMutedLangs.value);
|
||||
hardMWords = parseMutedWords(hardMutedWords.value);
|
||||
hardMPatterns = parseMutedPatterns(
|
||||
|
|
|
@ -81,9 +81,7 @@ async function init() {
|
|||
...(visibleUserIds
|
||||
? visibleUserIds.split(",").map((userId) => ({ userId }))
|
||||
: []),
|
||||
...(visibleAccts
|
||||
? visibleAccts.split(",").map(acct.parse)
|
||||
: []),
|
||||
...(visibleAccts ? visibleAccts.split(",").map(acct.parse) : []),
|
||||
]
|
||||
// TypeScriptの指示通りに変換する
|
||||
.map((q) =>
|
||||
|
@ -100,9 +98,7 @@ async function init() {
|
|||
visibleUsers.value.push(user);
|
||||
},
|
||||
() => {
|
||||
console.error(
|
||||
`Invalid user query: ${JSON.stringify(q)}`,
|
||||
);
|
||||
console.error(`Invalid user query: ${JSON.stringify(q)}`);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
@ -414,8 +414,7 @@ function createFetcher() {
|
|||
emojiModPerm.value = info.value.emojiModPerm;
|
||||
silenced.value = info.value.isSilenced;
|
||||
suspended.value = info.value.isSuspended;
|
||||
driveCapacityOverrideMb.value =
|
||||
user.value.driveCapacityOverrideMb;
|
||||
driveCapacityOverrideMb.value = user.value.driveCapacityOverrideMb;
|
||||
moderationNote.value = info.value.moderationNote;
|
||||
|
||||
watch(moderationNote, async () => {
|
||||
|
|
|
@ -168,10 +168,7 @@ export default defineComponent({
|
|||
text: i18n.ts.help,
|
||||
icon: `${icon("ph-question")}`,
|
||||
action: () => {
|
||||
window.open(
|
||||
`https://misskey-hub.net/help.md`,
|
||||
"_blank",
|
||||
);
|
||||
window.open(`https://misskey-hub.net/help.md`, "_blank");
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// PIZZAX --- A lightweight store
|
||||
|
||||
import { isSignedIn, me } from "@/me";
|
||||
import type { Ref } from "vue";
|
||||
import { onUnmounted, ref, watch } from "vue";
|
||||
import { api } from "./os";
|
||||
import { useStream } from "./stream";
|
||||
import { isSignedIn, me } from "@/me";
|
||||
|
||||
type StateDef = Record<
|
||||
string,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Interpreter, Parser, utils, values } from "@syuilo/aiscript";
|
||||
import { inputText } from "@/os";
|
||||
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
||||
import {
|
||||
|
@ -8,6 +7,7 @@ import {
|
|||
postFormActions,
|
||||
userActions,
|
||||
} from "@/store";
|
||||
import { Interpreter, Parser, utils, values } from "@syuilo/aiscript";
|
||||
|
||||
const parser = new Parser();
|
||||
const pluginContexts = new Map<string, Interpreter>();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { AsyncComponentLoader } from "vue";
|
||||
import { defineAsyncComponent, inject } from "vue";
|
||||
import { isEmojiMod, isModerator, me } from "@/me";
|
||||
import { Router } from "@/nirax";
|
||||
import MkError from "@/pages/_error_.vue";
|
||||
import MkLoading from "@/pages/_loading_.vue";
|
||||
import type { AsyncComponentLoader } from "vue";
|
||||
import { defineAsyncComponent, inject } from "vue";
|
||||
|
||||
const page = (loader: AsyncComponentLoader<any>) =>
|
||||
defineAsyncComponent({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Stream } from "firefish-js";
|
||||
import { markRaw } from "vue";
|
||||
import { url } from "@/config";
|
||||
import { me } from "@/me";
|
||||
import { Stream } from "firefish-js";
|
||||
import { markRaw } from "vue";
|
||||
|
||||
let stream: Stream | null = null;
|
||||
let timeoutHeartBeat: number | null = null;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { Theme } from "./scripts/theme";
|
||||
import { isSignedIn, me } from "@/me";
|
||||
import { api } from "@/os";
|
||||
import type { Theme } from "./scripts/theme";
|
||||
|
||||
const lsCacheKey = isSignedIn ? `themes:${me.id}` : "";
|
||||
|
||||
|
|
|
@ -178,8 +178,7 @@ const otherMenuItemIndicated = computed(() => {
|
|||
|
||||
const calcViewState = () => {
|
||||
iconOnly.value =
|
||||
window.innerWidth <= 1279 ||
|
||||
defaultStore.state.menuDisplay === "sideIcon";
|
||||
window.innerWidth <= 1279 || defaultStore.state.menuDisplay === "sideIcon";
|
||||
};
|
||||
|
||||
calcViewState();
|
||||
|
|
|
@ -216,9 +216,7 @@ const XStatusBars = defineAsyncComponent(
|
|||
|
||||
mainRouter.navHook = (path, flag): boolean => {
|
||||
if (flag === "forcePage") return false;
|
||||
const noMainColumn = !deckStore.state.columns.some(
|
||||
(x) => x.type === "main",
|
||||
);
|
||||
const noMainColumn = !deckStore.state.columns.some((x) => x.type === "main");
|
||||
if (deckStore.state.navWindow || noMainColumn) {
|
||||
os.pageWindow(path);
|
||||
return true;
|
||||
|
|
|
@ -394,9 +394,7 @@ async function startGroup(): void {
|
|||
|
||||
onMounted(() => {
|
||||
if (!isDesktop.value) {
|
||||
matchMedia(`(min-width: ${DESKTOP_THRESHOLD - 1}px)`).onchange = (
|
||||
mql,
|
||||
) => {
|
||||
matchMedia(`(min-width: ${DESKTOP_THRESHOLD - 1}px)`).onchange = (mql) => {
|
||||
if (mql.matches) isDesktop.value = true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -140,8 +140,7 @@ export default defineComponent({
|
|||
window.addEventListener(
|
||||
"resize",
|
||||
() => {
|
||||
if (window.innerWidth >= DESKTOP_THRESHOLD)
|
||||
this.isDesktop = true;
|
||||
if (window.innerWidth >= DESKTOP_THRESHOLD) this.isDesktop = true;
|
||||
},
|
||||
{ passive: true },
|
||||
);
|
||||
|
|
|
@ -166,8 +166,7 @@ onMounted(() => {
|
|||
window.addEventListener(
|
||||
"resize",
|
||||
() => {
|
||||
if (window.innerWidth >= DESKTOP_THRESHOLD)
|
||||
isDesktop.value = true;
|
||||
if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true;
|
||||
},
|
||||
{ passive: true },
|
||||
);
|
||||
|
|
|
@ -99,10 +99,7 @@ const run = async () => {
|
|||
out: (value) => {
|
||||
logs.value.push({
|
||||
id: Math.random().toString(),
|
||||
text:
|
||||
value.type === "str"
|
||||
? value.value
|
||||
: utils.valToString(value),
|
||||
text: value.type === "str" ? value.value : utils.valToString(value),
|
||||
print: true,
|
||||
});
|
||||
},
|
||||
|
|
|
@ -203,13 +203,10 @@ const tzAbbrev = computed(
|
|||
? timezones.find(
|
||||
(tz) =>
|
||||
tz.name.toLowerCase() ===
|
||||
Intl.DateTimeFormat()
|
||||
.resolvedOptions()
|
||||
.timeZone.toLowerCase(),
|
||||
Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase(),
|
||||
)?.abbrev
|
||||
: timezones.find(
|
||||
(tz) => tz.name.toLowerCase() === widgetProps.timezone,
|
||||
)?.abbrev) ?? "?",
|
||||
: timezones.find((tz) => tz.name.toLowerCase() === widgetProps.timezone)
|
||||
?.abbrev) ?? "?",
|
||||
);
|
||||
|
||||
const tzOffset = computed(() =>
|
||||
|
|
|
@ -83,13 +83,10 @@ const tzAbbrev = computed(
|
|||
? timezones.find(
|
||||
(tz) =>
|
||||
tz.name.toLowerCase() ===
|
||||
Intl.DateTimeFormat()
|
||||
.resolvedOptions()
|
||||
.timeZone.toLowerCase(),
|
||||
Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase(),
|
||||
)?.abbrev
|
||||
: timezones.find(
|
||||
(tz) => tz.name.toLowerCase() === widgetProps.timezone,
|
||||
)?.abbrev) ?? "?",
|
||||
: timezones.find((tz) => tz.name.toLowerCase() === widgetProps.timezone)
|
||||
?.abbrev) ?? "?",
|
||||
);
|
||||
|
||||
const tzOffset = computed(() =>
|
||||
|
|
|
@ -147,19 +147,13 @@ function onStats(connStats) {
|
|||
viewBoxY.value
|
||||
} ${memPolylinePoints.value} ${viewBoxX.value},${viewBoxY.value}`;
|
||||
|
||||
cpuHeadX.value =
|
||||
cpuPolylinePointsStats[cpuPolylinePointsStats.length - 1][0];
|
||||
cpuHeadY.value =
|
||||
cpuPolylinePointsStats[cpuPolylinePointsStats.length - 1][1];
|
||||
memHeadX.value =
|
||||
memPolylinePointsStats[memPolylinePointsStats.length - 1][0];
|
||||
memHeadY.value =
|
||||
memPolylinePointsStats[memPolylinePointsStats.length - 1][1];
|
||||
cpuHeadX.value = cpuPolylinePointsStats[cpuPolylinePointsStats.length - 1][0];
|
||||
cpuHeadY.value = cpuPolylinePointsStats[cpuPolylinePointsStats.length - 1][1];
|
||||
memHeadX.value = memPolylinePointsStats[memPolylinePointsStats.length - 1][0];
|
||||
memHeadY.value = memPolylinePointsStats[memPolylinePointsStats.length - 1][1];
|
||||
|
||||
cpuP.value = (connStats.cpu * 100).toFixed(0);
|
||||
memP.value = ((connStats.mem.active / connStats.mem.total) * 100).toFixed(
|
||||
0,
|
||||
);
|
||||
memP.value = ((connStats.mem.active / connStats.mem.total) * 100).toFixed(0);
|
||||
}
|
||||
|
||||
function onStatsLog(statsLog) {
|
||||
|
|
|
@ -112,10 +112,8 @@ function onStats(connStats) {
|
|||
|
||||
inHeadX.value = inPolylinePointsStats[inPolylinePointsStats.length - 1][0];
|
||||
inHeadY.value = inPolylinePointsStats[inPolylinePointsStats.length - 1][1];
|
||||
outHeadX.value =
|
||||
outPolylinePointsStats[outPolylinePointsStats.length - 1][0];
|
||||
outHeadY.value =
|
||||
outPolylinePointsStats[outPolylinePointsStats.length - 1][1];
|
||||
outHeadX.value = outPolylinePointsStats[outPolylinePointsStats.length - 1][0];
|
||||
outHeadY.value = outPolylinePointsStats[outPolylinePointsStats.length - 1][1];
|
||||
|
||||
inRecent.value = connStats.net.rx;
|
||||
outRecent.value = connStats.net.tx;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Entity from "./entity";
|
||||
import type Entity from "./entity";
|
||||
|
||||
namespace FilterContext {
|
||||
export const Home: Entity.FilterContext = "home";
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import Response from "./response";
|
||||
import OAuth from "./oauth";
|
||||
import { isCancel, RequestCanceledError } from "./cancel";
|
||||
import { ProxyConfig } from "./proxy_config";
|
||||
import { RequestCanceledError, isCancel } from "./cancel";
|
||||
import Converter from "./converter";
|
||||
import Entity from "./entity";
|
||||
import FilterContext from "./filter_context";
|
||||
import generator, {
|
||||
detector,
|
||||
MegalodonInterface,
|
||||
WebSocketInterface,
|
||||
} from "./megalodon";
|
||||
import Misskey from "./misskey";
|
||||
import Entity from "./entity";
|
||||
import NotificationType from "./notification";
|
||||
import FilterContext from "./filter_context";
|
||||
import Converter from "./converter";
|
||||
import OAuth from "./oauth";
|
||||
import { ProxyConfig } from "./proxy_config";
|
||||
import Response from "./response";
|
||||
|
||||
export {
|
||||
Response,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue