Merge branch 'develop' into schedule-note

This commit is contained in:
かっこかり 2023-11-10 19:27:44 +09:00 committed by GitHub
commit fa3007e0dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 70 additions and 43 deletions

View File

@ -9,3 +9,9 @@ body:
description: Tell us what the suggestion is description: Tell us what the suggestion is
validations: validations:
required: true required: true
- type: textarea
attributes:
label: Purpose
description: Describe the specific problem or need you think this feature will solve, and who it will help.
validations:
required: true

View File

@ -29,7 +29,7 @@
"@vue/compiler-sfc": "3.3.7", "@vue/compiler-sfc": "3.3.7",
"astring": "1.8.6", "astring": "1.8.6",
"autosize": "6.0.1", "autosize": "6.0.1",
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.5", "aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.6",
"broadcast-channel": "6.0.0", "broadcast-channel": "6.0.0",
"browser-image-resizer": "github:misskey-dev/browser-image-resizer#v2.2.1-misskey.3", "browser-image-resizer": "github:misskey-dev/browser-image-resizer#v2.2.1-misskey.3",
"buraha": "0.0.1", "buraha": "0.0.1",

View File

@ -8,7 +8,7 @@ import { common } from './common.js';
import { version, ui, lang, updateLocale } from '@/config.js'; import { version, ui, lang, updateLocale } from '@/config.js';
import { i18n, updateI18n } from '@/i18n.js'; import { i18n, updateI18n } from '@/i18n.js';
import { confirm, alert, post, popup, toast } from '@/os.js'; import { confirm, alert, post, popup, toast } from '@/os.js';
import { useStream, isReloading } from '@/stream.js'; import { useStream } from '@/stream.js';
import * as sound from '@/scripts/sound.js'; import * as sound from '@/scripts/sound.js';
import { $i, refreshAccount, login, updateAccount, signout } from '@/account.js'; import { $i, refreshAccount, login, updateAccount, signout } from '@/account.js';
import { defaultStore, ColdDeviceStorage } from '@/store.js'; import { defaultStore, ColdDeviceStorage } from '@/store.js';
@ -39,7 +39,6 @@ export async function mainBoot() {
let reloadDialogShowing = false; let reloadDialogShowing = false;
stream.on('_disconnected_', async () => { stream.on('_disconnected_', async () => {
if (isReloading) return;
if (defaultStore.state.serverDisconnectedBehavior === 'reload') { if (defaultStore.state.serverDisconnectedBehavior === 'reload') {
location.reload(); location.reload();
} else if (defaultStore.state.serverDisconnectedBehavior === 'dialog') { } else if (defaultStore.state.serverDisconnectedBehavior === 'dialog') {

View File

@ -96,6 +96,10 @@ onUnmounted(() => {
onDeactivated(() => { onDeactivated(() => {
if (connection) connection.dispose(); if (connection) connection.dispose();
}); });
defineExpose({
reload,
});
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View File

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, provide, onUnmounted } from 'vue'; import { computed, provide, onUnmounted } from 'vue';
import MkNotes from '@/components/MkNotes.vue'; import MkNotes from '@/components/MkNotes.vue';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue'; import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import { useStream, reloadStream } from '@/stream.js'; import { useStream } from '@/stream.js';
import * as sound from '@/scripts/sound.js'; import * as sound from '@/scripts/sound.js';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
@ -201,7 +201,6 @@ function reloadTimeline() {
tlNotesCount = 0; tlNotesCount = 0;
tlComponent.pagingComponent?.reload().then(() => { tlComponent.pagingComponent?.reload().then(() => {
reloadStream();
res(); res();
}); });
}); });

View File

@ -9,9 +9,6 @@ import { $i } from '@/account.js';
import { url } from '@/config.js'; import { url } from '@/config.js';
let stream: Misskey.Stream | null = null; let stream: Misskey.Stream | null = null;
let timeoutHeartBeat: number | null = null;
export let isReloading: boolean = false;
export function useStream(): Misskey.Stream { export function useStream(): Misskey.Stream {
if (stream) return stream; if (stream) return stream;
@ -20,20 +17,7 @@ export function useStream(): Misskey.Stream {
token: $i.token, token: $i.token,
} : null)); } : null));
timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60); window.setTimeout(heartbeat, 1000 * 60);
return stream;
}
export function reloadStream() {
if (!stream) return useStream();
if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
isReloading = true;
stream.close();
stream.once('_connected_', () => isReloading = false);
stream.stream.reconnect();
timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60);
return stream; return stream;
} }
@ -42,5 +26,5 @@ function heartbeat(): void {
if (stream != null && document.visibilityState === 'visible') { if (stream != null && document.visibilityState === 'visible') {
stream.heartbeat(); stream.heartbeat();
} }
timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60); window.setTimeout(heartbeat, 1000 * 60);
} }

View File

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { onUnmounted } from 'vue'; import { onUnmounted } from 'vue';
import { useStream, isReloading } from '@/stream.js'; import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -26,7 +26,6 @@ const zIndex = os.claimZIndex('high');
let hasDisconnected = $ref(false); let hasDisconnected = $ref(false);
function onDisconnected() { function onDisconnected() {
if (isReloading) return;
hasDisconnected = true; hasDisconnected = true;
} }

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<XColumn :menu="menu" :column="column" :isStacked="isStacked"> <XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="() => timeline.reloadTimeline()">
<template #header> <template #header>
<i class="ti ti-antenna"></i><span style="margin-left: 8px;">{{ column.name }}</span> <i class="ti ti-antenna"></i><span style="margin-left: 8px;">{{ column.name }}</span>
</template> </template>

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<XColumn :menu="menu" :column="column" :isStacked="isStacked"> <XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="() => timeline.reloadTimeline()">
<template #header> <template #header>
<i class="ti ti-device-tv"></i><span style="margin-left: 8px;">{{ column.name }}</span> <i class="ti ti-device-tv"></i><span style="margin-left: 8px;">{{ column.name }}</span>
</template> </template>

View File

@ -57,6 +57,7 @@ const props = withDefaults(defineProps<{
isStacked?: boolean; isStacked?: boolean;
naked?: boolean; naked?: boolean;
menu?: MenuItem[]; menu?: MenuItem[];
refresher?: () => Promise<void>;
}>(), { }>(), {
isStacked: false, isStacked: false,
naked: false, naked: false,
@ -183,6 +184,18 @@ function getMenu() {
items = props.menu.concat(items); items = props.menu.concat(items);
} }
if (props.refresher) {
items = [{
icon: 'ti ti-refresh',
text: i18n.ts.reload,
action: () => {
if (props.refresher) {
props.refresher();
}
},
}, ...items];
}
return items; return items;
} }

View File

@ -4,10 +4,10 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<XColumn :column="column" :isStacked="isStacked"> <XColumn :column="column" :isStacked="isStacked" :refresher="() => reloadTimeline()">
<template #header><i class="ti ti-mail" style="margin-right: 8px;"></i>{{ column.name }}</template> <template #header><i class="ti ti-mail" style="margin-right: 8px;"></i>{{ column.name }}</template>
<MkNotes :pagination="pagination"/> <MkNotes ref="tlComponent" :pagination="pagination"/>
</XColumn> </XColumn>
</template> </template>
@ -29,4 +29,14 @@ const pagination = {
visibility: 'specified', visibility: 'specified',
}, },
}; };
const tlComponent: InstanceType<typeof MkNotes> = $ref();
function reloadTimeline() {
return new Promise<void>((res) => {
tlComponent.pagingComponent?.reload().then(() => {
res();
});
});
}
</script> </script>

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<XColumn :menu="menu" :column="column" :isStacked="isStacked"> <XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="() => timeline.reloadTimeline()">
<template #header> <template #header>
<i class="ti ti-list"></i><span style="margin-left: 8px;">{{ column.name }}</span> <i class="ti ti-list"></i><span style="margin-left: 8px;">{{ column.name }}</span>
</template> </template>

View File

