Merge branch 'fix-10791' into 'develop'

fix: Extract $i from account.ts into reactiveAccount.ts to fix circular dependency

Co-authored-by: minneyar <speed@sakabatou.net>

Closes #10791

See merge request firefish/firefish!10630
This commit is contained in:
Kainoa Kanter 2023-10-22 21:29:46 +00:00
commit 9f9967ee79
75 changed files with 95 additions and 85 deletions

View File

@ -6,17 +6,11 @@ import { apiUrl } from "@/config";
import { alert, api, popup, popupMenu, waiting } from "@/os"; import { alert, api, popup, popupMenu, waiting } from "@/os";
import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; import { reloadChannel, unisonReload } from "@/scripts/unison-reload";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
import { $i } from "@/reactiveAccount";
// TODO: 他のタブと永続化されたstateを同期 // TODO: 他のタブと永続化されたstateを同期
type Account = firefish.entities.MeDetailed; export type Account = firefish.entities.MeDetailed;
const accountData = localStorage.getItem("account");
// TODO: 外部からはreadonlyに
export const $i = accountData
? reactive(JSON.parse(accountData) as Account)
: null;
export const iAmModerator = $i != null && ($i.isAdmin || $i.isModerator); export const iAmModerator = $i != null && ($i.isAdmin || $i.isModerator);
export const iAmAdmin = $i?.isAdmin; export const iAmAdmin = $i?.isAdmin;

View File

