This commit is contained in:
mattyatea 2024-01-06 20:07:23 +09:00
parent 14fb95c798
commit 68aab48f4e
6 changed files with 71 additions and 72 deletions

View File

@ -81,7 +81,7 @@ function del() {
text: i18n.t('deleteAreYouSure', { x: props.avatarDecoration?.name }), text: i18n.t('deleteAreYouSure', { x: props.avatarDecoration?.name }),
}).then(({ canceled }) => { }).then(({ canceled }) => {
if (canceled) return; if (canceled) return;
os.api('admin/avatar-decorations/delete', { id: props.avatarDecoration?.id }).then(() => { misskeyApi('admin/avatar-decorations/delete', { id: props.avatarDecoration?.id }).then(() => {
}); });
}); });

View File

@ -693,7 +693,7 @@ async function isSensitive(Files, isSensitive: boolean) {
if (canceled) return; if (canceled) return;
Files.forEach((file) => { Files.forEach((file) => {
os.api('drive/files/update', { misskeyApi('drive/files/update', {
fileId: file.id, fileId: file.id,
isSensitive, isSensitive,
}); });
@ -708,7 +708,7 @@ async function fileDelete(Files) {
if (canceled) return; if (canceled) return;
Files.forEach((file) => { Files.forEach((file) => {
os.api('drive/files/delete', { misskeyApi('drive/files/delete', {
fileId: file.id, fileId: file.id,
}); });
}); });

View File

@ -3,63 +3,63 @@ SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<button <button
class="_button" v-if="isFollowing"
:class="[$style.root,{[$style.gamingDark]: gaming === 'dark',[$style.gamingLight]: gaming === 'light' class="_button" :class="[$style.root,{[$style.gamingDark]: gaming === 'dark',[$style.gamingLight]: gaming === 'light'
,}]" v-if="isFollowing" ,}]"
@click="onClick" @click="onClick"
> >
<span v-if="props.user.notify === 'none'" :class="[{[$style.gamingDark]: gaming === 'dark',[$style.gamingLight]: gaming === 'light' }] "><i class="ti ti-bell"></i></span> <span v-if="props.user.notify === 'none'" :class="[{[$style.gamingDark]: gaming === 'dark',[$style.gamingLight]: gaming === 'light' }] "><i class="ti ti-bell"></i></span>
<span v-else-if="props.user.notify === 'normal'" :class="[{[$style.gamingDark]: gaming === 'dark',[$style.gamingLight]: gaming === 'light' }]"><i class="ti ti-bell-off"></i></span> <span v-else-if="props.user.notify === 'normal'" :class="[{[$style.gamingDark]: gaming === 'dark',[$style.gamingLight]: gaming === 'light' }]"><i class="ti ti-bell-off"></i></span>
</button> </button>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {computed, onBeforeUnmount, onMounted, ref, watch} from 'vue'; import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import {useStream} from '@/stream.js'; import { useStream } from '@/stream.js';
import {defaultStore} from "@/store.js"; import { defaultStore } from '@/store.js';
let gaming = ref(''); let gaming = ref('');
const gamingMode = computed(defaultStore.makeGetterSetter('gamingMode')); const gamingMode = computed(defaultStore.makeGetterSetter('gamingMode'));
const darkMode = computed(defaultStore.makeGetterSetter('darkMode')); const darkMode = computed(defaultStore.makeGetterSetter('darkMode'));
if (darkMode.value && gamingMode.value == true) { if (darkMode.value && gamingMode.value == true) {
gaming.value = 'dark'; gaming.value = 'dark';
} else if (!darkMode.value && gamingMode.value == true) { } else if (!darkMode.value && gamingMode.value == true) {
gaming.value = 'light'; gaming.value = 'light';
} else { } else {
gaming.value = ''; gaming.value = '';
} }
watch(darkMode, () => { watch(darkMode, () => {
if (darkMode.value && gamingMode.value == true) { if (darkMode.value && gamingMode.value == true) {
gaming.value = 'dark'; gaming.value = 'dark';
} else if (!darkMode.value && gamingMode.value == true) { } else if (!darkMode.value && gamingMode.value == true) {
gaming.value = 'light'; gaming.value = 'light';
} else { } else {
gaming.value = ''; gaming.value = '';
} }
}) });
watch(gamingMode, () => { watch(gamingMode, () => {
if (darkMode.value && gamingMode.value == true) { if (darkMode.value && gamingMode.value == true) {
gaming.value = 'dark'; gaming.value = 'dark';
} else if (!darkMode.value && gamingMode.value == true) { } else if (!darkMode.value && gamingMode.value == true) {
gaming.value = 'light'; gaming.value = 'light';
} else { } else {
gaming.value = ''; gaming.value = '';
} }
}) });
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
user: Misskey.entities.UserDetailed, user: Misskey.entities.UserDetailed,
full?: boolean, full?: boolean,
large?: boolean, large?: boolean,
}>(), { }>(), {
full: false, full: false,
large: false, large: false,
}); });
let isFollowing = ref(props.user.isFollowing); let isFollowing = ref(props.user.isFollowing);
@ -67,47 +67,49 @@ let notify = ref(props.user.notify);
const connection = useStream().useChannel('main'); const connection = useStream().useChannel('main');
if (props.user.isFollowing == null) { if (props.user.isFollowing == null) {
os.api('users/show', { misskeyApi('users/show', {
userId: props.user.id, userId: props.user.id,
}).then(onFollowChange); }).then(onFollowChange);
} }
if (props.user.notify == null) { if (props.user.notify == null) {
os.api('users/show', { misskeyApi('users/show', {
userId: props.user.id, userId: props.user.id,
}).then(onNotifyChange); }).then(onNotifyChange);
} }
function onFollowChange(user: Misskey.entities.UserDetailed) { function onFollowChange(user: Misskey.entities.UserDetailed) {
if (user.id === props.user.id) { if (user.id === props.user.id) {
isFollowing.value = user.isFollowing; isFollowing.value = user.isFollowing;
} }
} }
function onNotifyChange(user: Misskey.entities.UserDetailed) {
if (user.id === props.user.id) {
notify.value = user.notify;
console.log(props.user.notify)
}
}
async function onClick() {
try {
await os.apiWithDialog('following/update', {
userId: props.user.id,
notify: props.user.notify === 'normal' ? 'none' : 'normal',
}).then(() => {
props.user.notify = props.user.notify === 'normal' ? 'none' : 'normal';
});
}finally {
} function onNotifyChange(user: Misskey.entities.UserDetailed) {
if (user.id === props.user.id) {
notify.value = user.notify;
console.log(props.user.notify);
}
}
async function onClick() {
try {
await os.apiWithDialog('following/update', {
userId: props.user.id,
notify: props.user.notify === 'normal' ? 'none' : 'normal',
}).then(() => {
props.user.notify = props.user.notify === 'normal' ? 'none' : 'normal';
});
} finally {
}
} }
onMounted(() => { onMounted(() => {
connection.on('follow', onFollowChange); connection.on('follow', onFollowChange);
connection.on('unfollow', onFollowChange); connection.on('unfollow', onFollowChange);
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
connection.dispose(); connection.dispose();
}); });
</script> </script>
@ -278,10 +280,8 @@ onBeforeUnmount(() => {
} }
} }
.gamingDark { .gamingDark {
color: black; color: black;
@ -292,7 +292,6 @@ onBeforeUnmount(() => {
} }
@-webkit-keyframes AnimationLight { @-webkit-keyframes AnimationLight {
0% { 0% {
background-position: 0% 50% background-position: 0% 50%

View File

@ -101,7 +101,7 @@ import { definePageMetadata } from '@/scripts/page-metadata';
const stats = ref<any>({}); const stats = ref<any>({});
onMounted(() => { onMounted(() => {
os.api('i/stats', { misskeyApi('i/stats', {
userId: $i!.id, userId: $i!.id,
}).then(response => { }).then(response => {
stats.value = response; stats.value = response;

View File

@ -79,11 +79,11 @@ const sendReadMessage = computed(() => pushRegistrationInServer.value?.sendReadM
const userLists = await misskeyApi('users/lists/list'); const userLists = await misskeyApi('users/lists/list');
async function readAllUnreadNotes() { async function readAllUnreadNotes() {
await os.api('i/read-all-unread-notes'); await misskeyApi('i/read-all-unread-notes');
} }
async function readAllNotifications() { async function readAllNotifications() {
await os.api('notifications/mark-all-as-read'); await misskeyApi('notifications/mark-all-as-read');
} }
async function updateReceiveConfig(type, value) { async function updateReceiveConfig(type, value) {

View File

@ -82,14 +82,14 @@ async function MultideleteFile(files: Misskey.entities.DriveFile[] | null) {
if (canceled) return; if (canceled) return;
files.forEach((e)=>{ files.forEach((e)=>{
os.api('drive/files/delete', { misskeyApi('drive/files/delete', {
fileId: e.id, fileId: e.id,
}); });
}) })
} }
function isSensitive(files: Misskey.entities.DriveFile[] | null ,sensitive:boolean) { function isSensitive(files: Misskey.entities.DriveFile[] | null ,sensitive:boolean) {
files.forEach((e)=>{ files.forEach((e)=>{
os.api('drive/files/update', { misskeyApi('drive/files/update', {
fileId: e.id, fileId: e.id,
isSensitive: sensitive, isSensitive: sensitive,
}).catch(err => { }).catch(err => {