refactor (client): $i -> me
This commit is contained in:
parent
ce406f9861
commit
5fb3253069
92 changed files with 314 additions and 320 deletions
|
@ -3,8 +3,7 @@ import { defineAsyncComponent } from "vue";
|
||||||
import { i18n } from "./i18n";
|
import { i18n } from "./i18n";
|
||||||
import { apiUrl } from "@/config";
|
import { apiUrl } from "@/config";
|
||||||
import { alert, api, popup, popupMenu, waiting } from "@/os";
|
import { alert, api, popup, popupMenu, waiting } from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
|
||||||
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";
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ export async function signout() {
|
||||||
waiting();
|
waiting();
|
||||||
localStorage.removeItem("account");
|
localStorage.removeItem("account");
|
||||||
|
|
||||||
await removeAccount($i.id);
|
await removeAccount(me.id);
|
||||||
|
|
||||||
const accounts = await getAccounts();
|
const accounts = await getAccounts();
|
||||||
|
|
||||||
|
@ -29,7 +28,7 @@ export async function signout() {
|
||||||
await fetch(`${apiUrl}/sw/unregister`, {
|
await fetch(`${apiUrl}/sw/unregister`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
i: $i.token,
|
i: me.token,
|
||||||
endpoint: push.endpoint,
|
endpoint: push.endpoint,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
@ -117,22 +116,23 @@ function showSuspendedDialog() {
|
||||||
|
|
||||||
export function updateAccount(accountData) {
|
export function updateAccount(accountData) {
|
||||||
for (const [key, value] of Object.entries(accountData)) {
|
for (const [key, value] of Object.entries(accountData)) {
|
||||||
$i[key] = value;
|
me[key] = value;
|
||||||
}
|
}
|
||||||
localStorage.setItem("account", JSON.stringify($i));
|
localStorage.setItem("account", JSON.stringify(me));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function refreshAccount() {
|
export async function refreshAccount() {
|
||||||
return fetchAccount($i.token).then(updateAccount);
|
const accountData = await fetchAccount(me.token);
|
||||||
|
return updateAccount(accountData);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function login(token: Account["token"], redirect?: string) {
|
export async function login(token: Account["token"], redirect?: string) {
|
||||||
waiting();
|
waiting();
|
||||||
if (_DEV_) console.log("logging as token ", token);
|
if (_DEV_) console.log("logging as token ", token);
|
||||||
const me = await fetchAccount(token);
|
const newAccount = await fetchAccount(token);
|
||||||
localStorage.setItem("account", JSON.stringify(me));
|
localStorage.setItem("account", JSON.stringify(newAccount));
|
||||||
document.cookie = `token=${token}; path=/; max-age=31536000`; // bull dashboardの認証とかで使う
|
document.cookie = `token=${token}; path=/; max-age=31536000`; // bull dashboardの認証とかで使う
|
||||||
await addAccount(me.id, token);
|
await addAccount(newAccount.id, token);
|
||||||
|
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
// 他のタブは再読み込みするだけ
|
// 他のタブは再読み込みするだけ
|
||||||
|
@ -194,7 +194,7 @@ export async function openAccountMenu(
|
||||||
}
|
}
|
||||||
|
|
||||||
const storedAccounts = await getAccounts().then((accounts) =>
|
const storedAccounts = await getAccounts().then((accounts) =>
|
||||||
accounts.filter((x) => x.id !== $i.id),
|
accounts.filter((x) => x.id !== me.id),
|
||||||
);
|
);
|
||||||
const accountsPromise = api("users/show", {
|
const accountsPromise = api("users/show", {
|
||||||
userIds: storedAccounts.map((x) => x.id),
|
userIds: storedAccounts.map((x) => x.id),
|
||||||
|
@ -256,12 +256,12 @@ export async function openAccountMenu(
|
||||||
{
|
{
|
||||||
type: "link",
|
type: "link",
|
||||||
text: i18n.ts.profile,
|
text: i18n.ts.profile,
|
||||||
to: `/@${$i.username}`,
|
to: `/@${me.username}`,
|
||||||
avatar: $i,
|
avatar: me,
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
]),
|
]),
|
||||||
...(opts.includeCurrentAccount ? [createItem($i)] : []),
|
...(opts.includeCurrentAccount ? [createItem(me)] : []),
|
||||||
...accountItemPromises,
|
...accountItemPromises,
|
||||||
...(isMobile ?? false
|
...(isMobile ?? false
|
||||||
? [
|
? [
|
||||||
|
@ -269,8 +269,8 @@ export async function openAccountMenu(
|
||||||
{
|
{
|
||||||
type: "link",
|
type: "link",
|
||||||
text: i18n.ts.profile,
|
text: i18n.ts.profile,
|
||||||
to: `/@${$i.username}`,
|
to: `/@${me.username}`,
|
||||||
avatar: $i,
|
avatar: me,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
|
@ -304,7 +304,7 @@ export async function openAccountMenu(
|
||||||
} else {
|
} else {
|
||||||
popupMenu(
|
popupMenu(
|
||||||
[
|
[
|
||||||
...(opts.includeCurrentAccount ? [createItem($i)] : []),
|
...(opts.includeCurrentAccount ? [createItem(me)] : []),
|
||||||
...accountItemPromises,
|
...accountItemPromises,
|
||||||
],
|
],
|
||||||
ev.currentTarget ?? ev.target,
|
ev.currentTarget ?? ev.target,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:class="{
|
:class="{
|
||||||
isMe: isMe(message),
|
isMe: isMe(message),
|
||||||
isRead: message.groupId
|
isRead: message.groupId
|
||||||
? message.reads.includes($i?.id)
|
? message.reads.includes(me?.id)
|
||||||
: message.isRead,
|
: message.isRead,
|
||||||
}"
|
}"
|
||||||
:to="
|
:to="
|
||||||
|
@ -67,14 +67,14 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { acct } from "firefish-js";
|
import { acct } from "firefish-js";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
message: Record<string, any>;
|
message: Record<string, any>;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
function isMe(message): boolean {
|
function isMe(message): boolean {
|
||||||
return message.userId === $i?.id;
|
return message.userId === me?.id;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ import Cropper from "cropperjs";
|
||||||
import tinycolor from "tinycolor2";
|
import tinycolor from "tinycolor2";
|
||||||
import XModalWindow from "@/components/MkModalWindow.vue";
|
import XModalWindow from "@/components/MkModalWindow.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { apiUrl, url } from "@/config";
|
import { apiUrl, url } from "@/config";
|
||||||
import { query } from "@/scripts/url";
|
import { query } from "@/scripts/url";
|
||||||
|
@ -81,7 +81,7 @@ const ok = async () => {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${$i.token}`,
|
authorization: `Bearer ${me.token}`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
@dragstart="onDragstart"
|
@dragstart="onDragstart"
|
||||||
@dragend="onDragend"
|
@dragend="onDragend"
|
||||||
>
|
>
|
||||||
<div v-if="$i?.avatarId == file.id" class="label">
|
<div v-if="me?.avatarId == file.id" class="label">
|
||||||
<img src="/client-assets/label.svg" />
|
<img src="/client-assets/label.svg" />
|
||||||
<p>{{ i18n.ts.avatar }}</p>
|
<p>{{ i18n.ts.avatar }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="$i?.bannerId == file.id" class="label">
|
<div v-if="me?.bannerId == file.id" class="label">
|
||||||
<img src="/client-assets/label.svg" />
|
<img src="/client-assets/label.svg" />
|
||||||
<p>{{ i18n.ts.banner }}</p>
|
<p>{{ i18n.ts.banner }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,7 +45,7 @@ import MkDriveFileThumbnail from "@/components/MkDriveFileThumbnail.vue";
|
||||||
import bytes from "@/filters/bytes";
|
import bytes from "@/filters/bytes";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<i :class="icon('ph-dots-three-outline')"></i>
|
<i :class="icon('ph-dots-three-outline')"></i>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="!hideFollowButton && isSignedIn && $i.id != user.id"
|
v-if="!hideFollowButton && isSignedIn && me.id != user.id"
|
||||||
v-tooltip="full ? null : `${state} ${user.name || user.username}`"
|
v-tooltip="full ? null : `${state} ${user.name || user.username}`"
|
||||||
class="kpoogebi _button follow-button"
|
class="kpoogebi _button follow-button"
|
||||||
:class="{
|
:class="{
|
||||||
|
@ -66,7 +66,7 @@ import type { entities } from "firefish-js";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { useStream } from "@/stream";
|
import { useStream } from "@/stream";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { getUserMenu } from "@/scripts/get-user-menu";
|
import { getUserMenu } from "@/scripts/get-user-menu";
|
||||||
import { useRouter } from "@/router";
|
import { useRouter } from "@/router";
|
||||||
import { vibrate } from "@/scripts/vibrate";
|
import { vibrate } from "@/scripts/vibrate";
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { toUnicode } from "punycode";
|
import { toUnicode } from "punycode";
|
||||||
import { host as localHost } from "@/config";
|
import { host as localHost } from "@/config";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -53,8 +53,8 @@ const url = `/${canonical}`;
|
||||||
|
|
||||||
const isMe =
|
const isMe =
|
||||||
isSignedIn &&
|
isSignedIn &&
|
||||||
`@${props.username}@${toUnicode(props.host)}` ===
|
`@${props.username}@${toUnicode(props.host)}`.toLowerCase() ===
|
||||||
`@${$i.username}@${toUnicode(localHost)}`.toLowerCase();
|
`@${me.username}@${toUnicode(localHost)}`.toLowerCase();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
<Mfm
|
<Mfm
|
||||||
:text="translation.text"
|
:text="translation.text"
|
||||||
:author="appearNote.user"
|
:author="appearNote.user"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:lang="targetLang"
|
:lang="targetLang"
|
||||||
:custom-emojis="appearNote.emojis"
|
:custom-emojis="appearNote.emojis"
|
||||||
/>
|
/>
|
||||||
|
@ -296,7 +296,7 @@ import { userPage } from "@/filters/user";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { defaultStore, noteViewInterruptors } from "@/store";
|
import { defaultStore, noteViewInterruptors } from "@/store";
|
||||||
import { reactionPicker } from "@/scripts/reaction-picker";
|
import { reactionPicker } from "@/scripts/reaction-picker";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { getNoteMenu } from "@/scripts/get-note-menu";
|
import { getNoteMenu } from "@/scripts/get-note-menu";
|
||||||
import { useNoteCapture } from "@/scripts/use-note-capture";
|
import { useNoteCapture } from "@/scripts/use-note-capture";
|
||||||
|
@ -355,13 +355,13 @@ const reactButton = ref<HTMLElement>();
|
||||||
const appearNote = computed(() =>
|
const appearNote = computed(() =>
|
||||||
isRenote ? (note.value.renote as entities.Note) : note.value,
|
isRenote ? (note.value.renote as entities.Note) : note.value,
|
||||||
);
|
);
|
||||||
const isMyRenote = isSignedIn && $i.id === note.value.userId;
|
const isMyRenote = isSignedIn && me.id === note.value.userId;
|
||||||
const showContent = ref(false);
|
const showContent = ref(false);
|
||||||
const isDeleted = ref(false);
|
const isDeleted = ref(false);
|
||||||
const muted = ref(
|
const muted = ref(
|
||||||
getWordSoftMute(
|
getWordSoftMute(
|
||||||
note.value,
|
note.value,
|
||||||
$i?.id,
|
me?.id,
|
||||||
defaultStore.state.mutedWords,
|
defaultStore.state.mutedWords,
|
||||||
defaultStore.state.mutedLangs,
|
defaultStore.state.mutedLangs,
|
||||||
),
|
),
|
||||||
|
|
|
@ -180,7 +180,7 @@ import { userPage } from "@/filters/user";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { defaultStore, noteViewInterruptors } from "@/store";
|
import { defaultStore, noteViewInterruptors } from "@/store";
|
||||||
import { reactionPicker } from "@/scripts/reaction-picker";
|
import { reactionPicker } from "@/scripts/reaction-picker";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { getNoteMenu } from "@/scripts/get-note-menu";
|
import { getNoteMenu } from "@/scripts/get-note-menu";
|
||||||
import { useNoteCapture } from "@/scripts/use-note-capture";
|
import { useNoteCapture } from "@/scripts/use-note-capture";
|
||||||
|
@ -235,7 +235,7 @@ const isDeleted = ref(false);
|
||||||
const muted = ref(
|
const muted = ref(
|
||||||
getWordSoftMute(
|
getWordSoftMute(
|
||||||
note.value,
|
note.value,
|
||||||
$i?.id,
|
me?.id,
|
||||||
defaultStore.state.mutedWords,
|
defaultStore.state.mutedWords,
|
||||||
defaultStore.state.mutedLangs,
|
defaultStore.state.mutedLangs,
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-size="{ min: [350, 500] }" class="fefdfafb">
|
<div v-size="{ min: [350, 500] }" class="fefdfafb">
|
||||||
<MkAvatar class="avatar" :user="$i" disable-link />
|
<MkAvatar class="avatar" :user="me" disable-link />
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<MkUserName :user="$i" />
|
<MkUserName :user="me" />
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<Mfm
|
<Mfm
|
||||||
:text="preprocess(text).trim()"
|
:text="preprocess(text).trim()"
|
||||||
:lang="lang"
|
:lang="lang"
|
||||||
:author="$i"
|
:author="me"
|
||||||
:i="$i"
|
:i="me"
|
||||||
advanced-mfm
|
advanced-mfm
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<Mfm
|
<Mfm
|
||||||
:text="translation.text"
|
:text="translation.text"
|
||||||
:author="appearNote.user"
|
:author="appearNote.user"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:lang="targetLang"
|
:lang="targetLang"
|
||||||
:custom-emojis="appearNote.emojis"
|
:custom-emojis="appearNote.emojis"
|
||||||
/>
|
/>
|
||||||
|
@ -211,7 +211,7 @@ import { useRouter } from "@/router";
|
||||||
import { userPage } from "@/filters/user";
|
import { userPage } from "@/filters/user";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { reactionPicker } from "@/scripts/reaction-picker";
|
import { reactionPicker } from "@/scripts/reaction-picker";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { useNoteCapture } from "@/scripts/use-note-capture";
|
import { useNoteCapture } from "@/scripts/use-note-capture";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
|
@ -269,7 +269,7 @@ const isDeleted = ref(false);
|
||||||
const muted = ref(
|
const muted = ref(
|
||||||
getWordSoftMute(
|
getWordSoftMute(
|
||||||
note.value,
|
note.value,
|
||||||
$i?.id,
|
me?.id,
|
||||||
defaultStore.state.mutedWords,
|
defaultStore.state.mutedWords,
|
||||||
defaultStore.state.mutedLangs,
|
defaultStore.state.mutedLangs,
|
||||||
),
|
),
|
||||||
|
|
|
@ -54,7 +54,7 @@ import XNotification from "@/components/MkNotification.vue";
|
||||||
import XList from "@/components/MkDateSeparatedList.vue";
|
import XList from "@/components/MkDateSeparatedList.vue";
|
||||||
import XNote from "@/components/MkNote.vue";
|
import XNote from "@/components/MkNote.vue";
|
||||||
import { useStream } from "@/stream";
|
import { useStream } from "@/stream";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -73,7 +73,7 @@ const pagination: Paging = {
|
||||||
includeTypes: props.includeTypes ?? undefined,
|
includeTypes: props.includeTypes ?? undefined,
|
||||||
excludeTypes: props.includeTypes
|
excludeTypes: props.includeTypes
|
||||||
? undefined
|
? undefined
|
||||||
: $i.mutingNotificationTypes,
|
: me.mutingNotificationTypes,
|
||||||
unreadOnly: props.unreadOnly,
|
unreadOnly: props.unreadOnly,
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,7 @@ const pagination: Paging = {
|
||||||
const onNotification = (notification) => {
|
const onNotification = (notification) => {
|
||||||
const isMuted = props.includeTypes
|
const isMuted = props.includeTypes
|
||||||
? !props.includeTypes.includes(notification.type)
|
? !props.includeTypes.includes(notification.type)
|
||||||
: $i.mutingNotificationTypes.includes(notification.type);
|
: me.mutingNotificationTypes.includes(notification.type);
|
||||||
if (isMuted || document.visibilityState === "visible") {
|
if (isMuted || document.visibilityState === "visible") {
|
||||||
stream.send("readNotification", {
|
stream.send("readNotification", {
|
||||||
id: notification.id,
|
id: notification.id,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
class="account _button"
|
class="account _button"
|
||||||
@click="openAccountMenu"
|
@click="openAccountMenu"
|
||||||
>
|
>
|
||||||
<MkAvatar :user="postAccount ?? $i" class="avatar" />
|
<MkAvatar :user="postAccount ?? me" class="avatar" />
|
||||||
</button>
|
</button>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<span
|
<span
|
||||||
|
@ -322,7 +322,7 @@ import MkInfo from "@/components/MkInfo.vue";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { getAccounts, openAccountMenu as openAccountMenu_ } from "@/account";
|
import { getAccounts, openAccountMenu as openAccountMenu_ } from "@/account";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { uploadFile } from "@/scripts/upload";
|
import { uploadFile } from "@/scripts/upload";
|
||||||
import { deepClone } from "@/scripts/clone";
|
import { deepClone } from "@/scripts/clone";
|
||||||
import XCheatSheet from "@/components/MkCheatSheetDialog.vue";
|
import XCheatSheet from "@/components/MkCheatSheetDialog.vue";
|
||||||
|
@ -517,7 +517,7 @@ if (props.mention) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
props.reply &&
|
props.reply &&
|
||||||
(props.reply.user.username !== $i.username ||
|
(props.reply.user.username !== me.username ||
|
||||||
(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}${
|
||||||
|
@ -539,7 +539,7 @@ if (props.reply && props.reply.text != null) {
|
||||||
: `@${x.username}@${toASCII(otherHost)}`;
|
: `@${x.username}@${toASCII(otherHost)}`;
|
||||||
|
|
||||||
// exclude me
|
// exclude me
|
||||||
if ($i.username === x.username && (x.host == null || x.host === host))
|
if (me.username === x.username && (x.host == null || x.host === host))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// remove duplicates
|
// remove duplicates
|
||||||
|
@ -573,7 +573,7 @@ if (
|
||||||
if (props.reply.visibleUserIds) {
|
if (props.reply.visibleUserIds) {
|
||||||
os.api("users/show", {
|
os.api("users/show", {
|
||||||
userIds: props.reply.visibleUserIds.filter(
|
userIds: props.reply.visibleUserIds.filter(
|
||||||
(uid) => uid !== $i.id && uid !== props.reply.userId,
|
(uid) => uid !== me.id && uid !== props.reply.userId,
|
||||||
),
|
),
|
||||||
}).then((users) => {
|
}).then((users) => {
|
||||||
users.forEach(pushVisibleUser);
|
users.forEach(pushVisibleUser);
|
||||||
|
@ -582,7 +582,7 @@ if (
|
||||||
visibility.value = "private";
|
visibility.value = "private";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.reply.userId !== $i.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);
|
||||||
|
@ -611,7 +611,7 @@ const addRe = (s: string) => {
|
||||||
if (defaultStore.state.keepCw && props.reply && props.reply.cw) {
|
if (defaultStore.state.keepCw && props.reply && props.reply.cw) {
|
||||||
useCw.value = true;
|
useCw.value = true;
|
||||||
cw.value =
|
cw.value =
|
||||||
props.reply.user.username === $i.username
|
props.reply.user.username === me.username
|
||||||
? props.reply.cw
|
? props.reply.cw
|
||||||
: addRe(props.reply.cw);
|
: addRe(props.reply.cw);
|
||||||
}
|
}
|
||||||
|
@ -1194,9 +1194,9 @@ function openAccountMenu(ev: MouseEvent) {
|
||||||
{
|
{
|
||||||
withExtraOperation: false,
|
withExtraOperation: false,
|
||||||
includeCurrentAccount: true,
|
includeCurrentAccount: true,
|
||||||
active: postAccount.value != null ? postAccount.value.id : $i.id,
|
active: postAccount.value != null ? postAccount.value.id : me.id,
|
||||||
onChoose: (account) => {
|
onChoose: (account) => {
|
||||||
if (account.id === $i.id) {
|
if (account.id === me.id) {
|
||||||
postAccount.value = null;
|
postAccount.value = null;
|
||||||
} else {
|
} else {
|
||||||
postAccount.value = account;
|
postAccount.value = account;
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
import { getAccounts } from "@/account";
|
import { getAccounts } from "@/account";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { api, apiWithDialog, promiseDialog } from "@/os";
|
import { api, apiWithDialog, promiseDialog } from "@/os";
|
||||||
|
@ -149,7 +149,7 @@ async function unsubscribe() {
|
||||||
|
|
||||||
if (isSignedIn && accounts.length >= 2) {
|
if (isSignedIn && accounts.length >= 2) {
|
||||||
apiWithDialog("sw/unregister", {
|
apiWithDialog("sw/unregister", {
|
||||||
i: $i.token,
|
i: me.token,
|
||||||
endpoint,
|
endpoint,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -197,7 +197,7 @@ if (navigator.serviceWorker == null) {
|
||||||
instance.swPublickey &&
|
instance.swPublickey &&
|
||||||
"PushManager" in window &&
|
"PushManager" in window &&
|
||||||
isSignedIn &&
|
isSignedIn &&
|
||||||
$i.token
|
me.token
|
||||||
) {
|
) {
|
||||||
supported.value = true;
|
supported.value = true;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { computed } from "vue";
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import { pleaseLogin } from "@/scripts/please-login";
|
import { pleaseLogin } from "@/scripts/please-login";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -26,7 +26,7 @@ const props = defineProps<{
|
||||||
const canRenote = computed(
|
const canRenote = computed(
|
||||||
() =>
|
() =>
|
||||||
["public", "home"].includes(props.note.visibility) ||
|
["public", "home"].includes(props.note.visibility) ||
|
||||||
props.note.userId === $i?.id,
|
props.note.userId === me?.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
function quote(): void {
|
function quote(): void {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import XDetails from "@/components/MkReactionsViewer.details.vue";
|
||||||
import XReactionIcon from "@/components/MkReactionIcon.vue";
|
import XReactionIcon from "@/components/MkReactionIcon.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { useTooltip } from "@/scripts/use-tooltip";
|
import { useTooltip } from "@/scripts/use-tooltip";
|
||||||
import { isSignedIn } from "@/reactiveAccount";
|
import { isSignedIn } from "@/me";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reaction: string;
|
reaction: string;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import XReaction from "@/components/MkReactionsViewer.reaction.vue";
|
import XReaction from "@/components/MkReactionsViewer.reaction.vue";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -30,7 +30,7 @@ const reactionsEl = ref<HTMLElement>();
|
||||||
|
|
||||||
const initialReactions = new Set(Object.keys(props.note.reactions));
|
const initialReactions = new Set(Object.keys(props.note.reactions));
|
||||||
|
|
||||||
const isMe = computed(() => isSignedIn && $i.id === props.note.userId);
|
const isMe = computed(() => isSignedIn && me.id === props.note.userId);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -27,7 +27,7 @@ import Ripple from "@/components/MkRipple.vue";
|
||||||
import XDetails from "@/components/MkUsersTooltip.vue";
|
import XDetails from "@/components/MkUsersTooltip.vue";
|
||||||
import { pleaseLogin } from "@/scripts/please-login";
|
import { pleaseLogin } from "@/scripts/please-login";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { useTooltip } from "@/scripts/use-tooltip";
|
import { useTooltip } from "@/scripts/use-tooltip";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
|
@ -46,7 +46,7 @@ const buttonRef = ref<HTMLElement>();
|
||||||
const canRenote = computed(
|
const canRenote = computed(
|
||||||
() =>
|
() =>
|
||||||
["public", "home"].includes(props.note.visibility) ||
|
["public", "home"].includes(props.note.visibility) ||
|
||||||
props.note.userId === $i.id,
|
props.note.userId === me.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
useTooltip(buttonRef, async (showing) => {
|
useTooltip(buttonRef, async (showing) => {
|
||||||
|
@ -77,7 +77,7 @@ const hasRenotedBefore = ref(false);
|
||||||
if (isSignedIn) {
|
if (isSignedIn) {
|
||||||
os.api("notes/renotes", {
|
os.api("notes/renotes", {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
userId: $i.id,
|
userId: me.id,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
hasRenotedBefore.value = res.length > 0;
|
hasRenotedBefore.value = res.length > 0;
|
||||||
|
|
|
@ -52,7 +52,7 @@ export default defineComponent({
|
||||||
flag: true,
|
flag: true,
|
||||||
radio: "firefish",
|
radio: "firefish",
|
||||||
mfm: `Hello world! This is an @example mention. BTW, you are @${
|
mfm: `Hello world! This is an @example mention. BTW, you are @${
|
||||||
this.$i ? this.$i.username : "guest"
|
this.me ? this.me.username : "guest"
|
||||||
}.\nAlso, here is ${config.url} and [example link](${
|
}.\nAlso, here is ${config.url} and [example link](${
|
||||||
config.url
|
config.url
|
||||||
}). for more details, see <https://firefish.dev/firefish/firefish>.\nAs you know #Firefish is open-source software.`,
|
}). for more details, see <https://firefish.dev/firefish/firefish>.\nAs you know #Firefish is open-source software.`,
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
:text="note.cw"
|
:text="note.cw"
|
||||||
:author="note.user"
|
:author="note.user"
|
||||||
:lang="note.lang"
|
:lang="note.lang"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:custom-emojis="note.emojis"
|
:custom-emojis="note.emojis"
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
v-if="note.text"
|
v-if="note.text"
|
||||||
:text="note.text"
|
:text="note.text"
|
||||||
:author="note.user"
|
:author="note.user"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:lang="note.lang"
|
:lang="note.lang"
|
||||||
:custom-emojis="note.emojis"
|
:custom-emojis="note.emojis"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -50,7 +50,7 @@ import XNotes from "@/components/MkNotes.vue";
|
||||||
import MkInfo from "@/components/MkInfo.vue";
|
import MkInfo from "@/components/MkInfo.vue";
|
||||||
import { useStream } from "@/stream";
|
import { useStream } from "@/stream";
|
||||||
import * as sound from "@/scripts/sound";
|
import * as sound from "@/scripts/sound";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -103,7 +103,7 @@ const prepend = (note) => {
|
||||||
emit("note");
|
emit("note");
|
||||||
|
|
||||||
if (props.sound) {
|
if (props.sound) {
|
||||||
sound.play(isSignedIn && note.userId === $i.id ? "noteMy" : "note");
|
sound.play(isSignedIn && note.userId === me.id ? "noteMy" : "note");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ import MkPushNotificationAllowButton from "@/components/MkPushNotificationAllowB
|
||||||
import FormSwitch from "@/components/form/switch.vue";
|
import FormSwitch from "@/components/form/switch.vue";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { isModerator } from "@/reactiveAccount";
|
import { isModerator } from "@/me";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
:class="{ detailed }"
|
:class="{ detailed }"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
v-if="isSignedIn && $i.id !== user.id && user.isFollowed"
|
v-if="isSignedIn && me.id !== user.id && user.isFollowed"
|
||||||
class="followed"
|
class="followed"
|
||||||
>{{ i18n.ts.followsYou }}</span
|
>{{ i18n.ts.followsYou }}</span
|
||||||
>
|
>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
class="mfm"
|
class="mfm"
|
||||||
:text="user.description"
|
:text="user.description"
|
||||||
:author="user"
|
:author="user"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:custom-emojis="user.emojis"
|
:custom-emojis="user.emojis"
|
||||||
/>
|
/>
|
||||||
<span v-else style="opacity: 0.7">{{
|
<span v-else style="opacity: 0.7">{{
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
<Mfm
|
<Mfm
|
||||||
:text="field.value"
|
:text="field.value"
|
||||||
:author="user"
|
:author="user"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:custom-emojis="user.emojis"
|
:custom-emojis="user.emojis"
|
||||||
:colored="false"
|
:colored="false"
|
||||||
/>
|
/>
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<slot>
|
<slot>
|
||||||
<MkFollowButton
|
<MkFollowButton
|
||||||
v-if="isSignedIn && user.id !== $i.id"
|
v-if="isSignedIn && user.id !== me.id"
|
||||||
:user="user"
|
:user="user"
|
||||||
/>
|
/>
|
||||||
</slot>
|
</slot>
|
||||||
|
@ -97,7 +97,7 @@ import XShowMoreButton from "@/components/MkShowMoreButton.vue";
|
||||||
import MkNumber from "@/components/MkNumber.vue";
|
import MkNumber from "@/components/MkNumber.vue";
|
||||||
import { userPage } from "@/filters/user";
|
import { userPage } from "@/filters/user";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
user: entities.UserDetailed;
|
user: entities.UserDetailed;
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
<i :class="icon('ph-caret-left')"></i>
|
<i :class="icon('ph-caret-left')"></i>
|
||||||
</button>
|
</button>
|
||||||
<MkAvatar
|
<MkAvatar
|
||||||
v-if="narrow && props.displayMyAvatar && $i"
|
v-if="narrow && props.displayMyAvatar && me"
|
||||||
v-vibrate="5"
|
v-vibrate="5"
|
||||||
class="avatar button"
|
class="avatar button"
|
||||||
:user="$i"
|
:user="me"
|
||||||
:disable-preview="true"
|
:disable-preview="true"
|
||||||
disable-link
|
disable-link
|
||||||
@click.stop="openAccountMenu"
|
@click.stop="openAccountMenu"
|
||||||
|
@ -139,7 +139,7 @@ import { popupMenu } from "@/os";
|
||||||
import { scrollToTop } from "@/scripts/scroll";
|
import { scrollToTop } from "@/scripts/scroll";
|
||||||
import { injectPageMetadata } from "@/scripts/page-metadata";
|
import { injectPageMetadata } from "@/scripts/page-metadata";
|
||||||
import { openAccountMenu as openAccountMenu_ } from "@/account";
|
import { openAccountMenu as openAccountMenu_ } from "@/account";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ export default defineComponent({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${this.$i.token}`,
|
authorization: `Bearer ${this.me.token}`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mrdgzndn">
|
<div class="mrdgzndn">
|
||||||
<Mfm :key="text" :text="text" :is-note="false" :i="$i" />
|
<Mfm :key="text" :text="text" :is-note="false" :i="me" />
|
||||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url" class="url" />
|
<MkUrlPreview v-for="url in urls" :key="url" :url="url" class="url" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { Parser } from "@syuilo/aiscript";
|
||||||
import XBlock from "./page.block.vue";
|
import XBlock from "./page.block.vue";
|
||||||
import { Hpml } from "@/scripts/hpml/evaluator";
|
import { Hpml } from "@/scripts/hpml/evaluator";
|
||||||
import { url } from "@/config";
|
import { url } from "@/config";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -37,7 +37,7 @@ export default defineComponent({
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const hpml = new Hpml(props.page, {
|
const hpml = new Hpml(props.page, {
|
||||||
randomSeed: Math.random(),
|
randomSeed: Math.random(),
|
||||||
visitor: $i,
|
visitor: me,
|
||||||
url,
|
url,
|
||||||
enableAiScript: !defaultStore.state.disablePagesScript,
|
enableAiScript: !defaultStore.state.disablePagesScript,
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@ import directives from "@/directives";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { fetchInstance, instance } from "@/instance";
|
import { fetchInstance, instance } from "@/instance";
|
||||||
import { alert, api, confirm, popup, post, toast } from "@/os";
|
import { alert, api, confirm, popup, post, toast } from "@/os";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { compareFirefishVersions } from "@/scripts/compare-versions";
|
import { compareFirefishVersions } from "@/scripts/compare-versions";
|
||||||
import { deviceKind } from "@/scripts/device-kind";
|
import { deviceKind } from "@/scripts/device-kind";
|
||||||
import { getAccountFromId } from "@/scripts/get-account-from-id";
|
import { getAccountFromId } from "@/scripts/get-account-from-id";
|
||||||
|
@ -76,8 +76,6 @@ function checkForSplash() {
|
||||||
|
|
||||||
console.info(`vue ${vueVersion}`);
|
console.info(`vue ${vueVersion}`);
|
||||||
|
|
||||||
(window as any).$i = $i;
|
|
||||||
|
|
||||||
window.addEventListener("error", (event) => {
|
window.addEventListener("error", (event) => {
|
||||||
console.error(event);
|
console.error(event);
|
||||||
/*
|
/*
|
||||||
|
@ -132,7 +130,7 @@ function checkForSplash() {
|
||||||
if (loginId) {
|
if (loginId) {
|
||||||
const target = getUrlWithoutLoginId(location.href);
|
const target = getUrlWithoutLoginId(location.href);
|
||||||
|
|
||||||
if (!$i || $i.id !== loginId) {
|
if (!me || me.id !== loginId) {
|
||||||
const account = await getAccountFromId(loginId);
|
const account = await getAccountFromId(loginId);
|
||||||
if (account) {
|
if (account) {
|
||||||
await login(account.token, target);
|
await login(account.token, target);
|
||||||
|
@ -145,7 +143,7 @@ function checkForSplash() {
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Fetch user
|
// #region Fetch user
|
||||||
if ($i?.token) {
|
if (me?.token) {
|
||||||
if (_DEV_) {
|
if (_DEV_) {
|
||||||
console.log("account cache found. refreshing...");
|
console.log("account cache found. refreshing...");
|
||||||
}
|
}
|
||||||
|
@ -192,7 +190,7 @@ function checkForSplash() {
|
||||||
const app = createApp(
|
const app = createApp(
|
||||||
window.location.search === "?zen"
|
window.location.search === "?zen"
|
||||||
? defineAsyncComponent(() => import("@/ui/zen.vue"))
|
? defineAsyncComponent(() => import("@/ui/zen.vue"))
|
||||||
: !$i
|
: !me
|
||||||
? defineAsyncComponent(() => import("@/ui/visitor.vue"))
|
? defineAsyncComponent(() => import("@/ui/visitor.vue"))
|
||||||
: ui === "deck"
|
: ui === "deck"
|
||||||
? defineAsyncComponent(() => import("@/ui/deck.vue"))
|
? defineAsyncComponent(() => import("@/ui/deck.vue"))
|
||||||
|
@ -203,10 +201,6 @@ function checkForSplash() {
|
||||||
app.config.performance = true;
|
app.config.performance = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.config.globalProperties = {
|
|
||||||
$i,
|
|
||||||
};
|
|
||||||
|
|
||||||
widgets(app);
|
widgets(app);
|
||||||
directives(app);
|
directives(app);
|
||||||
components(app);
|
components(app);
|
||||||
|
@ -258,7 +252,7 @@ function checkForSplash() {
|
||||||
defaultStore.state.showUpdates
|
defaultStore.state.showUpdates
|
||||||
) {
|
) {
|
||||||
// ログインしてる場合だけ
|
// ログインしてる場合だけ
|
||||||
if ($i) {
|
if (me) {
|
||||||
popup(
|
popup(
|
||||||
defineAsyncComponent(() => import("@/components/MkUpdated.vue")),
|
defineAsyncComponent(() => import("@/components/MkUpdated.vue")),
|
||||||
{},
|
{},
|
||||||
|
@ -432,7 +426,7 @@ function checkForSplash() {
|
||||||
// only add post shortcuts if logged in
|
// only add post shortcuts if logged in
|
||||||
hotkeys["p|n"] = post;
|
hotkeys["p|n"] = post;
|
||||||
|
|
||||||
if ($i.isDeleted) {
|
if (me.isDeleted) {
|
||||||
alert({
|
alert({
|
||||||
type: "warning",
|
type: "warning",
|
||||||
text: i18n.ts.accountDeletionInProgress,
|
text: i18n.ts.accountDeletionInProgress,
|
||||||
|
@ -446,7 +440,7 @@ function checkForSplash() {
|
||||||
if (Date.now() - lastUsedDate > 1000 * 60 * 60 * 2) {
|
if (Date.now() - lastUsedDate > 1000 * 60 * 60 * 2) {
|
||||||
toast(
|
toast(
|
||||||
i18n.t("welcomeBackWithName", {
|
i18n.t("welcomeBackWithName", {
|
||||||
name: $i.name || $i.username,
|
name: me.name || me.username,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -459,7 +453,7 @@ function checkForSplash() {
|
||||||
const neverShowDonationInfo = localStorage.getItem("neverShowDonationInfo");
|
const neverShowDonationInfo = localStorage.getItem("neverShowDonationInfo");
|
||||||
if (
|
if (
|
||||||
neverShowDonationInfo !== "true" &&
|
neverShowDonationInfo !== "true" &&
|
||||||
new Date($i.createdAt).getTime() < Date.now() - 1000 * 60 * 60 * 24 * 3 &&
|
new Date(me.createdAt).getTime() < Date.now() - 1000 * 60 * 60 * 24 * 3 &&
|
||||||
!location.pathname.startsWith("/miauth")
|
!location.pathname.startsWith("/miauth")
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -4,11 +4,11 @@ import type { Account } from "@/account";
|
||||||
const accountData = localStorage.getItem("account");
|
const accountData = localStorage.getItem("account");
|
||||||
|
|
||||||
// TODO: 外部からはreadonlyに
|
// TODO: 外部からはreadonlyに
|
||||||
export const $i = accountData
|
export const me = accountData
|
||||||
? reactive(JSON.parse(accountData) as Account)
|
? reactive(JSON.parse(accountData) as Account)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
export const isSignedIn = $i != null;
|
export const isSignedIn = me != null;
|
||||||
export const isModerator = $i != null && ($i.isModerator || $i.isAdmin);
|
export const isModerator = me != null && (me.isModerator || me.isAdmin);
|
||||||
export const isEmojiMod = isModerator || $i?.emojiModPerm !== "unauthorized";
|
export const isEmojiMod = isModerator || me?.emojiModPerm !== "unauthorized";
|
||||||
export const isAdmin = $i?.isAdmin;
|
export const isAdmin = me?.isAdmin;
|
|
@ -2,7 +2,7 @@ import { computed, reactive } from "vue";
|
||||||
import { ui } from "@/config";
|
import { ui } from "@/config";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
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";
|
||||||
|
@ -12,14 +12,14 @@ export const navbarItemDef = reactive({
|
||||||
title: "notifications",
|
title: "notifications",
|
||||||
icon: `${icon("ph-bell")}`,
|
icon: `${icon("ph-bell")}`,
|
||||||
show: computed(() => isSignedIn),
|
show: computed(() => isSignedIn),
|
||||||
indicated: computed(() => $i?.hasUnreadNotification),
|
indicated: computed(() => me?.hasUnreadNotification),
|
||||||
to: "/my/notifications",
|
to: "/my/notifications",
|
||||||
},
|
},
|
||||||
messaging: {
|
messaging: {
|
||||||
title: "messaging",
|
title: "messaging",
|
||||||
icon: `${icon("ph-chats-teardrop")}`,
|
icon: `${icon("ph-chats-teardrop")}`,
|
||||||
show: computed(() => isSignedIn),
|
show: computed(() => isSignedIn),
|
||||||
indicated: computed(() => $i?.hasUnreadMessagingMessage),
|
indicated: computed(() => me?.hasUnreadMessagingMessage),
|
||||||
to: "/my/messaging",
|
to: "/my/messaging",
|
||||||
},
|
},
|
||||||
drive: {
|
drive: {
|
||||||
|
@ -31,8 +31,8 @@ export const navbarItemDef = reactive({
|
||||||
followRequests: {
|
followRequests: {
|
||||||
title: "followRequests",
|
title: "followRequests",
|
||||||
icon: `${icon("ph-hand-waving")}`,
|
icon: `${icon("ph-hand-waving")}`,
|
||||||
show: computed(() => $i?.isLocked || $i?.hasPendingReceivedFollowRequest),
|
show: computed(() => me?.isLocked || me?.hasPendingReceivedFollowRequest),
|
||||||
indicated: computed(() => $i?.hasPendingReceivedFollowRequest),
|
indicated: computed(() => me?.hasPendingReceivedFollowRequest),
|
||||||
to: "/my/follow-requests",
|
to: "/my/follow-requests",
|
||||||
},
|
},
|
||||||
explore: {
|
explore: {
|
||||||
|
@ -43,7 +43,7 @@ export const navbarItemDef = reactive({
|
||||||
announcements: {
|
announcements: {
|
||||||
title: "announcements",
|
title: "announcements",
|
||||||
icon: `${icon("ph-megaphone-simple")}`,
|
icon: `${icon("ph-megaphone-simple")}`,
|
||||||
indicated: computed(() => $i?.hasUnreadAnnouncement),
|
indicated: computed(() => me?.hasUnreadAnnouncement),
|
||||||
to: "/announcements",
|
to: "/announcements",
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import MkPostFormDialog from "@/components/MkPostFormDialog.vue";
|
||||||
import MkToast from "@/components/MkToast.vue";
|
import MkToast from "@/components/MkToast.vue";
|
||||||
import MkWaitingDialog from "@/components/MkWaitingDialog.vue";
|
import MkWaitingDialog from "@/components/MkWaitingDialog.vue";
|
||||||
import { apiUrl, url } from "@/config";
|
import { apiUrl, url } from "@/config";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import type { MenuItem } from "@/types/menu";
|
import type { MenuItem } from "@/types/menu";
|
||||||
|
|
||||||
export const pendingApiRequestsCount = ref(0);
|
export const pendingApiRequestsCount = ref(0);
|
||||||
|
@ -32,7 +32,7 @@ export const api = ((
|
||||||
pendingApiRequestsCount.value--;
|
pendingApiRequestsCount.value--;
|
||||||
};
|
};
|
||||||
|
|
||||||
const authorizationToken = token ?? $i?.token ?? undefined;
|
const authorizationToken = token ?? me?.token ?? undefined;
|
||||||
const authorization = authorizationToken
|
const authorization = authorizationToken
|
||||||
? `Bearer ${authorizationToken}`
|
? `Bearer ${authorizationToken}`
|
||||||
: undefined;
|
: undefined;
|
||||||
|
@ -77,7 +77,7 @@ export const apiGet = ((
|
||||||
|
|
||||||
const query = new URLSearchParams(data);
|
const query = new URLSearchParams(data);
|
||||||
|
|
||||||
const authorizationToken = token ?? $i?.token ?? undefined;
|
const authorizationToken = token ?? me?.token ?? undefined;
|
||||||
const authorization = authorizationToken
|
const authorization = authorizationToken
|
||||||
? `Bearer ${authorizationToken}`
|
? `Bearer ${authorizationToken}`
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
|
@ -190,7 +190,7 @@ import number from "@/filters/number";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { deviceKind } from "@/scripts/device-kind";
|
import { deviceKind } from "@/scripts/device-kind";
|
||||||
import { isModerator } from "@/reactiveAccount";
|
import { isModerator } from "@/me";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
|
@ -172,7 +172,7 @@ import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { deviceKind } from "@/scripts/device-kind";
|
import { deviceKind } from "@/scripts/device-kind";
|
||||||
import { isAdmin, isModerator } from "@/reactiveAccount";
|
import { isAdmin, isModerator } from "@/me";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
import "swiper/scss";
|
import "swiper/scss";
|
||||||
|
|
|
@ -73,7 +73,7 @@ import MkSuperMenu from "@/components/MkSuperMenu.vue";
|
||||||
import MkInfo from "@/components/MkInfo.vue";
|
import MkInfo from "@/components/MkInfo.vue";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { version } from "@/config";
|
import { version } from "@/config";
|
||||||
import { $i, isAdmin } from "@/reactiveAccount";
|
import { me, isAdmin } from "@/me";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { lookupUser } from "@/scripts/lookup-user";
|
import { lookupUser } from "@/scripts/lookup-user";
|
||||||
import { lookupFile } from "@/scripts/lookup-file";
|
import { lookupFile } from "@/scripts/lookup-file";
|
||||||
|
|
|
@ -59,7 +59,7 @@ import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
import { isSignedIn } from "@/reactiveAccount";
|
import { isSignedIn } from "@/me";
|
||||||
|
|
||||||
const pagination = {
|
const pagination = {
|
||||||
endpoint: "announcements" as const,
|
endpoint: "announcements" as const,
|
||||||
|
|
|
@ -52,7 +52,7 @@ import MkSignin from "@/components/MkSignin.vue";
|
||||||
import MkKeyValue from "@/components/MkKeyValue.vue";
|
import MkKeyValue from "@/components/MkKeyValue.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { login } from "@/account";
|
import { login } from "@/account";
|
||||||
import { isSignedIn } from "@/reactiveAccount";
|
import { isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
|
@ -71,13 +71,13 @@
|
||||||
<Mfm
|
<Mfm
|
||||||
:text="channel.description"
|
:text="channel.description"
|
||||||
:is-note="false"
|
:is-note="false"
|
||||||
:i="$i"
|
:i="me"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<XPostForm
|
<XPostForm
|
||||||
v-if="$i"
|
v-if="me"
|
||||||
:channel="channel"
|
:channel="channel"
|
||||||
class="post-form _panel _gap"
|
class="post-form _panel _gap"
|
||||||
fixed
|
fixed
|
||||||
|
@ -103,7 +103,7 @@ import XTimeline from "@/components/MkTimeline.vue";
|
||||||
import XChannelFollowButton from "@/components/MkChannelFollowButton.vue";
|
import XChannelFollowButton from "@/components/MkChannelFollowButton.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { useRouter } from "@/router";
|
import { useRouter } from "@/router";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -132,7 +132,7 @@ function edit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerActions = computed(() => [
|
const headerActions = computed(() => [
|
||||||
...(channel.value && channel.value?.userId === $i?.id
|
...(channel.value && channel.value?.userId === me?.id
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
icon: `${icon("ph-gear-six")}`,
|
icon: `${icon("ph-gear-six")}`,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<Mfm
|
<Mfm
|
||||||
:text="clip.description"
|
:text="clip.description"
|
||||||
:is-note="false"
|
:is-note="false"
|
||||||
:i="$i"
|
:i="me"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="user">
|
<div class="user">
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
import { computed, provide, ref, watch } from "vue";
|
import { computed, provide, ref, watch } from "vue";
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import XNotes from "@/components/MkNotes.vue";
|
import XNotes from "@/components/MkNotes.vue";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
|
@ -51,7 +51,7 @@ const pagination = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const isOwned: boolean | null = computed<boolean | null>(
|
const isOwned: boolean | null = computed<boolean | null>(
|
||||||
() => isSignedIn && clip.value && $i.id === clip.value.userId,
|
() => isSignedIn && clip.value && me.id === clip.value.userId,
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
|
@ -146,7 +146,7 @@ import MkFolder from "@/components/MkFolder.vue";
|
||||||
import MkTab from "@/components/MkTab.vue";
|
import MkTab from "@/components/MkTab.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { isSignedIn } from "@/reactiveAccount";
|
import { isSignedIn } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
:text="req.followee.description"
|
:text="req.followee.description"
|
||||||
:is-note="false"
|
:is-note="false"
|
||||||
:author="req.followee"
|
:author="req.followee"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:custom-emojis="req.followee.emojis"
|
:custom-emojis="req.followee.emojis"
|
||||||
:plain="true"
|
:plain="true"
|
||||||
:nowrap="true"
|
:nowrap="true"
|
||||||
|
@ -70,7 +70,7 @@ import { userPage } from "@/filters/user";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const paginationComponent = ref<InstanceType<typeof MkPagination>>();
|
const paginationComponent = ref<InstanceType<typeof MkPagination>>();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #default="{ items }">
|
<template #default="{ items }">
|
||||||
<MkInfo v-if="$i?.isLocked === false" warn class="info"
|
<MkInfo v-if="me?.isLocked === false" warn class="info"
|
||||||
>{{ i18n.ts.silencedWarning }}
|
>{{ i18n.ts.silencedWarning }}
|
||||||
</MkInfo>
|
</MkInfo>
|
||||||
<div class="mk-follow-requests">
|
<div class="mk-follow-requests">
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
:text="req.follower.description"
|
:text="req.follower.description"
|
||||||
:is-note="false"
|
:is-note="false"
|
||||||
:author="req.follower"
|
:author="req.follower"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:custom-emojis="req.follower.emojis"
|
:custom-emojis="req.follower.emojis"
|
||||||
:plain="true"
|
:plain="true"
|
||||||
:nowrap="true"
|
:nowrap="true"
|
||||||
|
@ -89,7 +89,7 @@ import { userPage } from "@/filters/user";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const paginationComponent = ref<InstanceType<typeof MkPagination>>();
|
const paginationComponent = ref<InstanceType<typeof MkPagination>>();
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
<div class="other">
|
<div class="other">
|
||||||
<button
|
<button
|
||||||
v-if="
|
v-if="
|
||||||
isSignedIn && $i.id === post.user.id
|
isSignedIn && me.id === post.user.id
|
||||||
"
|
"
|
||||||
v-tooltip="i18n.ts.toEdit"
|
v-tooltip="i18n.ts.toEdit"
|
||||||
v-click-anime
|
v-click-anime
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
<MkAcct :user="post.user" />
|
<MkAcct :user="post.user" />
|
||||||
</div>
|
</div>
|
||||||
<MkFollowButton
|
<MkFollowButton
|
||||||
v-if="!$i || $i.id != post.user.id"
|
v-if="!me || me.id != post.user.id"
|
||||||
:user="post.user"
|
:user="post.user"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
:transparent="false"
|
:transparent="false"
|
||||||
|
@ -163,7 +163,7 @@ import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { shareAvailable } from "@/scripts/share-available";
|
import { shareAvailable } from "@/scripts/share-available";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
import { isSignedIn } from "@/reactiveAccount";
|
import { isSignedIn } from "@/me";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,7 @@ import MkKeyValue from "@/components/MkKeyValue.vue";
|
||||||
import FormSwitch from "@/components/form/switch.vue";
|
import FormSwitch from "@/components/form/switch.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import number from "@/filters/number";
|
import number from "@/filters/number";
|
||||||
import { isAdmin } from "@/reactiveAccount";
|
import { isAdmin } from "@/me";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { deviceKind } from "@/scripts/device-kind";
|
import { deviceKind } from "@/scripts/device-kind";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
|
|
|
@ -104,7 +104,7 @@ import { useStream } from "@/stream";
|
||||||
import { useRouter } from "@/router";
|
import { useRouter } from "@/router";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { deviceKind } from "@/scripts/device-kind";
|
import { deviceKind } from "@/scripts/device-kind";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -203,7 +203,7 @@ function onRead(ids): void {
|
||||||
if (found.recipientId) {
|
if (found.recipientId) {
|
||||||
found.isRead = true;
|
found.isRead = true;
|
||||||
} else if (found.groupId) {
|
} else if (found.groupId) {
|
||||||
found.reads.push($i.id);
|
found.reads.push(me.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
ref="text"
|
ref="text"
|
||||||
class="text"
|
class="text"
|
||||||
:text="message.text"
|
:text="message.text"
|
||||||
:i="$i"
|
:i="me"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="content">
|
<div v-else class="content">
|
||||||
|
@ -90,7 +90,7 @@ import XMediaList from "@/components/MkMediaList.vue";
|
||||||
import { extractUrlFromMfm } from "@/scripts/extract-url-from-mfm";
|
import { extractUrlFromMfm } from "@/scripts/extract-url-from-mfm";
|
||||||
import MkUrlPreview from "@/components/MkUrlPreview.vue";
|
import MkUrlPreview from "@/components/MkUrlPreview.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ const props = defineProps<{
|
||||||
isGroup?: boolean;
|
isGroup?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const isMe = computed(() => props.message.userId === $i?.id);
|
const isMe = computed(() => props.message.userId === me?.id);
|
||||||
const urls = computed(() =>
|
const urls = computed(() =>
|
||||||
props.message.text ? extractUrlFromMfm(mfm.parse(props.message.text)) : [],
|
props.message.text ? extractUrlFromMfm(mfm.parse(props.message.text)) : [],
|
||||||
);
|
);
|
||||||
|
|
|
@ -122,7 +122,7 @@ import { useStream } from "@/stream";
|
||||||
import * as sound from "@/scripts/sound";
|
import * as sound from "@/scripts/sound";
|
||||||
import { vibrate } from "@/scripts/vibrate";
|
import { vibrate } from "@/scripts/vibrate";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -200,7 +200,7 @@ async function fetch() {
|
||||||
connection.value.on("read", onRead);
|
connection.value.on("read", onRead);
|
||||||
connection.value.on("deleted", onDeleted);
|
connection.value.on("deleted", onDeleted);
|
||||||
connection.value.on("typers", (_typers) => {
|
connection.value.on("typers", (_typers) => {
|
||||||
typers.value = _typers.filter((u) => u.id !== $i?.id);
|
typers.value = _typers.filter((u) => u.id !== me?.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("visibilitychange", onVisibilitychange);
|
document.addEventListener("visibilitychange", onVisibilitychange);
|
||||||
|
@ -258,7 +258,7 @@ function onMessage(message) {
|
||||||
const _isBottom = isBottomVisible(rootEl.value, 64);
|
const _isBottom = isBottomVisible(rootEl.value, 64);
|
||||||
|
|
||||||
pagingComponent.value.prepend(message);
|
pagingComponent.value.prepend(message);
|
||||||
if (message.userId !== $i?.id && !document.hidden) {
|
if (message.userId !== me?.id && !document.hidden) {
|
||||||
connection.value?.send("read", {
|
connection.value?.send("read", {
|
||||||
id: message.id,
|
id: message.id,
|
||||||
});
|
});
|
||||||
|
@ -269,7 +269,7 @@ function onMessage(message) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
thisScrollToBottom();
|
thisScrollToBottom();
|
||||||
});
|
});
|
||||||
} else if (message.userId !== $i?.id) {
|
} else if (message.userId !== me?.id) {
|
||||||
// Notify
|
// Notify
|
||||||
notifyNewMessage();
|
notifyNewMessage();
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ function notifyNewMessage() {
|
||||||
function onVisibilitychange() {
|
function onVisibilitychange() {
|
||||||
if (document.hidden) return;
|
if (document.hidden) return;
|
||||||
for (const message of pagingComponent.value.items) {
|
for (const message of pagingComponent.value.items) {
|
||||||
if (message.userId !== $i?.id && !message.isRead) {
|
if (message.userId !== me?.id && !message.isRead) {
|
||||||
connection.value?.send("read", {
|
connection.value?.send("read", {
|
||||||
id: message.id,
|
id: message.id,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<MkSpacer :content-max="800">
|
<MkSpacer :content-max="800">
|
||||||
<div v-if="$i">
|
<div v-if="me">
|
||||||
<div v-if="state == 'waiting'" class="waiting _section">
|
<div v-if="state == 'waiting'" class="waiting _section">
|
||||||
<div class="_content">
|
<div class="_content">
|
||||||
<MkLoading />
|
<MkLoading />
|
||||||
|
@ -83,7 +83,7 @@ import MkSignin from "@/components/MkSignin.vue";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { login } from "@/account";
|
import { login } from "@/account";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { appendQuery, query } from "@/scripts/url";
|
import { appendQuery, query } from "@/scripts/url";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
|
@ -179,7 +179,7 @@ import { selectFile } from "@/scripts/select-file";
|
||||||
import { mainRouter } from "@/router";
|
import { mainRouter } from "@/router";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -189,7 +189,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const tab = ref("settings");
|
const tab = ref("settings");
|
||||||
const author = ref($i);
|
const author = ref(me);
|
||||||
const readonly = ref(false);
|
const readonly = ref(false);
|
||||||
const page = ref(null);
|
const page = ref(null);
|
||||||
const pageId = ref(null);
|
const pageId = ref(null);
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
/></MkA>
|
/></MkA>
|
||||||
<template
|
<template
|
||||||
v-if="
|
v-if="
|
||||||
isSignedIn && $i.id === page.userId
|
isSignedIn && me.id === page.userId
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<MkA
|
<MkA
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
><i :class="icon('ph-pencil')"
|
><i :class="icon('ph-pencil')"
|
||||||
/></MkA>
|
/></MkA>
|
||||||
<button
|
<button
|
||||||
v-if="$i.pinnedPageId === page.id"
|
v-if="me.pinnedPageId === page.id"
|
||||||
v-tooltip="i18n.ts.unpin"
|
v-tooltip="i18n.ts.unpin"
|
||||||
class="menu _button"
|
class="menu _button"
|
||||||
@click="pin(false)"
|
@click="pin(false)"
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
<MkAcct :user="page.user" />
|
<MkAcct :user="page.user" />
|
||||||
</div>
|
</div>
|
||||||
<MkFollowButton
|
<MkFollowButton
|
||||||
v-if="!$i || $i.id != page.user.id"
|
v-if="!me || me.id != page.user.id"
|
||||||
:user="page.user"
|
:user="page.user"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
:transparent="false"
|
:transparent="false"
|
||||||
|
@ -161,9 +161,9 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="links">
|
<!-- <div class="links">
|
||||||
<MkA :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
|
<MkA :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
|
||||||
<template v-if="isSignedIn && $i.id === page.userId">
|
<template v-if="isSignedIn && me.id === page.userId">
|
||||||
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA>
|
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA>
|
||||||
<button v-if="$i.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button>
|
<button v-if="me.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button>
|
||||||
<button v-else class="link _textButton" @click="pin(true)">{{ i18n.ts.pin }}</button>
|
<button v-else class="link _textButton" @click="pin(true)">{{ i18n.ts.pin }}</button>
|
||||||
</template>
|
</template>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
@ -215,7 +215,7 @@ import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { shareAvailable } from "@/scripts/share-available";
|
import { shareAvailable } from "@/scripts/share-available";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
import { isSignedIn } from "@/reactiveAccount";
|
import { isSignedIn } from "@/me";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
pageName: string;
|
pageName: string;
|
||||||
|
|
|
@ -50,7 +50,7 @@ import MkContainer from "@/components/MkContainer.vue";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -74,7 +74,7 @@ async function run() {
|
||||||
const aiscript = new Interpreter(
|
const aiscript = new Interpreter(
|
||||||
createAiScriptEnv({
|
createAiScriptEnv({
|
||||||
storageKey: "scratchpad",
|
storageKey: "scratchpad",
|
||||||
token: $i?.token,
|
token: me?.token,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
in: (q) => {
|
in: (q) => {
|
||||||
|
|
|
@ -51,7 +51,7 @@ import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { deviceKind } from "@/scripts/device-kind";
|
import { deviceKind } from "@/scripts/device-kind";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import "swiper/scss";
|
import "swiper/scss";
|
||||||
import "swiper/scss/virtual";
|
import "swiper/scss/virtual";
|
||||||
import { api } from "@/os";
|
import { api } from "@/os";
|
||||||
|
@ -96,7 +96,7 @@ const usersPagination = {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function getUserId(user: string): Promise<string> {
|
async function getUserId(user: string): Promise<string> {
|
||||||
if (user === "me") return $i!.id;
|
if (user === "me") return me!.id;
|
||||||
|
|
||||||
const split = (user.startsWith("@") ? user.slice(1) : user).split("@");
|
const split = (user.startsWith("@") ? user.slice(1) : user).split("@");
|
||||||
const username = split[0];
|
const username = split[0];
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<FormSection :first="first">
|
<FormSection :first="first">
|
||||||
<template #label>{{ i18n.ts["2fa"] }}</template>
|
<template #label>{{ i18n.ts["2fa"] }}</template>
|
||||||
|
|
||||||
<div v-if="$i" class="_gaps_s">
|
<div v-if="me" class="_gaps_s">
|
||||||
<MkFolder>
|
<MkFolder>
|
||||||
<template #icon
|
<template #icon
|
||||||
><i
|
><i
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
></template>
|
></template>
|
||||||
<template #label>{{ i18n.ts.totp }}</template>
|
<template #label>{{ i18n.ts.totp }}</template>
|
||||||
<template #caption>{{ i18n.ts.totpDescription }}</template>
|
<template #caption>{{ i18n.ts.totpDescription }}</template>
|
||||||
<div v-if="$i.twoFactorEnabled" class="_gaps_s">
|
<div v-if="me.twoFactorEnabled" class="_gaps_s">
|
||||||
<div v-text="i18n.ts._2fa.alreadyRegistered" />
|
<div v-text="i18n.ts._2fa.alreadyRegistered" />
|
||||||
<MkButton @click="unregisterTOTP"
|
<MkButton @click="unregisterTOTP"
|
||||||
><i
|
><i
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MkButton
|
<MkButton
|
||||||
v-else-if="!twoFactorData && !$i.twoFactorEnabled"
|
v-else-if="!twoFactorData && !me.twoFactorEnabled"
|
||||||
@click="registerTOTP"
|
@click="registerTOTP"
|
||||||
>{{ i18n.ts._2fa.registerTOTP }}</MkButton
|
>{{ i18n.ts._2fa.registerTOTP }}</MkButton
|
||||||
>
|
>
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
>{{ i18n.ts._2fa.registerSecurityKey }}</MkButton
|
>{{ i18n.ts._2fa.registerSecurityKey }}</MkButton
|
||||||
>
|
>
|
||||||
<MkFolder
|
<MkFolder
|
||||||
v-for="key in $i.securityKeysList"
|
v-for="key in me.securityKeysList"
|
||||||
:key="key.id"
|
:key="key.id"
|
||||||
>
|
>
|
||||||
<h3>{{ key.name }}</h3>
|
<h3>{{ key.name }}</h3>
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
|
|
||||||
<MkSwitch
|
<MkSwitch
|
||||||
:disabled="
|
:disabled="
|
||||||
!$i.twoFactorEnabled || $i.securityKeysList.length === 0
|
!me.twoFactorEnabled || me.securityKeysList.length === 0
|
||||||
"
|
"
|
||||||
:model-value="usePasswordLessLogin"
|
:model-value="usePasswordLessLogin"
|
||||||
@update:modelValue="(v) => updatePasswordLessLogin(v)"
|
@update:modelValue="(v) => updatePasswordLessLogin(v)"
|
||||||
|
@ -103,7 +103,7 @@ import MkSwitch from "@/components/form/switch.vue";
|
||||||
import FormSection from "@/components/form/section.vue";
|
import FormSection from "@/components/form/section.vue";
|
||||||
import MkFolder from "@/components/MkFolder.vue";
|
import MkFolder from "@/components/MkFolder.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ withDefaults(
|
||||||
|
|
||||||
const twoFactorData = ref<any>(null);
|
const twoFactorData = ref<any>(null);
|
||||||
const supportsCredentials = ref(!!navigator.credentials);
|
const supportsCredentials = ref(!!navigator.credentials);
|
||||||
const usePasswordLessLogin = computed(() => $i!.usePasswordLessLogin);
|
const usePasswordLessLogin = computed(() => me!.usePasswordLessLogin);
|
||||||
|
|
||||||
async function registerTOTP() {
|
async function registerTOTP() {
|
||||||
const password = await os.inputText({
|
const password = await os.inputText({
|
||||||
|
@ -252,9 +252,9 @@ async function addSecurityKey() {
|
||||||
name: "Firefish",
|
name: "Firefish",
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
id: byteify($i!.id, "ascii"),
|
id: byteify(me!.id, "ascii"),
|
||||||
name: $i!.username,
|
name: me!.username,
|
||||||
displayName: $i!.name,
|
displayName: me!.name,
|
||||||
},
|
},
|
||||||
pubKeyCredParams: [{ alg: -7, type: "public-key" }],
|
pubKeyCredParams: [{ alg: -7, type: "public-key" }],
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<MkKeyValue>
|
<MkKeyValue>
|
||||||
<template #key>ID</template>
|
<template #key>ID</template>
|
||||||
<template #value
|
<template #value
|
||||||
><span class="_monospace">{{ $i.id }}</span></template
|
><span class="_monospace">{{ me.id }}</span></template
|
||||||
>
|
>
|
||||||
</MkKeyValue>
|
</MkKeyValue>
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<MkKeyValue>
|
<MkKeyValue>
|
||||||
<template #key>{{ i18n.ts.registeredDate }}</template>
|
<template #key>{{ i18n.ts.registeredDate }}</template>
|
||||||
<template #value
|
<template #value
|
||||||
><MkTime :time="$i.createdAt" mode="detail"
|
><MkTime :time="me.createdAt" mode="detail"
|
||||||
/></template>
|
/></template>
|
||||||
</MkKeyValue>
|
</MkKeyValue>
|
||||||
</FormSection>
|
</FormSection>
|
||||||
|
@ -135,25 +135,25 @@
|
||||||
<MkKeyValue oneline style="margin: 1em 0">
|
<MkKeyValue oneline style="margin: 1em 0">
|
||||||
<template #key>emailVerified</template>
|
<template #key>emailVerified</template>
|
||||||
<template #value>{{
|
<template #value>{{
|
||||||
$i.emailVerified ? i18n.ts.yes : i18n.ts.no
|
me.emailVerified ? i18n.ts.yes : i18n.ts.no
|
||||||
}}</template>
|
}}</template>
|
||||||
</MkKeyValue>
|
</MkKeyValue>
|
||||||
<MkKeyValue oneline style="margin: 1em 0">
|
<MkKeyValue oneline style="margin: 1em 0">
|
||||||
<template #key>twoFactorEnabled</template>
|
<template #key>twoFactorEnabled</template>
|
||||||
<template #value>{{
|
<template #value>{{
|
||||||
$i.twoFactorEnabled ? i18n.ts.yes : i18n.ts.no
|
me.twoFactorEnabled ? i18n.ts.yes : i18n.ts.no
|
||||||
}}</template>
|
}}</template>
|
||||||
</MkKeyValue>
|
</MkKeyValue>
|
||||||
<MkKeyValue oneline style="margin: 1em 0">
|
<MkKeyValue oneline style="margin: 1em 0">
|
||||||
<template #key>securityKeys</template>
|
<template #key>securityKeys</template>
|
||||||
<template #value>{{
|
<template #value>{{
|
||||||
$i.securityKeys ? i18n.ts.yes : i18n.ts.no
|
me.securityKeys ? i18n.ts.yes : i18n.ts.no
|
||||||
}}</template>
|
}}</template>
|
||||||
</MkKeyValue>
|
</MkKeyValue>
|
||||||
<MkKeyValue oneline style="margin: 1em 0">
|
<MkKeyValue oneline style="margin: 1em 0">
|
||||||
<template #key>usePasswordLessLogin</template>
|
<template #key>usePasswordLessLogin</template>
|
||||||
<template #value>{{
|
<template #value>{{
|
||||||
$i.usePasswordLessLogin ? i18n.ts.yes : i18n.ts.no
|
me.usePasswordLessLogin ? i18n.ts.yes : i18n.ts.no
|
||||||
}}</template>
|
}}</template>
|
||||||
</MkKeyValue>
|
</MkKeyValue>
|
||||||
<MkKeyValue oneline style="margin: 1em 0">
|
<MkKeyValue oneline style="margin: 1em 0">
|
||||||
|
@ -179,7 +179,7 @@ import MkKeyValue from "@/components/MkKeyValue.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import number from "@/filters/number";
|
import number from "@/filters/number";
|
||||||
import bytes from "@/filters/bytes";
|
import bytes from "@/filters/bytes";
|
||||||
import { $i, isAdmin, isModerator } from "@/reactiveAccount";
|
import { me, isAdmin, isModerator } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -188,7 +188,7 @@ const stats = ref<any>({});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
os.api("users/stats", {
|
os.api("users/stats", {
|
||||||
userId: $i!.id,
|
userId: me!.id,
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
stats.value = response;
|
stats.value = response;
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@ import {
|
||||||
getAccounts,
|
getAccounts,
|
||||||
login,
|
login,
|
||||||
} from "@/account";
|
} from "@/account";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -50,7 +50,7 @@ const accounts = ref<any>(null);
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
getAccounts()
|
getAccounts()
|
||||||
.then((accounts) => {
|
.then((accounts) => {
|
||||||
storedAccounts.value = accounts.filter((x) => x.id !== $i!.id);
|
storedAccounts.value = accounts.filter((x) => x.id !== me!.id);
|
||||||
|
|
||||||
console.log(storedAccounts.value);
|
console.log(storedAccounts.value);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
i18n.ts._accountDelete.sendEmail
|
i18n.ts._accountDelete.sendEmail
|
||||||
}}</FormInfo>
|
}}</FormInfo>
|
||||||
<FormButton
|
<FormButton
|
||||||
v-if="!$i.isDeleted"
|
v-if="!me.isDeleted"
|
||||||
danger
|
danger
|
||||||
class="_formBlock"
|
class="_formBlock"
|
||||||
@click="deleteAccount"
|
@click="deleteAccount"
|
||||||
|
|
|
@ -57,14 +57,14 @@ import bytes from "@/filters/bytes";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const fetching = ref(true);
|
const fetching = ref(true);
|
||||||
const usage = ref<any>(null);
|
const usage = ref<any>(null);
|
||||||
const capacity = ref<any>(null);
|
const capacity = ref<any>(null);
|
||||||
const uploadFolder = ref<any>(null);
|
const uploadFolder = ref<any>(null);
|
||||||
const alwaysMarkNsfw = ref<boolean>(isSignedIn && $i.alwaysMarkNsfw);
|
const alwaysMarkNsfw = ref<boolean>(isSignedIn && me.alwaysMarkNsfw);
|
||||||
|
|
||||||
const meterStyle = computed(() => {
|
const meterStyle = computed(() => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
<template #prefix
|
<template #prefix
|
||||||
><i :class="icon('ph-envelope-simple-open')"></i
|
><i :class="icon('ph-envelope-simple-open')"></i
|
||||||
></template>
|
></template>
|
||||||
<template v-if="$i.email && !$i.emailVerified" #caption>{{
|
<template v-if="me.email && !me.emailVerified" #caption>{{
|
||||||
i18n.ts.verificationEmailSent
|
i18n.ts.verificationEmailSent
|
||||||
}}</template>
|
}}</template>
|
||||||
<template
|
<template
|
||||||
v-else-if="emailAddress === $i.email && $i.emailVerified"
|
v-else-if="emailAddress === me.email && me.emailVerified"
|
||||||
#caption
|
#caption
|
||||||
><i
|
><i
|
||||||
:class="icon('ph-check')"
|
:class="icon('ph-check')"
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
<FormSection>
|
<FormSection>
|
||||||
<FormSwitch
|
<FormSwitch
|
||||||
:model-value="$i.receiveAnnouncementEmail"
|
:model-value="me.receiveAnnouncementEmail"
|
||||||
@update:modelValue="onChangeReceiveAnnouncementEmail"
|
@update:modelValue="onChangeReceiveAnnouncementEmail"
|
||||||
>
|
>
|
||||||
{{ i18n.ts.receiveAnnouncementFromInstance }}
|
{{ i18n.ts.receiveAnnouncementFromInstance }}
|
||||||
|
@ -66,12 +66,12 @@ import FormSection from "@/components/form/section.vue";
|
||||||
import FormInput from "@/components/form/input.vue";
|
import FormInput from "@/components/form/input.vue";
|
||||||
import FormSwitch from "@/components/form/switch.vue";
|
import FormSwitch from "@/components/form/switch.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const emailAddress = ref($i!.email);
|
const emailAddress = ref(me!.email);
|
||||||
|
|
||||||
const onChangeReceiveAnnouncementEmail = (v) => {
|
const onChangeReceiveAnnouncementEmail = (v) => {
|
||||||
os.api("i/update", {
|
os.api("i/update", {
|
||||||
|
@ -93,22 +93,22 @@ const saveEmailAddress = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const emailNotification_mention = ref(
|
const emailNotification_mention = ref(
|
||||||
$i!.emailNotificationTypes.includes("mention"),
|
me!.emailNotificationTypes.includes("mention"),
|
||||||
);
|
);
|
||||||
const emailNotification_reply = ref(
|
const emailNotification_reply = ref(
|
||||||
$i!.emailNotificationTypes.includes("reply"),
|
me!.emailNotificationTypes.includes("reply"),
|
||||||
);
|
);
|
||||||
const emailNotification_quote = ref(
|
const emailNotification_quote = ref(
|
||||||
$i!.emailNotificationTypes.includes("quote"),
|
me!.emailNotificationTypes.includes("quote"),
|
||||||
);
|
);
|
||||||
const emailNotification_follow = ref(
|
const emailNotification_follow = ref(
|
||||||
$i!.emailNotificationTypes.includes("follow"),
|
me!.emailNotificationTypes.includes("follow"),
|
||||||
);
|
);
|
||||||
const emailNotification_receiveFollowRequest = ref(
|
const emailNotification_receiveFollowRequest = ref(
|
||||||
$i!.emailNotificationTypes.includes("receiveFollowRequest"),
|
me!.emailNotificationTypes.includes("receiveFollowRequest"),
|
||||||
);
|
);
|
||||||
const emailNotification_groupInvited = ref(
|
const emailNotification_groupInvited = ref(
|
||||||
$i!.emailNotificationTypes.includes("groupInvited"),
|
me!.emailNotificationTypes.includes("groupInvited"),
|
||||||
);
|
);
|
||||||
|
|
||||||
const saveNotificationSettings = () => {
|
const saveNotificationSettings = () => {
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
i18n.ts.enableTimelineStreaming
|
i18n.ts.enableTimelineStreaming
|
||||||
}}</FormSwitch>
|
}}</FormSwitch>
|
||||||
<!-- <FormSwitch
|
<!-- <FormSwitch
|
||||||
v-model="$i.injectFeaturedNote"
|
v-model="me.injectFeaturedNote"
|
||||||
class="_formBlock"
|
class="_formBlock"
|
||||||
@update:modelValue="onChangeInjectFeaturedNote"
|
@update:modelValue="onChangeInjectFeaturedNote"
|
||||||
>
|
>
|
||||||
|
@ -297,7 +297,7 @@
|
||||||
}}</template></FormSwitch
|
}}</template></FormSwitch
|
||||||
>
|
>
|
||||||
<FormSwitch
|
<FormSwitch
|
||||||
v-if="$i?.isAdmin"
|
v-if="me?.isAdmin"
|
||||||
v-model="showAdminUpdates"
|
v-model="showAdminUpdates"
|
||||||
class="_formBlock"
|
class="_formBlock"
|
||||||
>{{ i18n.ts.showAdminUpdates }}</FormSwitch
|
>{{ i18n.ts.showAdminUpdates }}</FormSwitch
|
||||||
|
@ -376,7 +376,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref, watch } from "vue";
|
import { computed, ref, watch } from "vue";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import FormSwitch from "@/components/form/switch.vue";
|
import FormSwitch from "@/components/form/switch.vue";
|
||||||
import FormSelect from "@/components/form/select.vue";
|
import FormSelect from "@/components/form/select.vue";
|
||||||
import FormRadios from "@/components/form/radios.vue";
|
import FormRadios from "@/components/form/radios.vue";
|
||||||
|
@ -536,7 +536,7 @@ const showNoAltTextWarning = computed(
|
||||||
// os.api("i/update", {
|
// os.api("i/update", {
|
||||||
// injectFeaturedNote: v,
|
// injectFeaturedNote: v,
|
||||||
// }).then((i) => {
|
// }).then((i) => {
|
||||||
// $i!.injectFeaturedNote = i.injectFeaturedNote;
|
// me!.injectFeaturedNote = i.injectFeaturedNote;
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ import { i18n } from "@/i18n";
|
||||||
import MkInfo from "@/components/MkInfo.vue";
|
import MkInfo from "@/components/MkInfo.vue";
|
||||||
import MkSuperMenu from "@/components/MkSuperMenu.vue";
|
import MkSuperMenu from "@/components/MkSuperMenu.vue";
|
||||||
import { signout } from "@/account";
|
import { signout } from "@/account";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { unisonReload } from "@/scripts/unison-reload";
|
import { unisonReload } from "@/scripts/unison-reload";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { useRouter } from "@/router";
|
import { useRouter } from "@/router";
|
||||||
|
@ -291,7 +291,7 @@ watch(router.currentRef, (to) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const emailNotConfigured = computed(
|
const emailNotConfigured = computed(
|
||||||
() => instance.enableEmail && ($i.email == null || !$i.emailVerified),
|
() => instance.enableEmail && (me.email == null || !me.emailVerified),
|
||||||
);
|
);
|
||||||
|
|
||||||
provideMetadataReceiver((info) => {
|
provideMetadataReceiver((info) => {
|
||||||
|
|
|
@ -26,12 +26,12 @@ import FormTextarea from "@/components/form/textarea.vue";
|
||||||
import MkInfo from "@/components/MkInfo.vue";
|
import MkInfo from "@/components/MkInfo.vue";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const instanceMutes = ref($i!.mutedInstances.join("\n"));
|
const instanceMutes = ref(me!.mutedInstances.join("\n"));
|
||||||
const changed = ref(false);
|
const changed = ref(false);
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
|
|
|
@ -60,7 +60,7 @@ import FormInfo from "@/components/MkInfo.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const moveToAccount = ref("");
|
const moveToAccount = ref("");
|
||||||
|
@ -69,8 +69,8 @@ const accountAlias = ref([""]);
|
||||||
await init();
|
await init();
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
if ($i?.alsoKnownAs && $i.alsoKnownAs.length > 0) {
|
if (me?.alsoKnownAs && me.alsoKnownAs.length > 0) {
|
||||||
const aka = await os.api("users/show", { userIds: $i.alsoKnownAs });
|
const aka = await os.api("users/show", { userIds: me.alsoKnownAs });
|
||||||
accountAlias.value =
|
accountAlias.value =
|
||||||
aka && aka.length > 0
|
aka && aka.length > 0
|
||||||
? aka.map((user) => `@${acct.toString(user)}`)
|
? aka.map((user) => `@${acct.toString(user)}`)
|
||||||
|
@ -86,7 +86,7 @@ async function save(): Promise<void> {
|
||||||
.map((e) => e.trim())
|
.map((e) => e.trim())
|
||||||
.filter((e) => e !== ""),
|
.filter((e) => e !== ""),
|
||||||
});
|
});
|
||||||
$i.alsoKnownAs = i.alsoKnownAs;
|
me.alsoKnownAs = i.alsoKnownAs;
|
||||||
await init();
|
await init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ import { notificationTypes } from "firefish-js";
|
||||||
import FormButton from "@/components/MkButton.vue";
|
import FormButton from "@/components/MkButton.vue";
|
||||||
import FormSection from "@/components/form/section.vue";
|
import FormSection from "@/components/form/section.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import MkPushNotificationAllowButton from "@/components/MkPushNotificationAllowButton.vue";
|
import MkPushNotificationAllowButton from "@/components/MkPushNotificationAllowButton.vue";
|
||||||
|
@ -83,7 +83,7 @@ async function readAllNotifications() {
|
||||||
|
|
||||||
function configure() {
|
function configure() {
|
||||||
const includingTypes = notificationTypes.filter(
|
const includingTypes = notificationTypes.filter(
|
||||||
(x) => !$i!.mutingNotificationTypes.includes(x),
|
(x) => !me!.mutingNotificationTypes.includes(x),
|
||||||
);
|
);
|
||||||
os.popup(
|
os.popup(
|
||||||
defineAsyncComponent(
|
defineAsyncComponent(
|
||||||
|
@ -103,7 +103,7 @@ function configure() {
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
.then((i) => {
|
.then((i) => {
|
||||||
$i!.mutingNotificationTypes = i.mutingNotificationTypes;
|
me!.mutingNotificationTypes = i.mutingNotificationTypes;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -65,7 +65,7 @@ import * as os from "@/os";
|
||||||
import { ColdDeviceStorage, defaultStore } from "@/store";
|
import { ColdDeviceStorage, defaultStore } from "@/store";
|
||||||
import { unisonReload } from "@/scripts/unison-reload";
|
import { unisonReload } from "@/scripts/unison-reload";
|
||||||
import { useStream } from "@/stream";
|
import { useStream } from "@/stream";
|
||||||
import { isSignedIn } from "@/reactiveAccount";
|
import { isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { host, version } from "@/config";
|
import { host, version } from "@/config";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
|
|
|
@ -165,19 +165,19 @@ import FormFolder from "@/components/form/folder.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const isLocked = ref($i.isLocked);
|
const isLocked = ref(me.isLocked);
|
||||||
const autoAcceptFollowed = ref($i.autoAcceptFollowed);
|
const autoAcceptFollowed = ref(me.autoAcceptFollowed);
|
||||||
const noCrawle = ref($i.noCrawle);
|
const noCrawle = ref(me.noCrawle);
|
||||||
const isIndexable = ref($i.isIndexable);
|
const isIndexable = ref(me.isIndexable);
|
||||||
const isExplorable = ref($i.isExplorable);
|
const isExplorable = ref(me.isExplorable);
|
||||||
const hideOnlineStatus = ref($i.hideOnlineStatus);
|
const hideOnlineStatus = ref(me.hideOnlineStatus);
|
||||||
const publicReactions = ref($i.publicReactions);
|
const publicReactions = ref(me.publicReactions);
|
||||||
const ffVisibility = ref($i.ffVisibility);
|
const ffVisibility = ref(me.ffVisibility);
|
||||||
const preventAiLearning = ref($i.preventAiLearning);
|
const preventAiLearning = ref(me.preventAiLearning);
|
||||||
|
|
||||||
const defaultNoteVisibility = computed(
|
const defaultNoteVisibility = computed(
|
||||||
defaultStore.makeGetterSetter("defaultNoteVisibility"),
|
defaultStore.makeGetterSetter("defaultNoteVisibility"),
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
<div
|
<div
|
||||||
class="llvierxe"
|
class="llvierxe"
|
||||||
:style="{
|
:style="{
|
||||||
backgroundImage: $i.bannerUrl ? `url(${$i.bannerUrl})` : null,
|
backgroundImage: me.bannerUrl ? `url(${me.bannerUrl})` : null,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
<MkAvatar
|
<MkAvatar
|
||||||
class="avatar"
|
class="avatar"
|
||||||
:user="$i"
|
:user="me"
|
||||||
:disable-link="true"
|
:disable-link="true"
|
||||||
@click="changeAvatar"
|
@click="changeAvatar"
|
||||||
/>
|
/>
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
i18n.t("_profile.metadataDescription", {
|
i18n.t("_profile.metadataDescription", {
|
||||||
a: "\<a\>",
|
a: "\<a\>",
|
||||||
l: "\<a\>",
|
l: "\<a\>",
|
||||||
rel: `rel="me" href="https://${host}/@${$i.username}"`,
|
rel: `rel="me" href="https://${host}/@${me.username}"`,
|
||||||
})
|
})
|
||||||
}}</template>
|
}}</template>
|
||||||
</FormSlot>
|
</FormSlot>
|
||||||
|
@ -162,19 +162,19 @@ import FormSlot from "@/components/form/slot.vue";
|
||||||
import { selectFile } from "@/scripts/select-file";
|
import { selectFile } from "@/scripts/select-file";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { host } from "@/config";
|
import { host } from "@/config";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const profile = reactive({
|
const profile = reactive({
|
||||||
name: $i?.name,
|
name: me?.name,
|
||||||
description: $i?.description,
|
description: me?.description,
|
||||||
location: $i?.location,
|
location: me?.location,
|
||||||
birthday: $i?.birthday,
|
birthday: me?.birthday,
|
||||||
isBot: $i?.isBot,
|
isBot: me?.isBot,
|
||||||
isCat: $i?.isCat,
|
isCat: me?.isCat,
|
||||||
speakAsCat: $i?.speakAsCat,
|
speakAsCat: me?.speakAsCat,
|
||||||
});
|
});
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
@ -197,7 +197,7 @@ watch(
|
||||||
);
|
);
|
||||||
|
|
||||||
const fields = reactive(
|
const fields = reactive(
|
||||||
$i.fields.map((field) => ({ name: field.name, value: field.value })),
|
me.fields.map((field) => ({ name: field.name, value: field.value })),
|
||||||
);
|
);
|
||||||
|
|
||||||
function addField() {
|
function addField() {
|
||||||
|
@ -253,8 +253,8 @@ function changeAvatar(ev) {
|
||||||
const i = await os.apiWithDialog("i/update", {
|
const i = await os.apiWithDialog("i/update", {
|
||||||
avatarId: originalOrCropped.id,
|
avatarId: originalOrCropped.id,
|
||||||
});
|
});
|
||||||
$i.avatarId = i.avatarId;
|
me.avatarId = i.avatarId;
|
||||||
$i.avatarUrl = i.avatarUrl;
|
me.avatarUrl = i.avatarUrl;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -278,8 +278,8 @@ function changeBanner(ev) {
|
||||||
const i = await os.apiWithDialog("i/update", {
|
const i = await os.apiWithDialog("i/update", {
|
||||||
bannerId: originalOrCropped.id,
|
bannerId: originalOrCropped.id,
|
||||||
});
|
});
|
||||||
$i.bannerId = i.bannerId;
|
me.bannerId = i.bannerId;
|
||||||
$i.bannerUrl = i.bannerUrl;
|
me.bannerUrl = i.bannerUrl;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ import MkTab from "@/components/MkTab.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import number from "@/filters/number";
|
import number from "@/filters/number";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -93,8 +93,8 @@ const render = (mutedWords) =>
|
||||||
const tab = ref("soft");
|
const tab = ref("soft");
|
||||||
const softMutedWords = ref(render(defaultStore.state.mutedWords));
|
const softMutedWords = ref(render(defaultStore.state.mutedWords));
|
||||||
const softMutedLangs = ref(render(defaultStore.state.mutedLangs));
|
const softMutedLangs = ref(render(defaultStore.state.mutedLangs));
|
||||||
const hardMutedWords = ref(render($i!.mutedWords));
|
const hardMutedWords = ref(render(me!.mutedWords));
|
||||||
const hardMutedPatterns = ref($i!.mutedPatterns.join("\n"));
|
const hardMutedPatterns = ref(me!.mutedPatterns.join("\n"));
|
||||||
const hardWordMutedNotesCount = ref(null);
|
const hardWordMutedNotesCount = ref(null);
|
||||||
const changed = ref(false);
|
const changed = ref(false);
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ import FormButton from "@/components/MkButton.vue";
|
||||||
import FormTextarea from "@/components/form/textarea.vue";
|
import FormTextarea from "@/components/form/textarea.vue";
|
||||||
import FormFolder from "@/components/form/folder.vue";
|
import FormFolder from "@/components/form/folder.vue";
|
||||||
|
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import type { Theme } from "@/scripts/theme";
|
import type { Theme } from "@/scripts/theme";
|
||||||
import { applyTheme } from "@/scripts/theme";
|
import { applyTheme } from "@/scripts/theme";
|
||||||
import lightTheme from "@/themes/_light.json5";
|
import lightTheme from "@/themes/_light.json5";
|
||||||
|
@ -315,7 +315,7 @@ async function saveAs() {
|
||||||
|
|
||||||
theme.value.id = uuid();
|
theme.value.id = uuid();
|
||||||
theme.value.name = name;
|
theme.value.name = name;
|
||||||
theme.value.author = `@${$i.username}@${toUnicode(host)}`;
|
theme.value.author = `@${me.username}@${toUnicode(host)}`;
|
||||||
if (description.value) theme.value.desc = description.value;
|
if (description.value) theme.value.desc = description.value;
|
||||||
await addTheme(theme.value);
|
await addTheme(theme.value);
|
||||||
applyTheme(theme.value);
|
applyTheme(theme.value);
|
||||||
|
|
|
@ -75,7 +75,7 @@ import * as os from "@/os";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { isModerator, isSignedIn } from "@/reactiveAccount";
|
import { isModerator, isSignedIn } from "@/me";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { deviceKind } from "@/scripts/device-kind";
|
import { deviceKind } from "@/scripts/device-kind";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
|
@ -362,7 +362,7 @@ import { url } from "@/config";
|
||||||
import { userPage } from "@/filters/user";
|
import { userPage } from "@/filters/user";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { isAdmin, isModerator } from "@/reactiveAccount";
|
import { isAdmin, isModerator } from "@/me";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
isSignedIn &&
|
isSignedIn &&
|
||||||
$i.id !== user.id &&
|
me.id !== user.id &&
|
||||||
user.isFollowed
|
user.isFollowed
|
||||||
"
|
"
|
||||||
class="followed"
|
class="followed"
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
isSignedIn &&
|
isSignedIn &&
|
||||||
$i.id !== user.id &&
|
me.id !== user.id &&
|
||||||
user.isFollowed
|
user.isFollowed
|
||||||
"
|
"
|
||||||
class="followed"
|
class="followed"
|
||||||
|
@ -221,7 +221,7 @@
|
||||||
:text="user.description"
|
:text="user.description"
|
||||||
:is-note="false"
|
:is-note="false"
|
||||||
:author="user"
|
:author="user"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:custom-emojis="user.emojis"
|
:custom-emojis="user.emojis"
|
||||||
/>
|
/>
|
||||||
<p v-else class="empty">
|
<p v-else class="empty">
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
<Mfm
|
<Mfm
|
||||||
:text="field.value"
|
:text="field.value"
|
||||||
:author="user"
|
:author="user"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:custom-emojis="user.emojis"
|
:custom-emojis="user.emojis"
|
||||||
:colored="false"
|
:colored="false"
|
||||||
/>
|
/>
|
||||||
|
@ -341,7 +341,7 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<MkInfo
|
<MkInfo
|
||||||
v-else-if="isSignedIn && $i.id === user.id"
|
v-else-if="isSignedIn && me.id === user.id"
|
||||||
style="margin: 12px 0"
|
style="margin: 12px 0"
|
||||||
>{{ i18n.ts.userPagePinTip }}</MkInfo
|
>{{ i18n.ts.userPagePinTip }}</MkInfo
|
||||||
>
|
>
|
||||||
|
@ -384,7 +384,7 @@ import { userPage } from "@/filters/user";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i, isModerator, isSignedIn } from "@/reactiveAccount";
|
import { me, isModerator, isSignedIn } from "@/me";
|
||||||
import { host } from "@/config";
|
import { host } from "@/config";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import * as os from "@/os";
|
||||||
import { useRouter } from "@/router";
|
import { useRouter } from "@/router";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
const XHome = defineAsyncComponent(() => import("./home.vue"));
|
const XHome = defineAsyncComponent(() => import("./home.vue"));
|
||||||
|
@ -86,7 +86,7 @@ const headerTabs = computed(() =>
|
||||||
title: i18n.ts.overview,
|
title: i18n.ts.overview,
|
||||||
icon: `${icon("ph-user")}`,
|
icon: `${icon("ph-user")}`,
|
||||||
},
|
},
|
||||||
...((isSignedIn && $i.id === user.value.id) ||
|
...((isSignedIn && me.id === user.value.id) ||
|
||||||
user.value.publicReactions
|
user.value.publicReactions
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
v-if="note.text"
|
v-if="note.text"
|
||||||
:text="note.text"
|
:text="note.text"
|
||||||
:author="note.user"
|
:author="note.user"
|
||||||
:i="$i"
|
:i="me"
|
||||||
:custom-emojis="note.emojis"
|
:custom-emojis="note.emojis"
|
||||||
/>
|
/>
|
||||||
<!-- <MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA> -->
|
<!-- <MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA> -->
|
||||||
|
|
|
@ -4,7 +4,7 @@ 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 { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
|
|
||||||
type StateDef = Record<
|
type StateDef = Record<
|
||||||
string,
|
string,
|
||||||
|
@ -45,12 +45,12 @@ export class Storage<T extends StateDef> {
|
||||||
);
|
);
|
||||||
const deviceAccountState = isSignedIn
|
const deviceAccountState = isSignedIn
|
||||||
? JSON.parse(
|
? JSON.parse(
|
||||||
localStorage.getItem(`${this.keyForLocalStorage}::${$i.id}`) || "{}",
|
localStorage.getItem(`${this.keyForLocalStorage}::${me.id}`) || "{}",
|
||||||
)
|
)
|
||||||
: {};
|
: {};
|
||||||
const registryCache = isSignedIn
|
const registryCache = isSignedIn
|
||||||
? JSON.parse(
|
? JSON.parse(
|
||||||
localStorage.getItem(`${this.keyForLocalStorage}::cache::${$i.id}`) ||
|
localStorage.getItem(`${this.keyForLocalStorage}::cache::${me.id}`) ||
|
||||||
"{}",
|
"{}",
|
||||||
)
|
)
|
||||||
: {};
|
: {};
|
||||||
|
@ -104,7 +104,7 @@ export class Storage<T extends StateDef> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
`${this.keyForLocalStorage}::cache::${$i.id}`,
|
`${this.keyForLocalStorage}::cache::${me.id}`,
|
||||||
JSON.stringify(cache),
|
JSON.stringify(cache),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -135,13 +135,13 @@ export class Storage<T extends StateDef> {
|
||||||
|
|
||||||
const cache = JSON.parse(
|
const cache = JSON.parse(
|
||||||
localStorage.getItem(
|
localStorage.getItem(
|
||||||
`${this.keyForLocalStorage}::cache::${$i.id}`,
|
`${this.keyForLocalStorage}::cache::${me.id}`,
|
||||||
) || "{}",
|
) || "{}",
|
||||||
);
|
);
|
||||||
if (cache[key] !== value) {
|
if (cache[key] !== value) {
|
||||||
cache[key] = value;
|
cache[key] = value;
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
`${this.keyForLocalStorage}::cache::${$i.id}`,
|
`${this.keyForLocalStorage}::cache::${me.id}`,
|
||||||
JSON.stringify(cache),
|
JSON.stringify(cache),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -171,11 +171,11 @@ export class Storage<T extends StateDef> {
|
||||||
case "deviceAccount": {
|
case "deviceAccount": {
|
||||||
if (!isSignedIn) break;
|
if (!isSignedIn) break;
|
||||||
const deviceAccountState = JSON.parse(
|
const deviceAccountState = JSON.parse(
|
||||||
localStorage.getItem(`${this.keyForLocalStorage}::${$i.id}`) || "{}",
|
localStorage.getItem(`${this.keyForLocalStorage}::${me.id}`) || "{}",
|
||||||
);
|
);
|
||||||
deviceAccountState[key] = value;
|
deviceAccountState[key] = value;
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
`${this.keyForLocalStorage}::${$i.id}`,
|
`${this.keyForLocalStorage}::${me.id}`,
|
||||||
JSON.stringify(deviceAccountState),
|
JSON.stringify(deviceAccountState),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
@ -183,12 +183,12 @@ export class Storage<T extends StateDef> {
|
||||||
case "account": {
|
case "account": {
|
||||||
if (!isSignedIn) break;
|
if (!isSignedIn) break;
|
||||||
const cache = JSON.parse(
|
const cache = JSON.parse(
|
||||||
localStorage.getItem(`${this.keyForLocalStorage}::cache::${$i.id}`) ||
|
localStorage.getItem(`${this.keyForLocalStorage}::cache::${me.id}`) ||
|
||||||
"{}",
|
"{}",
|
||||||
);
|
);
|
||||||
cache[key] = value;
|
cache[key] = value;
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
`${this.keyForLocalStorage}::cache::${$i.id}`,
|
`${this.keyForLocalStorage}::cache::${me.id}`,
|
||||||
JSON.stringify(cache),
|
JSON.stringify(cache),
|
||||||
);
|
);
|
||||||
api("i/registry/set", {
|
api("i/registry/set", {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { defineAsyncComponent, inject } from "vue";
|
||||||
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 { $i, isEmojiMod, isModerator } from "@/reactiveAccount";
|
import { me, isEmojiMod, isModerator } from "@/me";
|
||||||
|
|
||||||
const page = (loader: AsyncComponentLoader<any>) =>
|
const page = (loader: AsyncComponentLoader<any>) =>
|
||||||
defineAsyncComponent({
|
defineAsyncComponent({
|
||||||
|
@ -657,7 +657,7 @@ export const routes = [
|
||||||
{
|
{
|
||||||
name: "index",
|
name: "index",
|
||||||
path: "/",
|
path: "/",
|
||||||
component: $i
|
component: me
|
||||||
? page(() => import("./pages/timeline.vue"))
|
? page(() => import("./pages/timeline.vue"))
|
||||||
: page(() => import("./pages/welcome.vue")),
|
: page(() => import("./pages/welcome.vue")),
|
||||||
globalCacheKey: "index",
|
globalCacheKey: "index",
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { utils, values } from "@syuilo/aiscript";
|
import { utils, values } from "@syuilo/aiscript";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
|
|
||||||
export function createAiScriptEnv(opts) {
|
export function createAiScriptEnv(opts) {
|
||||||
let apiRequests = 0;
|
let apiRequests = 0;
|
||||||
return {
|
return {
|
||||||
USER_ID: $i ? values.STR($i.id) : values.NULL,
|
USER_ID: me ? values.STR(me.id) : values.NULL,
|
||||||
USER_NAME: $i ? values.STR($i.name) : values.NULL,
|
USER_NAME: me ? values.STR(me.name) : values.NULL,
|
||||||
USER_USERNAME: $i ? values.STR($i.username) : values.NULL,
|
USER_USERNAME: me ? values.STR(me.username) : values.NULL,
|
||||||
"Mk:dialog": values.FN_NATIVE(async ([title, text, type]) => {
|
"Mk:dialog": values.FN_NATIVE(async ([title, text, type]) => {
|
||||||
await os.alert({
|
await os.alert({
|
||||||
type: type ? type.value : "info",
|
type: type ? type.value : "info",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Ref } from "vue";
|
import type { Ref } from "vue";
|
||||||
import { defineAsyncComponent } from "vue";
|
import { defineAsyncComponent } from "vue";
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import { $i, isModerator, isSignedIn } from "@/reactiveAccount";
|
import { me, isModerator, isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
|
@ -288,10 +288,10 @@ export function getNoteMenu(props: {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const isAppearAuthor = appearNote.userId === $i.id;
|
const isAppearAuthor = appearNote.userId === me.id;
|
||||||
|
|
||||||
menu = [
|
menu = [
|
||||||
...(props.currentClipPage?.value.userId === $i.id
|
...(props.currentClipPage?.value.userId === me.id
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
icon: `${icon("ph-minus-circle")}`,
|
icon: `${icon("ph-minus-circle")}`,
|
||||||
|
@ -349,7 +349,7 @@ export function getNoteMenu(props: {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
isAppearAuthor
|
isAppearAuthor
|
||||||
? ($i.pinnedNoteIds || []).includes(appearNote.id)
|
? (me.pinnedNoteIds || []).includes(appearNote.id)
|
||||||
? {
|
? {
|
||||||
icon: `${icon("ph-push-pin")}`,
|
icon: `${icon("ph-push-pin")}`,
|
||||||
text: i18n.ts.unpin,
|
text: i18n.ts.unpin,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import copyToClipboard from "@/scripts/copy-to-clipboard";
|
||||||
import { host } from "@/config";
|
import { host } from "@/config";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { userActions } from "@/store";
|
import { userActions } from "@/store";
|
||||||
import { $i, isModerator, isSignedIn } from "@/reactiveAccount";
|
import { me, isModerator, isSignedIn } from "@/me";
|
||||||
import { mainRouter } from "@/router";
|
import { mainRouter } from "@/router";
|
||||||
import type { Router } from "@/nirax";
|
import type { Router } from "@/nirax";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
@ -290,7 +290,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
|
||||||
os.post({ specified: user });
|
os.post({ specified: user });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
$i.id !== user.id
|
me.id !== user.id
|
||||||
? {
|
? {
|
||||||
type: "link",
|
type: "link",
|
||||||
icon: `${icon("ph-chats-teardrop")}`,
|
icon: `${icon("ph-chats-teardrop")}`,
|
||||||
|
@ -313,7 +313,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
|
||||||
text: i18n.ts.addToList,
|
text: i18n.ts.addToList,
|
||||||
action: pushList,
|
action: pushList,
|
||||||
},
|
},
|
||||||
$i.id !== user.id
|
me.id !== user.id
|
||||||
? {
|
? {
|
||||||
icon: `${icon("ph-users-three")}`,
|
icon: `${icon("ph-users-three")}`,
|
||||||
text: i18n.ts.inviteToGroup,
|
text: i18n.ts.inviteToGroup,
|
||||||
|
@ -335,7 +335,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
|
||||||
},
|
},
|
||||||
] as any;
|
] as any;
|
||||||
|
|
||||||
if (isSignedIn && $i.id !== user.id) {
|
if (isSignedIn && me.id !== user.id) {
|
||||||
menu = menu.concat([
|
menu = menu.concat([
|
||||||
{
|
{
|
||||||
icon: user.isMuted ? "ph-eye ph-lg" : "ph-eye-slash ph-lg",
|
icon: user.isMuted ? "ph-eye ph-lg" : "ph-eye-slash ph-lg",
|
||||||
|
@ -386,7 +386,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSignedIn && $i.id === user.id) {
|
if (isSignedIn && me.id === user.id) {
|
||||||
menu = menu.concat([
|
menu = menu.concat([
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { defineAsyncComponent } from "vue";
|
import { defineAsyncComponent } from "vue";
|
||||||
import { isSignedIn } from "@/reactiveAccount";
|
import { isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { popup } from "@/os";
|
import { popup } from "@/os";
|
||||||
import { vibrate } from "@/scripts/vibrate";
|
import { vibrate } from "@/scripts/vibrate";
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { entities } from "firefish-js";
|
||||||
import { readAndCompressImage } from "browser-image-resizer";
|
import { readAndCompressImage } from "browser-image-resizer";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { apiUrl } from "@/config";
|
import { apiUrl } from "@/config";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { alert } from "@/os";
|
import { alert } from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ export function uploadFile(
|
||||||
|
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open("POST", `${apiUrl}/drive/files/create`, true);
|
xhr.open("POST", `${apiUrl}/drive/files/create`, true);
|
||||||
xhr.setRequestHeader("Authorization", `Bearer ${$i.token}`);
|
xhr.setRequestHeader("Authorization", `Bearer ${me.token}`);
|
||||||
xhr.onload = (ev) => {
|
xhr.onload = (ev) => {
|
||||||
if (
|
if (
|
||||||
xhr.status !== 200 ||
|
xhr.status !== 200 ||
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type { Ref } from "vue";
|
||||||
import { onUnmounted } from "vue";
|
import { onUnmounted } from "vue";
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import { useStream } from "@/stream";
|
import { useStream } from "@/stream";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
|
|
||||||
export function useNoteCapture(props: {
|
export function useNoteCapture(props: {
|
||||||
|
@ -34,7 +34,7 @@ export function useNoteCapture(props: {
|
||||||
|
|
||||||
note.value.reactions[reaction] = currentCount + 1;
|
note.value.reactions[reaction] = currentCount + 1;
|
||||||
|
|
||||||
if (isSignedIn && body.userId === $i.id) {
|
if (isSignedIn && body.userId === me.id) {
|
||||||
note.value.myReaction = reaction;
|
note.value.myReaction = reaction;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -48,7 +48,7 @@ export function useNoteCapture(props: {
|
||||||
|
|
||||||
note.value.reactions[reaction] = Math.max(0, currentCount - 1);
|
note.value.reactions[reaction] = Math.max(0, currentCount - 1);
|
||||||
|
|
||||||
if (isSignedIn && body.userId === $i.id) {
|
if (isSignedIn && body.userId === me.id) {
|
||||||
note.value.myReaction = undefined;
|
note.value.myReaction = undefined;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -62,7 +62,7 @@ export function useNoteCapture(props: {
|
||||||
choices[choice] = {
|
choices[choice] = {
|
||||||
...choices[choice],
|
...choices[choice],
|
||||||
votes: choices[choice].votes + 1,
|
votes: choices[choice].votes + 1,
|
||||||
...(isSignedIn && body.userId === $i.id
|
...(isSignedIn && body.userId === me.id
|
||||||
? {
|
? {
|
||||||
isVoted: true,
|
isVoted: true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { markRaw, ref } from "vue";
|
import { markRaw, ref } from "vue";
|
||||||
import { Storage } from "./pizzax";
|
import { Storage } from "./pizzax";
|
||||||
import { isSignedIn } from "./reactiveAccount";
|
import { isSignedIn } from "./me";
|
||||||
|
|
||||||
export const postFormActions = [];
|
export const postFormActions = [];
|
||||||
export const userActions = [];
|
export const userActions = [];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Stream } from "firefish-js";
|
import { Stream } from "firefish-js";
|
||||||
import { markRaw } from "vue";
|
import { markRaw } from "vue";
|
||||||
import { url } from "@/config";
|
import { url } from "@/config";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
|
|
||||||
let stream: Stream | null = null;
|
let stream: Stream | null = null;
|
||||||
let timeoutHeartBeat: number | null = null;
|
let timeoutHeartBeat: number | null = null;
|
||||||
|
@ -13,9 +13,9 @@ export function useStream() {
|
||||||
stream = markRaw(
|
stream = markRaw(
|
||||||
new Stream(
|
new Stream(
|
||||||
url,
|
url,
|
||||||
$i
|
me
|
||||||
? {
|
? {
|
||||||
token: $i.token,
|
token: me.token,
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Theme } from "./scripts/theme";
|
import type { Theme } from "./scripts/theme";
|
||||||
import { api } from "@/os";
|
import { api } from "@/os";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
|
|
||||||
const lsCacheKey = isSignedIn ? `themes:${$i.id}` : "";
|
const lsCacheKey = isSignedIn ? `themes:${me.id}` : "";
|
||||||
|
|
||||||
export function getThemes(): Theme[] {
|
export function getThemes(): Theme[] {
|
||||||
return JSON.parse(localStorage.getItem(lsCacheKey) || "[]");
|
return JSON.parse(localStorage.getItem(lsCacheKey) || "[]");
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { swInject } from "./sw-inject";
|
||||||
import { popup, popups } from "@/os";
|
import { popup, popups } from "@/os";
|
||||||
import { uploads } from "@/scripts/upload";
|
import { uploads } from "@/scripts/upload";
|
||||||
import * as sound from "@/scripts/sound";
|
import * as sound from "@/scripts/sound";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { useStream } from "@/stream";
|
import { useStream } from "@/stream";
|
||||||
|
|
||||||
const stream = useStream();
|
const stream = useStream();
|
||||||
|
@ -35,7 +35,7 @@ const XUpload = defineAsyncComponent(() => import("./upload.vue"));
|
||||||
const dev = _DEV_;
|
const dev = _DEV_;
|
||||||
|
|
||||||
const onNotification = (notification) => {
|
const onNotification = (notification) => {
|
||||||
if ($i.mutingNotificationTypes.includes(notification.type)) return;
|
if (me.mutingNotificationTypes.includes(notification.type)) return;
|
||||||
|
|
||||||
if (document.visibilityState === "visible") {
|
if (document.visibilityState === "visible") {
|
||||||
stream.send("readNotification", {
|
stream.send("readNotification", {
|
||||||
|
|
|
@ -4,22 +4,22 @@
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div
|
<div
|
||||||
class="banner"
|
class="banner"
|
||||||
:user="$i"
|
:user="me"
|
||||||
:style="{ backgroundImage: `url(${$i.bannerUrl})` }"
|
:style="{ backgroundImage: `url(${me.bannerUrl})` }"
|
||||||
></div>
|
></div>
|
||||||
<button
|
<button
|
||||||
v-click-anime
|
v-click-anime
|
||||||
v-tooltip.noDelay.right="
|
v-tooltip.noDelay.right="
|
||||||
`${i18n.ts.account}: @${$i.username}`
|
`${i18n.ts.account}: @${me.username}`
|
||||||
"
|
"
|
||||||
class="item _button account"
|
class="item _button account"
|
||||||
@click="openAccountMenu"
|
@click="openAccountMenu"
|
||||||
>
|
>
|
||||||
<MkAvatar
|
<MkAvatar
|
||||||
:user="$i"
|
:user="me"
|
||||||
class="icon"
|
class="icon"
|
||||||
disable-link
|
disable-link
|
||||||
/><!-- <MkAcct class="text" :user="$i"/> -->
|
/><!-- <MkAcct class="text" :user="me"/> -->
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="middle">
|
<div class="middle">
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
><span class="text">{{ i18n.ts.controlPanel }}</span>
|
><span class="text">{{ i18n.ts.controlPanel }}</span>
|
||||||
</MkA>
|
</MkA>
|
||||||
<MkA
|
<MkA
|
||||||
v-else-if="$i.emojiModPerm !== 'unauthorized'"
|
v-else-if="me.emojiModPerm !== 'unauthorized'"
|
||||||
v-click-anime
|
v-click-anime
|
||||||
v-tooltip.noDelay.right="i18n.ts.customEmojis"
|
v-tooltip.noDelay.right="i18n.ts.customEmojis"
|
||||||
class="item _button"
|
class="item _button"
|
||||||
|
@ -141,7 +141,7 @@ import { computed, defineAsyncComponent, toRef } from "vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { navbarItemDef } from "@/navbar";
|
import { navbarItemDef } from "@/navbar";
|
||||||
import { openAccountMenu as openAccountMenu_ } from "@/account";
|
import { openAccountMenu as openAccountMenu_ } from "@/account";
|
||||||
import { $i, isModerator } from "@/reactiveAccount";
|
import { me, isModerator } from "@/me";
|
||||||
import { openHelpMenu_ } from "@/scripts/helpMenu";
|
import { openHelpMenu_ } from "@/scripts/helpMenu";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
|
|
@ -4,22 +4,22 @@
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div
|
<div
|
||||||
class="banner"
|
class="banner"
|
||||||
:user="$i"
|
:user="me"
|
||||||
:style="{ backgroundImage: `url(${$i.bannerUrl})` }"
|
:style="{ backgroundImage: `url(${me.bannerUrl})` }"
|
||||||
></div>
|
></div>
|
||||||
<button
|
<button
|
||||||
v-click-anime
|
v-click-anime
|
||||||
v-tooltip.noDelay.right="
|
v-tooltip.noDelay.right="
|
||||||
`${i18n.ts.account}: @${$i.username}`
|
`${i18n.ts.account}: @${me.username}`
|
||||||
"
|
"
|
||||||
class="item _button account"
|
class="item _button account"
|
||||||
@click="openAccountMenu"
|
@click="openAccountMenu"
|
||||||
>
|
>
|
||||||
<MkAvatar
|
<MkAvatar
|
||||||
:user="$i"
|
:user="me"
|
||||||
class="icon"
|
class="icon"
|
||||||
disable-link
|
disable-link
|
||||||
/><!-- <MkAcct class="text" :user="$i"/> -->
|
/><!-- <MkAcct class="text" :user="me"/> -->
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<nav class="middle">
|
<nav class="middle">
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
><span class="text">{{ i18n.ts.controlPanel }}</span>
|
><span class="text">{{ i18n.ts.controlPanel }}</span>
|
||||||
</MkA>
|
</MkA>
|
||||||
<MkA
|
<MkA
|
||||||
v-else-if="$i.emojiModPerm !== 'unauthorized'"
|
v-else-if="me.emojiModPerm !== 'unauthorized'"
|
||||||
v-click-anime
|
v-click-anime
|
||||||
v-tooltip.noDelay.right="i18n.ts.customEmojis"
|
v-tooltip.noDelay.right="i18n.ts.customEmojis"
|
||||||
class="item _button"
|
class="item _button"
|
||||||
|
@ -155,7 +155,7 @@ import { computed, defineAsyncComponent, ref, watch } from "vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { navbarItemDef } from "@/navbar";
|
import { navbarItemDef } from "@/navbar";
|
||||||
import { openAccountMenu as openAccountMenu_ } from "@/account";
|
import { openAccountMenu as openAccountMenu_ } from "@/account";
|
||||||
import { $i, isAdmin, isModerator } from "@/reactiveAccount";
|
import { me, isAdmin, isModerator } from "@/me";
|
||||||
import { openHelpMenu_ } from "@/scripts/helpMenu";
|
import { openHelpMenu_ } from "@/scripts/helpMenu";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { post } from "@/os";
|
import { post } from "@/os";
|
||||||
import { login } from "@/account";
|
import { login } from "@/account";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { getAccountFromId } from "@/scripts/get-account-from-id";
|
import { getAccountFromId } from "@/scripts/get-account-from-id";
|
||||||
import { mainRouter } from "@/router";
|
import { mainRouter } from "@/router";
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ export function swInject() {
|
||||||
|
|
||||||
if (ev.data.type !== "order") return;
|
if (ev.data.type !== "order") return;
|
||||||
|
|
||||||
if (ev.data.loginId !== $i?.id) {
|
if (ev.data.loginId !== me?.id) {
|
||||||
return getAccountFromId(ev.data.loginId).then((account) => {
|
return getAccountFromId(ev.data.loginId).then((account) => {
|
||||||
if (!account) return;
|
if (!account) return;
|
||||||
return login(account.token, ev.data.url);
|
return login(account.token, ev.data.url);
|
||||||
|
|
|
@ -151,7 +151,7 @@
|
||||||
>
|
>
|
||||||
<i :class="icon('ph-bell')"></i
|
<i :class="icon('ph-bell')"></i
|
||||||
><span
|
><span
|
||||||
v-if="$i?.hasUnreadNotification"
|
v-if="me?.hasUnreadNotification"
|
||||||
class="indicator"
|
class="indicator"
|
||||||
:class="{
|
:class="{
|
||||||
animateIndicator: defaultStore.state.animation,
|
animateIndicator: defaultStore.state.animation,
|
||||||
|
@ -203,7 +203,7 @@ import XDrawerMenu from "@/ui/_common_/navbar-for-mobile.vue";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { navbarItemDef } from "@/navbar";
|
import { navbarItemDef } from "@/navbar";
|
||||||
import { $i, isSignedIn } from "@/reactiveAccount";
|
import { me, isSignedIn } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { mainRouter } from "@/router";
|
import { mainRouter } from "@/router";
|
||||||
import { unisonReload } from "@/scripts/unison-reload";
|
import { unisonReload } from "@/scripts/unison-reload";
|
||||||
|
|
|
@ -50,7 +50,7 @@ import type { Column } from "./deck-store";
|
||||||
import { removeColumn, updateColumn } from "./deck-store";
|
import { removeColumn, updateColumn } from "./deck-store";
|
||||||
import XTimeline from "@/components/MkTimeline.vue";
|
import XTimeline from "@/components/MkTimeline.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { isModerator, isSignedIn } from "@/reactiveAccount";
|
import { isModerator, isSignedIn } from "@/me";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
>
|
>
|
||||||
<i :class="icon('ph-bell')"></i
|
<i :class="icon('ph-bell')"></i
|
||||||
><span
|
><span
|
||||||
v-if="$i?.hasUnreadNotification"
|
v-if="me?.hasUnreadNotification"
|
||||||
class="indicator"
|
class="indicator"
|
||||||
:class="{
|
:class="{
|
||||||
animateIndicator: defaultStore.state.animation,
|
animateIndicator: defaultStore.state.animation,
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
>
|
>
|
||||||
<i :class="icon('ph-chats-teardrop')"></i
|
<i :class="icon('ph-chats-teardrop')"></i
|
||||||
><span
|
><span
|
||||||
v-if="$i?.hasUnreadMessagingMessage"
|
v-if="me?.hasUnreadMessagingMessage"
|
||||||
class="indicator"
|
class="indicator"
|
||||||
:class="{
|
:class="{
|
||||||
animateIndicator: defaultStore.state.animation,
|
animateIndicator: defaultStore.state.animation,
|
||||||
|
@ -222,7 +222,7 @@ import { defaultStore } from "@/store";
|
||||||
import { navbarItemDef } from "@/navbar";
|
import { navbarItemDef } from "@/navbar";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { openAccountMenu as openAccountMenuImpl } from "@/account";
|
import { openAccountMenu as openAccountMenuImpl } from "@/account";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { mainRouter } from "@/router";
|
import { mainRouter } from "@/router";
|
||||||
import { provideMetadataReceiver } from "@/scripts/page-metadata";
|
import { provideMetadataReceiver } from "@/scripts/page-metadata";
|
||||||
import { deviceKind } from "@/scripts/device-kind";
|
import { deviceKind } from "@/scripts/device-kind";
|
||||||
|
|
|
@ -38,7 +38,7 @@ import type { GetFormResultType } from "@/scripts/form";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import MkContainer from "@/components/MkContainer.vue";
|
import MkContainer from "@/components/MkContainer.vue";
|
||||||
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ const run = async () => {
|
||||||
const aiscript = new Interpreter(
|
const aiscript = new Interpreter(
|
||||||
createAiScriptEnv({
|
createAiScriptEnv({
|
||||||
storageKey: "widget",
|
storageKey: "widget",
|
||||||
token: $i?.token,
|
token: me?.token,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
in: (q) => {
|
in: (q) => {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import type {
|
||||||
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
||||||
import type { GetFormResultType } from "@/scripts/form";
|
import type { GetFormResultType } from "@/scripts/form";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
|
|
||||||
const name = "button";
|
const name = "button";
|
||||||
|
@ -57,7 +57,7 @@ const run = async () => {
|
||||||
const aiscript = new Interpreter(
|
const aiscript = new Interpreter(
|
||||||
createAiScriptEnv({
|
createAiScriptEnv({
|
||||||
storageKey: "widget",
|
storageKey: "widget",
|
||||||
token: $i?.token,
|
token: me?.token,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
in: (q) => {
|
in: (q) => {
|
||||||
|
|
|
@ -50,7 +50,7 @@ import { useWidgetPropsManager } from "./widget";
|
||||||
import type { GetFormResultType } from "@/scripts/form";
|
import type { GetFormResultType } from "@/scripts/form";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { useInterval } from "@/scripts/use-interval";
|
import { useInterval } from "@/scripts/use-interval";
|
||||||
import { $i } from "@/reactiveAccount";
|
import { me } from "@/me";
|
||||||
|
|
||||||
const name = "calendar";
|
const name = "calendar";
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ const { widgetProps, configure } = useWidgetPropsManager(
|
||||||
emit,
|
emit,
|
||||||
);
|
);
|
||||||
|
|
||||||
const hasBirthday = Boolean($i?.birthday);
|
const hasBirthday = Boolean(me?.birthday);
|
||||||
|
|
||||||
const year = ref(0);
|
const year = ref(0);
|
||||||
const month = ref(0);
|
const month = ref(0);
|
||||||
|
@ -123,7 +123,7 @@ const tick = () => {
|
||||||
isHoliday.value = now.getDay() === 0 || now.getDay() === 6;
|
isHoliday.value = now.getDay() === 0 || now.getDay() === 6;
|
||||||
|
|
||||||
if (hasBirthday) {
|
if (hasBirthday) {
|
||||||
const [bdayYear, bdayMonth, bdayDay] = $i.birthday.split("-");
|
const [bdayYear, bdayMonth, bdayDay] = me.birthday.split("-");
|
||||||
if (month.value === +bdayMonth && day.value == +bdayDay) {
|
if (month.value === +bdayMonth && day.value == +bdayDay) {
|
||||||
isBirthday.value = true;
|
isBirthday.value = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue