Storage improve (#6976)

* wip

* wip

* wip

* wip

* wip

* Update storage.ts

* wip

* wip

* wip

* wip

* Update storage.ts

* Update storage.ts

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update storage.ts

* wip

* wip

* wip

* wip

* 🍕

* wip

* wip

* wip

* wip

* wip

* wip

* Update deck-storage.ts

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update store.ts

* wip

* wip

* wip

* wip

* Update init.ts

* wip

* wip

* Update pizzax.ts

* wip

* wip

* Update timeline.vue

* Update init.ts

* wip

* wip

* Update init.ts
This commit is contained in:
syuilo 2020-12-19 10:55:52 +09:00 committed by GitHub
parent 57d0c19a98
commit 43930e6a84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
146 changed files with 1458 additions and 1519 deletions

View file

@ -1,5 +1,5 @@
<template>
<transition :name="$store.state.device.animation ? 'zoom' : ''" appear>
<transition :name="$store.state.animation ? 'zoom' : ''" appear>
<div class="_section">
<div class="mjndxjch _content">
<img src="https://xn--931a.moe/assets/error.jpg" class="_ghost"/>

View file

@ -7,7 +7,7 @@
<img src="/assets/icons/512.png" alt="" class="icon" ref="icon" @load="iconLoaded" draggable="false"/>
<div class="misskey">Misskey</div>
<div class="version">v{{ version }}</div>
<span class="emoji" v-for="emoji in easterEggEmojis" :key="emoji.id" :data-physics-x="emoji.left" :data-physics-y="emoji.top" :class="{ _physics_circle_: !emoji.emoji.startsWith(':') }"><MkEmoji class="emoji" :emoji="emoji.emoji" :custom-emojis="$store.state.instance.meta.emojis" :is-reaction="false" :normal="true" :no-style="true"/></span>
<span class="emoji" v-for="emoji in easterEggEmojis" :key="emoji.id" :data-physics-x="emoji.left" :data-physics-y="emoji.top" :class="{ _physics_circle_: !emoji.emoji.startsWith(':') }"><MkEmoji class="emoji" :emoji="emoji.emoji" :custom-emojis="$instance.emojis" :is-reaction="false" :normal="true" :no-style="true"/></span>
</div>
</section>
<section class="_formItem" style="text-align: center; padding: 0 16px;" @click="gravity">
@ -144,7 +144,7 @@ export default defineComponent({
methods: {
iconLoaded() {
const emojis = this.$store.state.settings.reactions;
const emojis = this.$store.state.reactions;
const containerWidth = this.$refs.about.offsetWidth;
for (let i = 0; i < 32; i++) {
this.easterEggEmojis.push({

View file

@ -59,7 +59,7 @@ export default defineComponent({
computed: {
meta() {
return this.$store.state.instance.meta;
return this.$instance;
},
},
});

View file

@ -2,12 +2,12 @@
<div class="_section">
<MkPagination :pagination="pagination" #default="{items}" class="ruryvtyk _content">
<section class="_card announcement _vMargin" v-for="(announcement, i) in items" :key="announcement.id">
<div class="_title"><span v-if="$store.getters.isSignedIn && !announcement.isRead">🆕 </span>{{ announcement.title }}</div>
<div class="_title"><span v-if="$i && !announcement.isRead">🆕 </span>{{ announcement.title }}</div>
<div class="_content">
<Mfm :text="announcement.text"/>
<img v-if="announcement.imageUrl" :src="announcement.imageUrl"/>
</div>
<div class="_footer" v-if="$store.getters.isSignedIn && !announcement.isRead">
<div class="_footer" v-if="$i && !announcement.isRead">
<MkButton @click="read(items, announcement, i)" primary><Fa :icon="faCheck"/> {{ $t('gotIt') }}</MkButton>
</div>
</section>

View file

@ -1,8 +1,8 @@
<template>
<div class="" v-if="$store.getters.isSignedIn && fetching">
<div class="" v-if="$i && fetching">
<MkLoading/>
</div>
<div v-else-if="$store.getters.isSignedIn">
<div v-else-if="$i">
<XForm
class="form"
ref="form"
@ -33,6 +33,7 @@ import { defineComponent } from 'vue';
import XForm from './auth.form.vue';
import MkSignin from '@/components/signin.vue';
import * as os from '@/os';
import { login } from '@/account';
export default defineComponent({
components: {
@ -52,7 +53,7 @@ export default defineComponent({
}
},
mounted() {
if (!this.$store.getters.isSignedIn) return;
if (!this.$i) return;
// Fetch session
os.api('auth/session/show', {
@ -83,8 +84,7 @@ export default defineComponent({
location.href = `${this.session.app.callbackUrl}?token=${this.session.token}`;
}
}, onLogin(res) {
localStorage.setItem('i', res.i);
location.reload();
login(res.i);
}
}
});

View file

@ -16,11 +16,11 @@
<div class="fade"></div>
</div>
<div class="description" v-if="channel.description">
<Mfm :text="channel.description" :is-note="false" :i="$store.state.i"/>
<Mfm :text="channel.description" :is-note="false" :i="$i"/>
</div>
</div>
<XPostForm :channel="channel" class="post-form _content _panel _vMargin" fixed v-if="$store.getters.isSignedIn"/>
<XPostForm :channel="channel" class="post-form _content _panel _vMargin" fixed v-if="$i"/>
<XTimeline class="_content _vMargin" src="channel" :channel="channelId" @before="before" @after="after"/>
</div>

View file

@ -1,6 +1,6 @@
<template>
<div>
<div class="_section" style="padding: 0;" v-if="$store.getters.isSignedIn">
<div class="_section" style="padding: 0;" v-if="$i">
<MkTab class="_content" v-model:value="tab">
<option value="featured"><Fa :icon="faFireAlt"/> {{ $t('_channel.featured') }}</option>
<option value="following"><Fa :icon="faHeart"/> {{ $t('_channel.following') }}</option>

View file

@ -2,7 +2,7 @@
<div v-if="clip" class="_section">
<div class="okzinsic _content _panel _vMargin">
<div class="description" v-if="clip.description">
<Mfm :text="clip.description" :is-note="false" :i="$store.state.i"/>
<Mfm :text="clip.description" :is-note="false" :i="$i"/>
</div>
<div class="user">
<MkAvatar :user="clip.user" class="avatar"/> <MkUserName :user="clip.user" :nowrap="false"/>
@ -58,7 +58,7 @@ export default defineComponent({
computed: {
isOwned(): boolean {
return this.$store.getters.isSignedIn && this.clip && (this.$store.state.i.id === this.clip.userId);
return this.$i && this.clip && (this.$i.id === this.clip.userId);
}
},

View file

@ -142,7 +142,7 @@ export default defineComponent({
computed: {
meta() {
return this.$store.state.instance.meta;
return this.$instance;
},
tagUsers(): any {
return {

View file

@ -16,7 +16,7 @@
<p class="acct">@{{ acct(req.follower) }}</p>
</div>
<div class="description" v-if="req.follower.description" :title="req.follower.description">
<Mfm :text="req.follower.description" :is-note="false" :author="req.follower" :i="$store.state.i" :custom-emojis="req.follower.emojis" :plain="true" :nowrap="true"/>
<Mfm :text="req.follower.description" :is-note="false" :author="req.follower" :i="$i" :custom-emojis="req.follower.emojis" :plain="true" :nowrap="true"/>
</div>
<div class="actions">
<button class="_button" @click="accept(req.follower)"><Fa :icon="faCheck"/></button>

View file

@ -160,7 +160,7 @@ export default defineComponent({
computed: {
gridColor() {
// TODO: var(--panel)
return this.$store.state.device.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
return this.$store.state.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
},
},

View file

@ -122,7 +122,7 @@ export default defineComponent({
computed: {
meta() {
return this.$store.state.instance.meta;
return this.$instance;
},
},

View file

@ -206,7 +206,7 @@ export default defineComponent({
},
meta() {
return this.$store.state.instance.meta;
return this.$instance;
},
isBlocked() {

View file

@ -63,7 +63,7 @@ export default defineComponent({
this.fetchJobs();
// TODO: var(--panel)
const gridColor = this.$store.state.device.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
const gridColor = this.$store.state.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
Chart.defaults.global.defaultFontColor = getComputedStyle(document.documentElement).getPropertyValue('--fg');

View file

@ -259,6 +259,7 @@ import MkInfo from '@/components/ui/info.vue';
import { url } from '@/config';
import getAcct from '../../../misc/acct/render';
import * as os from '@/os';
import { fetchInstance } from '@/instance';
export default defineComponent({
components: {
@ -565,7 +566,7 @@ export default defineComponent({
summalyProxy: this.summalyProxy,
useStarForReactionFallback: this.useStarForReactionFallback,
}).then(() => {
this.$store.dispatch('instance/fetch');
fetchInstance();
if (withDialog) {
os.success();
}

View file

@ -24,7 +24,7 @@
</div>
<div class="_section">
<div class="_content">
<MkSwitch v-if="user.host == null && $store.state.i.isAdmin && (moderator || !user.isAdmin)" @update:value="toggleModerator" v-model:value="moderator">{{ $t('moderator') }}</MkSwitch>
<MkSwitch v-if="user.host == null && $i.isAdmin && (moderator || !user.isAdmin)" @update:value="toggleModerator" v-model:value="moderator">{{ $t('moderator') }}</MkSwitch>
<MkSwitch @update:value="toggleSilence" v-model:value="silenced">{{ $t('silence') }}</MkSwitch>
<MkSwitch @update:value="toggleSuspend" v-model:value="suspended">{{ $t('suspend') }}</MkSwitch>
</div>

View file

@ -6,7 +6,7 @@
<div class="history" v-if="messages.length > 0">
<MkA v-for="(message, i) in messages"
class="message _panel"
:class="{ isMe: isMe(message), isRead: message.groupId ? message.reads.includes($store.state.i.id) : message.isRead }"
:class="{ isMe: isMe(message), isRead: message.groupId ? message.reads.includes($i.id) : message.isRead }"
:to="message.groupId ? `/my/messaging/group/${message.groupId}` : `/my/messaging/${getAcct(isMe(message) ? message.recipient : message.user)}`"
:data-index="i"
:key="message.id"
@ -88,7 +88,7 @@ export default defineComponent({
getAcct,
isMe(message) {
return message.userId == this.$store.state.i.id;
return message.userId == this.$i.id;
},
onMessage(message) {
@ -111,7 +111,7 @@ export default defineComponent({
if (found.recipientId) {
found.isRead = true;
} else if (found.groupId) {
found.reads.push(this.$store.state.i.id);
found.reads.push(this.$i.id);
}
}
}

View file

@ -91,8 +91,8 @@ export default defineComponent({
const file = items[0].getAsFile();
const lio = file.name.lastIndexOf('.');
const ext = lio >= 0 ? file.name.slice(lio) : '';
const formatted = `${formatTimeString(new Date(file.lastModified), this.$store.state.settings.pastedFileName).replace(/{{number}}/g, '1')}${ext}`;
const name = this.$store.state.settings.pasteDialog
const formatted = `${formatTimeString(new Date(file.lastModified), this.$store.state.pastedFileName).replace(/{{number}}/g, '1')}${ext}`;
const name = this.$store.state.pasteDialog
? await os.dialog({
title: this.$t('enterFileName'),
input: {
@ -163,7 +163,7 @@ export default defineComponent({
},
upload(file: File, name?: string) {
os.upload(file, this.$store.state.settings.uploadFolder, name).then(res => {
os.upload(file, this.$store.state.uploadFolder, name).then(res => {
this.file = res;
});
},

View file

@ -7,7 +7,7 @@
<img src="/assets/remove.png" alt="Delete"/>
</button>
<div class="content" v-if="!message.isDeleted">
<Mfm class="text" v-if="message.text" ref="text" :text="message.text" :i="$store.state.i"/>
<Mfm class="text" v-if="message.text" ref="text" :text="message.text" :i="$i"/>
<div class="file" v-if="message.file">
<a :href="message.file.url" rel="noopener" target="_blank" :title="message.file.name">
<img v-if="message.file.type.split('/')[0] == 'image'" :src="message.file.url" :alt="message.file.name"/>
@ -56,7 +56,7 @@ export default defineComponent({
},
computed: {
isMe(): boolean {
return this.message.userId === this.$store.state.i.id;
return this.message.userId === this.$i.id;
},
urls(): string[] {
if (this.message.text) {

View file

@ -110,7 +110,7 @@ const Component = defineComponent({
mounted() {
this.fetch();
if (this.$store.state.device.enableInfiniteScroll) {
if (this.$store.state.enableInfiniteScroll) {
this.$nextTick(() => this.ilObserver.observe(this.$refs.loadMore as Element));
}
},
@ -224,7 +224,7 @@ const Component = defineComponent({
const _isBottom = isBottom(this.$el, 64);
this.messages.push(message);
if (message.userId != this.$store.state.i.id && !document.hidden) {
if (message.userId != this.$i.id && !document.hidden) {
this.connection.send('read', {
id: message.id
});
@ -235,7 +235,7 @@ const Component = defineComponent({
this.$nextTick(() => {
this.scrollToBottom();
});
} else if (message.userId != this.$store.state.i.id) {
} else if (message.userId != this.$i.id) {
// Notify
this.notifyNewMessage();
}
@ -299,7 +299,7 @@ const Component = defineComponent({
onVisibilitychange() {
if (document.hidden) return;
for (const message of this.messages) {
if (message.userId !== this.$store.state.i.id && !message.isRead) {
if (message.userId !== this.$i.id && !message.isRead) {
this.connection.send('read', {
id: message.id
});

View file

@ -238,7 +238,7 @@ export default defineComponent({
preview_hashtag: '#test',
preview_url: `https://example.com`,
preview_link: `[${this.$t('_mfm.dummy')}](https://example.com)`,
preview_emoji: `:${this.$store.state.instance.meta.emojis[0].name}:`,
preview_emoji: `:${this.$instance.emojis[0].name}:`,
preview_bold: `**${this.$t('_mfm.dummy')}**`,
preview_small: `<small>${this.$t('_mfm.dummy')}</small>`,
preview_center: `<center>${this.$t('_mfm.dummy')}</center>`,

View file

@ -1,5 +1,5 @@
<template>
<div v-if="$store.getters.isSignedIn">
<div v-if="$i">
<div class="waiting _section" v-if="state == 'waiting'">
<div class="_content">
<MkLoading/>
@ -41,6 +41,7 @@ import { defineComponent } from 'vue';
import MkSignin from '@/components/signin.vue';
import MkButton from '@/components/ui/button.vue';
import * as os from '@/os';
import { login } from '@/account';
export default defineComponent({
components: {
@ -88,8 +89,7 @@ export default defineComponent({
this.state = 'denied';
},
onLogin(res) {
localStorage.setItem('i', res.i);
location.reload();
login(res.i);
}
}
});

View file

@ -141,7 +141,7 @@ export default defineComponent({
title: this.$t('_pages.newPage'),
icon: faPencilAlt,
}),
author: this.$store.state.i,
author: this.$i,
readonly: false,
page: null,
pageId: null,

View file

@ -21,9 +21,9 @@
<div class="_section links">
<div class="_content">
<MkA :to="`./${page.name}/view-source`" class="link">{{ $t('_pages.viewSource') }}</MkA>
<template v-if="$store.getters.isSignedIn && $store.state.i.id === page.userId">
<template v-if="$i && $i.id === page.userId">
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ $t('_pages.editThisPage') }}</MkA>
<button v-if="$store.state.i.pinnedPageId === page.id" @click="pin(false)" class="link _textButton">{{ $t('unpin') }}</button>
<button v-if="$i.pinnedPageId === page.id" @click="pin(false)" class="link _textButton">{{ $t('unpin') }}</button>
<button v-else @click="pin(true)" class="link _textButton">{{ $t('pin') }}</button>
</template>
</div>

View file

@ -1,6 +1,6 @@
<template>
<div>
<MkTab v-model:value="tab" v-if="$store.getters.isSignedIn">
<MkTab v-model:value="tab" v-if="$i">
<option value="featured"><Fa :icon="faFireAlt"/> {{ $t('_pages.featured') }}</option>
<option value="my"><Fa :icon="faEdit"/> {{ $t('_pages.my') }}</option>
<option value="liked"><Fa :icon="faHeart"/> {{ $t('_pages.liked') }}</option>

View file

@ -22,11 +22,11 @@
</div>
<div class="board">
<div class="labels-x" v-if="$store.state.settings.gamesReversiShowBoardLabels">
<div class="labels-x" v-if="$store.state.gamesReversiShowBoardLabels">
<span v-for="i in game.map[0].length">{{ String.fromCharCode(64 + i) }}</span>
</div>
<div class="flex">
<div class="labels-y" v-if="$store.state.settings.gamesReversiShowBoardLabels">
<div class="labels-y" v-if="$store.state.gamesReversiShowBoardLabels">
<div v-for="i in game.map.length">{{ i }}</div>
</div>
<div class="cells" :style="cellsStyle">
@ -35,7 +35,7 @@
@click="set(i)"
:title="`${String.fromCharCode(65 + o.transformPosToXy(i)[0])}${o.transformPosToXy(i)[1] + 1}`"
>
<template v-if="$store.state.settings.gamesReversiUseAvatarStones || true">
<template v-if="$store.state.gamesReversiUseAvatarStones || true">
<img v-if="stone === true" :src="blackUser.avatarUrl" alt="black">
<img v-if="stone === false" :src="whiteUser.avatarUrl" alt="white">
</template>
@ -45,11 +45,11 @@
</template>
</div>
</div>
<div class="labels-y" v-if="$store.state.settings.gamesReversiShowBoardLabels">
<div class="labels-y" v-if="$store.state.gamesReversiShowBoardLabels">
<div v-for="i in game.map.length">{{ i }}</div>
</div>
</div>
<div class="labels-x" v-if="$store.state.settings.gamesReversiShowBoardLabels">
<div class="labels-x" v-if="$store.state.gamesReversiShowBoardLabels">
<span v-for="i in game.map[0].length">{{ String.fromCharCode(64 + i) }}</span>
</div>
</div>
@ -126,14 +126,14 @@ export default defineComponent({
computed: {
iAmPlayer(): boolean {
if (!this.$store.getters.isSignedIn) return false;
return this.game.user1Id == this.$store.state.i.id || this.game.user2Id == this.$store.state.i.id;
if (!this.$i) return false;
return this.game.user1Id == this.$i.id || this.game.user2Id == this.$i.id;
},
myColor(): Color {
if (!this.iAmPlayer) return null;
if (this.game.user1Id == this.$store.state.i.id && this.game.black == 1) return true;
if (this.game.user2Id == this.$store.state.i.id && this.game.black == 2) return true;
if (this.game.user1Id == this.$i.id && this.game.black == 1) return true;
if (this.game.user2Id == this.$i.id && this.game.black == 2) return true;
return false;
},
@ -234,7 +234,7 @@ export default defineComponent({
isMyTurn(): boolean {
if (!this.iAmPlayer) return false;
if (this.turnUser() == null) return false;
return this.turnUser().id == this.$store.state.i.id;
return this.turnUser().id == this.$i.id;
},
set(pos) {

View file

@ -169,13 +169,13 @@ export default defineComponent({
return categories.filter((item, pos) => categories.indexOf(item) == pos);
},
isAccepted(): boolean {
if (this.game.user1Id == this.$store.state.i.id && this.game.user1Accepted) return true;
if (this.game.user2Id == this.$store.state.i.id && this.game.user2Accepted) return true;
if (this.game.user1Id == this.$i.id && this.game.user1Accepted) return true;
if (this.game.user2Id == this.$i.id && this.game.user2Accepted) return true;
return false;
},
isOpAccepted(): boolean {
if (this.game.user1Id != this.$store.state.i.id && this.game.user1Accepted) return true;
if (this.game.user2Id != this.$store.state.i.id && this.game.user2Accepted) return true;
if (this.game.user1Id != this.$i.id && this.game.user1Accepted) return true;
if (this.game.user2Id != this.$i.id && this.game.user2Accepted) return true;
return false;
}
},
@ -186,8 +186,8 @@ export default defineComponent({
this.connection.on('initForm', this.onInitForm);
this.connection.on('message', this.onMessage);
if (this.game.user1Id != this.$store.state.i.id && this.game.form1) this.form = this.game.form1;
if (this.game.user2Id != this.$store.state.i.id && this.game.form2) this.form = this.game.form2;
if (this.game.user1Id != this.$i.id && this.game.form1) this.form = this.game.form1;
if (this.game.user2Id != this.$i.id && this.game.form2) this.form = this.game.form2;
},
beforeUnmount() {
@ -233,12 +233,12 @@ export default defineComponent({
},
onInitForm(x) {
if (x.userId == this.$store.state.i.id) return;
if (x.userId == this.$i.id) return;
this.form = x.form;
},
onMessage(x) {
if (x.userId == this.$store.state.i.id) return;
if (x.userId == this.$i.id) return;
this.messages.unshift(x.message);
},

View file

@ -91,7 +91,7 @@ export default defineComponent({
},
mounted() {
if (this.$store.getters.isSignedIn) {
if (this.$i) {
this.connection = os.stream.useSharedConnection('gamesReversi');
this.connection.on('invited', this.onInvited);

View file

@ -62,6 +62,7 @@ import MkButton from '@/components/ui/button.vue';
import MkSelect from '@/components/ui/select.vue';
import { selectFile } from '@/scripts/select-file';
import * as os from '@/os';
import { ColdDeviceStorage } from '@/store';
let room: Room;
@ -107,7 +108,7 @@ export default defineComponent({
...parseAcct(this.acct)
});
this.isMyRoom = this.$store.getters.isSignedIn && (this.$store.state.i.id === this.user.id);
this.isMyRoom = this.$i && (this.$i.id === this.user.id);
const roomInfo = await os.api('room/show', {
userId: this.user.id
@ -117,7 +118,7 @@ export default defineComponent({
this.carpetColor = roomInfo.carpetColor;
room = new Room(this.user, this.isMyRoom, roomInfo, this.$el, {
graphicsQuality: this.$store.state.device.roomGraphicsQuality,
graphicsQuality: ColdDeviceStorage.get('roomGraphicsQuality'),
onChangeSelect: obj => {
this.objectSelected = obj != null;
if (obj) {
@ -132,7 +133,7 @@ export default defineComponent({
});
}
},
useOrthographicCamera: this.$store.state.device.roomUseOrthographicCamera
useOrthographicCamera: ColdDeviceStorage.get('roomUseOrthographicCamera'),
});
},

View file

@ -2,8 +2,8 @@
<section class="_card">
<div class="_title"><Fa :icon="faLock"/> {{ $t('twoStepAuthentication') }}</div>
<div class="_content">
<MkButton v-if="!data && !$store.state.i.twoFactorEnabled" @click="register">{{ $t('_2fa.registerDevice') }}</MkButton>
<template v-if="$store.state.i.twoFactorEnabled">
<MkButton v-if="!data && !$i.twoFactorEnabled" @click="register">{{ $t('_2fa.registerDevice') }}</MkButton>
<template v-if="$i.twoFactorEnabled">
<p>{{ $t('_2fa.alreadyRegistered') }}</p>
<MkButton @click="unregister">{{ $t('unregister') }}</MkButton>
@ -13,14 +13,14 @@
<h2 class="heading">{{ $t('securityKey') }}</h2>
<p>{{ $t('_2fa.securityKeyInfo') }}</p>
<div class="key-list">
<div class="key" v-for="key in $store.state.i.securityKeysList">
<div class="key" v-for="key in $i.securityKeysList">
<h3>{{ key.name }}</h3>
<div class="last-used">{{ $t('lastUsed') }}<MkTime :time="key.lastUsed"/></div>
<MkButton @click="unregisterKey(key)">{{ $t('unregister') }}</MkButton>
</div>
</div>
<MkSwitch v-model:value="usePasswordLessLogin" @update:value="updatePasswordLessLogin" v-if="$store.state.i.securityKeysList.length > 0">{{ $t('passwordLessLogin') }}</MkSwitch>
<MkSwitch v-model:value="usePasswordLessLogin" @update:value="updatePasswordLessLogin" v-if="$i.securityKeysList.length > 0">{{ $t('passwordLessLogin') }}</MkSwitch>
<MkInfo warn v-if="registration && registration.error">{{ $t('error') }} {{ registration.error }}</MkInfo>
<MkButton v-if="!registration || registration.error" @click="addSecurityKey">{{ $t('_2fa.registerKey') }}</MkButton>
@ -42,7 +42,7 @@
</ol>
</template>
</template>
<div v-if="data && !$store.state.i.twoFactorEnabled">
<div v-if="data && !$i.twoFactorEnabled">
<ol style="margin: 0; padding: 0 0 0 1em;">
<li>
<i18n-t keypath="_2fa.step1" tag="span">
@ -96,7 +96,7 @@ export default defineComponent({
},
data: null,
supportsCredentials: !!navigator.credentials,
usePasswordLessLogin: this.$store.state.i.usePasswordLessLogin,
usePasswordLessLogin: this.$i.usePasswordLessLogin,
registration: null,
keyName: '',
token: null,
@ -136,7 +136,7 @@ export default defineComponent({
this.updatePasswordLessLogin();
}).then(() => {
os.success();
this.$store.state.i.twoFactorEnabled = false;
this.$i.twoFactorEnabled = false;
});
});
},
@ -146,7 +146,7 @@ export default defineComponent({
token: this.token
}).then(() => {
os.success();
this.$store.state.i.twoFactorEnabled = true;
this.$i.twoFactorEnabled = true;
}).catch(e => {
os.dialog({
type: 'error',
@ -213,9 +213,9 @@ export default defineComponent({
name: 'Misskey'
},
user: {
id: byteify(this.$store.state.i.id, 'ascii'),
name: this.$store.state.i.username,
displayName: this.$store.state.i.name,
id: byteify(this.$i.id, 'ascii'),
name: this.$i.username,
displayName: this.$i.name,
},
pubKeyCredParams: [{ alg: -7, type: 'public-key' }],
timeout: 60000,

View file

@ -2,13 +2,13 @@
<FormBase>
<FormKeyValueView>
<template #key>ID</template>
<template #value><span class="_monospace">{{ $store.state.i.id }}</span></template>
<template #value><span class="_monospace">{{ $i.id }}</span></template>
</FormKeyValueView>
<FormGroup>
<FormKeyValueView>
<template #key>{{ $t('registeredDate') }}</template>
<template #value><MkTime :time="$store.state.i.createdAt" mode="detail"/></template>
<template #value><MkTime :time="$i.createdAt" mode="detail"/></template>
</FormKeyValueView>
</FormGroup>
@ -104,27 +104,27 @@
<template #label>{{ $t('other') }}</template>
<FormKeyValueView>
<template #key>emailVerified</template>
<template #value>{{ $store.state.i.emailVerified ? $t('yes') : $t('no') }}</template>
<template #value>{{ $i.emailVerified ? $t('yes') : $t('no') }}</template>
</FormKeyValueView>
<FormKeyValueView>
<template #key>twoFactorEnabled</template>
<template #value>{{ $store.state.i.twoFactorEnabled ? $t('yes') : $t('no') }}</template>
<template #value>{{ $i.twoFactorEnabled ? $t('yes') : $t('no') }}</template>
</FormKeyValueView>
<FormKeyValueView>
<template #key>securityKeys</template>
<template #value>{{ $store.state.i.securityKeys ? $t('yes') : $t('no') }}</template>
<template #value>{{ $i.securityKeys ? $t('yes') : $t('no') }}</template>
</FormKeyValueView>
<FormKeyValueView>
<template #key>usePasswordLessLogin</template>
<template #value>{{ $store.state.i.usePasswordLessLogin ? $t('yes') : $t('no') }}</template>
<template #value>{{ $i.usePasswordLessLogin ? $t('yes') : $t('no') }}</template>
</FormKeyValueView>
<FormKeyValueView>
<template #key>isModerator</template>
<template #value>{{ $store.state.i.isModerator ? $t('yes') : $t('no') }}</template>
<template #value>{{ $i.isModerator ? $t('yes') : $t('no') }}</template>
</FormKeyValueView>
<FormKeyValueView>
<template #key>isAdmin</template>
<template #value>{{ $store.state.i.isAdmin ? $t('yes') : $t('no') }}</template>
<template #value>{{ $i.isAdmin ? $t('yes') : $t('no') }}</template>
</FormKeyValueView>
</FormGroup>
</FormBase>
@ -171,7 +171,7 @@ export default defineComponent({
this.$emit('info', this.INFO);
os.api('users/stats', {
userId: this.$store.state.i.id
userId: this.$i.id
}).then(stats => {
this.stats = stats;
});

View file

@ -5,17 +5,17 @@
<div class="_title"><Fa :icon="faColumns"/> </div>
<div class="_content">
<div>{{ $t('defaultNavigationBehaviour') }}</div>
<MkSwitch v-model:value="deckNavWindow">{{ $t('openInWindow') }}</MkSwitch>
<MkSwitch v-model:value="navWindow">{{ $t('openInWindow') }}</MkSwitch>
</div>
<div class="_content">
<MkSwitch v-model:value="deckAlwaysShowMainColumn">
<MkSwitch v-model:value="alwaysShowMainColumn">
{{ $t('_deck.alwaysShowMainColumn') }}
</MkSwitch>
</div>
<div class="_content">
<div>{{ $t('_deck.columnAlign') }}</div>
<MkRadio v-model="deckColumnAlign" value="left">{{ $t('left') }}</MkRadio>
<MkRadio v-model="deckColumnAlign" value="center">{{ $t('center') }}</MkRadio>
<MkRadio v-model="columnAlign" value="left">{{ $t('left') }}</MkRadio>
<MkRadio v-model="columnAlign" value="center">{{ $t('center') }}</MkRadio>
</div>
</section>
@ -38,6 +38,7 @@ import FormBase from '@/components/form/base.vue';
import FormGroup from '@/components/form/group.vue';
import { clientDb, set } from '@/db';
import * as os from '@/os';
import { deckStore } from '@/ui/deck/deck-store';
export default defineComponent({
components: {
@ -67,20 +68,9 @@ export default defineComponent({
},
computed: {
deckNavWindow: {
get() { return this.$store.state.device.deckNavWindow; },
set(value) { this.$store.commit('device/set', { key: 'deckNavWindow', value }); }
},
deckAlwaysShowMainColumn: {
get() { return this.$store.state.device.deckAlwaysShowMainColumn; },
set(value) { this.$store.commit('device/set', { key: 'deckAlwaysShowMainColumn', value }); }
},
deckColumnAlign: {
get() { return this.$store.state.device.deckColumnAlign; },
set(value) { this.$store.commit('device/set', { key: 'deckColumnAlign', value }); }
},
navWindow: deckStore.makeGetterSetter('navWindow'),
alwaysShowMainColumn: deckStore.makeGetterSetter('alwaysShowMainColumn'),
columnAlign: deckStore.makeGetterSetter('columnAlign'),
},
mounted() {

View file

@ -28,9 +28,9 @@ export default defineComponent({
},
async created() {
if (this.$store.state.settings.uploadFolder) {
if (this.$store.state.uploadFolder) {
this.uploadFolder = await os.api('drive/folders/show', {
folderId: this.$store.state.settings.uploadFolder
folderId: this.$store.state.uploadFolder
});
}
},
@ -38,11 +38,11 @@ export default defineComponent({
methods: {
chooseUploadFolder() {
os.selectDriveFolder(false).then(async folder => {
await this.$store.dispatch('settings/set', { key: 'uploadFolder', value: folder ? folder.id : null });
this.$store.set('uploadFolder', folder ? folder.id : null);
os.success();
if (this.$store.state.settings.uploadFolder) {
if (this.$store.state.uploadFolder) {
this.uploadFolder = await os.api('drive/folders/show', {
folderId: this.$store.state.settings.uploadFolder
folderId: this.$store.state.uploadFolder
});
} else {
this.uploadFolder = null;

View file

@ -3,8 +3,8 @@
<FormGroup>
<FormInput v-model:value="emailAddress" type="email">
{{ $t('emailAddress') }}
<template #desc v-if="$store.state.i.email && !$store.state.i.emailVerified">{{ $t('verificationEmailSent') }}</template>
<template #desc v-else-if="emailAddress === $store.state.i.email && $store.state.i.emailVerified">{{ $t('emailVerified') }}</template>
<template #desc v-if="$i.email && !$i.emailVerified">{{ $t('verificationEmailSent') }}</template>
<template #desc v-else-if="emailAddress === $i.email && $i.emailVerified">{{ $t('emailVerified') }}</template>
</FormInput>
</FormGroup>
<FormButton @click="save" primary>{{ $t('save') }}</FormButton>
@ -44,7 +44,7 @@ export default defineComponent({
},
created() {
this.emailAddress = this.$store.state.i.email;
this.emailAddress = this.$i.email;
},
mounted() {

View file

@ -3,9 +3,9 @@
<FormGroup>
<template #label>{{ $t('emailAddress') }}</template>
<FormLink to="/settings/email/address">
<template v-if="$store.state.i.email && !$store.state.i.emailVerified" #icon><Fa :icon="faExclamationTriangle" style="color: var(--warn);"/></template>
<template v-else-if="$store.state.i.email && $store.state.i.emailVerified" #icon><Fa :icon="faCheck" style="color: var(--success);"/></template>
{{ $store.state.i.email || $t('notSet') }}
<template v-if="$i.email && !$i.emailVerified" #icon><Fa :icon="faExclamationTriangle" style="color: var(--warn);"/></template>
<template v-else-if="$i.email && $i.emailVerified" #icon><Fa :icon="faCheck" style="color: var(--success);"/></template>
{{ $i.email || $t('notSet') }}
</FormLink>
</FormGroup>
</FormBase>

View file

@ -38,7 +38,7 @@
<FormSwitch v-model:value="disableShowingAnimatedImages">{{ $t('disableShowingAnimatedImages') }}</FormSwitch>
<FormSwitch v-model:value="useSystemFont">{{ $t('useSystemFont') }}</FormSwitch>
<FormSwitch v-model:value="useOsNativeEmojis">{{ $t('useOsNativeEmojis') }}
<div><Mfm text="🍮🍦🍭🍩🍰🍫🍬🥞🍪"/></div>
<div><Mfm text="🍮🍦🍭🍩🍰🍫🍬🥞🍪" :key="useOsNativeEmojis"/></div>
</FormSwitch>
</FormGroup>
@ -96,6 +96,8 @@ import MkLink from '@/components/link.vue';
import { langs } from '@/config';
import { clientDb, set } from '@/db';
import * as os from '@/os';
import { defaultStore } from '@/store';
import { ColdDeviceStorage } from '@/store';
export default defineComponent({
components: {
@ -126,85 +128,22 @@ export default defineComponent({
},
computed: {
serverDisconnectedBehavior: {
get() { return this.$store.state.device.serverDisconnectedBehavior; },
set(value) { this.$store.commit('device/set', { key: 'serverDisconnectedBehavior', value }); }
},
reduceAnimation: {
get() { return !this.$store.state.device.animation; },
set(value) { this.$store.commit('device/set', { key: 'animation', value: !value }); }
},
useBlurEffectForModal: {
get() { return this.$store.state.device.useBlurEffectForModal; },
set(value) { this.$store.commit('device/set', { key: 'useBlurEffectForModal', value: value }); }
},
showGapBetweenNotesInTimeline: {
get() { return this.$store.state.device.showGapBetweenNotesInTimeline; },
set(value) { this.$store.commit('device/set', { key: 'showGapBetweenNotesInTimeline', value: value }); }
},
disableAnimatedMfm: {
get() { return !this.$store.state.device.animatedMfm; },
set(value) { this.$store.commit('device/set', { key: 'animatedMfm', value: !value }); }
},
useOsNativeEmojis: {
get() { return this.$store.state.device.useOsNativeEmojis; },
set(value) { this.$store.commit('device/set', { key: 'useOsNativeEmojis', value }); }
},
imageNewTab: {
get() { return this.$store.state.device.imageNewTab; },
set(value) { this.$store.commit('device/set', { key: 'imageNewTab', value }); }
},
disablePagesScript: {
get() { return this.$store.state.device.disablePagesScript; },
set(value) { this.$store.commit('device/set', { key: 'disablePagesScript', value }); }
},
showFixedPostForm: {
get() { return this.$store.state.device.showFixedPostForm; },
set(value) { this.$store.commit('device/set', { key: 'showFixedPostForm', value }); }
},
defaultSideView: {
get() { return this.$store.state.device.defaultSideView; },
set(value) { this.$store.commit('device/set', { key: 'defaultSideView', value }); }
},
chatOpenBehavior: {
get() { return this.$store.state.device.chatOpenBehavior; },
set(value) { this.$store.commit('device/set', { key: 'chatOpenBehavior', value }); }
},
instanceTicker: {
get() { return this.$store.state.device.instanceTicker; },
set(value) { this.$store.commit('device/set', { key: 'instanceTicker', value }); }
},
loadRawImages: {
get() { return this.$store.state.device.loadRawImages; },
set(value) { this.$store.commit('device/set', { key: 'loadRawImages', value }); }
},
disableShowingAnimatedImages: {
get() { return this.$store.state.device.disableShowingAnimatedImages; },
set(value) { this.$store.commit('device/set', { key: 'disableShowingAnimatedImages', value }); }
},
nsfw: {
get() { return this.$store.state.device.nsfw; },
set(value) { this.$store.commit('device/set', { key: 'nsfw', value }); }
},
enableInfiniteScroll: {
get() { return this.$store.state.device.enableInfiniteScroll; },
set(value) { this.$store.commit('device/set', { key: 'enableInfiniteScroll', value }); }
},
serverDisconnectedBehavior: defaultStore.makeGetterSetter('serverDisconnectedBehavior'),
reduceAnimation: defaultStore.makeGetterSetter('animation', v => !v, v => !v),
useBlurEffectForModal: defaultStore.makeGetterSetter('useBlurEffectForModal'),
showGapBetweenNotesInTimeline: defaultStore.makeGetterSetter('showGapBetweenNotesInTimeline'),
disableAnimatedMfm: defaultStore.makeGetterSetter('animatedMfm', v => !v, v => !v),
useOsNativeEmojis: defaultStore.makeGetterSetter('useOsNativeEmojis'),
disableShowingAnimatedImages: defaultStore.makeGetterSetter('disableShowingAnimatedImages'),
loadRawImages: defaultStore.makeGetterSetter('loadRawImages'),
imageNewTab: defaultStore.makeGetterSetter('imageNewTab'),
nsfw: defaultStore.makeGetterSetter('nsfw'),
disablePagesScript: defaultStore.makeGetterSetter('disablePagesScript'),
showFixedPostForm: defaultStore.makeGetterSetter('showFixedPostForm'),
defaultSideView: defaultStore.makeGetterSetter('defaultSideView'),
chatOpenBehavior: ColdDeviceStorage.makeGetterSetter('chatOpenBehavior'),
instanceTicker: defaultStore.makeGetterSetter('instanceTicker'),
enableInfiniteScroll: defaultStore.makeGetterSetter('enableInfiniteScroll'),
},
watch: {

View file

@ -41,13 +41,13 @@
import { computed, defineAsyncComponent, defineComponent, nextTick, onMounted, ref, watch } from 'vue';
import { faCog, faPalette, faPlug, faUser, faListUl, faLock, faCommentSlash, faMusic, faCogs, faEllipsisH, faBan, faShareAlt, faLockOpen, faKey, faBoxes } from '@fortawesome/free-solid-svg-icons';
import { faLaugh, faBell, faEnvelope } from '@fortawesome/free-regular-svg-icons';
import { store } from '@/store';
import { i18n } from '@/i18n';
import FormLink from '@/components/form/link.vue';
import FormGroup from '@/components/form/group.vue';
import FormBase from '@/components/form/base.vue';
import FormButton from '@/components/form/button.vue';
import { scroll } from '../../scripts/scroll';
import { scroll } from '@/scripts/scroll';
import { signout } from '@/account';
export default defineComponent({
components: {
@ -101,7 +101,6 @@ export default defineComponent({
case 'plugins': return defineAsyncComponent(() => import('./plugins.vue'));
case 'import-export': return defineAsyncComponent(() => import('./import-export.vue'));
case 'account-info': return defineAsyncComponent(() => import('./account-info.vue'));
case 'regedit': return defineAsyncComponent(() => import('./regedit.vue'));
case 'experimental-features': return defineAsyncComponent(() => import('./experimental-features.vue'));
default: return null;
}
@ -125,8 +124,7 @@ export default defineComponent({
onInfo,
component,
logout: () => {
store.dispatch('logout');
location.href = '/';
signout();
},
faPalette, faPlug, faUser, faListUl, faLock, faLaugh, faCommentSlash, faMusic, faBell, faCogs, faEllipsisH, faBan, faShareAlt, faLockOpen, faKey, faBoxes, faEnvelope,
};

View file

@ -57,11 +57,11 @@ export default defineComponent({
computed: {
integrations() {
return this.$store.state.i.integrations;
return this.$i.integrations;
},
meta() {
return this.$store.state.instance.meta;
return this.$instance;
},
},
@ -74,7 +74,7 @@ export default defineComponent({
mounted() {
this.$emit('info', this.INFO);
document.cookie = `igi=${this.$store.state.i.token}; path=/;` +
document.cookie = `igi=${this.$i.token}; path=/;` +
` max-age=31536000;` +
(document.location.protocol.startsWith('https') ? ' secure' : '');

View file

@ -58,7 +58,7 @@ export default defineComponent({
},
configure() {
const includingTypes = notificationTypes.filter(x => !this.$store.state.i.mutingNotificationTypes.includes(x));
const includingTypes = notificationTypes.filter(x => !this.$i.mutingNotificationTypes.includes(x));
os.popup(import('@/components/notification-setting-window.vue'), {
includingTypes,
showGlobalToggle: false,
@ -68,7 +68,7 @@ export default defineComponent({
await os.apiWithDialog('i/update', {
mutingNotificationTypes: notificationTypes.filter(x => !value.includes(x)),
}).then(i => {
this.$store.state.i.mutingNotificationTypes = i.mutingNotificationTypes;
this.$i.mutingNotificationTypes = i.mutingNotificationTypes;
});
}
}, 'closed');

View file

@ -1,6 +1,6 @@
<template>
<FormBase>
<FormSwitch :value="$store.state.i.injectFeaturedNote" @update:value="onChangeInjectFeaturedNote">
<FormSwitch :value="$i.injectFeaturedNote" @update:value="onChangeInjectFeaturedNote">
{{ $t('showFeaturedNotesInTimeline') }}
</FormSwitch>

View file

@ -15,7 +15,7 @@
<details>
<summary><Fa :icon="faFolderOpen"/> {{ $t('manage') }}</summary>
<MkSelect v-model:value="selectedPluginId">
<option v-for="x in $store.state.deviceUser.plugins" :value="x.id" :key="x.id">{{ x.name }}</option>
<option v-for="x in plugins" :value="x.id" :key="x.id">{{ x.name }}</option>
</MkSelect>
<template v-if="selectedPlugin">
<div style="margin: -8px 0 8px 0;">
@ -55,6 +55,7 @@ import MkSelect from '@/components/ui/select.vue';
import MkInfo from '@/components/ui/info.vue';
import MkSwitch from '@/components/ui/switch.vue';
import * as os from '@/os';
import { ColdDeviceStorage } from '@/store';
export default defineComponent({
components: {
@ -68,6 +69,7 @@ export default defineComponent({
data() {
return {
script: '',
plugins: ColdDeviceStorage.get('plugins'),
selectedPluginId: null,
faPlug, faSave, faTrashAlt, faFolderOpen, faDownload, faCog
}
@ -76,11 +78,22 @@ export default defineComponent({
computed: {
selectedPlugin() {
if (this.selectedPluginId == null) return null;
return this.$store.state.deviceUser.plugins.find(x => x.id === this.selectedPluginId);
return this.plugins.find(x => x.id === this.selectedPluginId);
},
},
methods: {
installPlugin({ id, meta, ast, token }) {
ColdDeviceStorage.set('plugins', this.plugins.concat({
...meta,
id,
active: true,
configData: {},
token: token,
ast: ast
}));
},
async install() {
let ast;
try {
@ -137,7 +150,7 @@ export default defineComponent({
}, 'closed');
});
this.$store.commit('deviceUser/installPlugin', {
this.installPlugin({
id: uuid(),
meta: {
name, version, author, description, permissions, config
@ -154,7 +167,7 @@ export default defineComponent({
},
uninstall() {
this.$store.commit('deviceUser/uninstallPlugin', this.selectedPluginId);
ColdDeviceStorage.set('plugins', this.plugins.filter(x => x.id !== this.selectedPluginId));
os.success();
this.$nextTick(() => {
location.reload();
@ -171,10 +184,9 @@ export default defineComponent({
const { canceled, result } = await os.form(this.selectedPlugin.name, config);
if (canceled) return;
this.$store.commit('deviceUser/configPlugin', {
id: this.selectedPluginId,
config: result
});
const plugins = ColdDeviceStorage.get('plugins');
plugins.find(p => p.id === this.selectedPluginId).configData = result;
ColdDeviceStorage.set('plugins', plugins);
this.$nextTick(() => {
location.reload();
@ -182,10 +194,9 @@ export default defineComponent({
},
changeActive(plugin, active) {
this.$store.commit('deviceUser/changePluginActive', {
id: plugin.id,
active: active
});
const plugins = ColdDeviceStorage.get('plugins');
plugins.find(p => p.id === plugin.id).active = active;
ColdDeviceStorage.set('plugins', plugins);
this.$nextTick(() => {
location.reload();

View file

@ -35,6 +35,7 @@ import FormSelect from '@/components/form/select.vue';
import FormBase from '@/components/form/base.vue';
import FormGroup from '@/components/form/group.vue';
import * as os from '@/os';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
@ -60,27 +61,16 @@ export default defineComponent({
},
computed: {
defaultNoteVisibility: {
get() { return this.$store.state.settings.defaultNoteVisibility; },
set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteVisibility', value }); }
},
defaultNoteLocalOnly: {
get() { return this.$store.state.settings.defaultNoteLocalOnly; },
set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteLocalOnly', value }); }
},
rememberNoteVisibility: {
get() { return this.$store.state.settings.rememberNoteVisibility; },
set(value) { this.$store.dispatch('settings/set', { key: 'rememberNoteVisibility', value }); }
},
defaultNoteVisibility: defaultStore.makeGetterSetter('defaultNoteVisibility'),
defaultNoteLocalOnly: defaultStore.makeGetterSetter('defaultNoteLocalOnly'),
rememberNoteVisibility: defaultStore.makeGetterSetter('rememberNoteVisibility'),
},
created() {
this.isLocked = this.$store.state.i.isLocked;
this.autoAcceptFollowed = this.$store.state.i.autoAcceptFollowed;
this.noCrawle = this.$store.state.i.noCrawle;
this.isExplorable = this.$store.state.i.isExplorable;
this.isLocked = this.$i.isLocked;
this.autoAcceptFollowed = this.$i.autoAcceptFollowed;
this.noCrawle = this.$i.noCrawle;
this.isExplorable = this.$i.isExplorable;
},
mounted() {

View file

@ -1,8 +1,8 @@
<template>
<FormBase>
<FormGroup>
<div class="_formItem _formPanel llvierxe" :style="{ backgroundImage: $store.state.i.bannerUrl ? `url(${ $store.state.i.bannerUrl })` : null }">
<MkAvatar class="avatar" :user="$store.state.i"/>
<div class="_formItem _formPanel llvierxe" :style="{ backgroundImage: $i.bannerUrl ? `url(${ $i.bannerUrl })` : null }">
<MkAvatar class="avatar" :user="$i"/>
</div>
<FormButton @click="changeAvatar" primary>{{ $t('_profile.changeAvatar') }}</FormButton>
<FormButton @click="changeBanner" primary>{{ $t('_profile.changeBanner') }}</FormButton>
@ -100,24 +100,24 @@ export default defineComponent({
},
created() {
this.name = this.$store.state.i.name;
this.description = this.$store.state.i.description;
this.location = this.$store.state.i.location;
this.birthday = this.$store.state.i.birthday;
this.avatarId = this.$store.state.i.avatarId;
this.bannerId = this.$store.state.i.bannerId;
this.isBot = this.$store.state.i.isBot;
this.isCat = this.$store.state.i.isCat;
this.alwaysMarkNsfw = this.$store.state.i.alwaysMarkNsfw;
this.name = this.$i.name;
this.description = this.$i.description;
this.location = this.$i.location;
this.birthday = this.$i.birthday;
this.avatarId = this.$i.avatarId;
this.bannerId = this.$i.bannerId;
this.isBot = this.$i.isBot;
this.isCat = this.$i.isCat;
this.alwaysMarkNsfw = this.$i.alwaysMarkNsfw;
this.fieldName0 = this.$store.state.i.fields[0] ? this.$store.state.i.fields[0].name : null;
this.fieldValue0 = this.$store.state.i.fields[0] ? this.$store.state.i.fields[0].value : null;
this.fieldName1 = this.$store.state.i.fields[1] ? this.$store.state.i.fields[1].name : null;
this.fieldValue1 = this.$store.state.i.fields[1] ? this.$store.state.i.fields[1].value : null;
this.fieldName2 = this.$store.state.i.fields[2] ? this.$store.state.i.fields[2].name : null;
this.fieldValue2 = this.$store.state.i.fields[2] ? this.$store.state.i.fields[2].value : null;
this.fieldName3 = this.$store.state.i.fields[3] ? this.$store.state.i.fields[3].name : null;
this.fieldValue3 = this.$store.state.i.fields[3] ? this.$store.state.i.fields[3].value : null;
this.fieldName0 = this.$i.fields[0] ? this.$i.fields[0].name : null;
this.fieldValue0 = this.$i.fields[0] ? this.$i.fields[0].value : null;
this.fieldName1 = this.$i.fields[1] ? this.$i.fields[1].name : null;
this.fieldValue1 = this.$i.fields[1] ? this.$i.fields[1].value : null;
this.fieldName2 = this.$i.fields[2] ? this.$i.fields[2].name : null;
this.fieldValue2 = this.$i.fields[2] ? this.$i.fields[2].value : null;
this.fieldName3 = this.$i.fields[3] ? this.$i.fields[3].name : null;
this.fieldValue3 = this.$i.fields[3] ? this.$i.fields[3].value : null;
},
mounted() {
@ -227,10 +227,10 @@ export default defineComponent({
alwaysMarkNsfw: !!this.alwaysMarkNsfw,
}).then(i => {
this.saving = false;
this.$store.state.i.avatarId = i.avatarId;
this.$store.state.i.avatarUrl = i.avatarUrl;
this.$store.state.i.bannerId = i.bannerId;
this.$store.state.i.bannerUrl = i.bannerUrl;
this.$i.avatarId = i.avatarId;
this.$i.avatarUrl = i.avatarUrl;
this.$i.bannerId = i.bannerId;
this.$i.bannerUrl = i.bannerUrl;
if (notify) {
os.success();

View file

@ -43,8 +43,8 @@ import FormInput from '@/components/form/input.vue';
import FormRadios from '@/components/form/radios.vue';
import FormBase from '@/components/form/base.vue';
import FormButton from '@/components/form/button.vue';
import { defaultSettings } from '@/store';
import * as os from '@/os';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
@ -67,24 +67,14 @@ export default defineComponent({
handler: this.preview
}
},
reactions: JSON.parse(JSON.stringify(this.$store.state.settings.reactions)),
reactions: JSON.parse(JSON.stringify(this.$store.state.reactions)),
faLaugh, faSave, faEye, faUndo, faPlus
}
},
computed: {
useFullReactionPicker: {
get() { return this.$store.state.device.useFullReactionPicker; },
set(value) { this.$store.commit('device/set', { key: 'useFullReactionPicker', value: value }); }
},
reactionPickerWidth: {
get() { return this.$store.state.device.reactionPickerWidth; },
set(value) { this.$store.commit('device/set', { key: 'reactionPickerWidth', value: value }); }
},
reactionPickerHeight: {
get() { return this.$store.state.device.reactionPickerHeight; },
set(value) { this.$store.commit('device/set', { key: 'reactionPickerHeight', value: value }); }
},
reactionPickerWidth: defaultStore.makeGetterSetter('reactionPickerWidth'),
reactionPickerHeight: defaultStore.makeGetterSetter('reactionPickerHeight'),
},
watch: {
@ -102,7 +92,7 @@ export default defineComponent({
methods: {
save() {
this.$store.dispatch('settings/set', { key: 'reactions', value: this.reactions });
this.$store.set('reactions', this.reactions);
},
remove(reaction, ev) {
@ -129,7 +119,7 @@ export default defineComponent({
});
if (canceled) return;
this.reactions = JSON.parse(JSON.stringify(defaultSettings.reactions));
this.reactions = JSON.parse(JSON.stringify(this.$store.def.reactions.default));
},
chooseEmoji(ev) {

View file

@ -1,75 +0,0 @@
<template>
<div>
<div class="_section">
<MkInfo warn>{{ $t('editTheseSettingsMayBreakAccount') }}</MkInfo>
</div>
<div class="_section">
<div class="_title">Account</div>
<div class="_content">
<MkTextarea v-model:value="settings" code tall></MkTextarea>
<!--<MkButton @click="saveSettings">Save</MkButton>-->
</div>
</div>
<div class="_section">
<div class="_title">Device</div>
<div class="_content">
<MkTextarea v-model:value="deviceSettings" code tall></MkTextarea>
<MkButton @click="saveDeviceSettings">Save</MkButton>
</div>
</div>
<div class="_section">
<div class="_title">Device (per account)</div>
<div class="_content">
<MkTextarea v-model:value="deviceUserSettings" code tall></MkTextarea>
<MkButton @click="saveDeviceUserSettings">Save</MkButton>
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { faCode } from '@fortawesome/free-solid-svg-icons';
import * as JSON5 from 'json5';
import MkInfo from '@/components/ui/info.vue';
import MkButton from '@/components/ui/button.vue';
import MkTextarea from '@/components/ui/textarea.vue';
import * as os from '@/os';
export default defineComponent({
components: {
MkInfo, MkButton, MkTextarea
},
emits: ['info'],
data() {
return {
INFO: {
title: 'RegEdit',
icon: faCode
},
settings: JSON5.stringify(this.$store.state.settings, null, '\t'),
deviceSettings: JSON5.stringify(this.$store.state.device, null, '\t'),
deviceUserSettings: JSON5.stringify(this.$store.state.deviceUser, null, '\t'),
};
},
mounted() {
this.$emit('info', this.INFO);
},
methods: {
saveDeviceSettings() {
const obj = JSON5.parse(this.deviceSettings);
this.$store.commit('device/overwrite', obj);
},
saveDeviceUserSettings() {
const obj = JSON5.parse(this.deviceUserSettings);
this.$store.commit('deviceUser/overwrite', obj);
},
}
});
</script>

View file

@ -26,9 +26,9 @@ import FormRadios from '@/components/form/radios.vue';
import FormBase from '@/components/form/base.vue';
import FormGroup from '@/components/form/group.vue';
import FormButton from '@/components/form/button.vue';
import { defaultDeviceUserSettings } from '@/store';
import * as os from '@/os';
import { sidebarDef } from '@/sidebar';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
@ -57,14 +57,11 @@ export default defineComponent({
return this.items.trim().split('\n').filter(x => x.trim() !== '');
},
sidebarDisplay: {
get() { return this.$store.state.device.sidebarDisplay; },
set(value) { this.$store.commit('device/set', { key: 'sidebarDisplay', value }); }
},
sidebarDisplay: defaultStore.makeGetterSetter('sidebarDisplay')
},
created() {
this.items = this.$store.state.deviceUser.menu.join('\n');
this.items = this.$store.state.menu.join('\n');
},
mounted() {
@ -73,7 +70,7 @@ export default defineComponent({
methods: {
async addItem() {
const menu = Object.keys(this.menuDef).filter(k => !this.$store.state.deviceUser.menu.includes(k));
const menu = Object.keys(this.menuDef).filter(k => !this.$store.state.menu.includes(k));
const { canceled, result: item } = await os.dialog({
type: null,
title: this.$t('addItem'),
@ -92,12 +89,12 @@ export default defineComponent({
},
save() {
this.$store.commit('deviceUser/setMenu', this.splited);
this.$store.set('menu', this.splited);
},
reset() {
this.$store.commit('deviceUser/setMenu', defaultDeviceUserSettings.menu);
this.items = this.$store.state.deviceUser.menu.join('\n');
this.$store.reset('menu');
this.items = this.$store.state.menu.join('\n');
},
},
});

View file

@ -26,7 +26,7 @@ import FormBase from '@/components/form/base.vue';
import FormButton from '@/components/form/button.vue';
import FormGroup from '@/components/form/group.vue';
import * as os from '@/os';
import { device, defaultDeviceSettings } from '@/cold-storage';
import { ColdDeviceStorage } from '@/store';
import { playFile } from '@/scripts/sound';
const soundsTypes = [
@ -79,8 +79,8 @@ export default defineComponent({
computed: {
masterVolume: { // TODO: ()computed使
get() { return device.get('sound_masterVolume'); },
set(value) { device.set('sound_masterVolume', value); }
get() { return ColdDeviceStorage.get('sound_masterVolume'); },
set(value) { ColdDeviceStorage.set('sound_masterVolume', value); }
},
volumeIcon() {
return this.masterVolume === 0 ? faVolumeMute : faVolumeUp;
@ -88,15 +88,15 @@ export default defineComponent({
},
created() {
this.sounds.note = device.get('sound_note');
this.sounds.noteMy = device.get('sound_noteMy');
this.sounds.notification = device.get('sound_notification');
this.sounds.chat = device.get('sound_chat');
this.sounds.chatBg = device.get('sound_chatBg');
this.sounds.antenna = device.get('sound_antenna');
this.sounds.channel = device.get('sound_channel');
this.sounds.reversiPutBlack = device.get('sound_reversiPutBlack');
this.sounds.reversiPutWhite = device.get('sound_reversiPutWhite');
this.sounds.note = ColdDeviceStorage.get('sound_note');
this.sounds.noteMy = ColdDeviceStorage.get('sound_noteMy');
this.sounds.notification = ColdDeviceStorage.get('sound_notification');
this.sounds.chat = ColdDeviceStorage.get('sound_chat');
this.sounds.chatBg = ColdDeviceStorage.get('sound_chatBg');
this.sounds.antenna = ColdDeviceStorage.get('sound_antenna');
this.sounds.channel = ColdDeviceStorage.get('sound_channel');
this.sounds.reversiPutBlack = ColdDeviceStorage.get('sound_reversiPutBlack');
this.sounds.reversiPutWhite = ColdDeviceStorage.get('sound_reversiPutWhite');
},
mounted() {
@ -138,14 +138,14 @@ export default defineComponent({
volume: result.volume,
};
device.set('sound_' + type, v);
ColdDeviceStorage.set('sound_' + type, v);
this.sounds[type] = v;
},
reset() {
for (const sound of Object.keys(this.sounds)) {
const v = defaultDeviceSettings['sound_' + sound];
device.set('sound_' + sound, v);
const v = ColdDeviceStorage.default['sound_' + sound];
ColdDeviceStorage.set('sound_' + sound, v);
this.sounds[sound] = v;
}
}

View file

@ -24,6 +24,7 @@ import FormLink from '@/components/form/link.vue';
import FormButton from '@/components/form/button.vue';
import { applyTheme, validateTheme } from '@/scripts/theme';
import * as os from '@/os';
import { ColdDeviceStorage } from '@/store';
export default defineComponent({
components: {
@ -73,7 +74,7 @@ export default defineComponent({
});
return false;
}
if (this.$store.state.device.themes.some(t => t.id === theme.id)) {
if (ColdDeviceStorage.get('themes').some(t => t.id === theme.id)) {
os.dialog({
type: 'info',
text: this.$t('_theme.alreadyInstalled')
@ -92,10 +93,8 @@ export default defineComponent({
install(code) {
const theme = this.parseThemeCode(code);
if (!theme) return;
const themes = this.$store.state.device.themes.concat(theme);
this.$store.commit('device/set', {
key: 'themes', value: themes
});
const themes = ColdDeviceStorage.get('themes').concat(theme);
ColdDeviceStorage.set('themes', themes);
os.dialog({
type: 'success',
text: this.$t('_theme.installed', { name: theme.name })

View file

@ -34,6 +34,7 @@ import FormButton from '@/components/form/button.vue';
import { Theme, builtinThemes } from '@/scripts/theme';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import * as os from '@/os';
import { ColdDeviceStorage } from '@/store';
export default defineComponent({
components: {
@ -54,6 +55,7 @@ export default defineComponent({
title: this.$t('_theme.manage'),
icon: faFolderOpen
},
installedThemes: ColdDeviceStorage.ref('themes'),
builtinThemes,
selectedThemeId: null,
faPalette, faDownload, faFolderOpen, faCheck, faTrashAlt, faEye
@ -62,11 +64,7 @@ export default defineComponent({
computed: {
themes(): Theme[] {
return builtinThemes.concat(this.$store.state.device.themes);
},
installedThemes(): Theme[] {
return this.$store.state.device.themes;
return this.builtinThemes.concat(this.installedThemes.value);
},
selectedTheme() {
@ -92,10 +90,8 @@ export default defineComponent({
uninstall() {
const theme = this.selectedTheme;
const themes = this.$store.state.device.themes.filter(t => t.id != theme.id);
this.$store.commit('device/set', {
key: 'themes', value: themes
});
const themes = ColdDeviceStorage.get('themes').filter(t => t.id != theme.id);
ColdDeviceStorage.set('themes', themes);
os.success();
},
}

View file

@ -60,25 +60,25 @@
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { computed, defineComponent, onMounted, ref, watch } from 'vue';
import { faPalette, faDownload, faFolderOpen, faCheck, faTrashAlt, faEye } from '@fortawesome/free-solid-svg-icons';
import FormSwitch from '@/components/form/switch.vue';
import FormSelect from '@/components/form/select.vue';
import FormRadios from '@/components/form/radios.vue';
import FormBase from '@/components/form/base.vue';
import FormGroup from '@/components/form/group.vue';
import FormLink from '@/components/form/link.vue';
import FormButton from '@/components/form/button.vue';
import { Theme, builtinThemes, applyTheme } from '@/scripts/theme';
import { builtinThemes, applyTheme } from '@/scripts/theme';
import { selectFile } from '@/scripts/select-file';
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode';
import * as os from '@/os';
import { ColdDeviceStorage } from '@/store';
import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
FormSwitch,
FormSelect,
FormRadios,
FormBase,
FormGroup,
FormLink,
@ -86,96 +86,70 @@ export default defineComponent({
},
emits: ['info'],
data() {
return {
INFO: {
title: this.$t('theme'),
icon: faPalette
},
builtinThemes,
wallpaper: localStorage.getItem('wallpaper'),
faPalette, faDownload, faFolderOpen, faCheck, faTrashAlt, faEye
}
},
computed: {
themes(): Theme[] {
return builtinThemes.concat(this.$store.state.device.themes);
},
setup(props, { emit }) {
const INFO = {
title: i18n.global.t('theme'),
icon: faPalette
};
installedThemes(): Theme[] {
return this.$store.state.device.themes;
},
darkThemes(): Theme[] {
return this.themes.filter(t => t.base == 'dark' || t.kind == 'dark');
},
const installedThemes = ColdDeviceStorage.ref('themes');
const themes = computed(() => builtinThemes.concat(installedThemes.value));
const darkThemes = computed(() => themes.value.filter(t => t.base == 'dark' || t.kind == 'dark'));
const lightThemes = computed(() => themes.value.filter(t => t.base == 'light' || t.kind == 'light'));
const darkTheme = computed(ColdDeviceStorage.makeGetterSetter('darkTheme'));
const lightTheme = computed(ColdDeviceStorage.makeGetterSetter('lightTheme'));
const darkMode = computed(defaultStore.makeGetterSetter('darkMode'));
const syncDeviceDarkMode = computed(ColdDeviceStorage.makeGetterSetter('syncDeviceDarkMode'));
const wallpaper = ref(localStorage.getItem('wallpaper'));
lightThemes(): Theme[] {
return this.themes.filter(t => t.base == 'light' || t.kind == 'light');
},
darkTheme: {
get() { return this.$store.state.device.darkTheme; },
set(value) { this.$store.commit('device/set', { key: 'darkTheme', value }); }
},
lightTheme: {
get() { return this.$store.state.device.lightTheme; },
set(value) { this.$store.commit('device/set', { key: 'lightTheme', value }); }
},
darkMode: {
get() { return this.$store.state.device.darkMode; },
set(value) { this.$store.commit('device/set', { key: 'darkMode', value }); }
},
syncDeviceDarkMode: {
get() { return this.$store.state.device.syncDeviceDarkMode; },
set(value) { this.$store.commit('device/set', { key: 'syncDeviceDarkMode', value }); }
},
},
watch: {
darkTheme() {
if (this.$store.state.device.darkMode) {
applyTheme(this.themes.find(x => x.id === this.darkTheme));
watch(darkTheme, () => {
if (defaultStore.state.darkMode) {
applyTheme(themes.value.find(x => x.id === darkTheme.value));
}
},
});
lightTheme() {
if (!this.$store.state.device.darkMode) {
applyTheme(this.themes.find(x => x.id === this.lightTheme));
watch(lightTheme, () => {
if (!defaultStore.state.darkMode) {
applyTheme(themes.value.find(x => x.id === lightTheme.value));
}
},
});
syncDeviceDarkMode() {
if (this.$store.state.device.syncDeviceDarkMode) {
this.$store.commit('device/set', { key: 'darkMode', value: isDeviceDarkmode() });
watch(syncDeviceDarkMode, () => {
if (syncDeviceDarkMode) {
defaultStore.set('darkMode', isDeviceDarkmode());
}
},
});
wallpaper() {
if (this.wallpaper == null) {
watch(wallpaper, () => {
if (wallpaper.value == null) {
localStorage.removeItem('wallpaper');
} else {
localStorage.setItem('wallpaper', this.wallpaper);
localStorage.setItem('wallpaper', wallpaper.value);
}
location.reload();
}
},
});
mounted() {
this.$emit('info', this.INFO);
},
onMounted(() => {
emit('info', INFO);
});
methods: {
setWallpaper(e) {
selectFile(e.currentTarget || e.target, null, false).then(file => {
this.wallpaper = file.url;
});
},
return {
INFO,
darkThemes,
lightThemes,
darkTheme,
lightTheme,
darkMode,
syncDeviceDarkMode,
wallpaper,
setWallpaper(e) {
selectFile(e.currentTarget || e.target, null, false).then(file => {
wallpaper.value = file.url;
});
},
faPalette, faDownload, faFolderOpen, faCheck, faTrashAlt, faEye
};
}
});
</script>

View file

@ -85,8 +85,8 @@ export default defineComponent({
},
async created() {
this.softMutedWords = this.$store.state.settings.mutedWords.map(x => x.join(' ')).join('\n');
this.hardMutedWords = this.$store.state.i.mutedWords.map(x => x.join(' ')).join('\n');
this.softMutedWords = this.$store.state.mutedWords.map(x => x.join(' ')).join('\n');
this.hardMutedWords = this.$i.mutedWords.map(x => x.join(' ')).join('\n');
this.hardWordMutedNotesCount = (await os.api('i/get-word-muted-notes-count', {})).count;
},
@ -97,7 +97,7 @@ export default defineComponent({
methods: {
async save() {
this.$store.dispatch('settings/set', { key: 'mutedWords', value: this.softMutedWords.trim().split('\n').map(x => x.trim().split(' ')) });
this.$store.set('mutedWords', this.softMutedWords.trim().split('\n').map(x => x.trim().split(' ')));
await os.api('i/update', {
mutedWords: this.hardMutedWords.trim().split('\n').map(x => x.trim().split(' ')),
});

View file

@ -252,7 +252,7 @@ export default defineComponent({
},
resetTutorial() {
this.$store.dispatch('settings/set', { key: 'tutorial', value: 0 });
this.$store.set('tutorial', 0);
},
}
});

View file

@ -107,6 +107,7 @@ import { convertToMisskeyTheme, ThemeValue, convertToViewModel, ThemeViewModel }
import { Theme, applyTheme, lightTheme, darkTheme, themeProps, validateTheme } from '@/scripts/theme';
import { host } from '@/config';
import * as os from '@/os';
import { ColdDeviceStorage } from '@/store';
export default defineComponent({
components: {
@ -128,7 +129,7 @@ export default defineComponent({
name: '',
description: '',
baseTheme: 'light' as 'dark' | 'light',
author: `@${this.$store.state.i.username}@${toUnicode(host)}`,
author: `@${this.$i.username}@${toUnicode(host)}`,
themeToImport: '',
changed: false,
lightTheme, darkTheme, themeProps,
@ -211,10 +212,8 @@ export default defineComponent({
save() {
const theme = convertToMisskeyTheme(this.theme, this.name, this.description, this.author, this.baseTheme);
const themes = this.$store.state.device.themes.concat(theme);
this.$store.commit('device/set', {
key: 'themes', value: themes
});
const themes = ColdDeviceStorage.get('themes').concat(theme);
ColdDeviceStorage.set('themes', themes);
os.dialog({
type: 'success',
text: this.$t('_theme.installed', { name: theme.name })

View file

@ -83,8 +83,8 @@ export default defineComponent({
computed: {
tutorial: {
get() { return this.$store.state.settings.tutorial || 0; },
set(value) { this.$store.dispatch('settings/set', { key: 'tutorial', value }); }
get() { return this.$store.reactiveState.tutorial.value || 0; },
set(value) { this.$store.set('tutorial', value); }
},
},
});

View file

@ -3,8 +3,8 @@
<div class="new" v-if="queue > 0" :style="{ width: width + 'px' }"><button class="_buttonPrimary" @click="top()">{{ $t('newNoteRecived') }}</button></div>
<div class="_section">
<XTutorial v-if="$store.state.settings.tutorial != -1" class="tutorial _content _vMargin"/>
<XPostForm v-if="$store.state.device.showFixedPostForm" class="post-form _panel _content _vMargin" fixed/>
<XTutorial v-if="$store.reactiveState.tutorial.value != -1" class="tutorial _content _vMargin"/>
<XPostForm v-if="$store.reactiveState.showFixedPostForm.value" class="post-form _panel _content _vMargin" fixed/>
<XTimeline ref="tl"
class="_content _vMargin"
:key="src === 'list' ? `list:${list.id}` : src === 'antenna' ? `antenna:${antenna.id}` : src === 'channel' ? `channel:${channel.id}` : src"
@ -59,7 +59,7 @@ export default defineComponent({
selected: computed(() => this.src === 'home')
}];
if (!this.$store.state.instance.meta.disableLocalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin) {
if (!this.$instance.disableLocalTimeline || this.$i.isModerator || this.$i.isAdmin) {
tabs.push({
id: 'local',
title: null,
@ -79,7 +79,7 @@ export default defineComponent({
});
}
if (!this.$store.state.instance.meta.disableGlobalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin) {
if (!this.$instance.disableGlobalTimeline || this.$i.isModerator || this.$i.isAdmin) {
tabs.push({
id: 'global',
title: null,
@ -95,7 +95,7 @@ export default defineComponent({
title: null,
icon: faEllipsisH,
onClick: this.choose,
indicate: computed(() => this.$store.state.i.hasUnreadAntenna || this.$store.state.i.hasUnreadChannel)
indicate: computed(() => this.$i.hasUnreadAntenna || this.$i.hasUnreadChannel)
});
return {
@ -118,7 +118,7 @@ export default defineComponent({
},
meta() {
return this.$store.state.instance.meta;
return this.$instance;
},
},
@ -144,13 +144,13 @@ export default defineComponent({
},
created() {
this.src = this.$store.state.deviceUser.tl.src;
this.src = this.$store.state.tl.src;
if (this.src === 'list') {
this.list = this.$store.state.deviceUser.tl.arg;
this.list = this.$store.state.tl.arg;
} else if (this.src === 'antenna') {
this.antenna = this.$store.state.deviceUser.tl.arg;
this.antenna = this.$store.state.tl.arg;
} else if (this.src === 'channel') {
this.channel = this.$store.state.deviceUser.tl.arg;
this.channel = this.$store.state.tl.arg;
}
},
@ -218,7 +218,7 @@ export default defineComponent({
},
saveSrc() {
this.$store.commit('deviceUser/setTl', {
this.$store.set('tl', {
src: this.src,
arg:
this.src === 'list' ? this.list :

View file

@ -51,7 +51,7 @@ export default defineComponent({
os.api('users/notes', {
userId: this.user.id,
fileType: image,
excludeNsfw: this.$store.state.device.nsfw !== 'ignore',
excludeNsfw: this.$store.state.nsfw !== 'ignore',
limit: 9,
}).then(notes => {
for (const note of notes) {
@ -69,7 +69,7 @@ export default defineComponent({
},
methods: {
thumbnail(image: any): string {
return this.$store.state.device.disableShowingAnimatedImages
return this.$store.state.disableShowingAnimatedImages
? getStaticImageUrl(image.thumbnailUrl)
: image.thumbnailUrl;
},

View file

@ -13,7 +13,7 @@
<MkUserName :user="user" :nowrap="false" class="name"/>
<MkAcct :user="user" :detail="true" class="acct"/>
</div>
<div class="followed" v-if="$store.getters.isSignedIn && $store.state.i.id != user.id && user.isFollowed"><span>{{ $t('followsYou') }}</span></div>
<div class="followed" v-if="$i && $i.id != user.id && user.isFollowed"><span>{{ $t('followsYou') }}</span></div>
<div class="status">
<MkA :to="userPage(user)" :class="{ active: page === 'index' }">
<b>{{ number(user.notesCount) }}</b>
@ -29,7 +29,7 @@
</MkA>
</div>
<div class="description">
<Mfm v-if="user.description" :text="user.description" :is-note="false" :author="user" :i="$store.state.i" :custom-emojis="user.emojis"/>
<Mfm v-if="user.description" :text="user.description" :is-note="false" :author="user" :i="$i" :custom-emojis="user.emojis"/>
<p v-else class="empty">{{ $t('noAccountDescription') }}</p>
</div>
<div class="fields system">
@ -52,7 +52,7 @@
<Mfm :text="field.name" :plain="true" :custom-emojis="user.emojis" :colored="false"/>
</dt>
<dd class="value">
<Mfm :text="field.value" :author="user" :i="$store.state.i" :custom-emojis="user.emojis" :colored="false"/>
<Mfm :text="field.value" :author="user" :i="$i" :custom-emojis="user.emojis" :colored="false"/>
</dd>
</dl>
</div>
@ -75,7 +75,7 @@
</MkA>
<div class="actions">
<button @click="menu" class="menu _button"><Fa :icon="faEllipsisH"/></button>
<MkFollowButton v-if="!$store.getters.isSignedIn || $store.state.i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true" large class="koudoku"/>
<MkFollowButton v-if="!$i || $i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true" large class="koudoku"/>
</div>
</div>
<template v-if="page === 'index'">
@ -115,10 +115,10 @@
<span v-if="user.isBot" :title="$t('isBot')"><Fa :icon="faRobot"/></span>
</div>
</div>
<span class="followed" v-if="$store.getters.isSignedIn && $store.state.i.id != user.id && user.isFollowed">{{ $t('followsYou') }}</span>
<div class="actions" v-if="$store.getters.isSignedIn">
<span class="followed" v-if="$i && $i.id != user.id && user.isFollowed">{{ $t('followsYou') }}</span>
<div class="actions" v-if="$i">
<button @click="menu" class="menu _button"><Fa :icon="faEllipsisH"/></button>
<MkFollowButton v-if="$store.state.i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true" class="koudoku"/>
<MkFollowButton v-if="$i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true" class="koudoku"/>
</div>
</div>
<MkAvatar class="avatar" :user="user" :disable-preview="true"/>
@ -133,7 +133,7 @@
</div>
</div>
<div class="description">
<Mfm v-if="user.description" :text="user.description" :is-note="false" :author="user" :i="$store.state.i" :custom-emojis="user.emojis"/>
<Mfm v-if="user.description" :text="user.description" :is-note="false" :author="user" :i="$i" :custom-emojis="user.emojis"/>
<p v-else class="empty">{{ $t('noAccountDescription') }}</p>
</div>
<div class="fields system">
@ -156,7 +156,7 @@
<Mfm :text="field.name" :plain="true" :custom-emojis="user.emojis" :colored="false"/>
</dt>
<dd class="value">
<Mfm :text="field.value" :author="user" :i="$store.state.i" :custom-emojis="user.emojis" :colored="false"/>
<Mfm :text="field.value" :author="user" :i="$i" :custom-emojis="user.emojis" :colored="false"/>
</dd>
</dl>
</div>

View file

@ -26,6 +26,7 @@ import MkButton from '@/components/ui/button.vue';
import MkInput from '@/components/ui/input.vue';
import { host } from '@/config';
import * as os from '@/os';
import { login } from '@/account';
export default defineComponent({
components: {
@ -52,8 +53,7 @@ export default defineComponent({
username: this.username,
password: this.password,
}).then(res => {
localStorage.setItem('i', res.token);
location.href = '/';
login(res.i);
}).catch(() => {
this.submitting = false;