@ -4,10 +4,10 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<XColumn :column="column" :isStacked="isStacked"> <XColumn :column="column" :isStacked="isStacked" :refresher="() => reloadTimeline()">
<template #header><i class="ti ti-at" style="margin-right: 8px;"></i>{{ column.name }}</template> <template #header><i class="ti ti-at" style="margin-right: 8px;"></i>{{ column.name }}</template>
<MkNotes :pagination="pagination"/> <MkNotes ref="tlComponent" :pagination="pagination"/>
</XColumn> </XColumn>
</template> </template>
@ -22,6 +22,16 @@ defineProps<{
isStacked: boolean; isStacked: boolean;
}>(); }>();
const tlComponent: InstanceType<typeof MkNotes> = $ref();
function reloadTimeline() {
return new Promise<void>((res) => {
tlComponent.pagingComponent?.reload().then(() => {
res();
});
});
}
const pagination = { const pagination = {
endpoint: 'notes/mentions' as const, endpoint: 'notes/mentions' as const,
limit: 10, limit: 10,

View File

@ -4,10 +4,10 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<XColumn :column="column" :isStacked="isStacked" :menu="menu"> <XColumn :column="column" :isStacked="isStacked" :menu="menu" :refresher="() => notificationsComponent.reload()">
<template #header><i class="ti ti-bell" style="margin-right: 8px;"></i>{{ column.name }}</template> <template #header><i class="ti ti-bell" style="margin-right: 8px;"></i>{{ column.name }}</template>
<XNotifications :excludeTypes="props.column.excludeTypes"/> <XNotifications ref="notificationsComponent" :excludeTypes="props.column.excludeTypes"/>
</XColumn> </XColumn>
</template> </template>
@ -24,6 +24,8 @@ const props = defineProps<{
isStacked: boolean; isStacked: boolean;
}>(); }>();
let notificationsComponent = $shallowRef<InstanceType<typeof XNotifications>>();
function func() { function func() {
os.popup(defineAsyncComponent(() => import('@/components/MkNotificationSelectWindow.vue')), { os.popup(defineAsyncComponent(() => import('@/components/MkNotificationSelectWindow.vue')), {
excludeTypes: props.column.excludeTypes, excludeTypes: props.column.excludeTypes,

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<XColumn :menu="menu" :column="column" :isStacked="isStacked"> <XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="() => timeline.reloadTimeline()">
<template #header> <template #header>
<i class="ti ti-badge"></i><span style="margin-left: 8px;">{{ column.name }}</span> <i class="ti ti-badge"></i><span style="margin-left: 8px;">{{ column.name }}</span>
</template> </template>

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<XColumn :menu="menu" :column="column" :isStacked="isStacked"> <XColumn :menu="menu" :column="column" :isStacked="isStacked" :refresher="() => timeline.reloadTimeline()">
<template #header> <template #header>
<i v-if="column.tl === 'home'" class="ti ti-home"></i> <i v-if="column.tl === 'home'" class="ti ti-home"></i>
<i v-else-if="column.tl === 'local'" class="ti ti-planet"></i> <i v-else-if="column.tl === 'local'" class="ti ti-planet"></i>
@ -48,6 +48,7 @@ const props = defineProps<{
}>(); }>();
let disabled = $ref(false); let disabled = $ref(false);
let timeline = $shallowRef<InstanceType<typeof MkTimeline>>();
const isLocalTimelineAvailable = (($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable)); const isLocalTimelineAvailable = (($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable));
const isGlobalTimelineAvailable = (($i == null && instance.policies.gtlAvailable) || ($i != null && $i.policies.gtlAvailable)); const isGlobalTimelineAvailable = (($i == null && instance.policies.gtlAvailable) || ($i != null && $i.policies.gtlAvailable));

View File

@ -1061,7 +1061,7 @@
"💰": ["dollar", "payment", "coins", "sale"], "💰": ["dollar", "payment", "coins", "sale"],
"🪙": ["dollar", "payment", "coins", "sale"], "🪙": ["dollar", "payment", "coins", "sale"],
"💳": ["money", "sales", "dollar", "bill", "payment", "shopping"], "💳": ["money", "sales", "dollar", "bill", "payment", "shopping"],
"🪫": [], "🪪": [],
"💎": ["blue", "ruby", "diamond", "jewelry"], "💎": ["blue", "ruby", "diamond", "jewelry"],
"⚖": ["law", "fairness", "weight"], "⚖": ["law", "fairness", "weight"],
"🧰": ["tools", "diy", "fix", "maintainer", "mechanic"], "🧰": ["tools", "diy", "fix", "maintainer", "mechanic"],

View File

@ -674,8 +674,8 @@ importers:
specifier: 3.3.7 specifier: 3.3.7
version: 3.3.7 version: 3.3.7
aiscript-vscode: aiscript-vscode:
specifier: github:aiscript-dev/aiscript-vscode#v0.0.5 specifier: github:aiscript-dev/aiscript-vscode#v0.0.6
version: github.com/aiscript-dev/aiscript-vscode/a8fa5bb41885391cdb6a6e3165eaa6e4868da86e version: github.com/aiscript-dev/aiscript-vscode/b5a8aa0ad927831a0b867d1c183460a14e6c48cd
astring: astring:
specifier: 1.8.6 specifier: 1.8.6
version: 1.8.6 version: 1.8.6
@ -6931,7 +6931,7 @@ packages:
hasBin: true hasBin: true
peerDependencies: peerDependencies:
'@swc/core': ^1.2.66 '@swc/core': ^1.2.66
chokidar: 3.5.3 chokidar: ^3.5.1
peerDependenciesMeta: peerDependenciesMeta:
chokidar: chokidar:
optional: true optional: true
@ -19784,10 +19784,10 @@ packages:
readable-stream: 3.6.0 readable-stream: 3.6.0
dev: false dev: false
github.com/aiscript-dev/aiscript-vscode/a8fa5bb41885391cdb6a6e3165eaa6e4868da86e: github.com/aiscript-dev/aiscript-vscode/b5a8aa0ad927831a0b867d1c183460a14e6c48cd:
resolution: {tarball: https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/a8fa5bb41885391cdb6a6e3165eaa6e4868da86e} resolution: {tarball: https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/b5a8aa0ad927831a0b867d1c183460a14e6c48cd}
name: aiscript-vscode name: aiscript-vscode
version: 0.0.5 version: 0.0.6
engines: {vscode: ^1.83.0} engines: {vscode: ^1.83.0}
dev: false dev: false