@ -66,7 +66,7 @@
import * as Acct from "firefish-js/built/acct"; import * as Acct from "firefish-js/built/acct";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { acct } from "@/filters/user"; import { acct } from "@/filters/user";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
const getAcct = Acct.toString; const getAcct = Acct.toString;

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
const props = withDefaults( const props = withDefaults(

View File

@ -66,7 +66,7 @@ import type * as firefish from "firefish-js";
import * as os from "@/os"; import * as os from "@/os";
import { stream } from "@/stream"; import { stream } from "@/stream";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -15,7 +15,7 @@ import { defaultStore } from "@/store";
import { useChartTooltip } from "@/scripts/use-chart-tooltip"; import { useChartTooltip } from "@/scripts/use-chart-tooltip";
import { alpha } from "@/scripts/color"; import { alpha } from "@/scripts/color";
import { initChart } from "@/scripts/init-chart"; import { initChart } from "@/scripts/init-chart";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
initChart(); initChart();

View File

@ -37,7 +37,7 @@
import { toUnicode } from "punycode"; import { toUnicode } from "punycode";
import {} from "vue"; import {} from "vue";
import { host as localHost } from "@/config"; import { host as localHost } from "@/config";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
const props = defineProps<{ const props = defineProps<{

View File

@ -294,7 +294,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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -182,7 +182,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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -210,7 +210,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 } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 { stream } from "@/stream"; import { stream } from "@/stream";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
const props = defineProps<{ const props = defineProps<{

View File

@ -268,11 +268,8 @@ import { defaultStore, notePostInterruptors, postFormActions } from "@/store";
import MkInfo from "@/components/MkInfo.vue"; import MkInfo from "@/components/MkInfo.vue";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { instance } from "@/instance"; import { instance } from "@/instance";
import { import { getAccounts, openAccountMenu as openAccountMenu_ } from "@/account";
$i, import { $i } from "@/reactiveAccount";
getAccounts,
openAccountMenu as openAccountMenu_,
} from "@/account";
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";

View File

@ -55,7 +55,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { $i, getAccounts } from "@/account"; import { getAccounts } from "@/account";
import { $i } from "@/reactiveAccount";
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";

View File

@ -14,7 +14,7 @@ import { computed } from "vue";
import type { Note } from "firefish-js/built/entities"; import type { Note } from "firefish-js/built/entities";
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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 { $i } from "@/account"; import { $i } from "@/reactiveAccount";
const props = defineProps<{ const props = defineProps<{
reaction: string; reaction: string;

View File

@ -19,7 +19,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import type * as firefish from "firefish-js"; import type * as firefish from "firefish-js";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import XReaction from "@/components/MkReactionsViewer.reaction.vue"; import XReaction from "@/components/MkReactionsViewer.reaction.vue";
const props = defineProps<{ const props = defineProps<{

View File

@ -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 } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -33,7 +33,7 @@ import XNotes from "@/components/MkNotes.vue";
import MkInfo from "@/components/MkInfo.vue"; import MkInfo from "@/components/MkInfo.vue";
import { stream } from "@/stream"; import { stream } from "@/stream";
import * as sound from "@/scripts/sound"; import * as sound from "@/scripts/sound";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import { instance } from "@/instance"; import { instance } from "@/instance";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";

View File

@ -138,7 +138,8 @@ import MkFollowButton from "@/components/MkFollowButton.vue";
import { popupMenu } from "@/os"; 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 { $i, openAccountMenu as openAccountMenu_ } from "@/account"; import { openAccountMenu as openAccountMenu_ } from "@/account";
import { $i } from "@/reactiveAccount";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";

View File

@ -21,7 +21,7 @@ import { parse } 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 "@/account"; import { $i } from "@/reactiveAccount";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
export default defineComponent({ export default defineComponent({

View File

@ -43,7 +43,8 @@ import { i18n } from "@/i18n";
import { alert, api, confirm, popup, post, toast } from "@/os"; import { alert, api, confirm, popup, post, toast } from "@/os";
import { stream } from "@/stream"; import { stream } from "@/stream";
import * as sound from "@/scripts/sound"; import * as sound from "@/scripts/sound";
import { $i, login, refreshAccount, signout, updateAccount } from "@/account"; import { login, refreshAccount, signout, updateAccount } from "@/account";
import { $i } from "@/reactiveAccount";
import { ColdDeviceStorage, defaultStore } from "@/store"; import { ColdDeviceStorage, defaultStore } from "@/store";
import { fetchInstance, instance } from "@/instance"; import { fetchInstance, instance } from "@/instance";
import { makeHotkey } from "@/scripts/hotkey"; import { makeHotkey } from "@/scripts/hotkey";

View File

@ -1,5 +1,5 @@
import { computed, reactive } from "vue"; import { computed, reactive } from "vue";
import { $i } from "./account"; import { $i } from "@/reactiveAccount";
import { search } from "@/scripts/search"; import { search } from "@/scripts/search";
import * as os from "@/os"; import * as os from "@/os";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";

View File

@ -12,7 +12,7 @@ import MkWaitingDialog from "@/components/MkWaitingDialog.vue";
import MkToast from "@/components/MkToast.vue"; import MkToast from "@/components/MkToast.vue";
import MkDialog from "@/components/MkDialog.vue"; import MkDialog from "@/components/MkDialog.vue";
import type { MenuItem } from "@/types/menu"; import type { MenuItem } from "@/types/menu";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
export const pendingApiRequestsCount = ref(0); export const pendingApiRequestsCount = ref(0);

View File

@ -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 } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -51,7 +51,8 @@ import XForm from "./auth.form.vue";
import MkSignin from "@/components/MkSignin.vue"; 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 { $i, login } from "@/account"; import { login } from "@/account";
import { $i } from "@/reactiveAccount";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
const props = defineProps<{ const props = defineProps<{

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -31,7 +31,7 @@
import { computed, provide, ref, watch } from "vue"; import { computed, provide, ref, watch } from "vue";
import type * as firefish from "firefish-js"; import type * as firefish from "firefish-js";
import XNotes from "@/components/MkNotes.vue"; import XNotes from "@/components/MkNotes.vue";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
const props = defineProps<{ const props = defineProps<{

View File

@ -88,7 +88,7 @@ import { acct, 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 "@/account"; import { $i } from "@/reactiveAccount";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
const paginationComponent = ref<InstanceType<typeof MkPagination>>(); const paginationComponent = ref<InstanceType<typeof MkPagination>>();

View File

@ -100,7 +100,7 @@ import { stream } 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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";

View File

@ -122,7 +122,7 @@ import { stream } 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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -82,7 +82,8 @@ import { ref } from "vue";
import MkSignin from "@/components/MkSignin.vue"; 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 { $i, login } from "@/account"; import { login } from "@/account";
import { $i } from "@/reactiveAccount";
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";

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
const props = defineProps<{ const props = defineProps<{

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -120,7 +120,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 "@/account"; import { $i } from "@/reactiveAccount";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";

View File

@ -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 } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -34,12 +34,12 @@ import FormSuspense from "@/components/form/suspense.vue";
import FormButton from "@/components/MkButton.vue"; import FormButton from "@/components/MkButton.vue";
import * as os from "@/os"; import * as os from "@/os";
import { import {
$i,
removeAccount as _removeAccount, removeAccount as _removeAccount,
addAccount as addAccounts, addAccount as addAccounts,
getAccounts, getAccounts,
login, login,
} from "@/account"; } from "@/account";
import { $i } from "@/reactiveAccount";
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";

View File

@ -85,7 +85,7 @@ import { defaultStore } from "@/store";
import MkChart from "@/components/MkChart.vue"; import MkChart from "@/components/MkChart.vue";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { definePageMetadata } from "@/scripts/page-metadata"; import { definePageMetadata } from "@/scripts/page-metadata";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
const fetching = ref(true); const fetching = ref(true);

View File

@ -66,7 +66,7 @@ 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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -303,7 +303,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, watch } from "vue"; import { computed, ref, watch } from "vue";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -45,7 +45,8 @@ import { computed, onActivated, onMounted, onUnmounted, ref, watch } from "vue";
import { i18n } from "@/i18n"; 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 { $i, signout } from "@/account"; import { signout } from "@/account";
import { $i } from "@/reactiveAccount";
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";

View File

@ -26,7 +26,7 @@ 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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
const moveToAccount = ref(""); const moveToAccount = ref("");

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 { stream } from "@/stream"; import { stream } from "@/stream";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -157,7 +157,7 @@ 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 "@/account"; import { $i } from "@/reactiveAccount";
import { definePageMetadata } from "@/scripts/page-metadata"; import { definePageMetadata } from "@/scripts/page-metadata";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";

View File

@ -170,7 +170,7 @@ 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 "@/account"; import { $i } from "@/reactiveAccount";
import { langmap } from "@/scripts/langmap"; import { langmap } from "@/scripts/langmap";
import { definePageMetadata } from "@/scripts/page-metadata"; import { definePageMetadata } from "@/scripts/page-metadata";
import { host } from "@/config"; import { host } from "@/config";

View File

@ -70,7 +70,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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -74,7 +74,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 { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -392,7 +392,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 } from "@/account"; import { $i } from "@/reactiveAccount";
import { host } from "@/config"; import { host } from "@/config";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";

View File

@ -37,7 +37,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 } from "@/account"; import { $i } from "@/reactiveAccount";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
const XHome = defineAsyncComponent(() => import("./home.vue")); const XHome = defineAsyncComponent(() => import("./home.vue"));

View File

@ -2,7 +2,7 @@
import type { Ref } from "vue"; import type { Ref } from "vue";
import { onUnmounted, ref, watch } from "vue"; import { onUnmounted, ref, watch } from "vue";
import { $i } from "./account"; import { $i } from "@/reactiveAccount";
import { api } from "./os"; import { api } from "./os";
import { stream } from "./stream"; import { stream } from "./stream";

View File

@ -0,0 +1,9 @@
import { reactive } from "vue";
import { Account } from "@/account";
const accountData = localStorage.getItem("account");
// TODO: 外部からはreadonlyに
export const $i = accountData
? reactive(JSON.parse(accountData) as Account)
: null;

View File

@ -1,7 +1,8 @@
import type { AsyncComponentLoader } from "vue"; import type { AsyncComponentLoader } from "vue";
import { defineAsyncComponent, inject } from "vue"; import { defineAsyncComponent, inject } from "vue";
import { Router } from "@/nirax"; import { Router } from "@/nirax";
import { $i, iAmModerator } from "@/account"; import { iAmModerator } from "@/account";
import { $i } from "@/reactiveAccount";
import MkLoading from "@/pages/_loading_.vue"; import MkLoading from "@/pages/_loading_.vue";
import MkError from "@/pages/_error_.vue"; import MkError from "@/pages/_error_.vue";
import { api } from "@/os"; import { api } from "@/os";

View File

@ -1,6 +1,6 @@
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 "@/account"; import { $i } from "@/reactiveAccount";
export function createAiScriptEnv(opts) { export function createAiScriptEnv(opts) {
let apiRequests = 0; let apiRequests = 0;

View File

@ -1,7 +1,7 @@
import type { Ref } from "vue"; import type { Ref } from "vue";
import { defineAsyncComponent, inject } from "vue"; import { defineAsyncComponent, inject } from "vue";
import type * as firefish from "firefish-js"; import type * as firefish from "firefish-js";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -5,7 +5,8 @@ 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, iAmModerator } from "@/account"; import { iAmModerator } from "@/account";
import { $i } from "@/reactiveAccount";
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";

View File

@ -1,5 +1,5 @@
import { defineAsyncComponent } from "vue"; import { defineAsyncComponent } from "vue";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -3,7 +3,7 @@ import type * as firefish 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 "@/account"; import { $i } from "@/reactiveAccount";
import { alert } from "@/os"; import { alert } from "@/os";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";

View File

@ -2,7 +2,7 @@ import type { Ref } from "vue";
import { onUnmounted } from "vue"; import { onUnmounted } from "vue";
import type * as firefish from "firefish-js"; import type * as firefish from "firefish-js";
import { stream } from "@/stream"; import { stream } from "@/stream";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import * as os from "@/os"; import * as os from "@/os";
export function useNoteCapture(props: { export function useNoteCapture(props: {

View File

@ -1,6 +1,6 @@
import * as firefish from "firefish-js"; import * as firefish from "firefish-js";
import { markRaw } from "vue"; import { markRaw } from "vue";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import { url } from "@/config"; import { url } from "@/config";
export const stream = markRaw( export const stream = markRaw(

View File

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

View File

@ -22,7 +22,7 @@ import { swInject } from "./sw-inject";
import { pendingApiRequestsCount, popup, popups } from "@/os"; import { pendingApiRequestsCount, 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 } from "@/account"; import { $i } from "@/reactiveAccount";
import { stream } from "@/stream"; import { stream } from "@/stream";
const XStreamIndicator = defineAsyncComponent( const XStreamIndicator = defineAsyncComponent(

View File

@ -149,7 +149,8 @@
import { computed, defineAsyncComponent, ref, watch } from "vue"; 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 { $i, openAccountMenu as openAccountMenu_ } from "@/account"; import { openAccountMenu as openAccountMenu_ } from "@/account";
import { $i } from "@/reactiveAccount";
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";

View File

@ -1,6 +1,7 @@
import { inject } from "vue"; import { inject } from "vue";
import { post } from "@/os"; import { post } from "@/os";
import { $i, login } from "@/account"; import { login } from "@/account";
import { $i } from "@/reactiveAccount";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
import { getAccountFromId } from "@/scripts/get-account-from-id"; import { getAccountFromId } from "@/scripts/get-account-from-id";
import { mainRouter } from "@/router"; import { mainRouter } from "@/router";

View File

@ -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 } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -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 { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -199,7 +199,7 @@ import * as os from "@/os";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
import { navbarItemDef } from "@/navbar"; import { navbarItemDef } from "@/navbar";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
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";

View File

@ -46,7 +46,7 @@ import MkHeatmap from "@/components/MkHeatmap.vue";
import type { GetFormResultType } from "@/scripts/form"; 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 { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";

View File

@ -34,7 +34,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 "@/account"; import { $i } from "@/reactiveAccount";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";

View File

@ -18,7 +18,7 @@ import {
import type { GetFormResultType } from "@/scripts/form"; import type { GetFormResultType } from "@/scripts/form";
import * as os from "@/os"; import * as os from "@/os";
import { createAiScriptEnv } from "@/scripts/aiscript/api"; import { createAiScriptEnv } from "@/scripts/aiscript/api";
import { $i } from "@/account"; import { $i } from "@/reactiveAccount";
import MkButton from "@/components/MkButton.vue"; import MkButton from "@/components/MkButton.vue";
const name = "button"; const name = "button";

View File

@ -54,7 +54,7 @@ import {
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 "@/account"; import { $i } from "@/reactiveAccount";
const name = "calendar"; const name = "calendar";