enhance: pizzaxでstreamingのuser storage updateイベントを監視して更新 (#8095)
* wip * wip? * ? * streamingのuser storage updateイベントを監視して更新 * 必要な時以外はストレージを更新しない * fix? * wip * fix * fix
This commit is contained in:
@ -53,6 +53,7 @@ import XFolder from './drive.folder.vue';
|
||||
import XFile from './drive.file.vue';
|
||||
import MkButton from './ui/button.vue';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@ -140,7 +141,7 @@ export default defineComponent({
|
||||
});
|
||||
}
|
||||
|
||||
this.connection = markRaw(os.stream.useChannel('drive'));
|
||||
this.connection = markRaw(stream.useChannel('drive'));
|
||||
|
||||
this.connection.on('fileCreated', this.onStreamDriveFileCreated);
|
||||
this.connection.on('fileUpdated', this.onStreamDriveFileUpdated);
|
||||
|
@ -30,6 +30,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@ -71,7 +72,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.connection = markRaw(os.stream.useChannel('main'));
|
||||
this.connection = markRaw(stream.useChannel('main'));
|
||||
|
||||
this.connection.on('follow', this.onFollowChange);
|
||||
this.connection.on('unfollow', this.onFollowChange);
|
||||
|
@ -140,6 +140,7 @@ import { checkWordMute } from '@/scripts/check-word-mute';
|
||||
import { userPage } from '@/filters/user';
|
||||
import { notePage } from '@/filters/note';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
import { noteActions, noteViewInterruptors } from '@/store';
|
||||
import { reactionPicker } from '@/scripts/reaction-picker';
|
||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
|
||||
@ -260,7 +261,7 @@ export default defineComponent({
|
||||
|
||||
async created() {
|
||||
if (this.$i) {
|
||||
this.connection = os.stream;
|
||||
this.connection = stream;
|
||||
}
|
||||
|
||||
this.muted = await checkWordMute(this.appearNote, this.$i, this.$store.state.mutedWords);
|
||||
|
@ -122,6 +122,7 @@ import copyToClipboard from '@/scripts/copy-to-clipboard';
|
||||
import { checkWordMute } from '@/scripts/check-word-mute';
|
||||
import { userPage } from '@/filters/user';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
import { noteActions, noteViewInterruptors } from '@/store';
|
||||
import { reactionPicker } from '@/scripts/reaction-picker';
|
||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
|
||||
@ -245,7 +246,7 @@ export default defineComponent({
|
||||
|
||||
async created() {
|
||||
if (this.$i) {
|
||||
this.connection = os.stream;
|
||||
this.connection = stream;
|
||||
}
|
||||
|
||||
this.collapsed = this.appearNote.cw == null && this.appearNote.text && (
|
||||
|
@ -74,6 +74,7 @@ import { notePage } from '@/filters/note';
|
||||
import { userPage } from '@/filters/user';
|
||||
import { i18n } from '@/i18n';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
import { useTooltip } from '@/scripts/use-tooltip';
|
||||
|
||||
export default defineComponent({
|
||||
@ -106,7 +107,7 @@ export default defineComponent({
|
||||
if (!props.notification.isRead) {
|
||||
const readObserver = new IntersectionObserver((entries, observer) => {
|
||||
if (!entries.some(entry => entry.isIntersecting)) return;
|
||||
os.stream.send('readNotification', {
|
||||
stream.send('readNotification', {
|
||||
id: props.notification.id
|
||||
});
|
||||
observer.disconnect();
|
||||
@ -114,7 +115,7 @@ export default defineComponent({
|
||||
|
||||
readObserver.observe(elRef.value);
|
||||
|
||||
const connection = os.stream.useChannel('main');
|
||||
const connection = stream.useChannel('main');
|
||||
connection.on('readAllNotifications', () => readObserver.disconnect());
|
||||
|
||||
onUnmounted(() => {
|
||||
|
@ -28,6 +28,7 @@ import XList from './date-separated-list.vue';
|
||||
import XNote from './note.vue';
|
||||
import { notificationTypes } from 'misskey-js';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
import MkButton from '@/components/ui/button.vue';
|
||||
|
||||
export default defineComponent({
|
||||
@ -100,7 +101,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.connection = markRaw(os.stream.useChannel('main'));
|
||||
this.connection = markRaw(stream.useChannel('main'));
|
||||
this.connection.on('notification', this.onNotification);
|
||||
},
|
||||
|
||||
@ -112,7 +113,7 @@ export default defineComponent({
|
||||
onNotification(notification) {
|
||||
const isMuted = !this.allIncludeTypes.includes(notification.type);
|
||||
if (isMuted || document.visibilityState === 'visible') {
|
||||
os.stream.send('readNotification', {
|
||||
stream.send('readNotification', {
|
||||
id: notification.id
|
||||
});
|
||||
}
|
||||
|
@ -74,11 +74,11 @@ import { formatTimeString } from '@/scripts/format-time-string';
|
||||
import { Autocomplete } from '@/scripts/autocomplete';
|
||||
import { noteVisibilities } from 'misskey-js';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
import { selectFiles } from '@/scripts/select-file';
|
||||
import { defaultStore, notePostInterruptors, postFormActions } from '@/store';
|
||||
import { throttle } from 'throttle-debounce';
|
||||
import MkInfo from '@/components/ui/info.vue';
|
||||
import { defaultStore } from '@/store';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@ -176,7 +176,7 @@ export default defineComponent({
|
||||
imeText: '',
|
||||
typing: throttle(3000, () => {
|
||||
if (this.channel) {
|
||||
os.stream.send('typingOnChannel', { channel: this.channel.id });
|
||||
stream.send('typingOnChannel', { channel: this.channel.id });
|
||||
}
|
||||
}),
|
||||
postFormActions,
|
||||
|
@ -83,6 +83,7 @@ import MkTab from '@/components/tab.vue';
|
||||
import MkButton from '@/components/ui/button.vue';
|
||||
import follow from '@/directives/follow-append';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@ -104,15 +105,15 @@ export default defineComponent({
|
||||
const connections = shallowRef([]);
|
||||
const pools = shallowRef([]);
|
||||
const refreshStreamInfo = () => {
|
||||
console.log(os.stream.sharedConnectionPools, os.stream.sharedConnections, os.stream.nonSharedConnections);
|
||||
const conn = os.stream.sharedConnections.map(c => ({
|
||||
console.log(stream.sharedConnectionPools, stream.sharedConnections, stream.nonSharedConnections);
|
||||
const conn = stream.sharedConnections.map(c => ({
|
||||
id: c.id, name: c.name, channel: c.channel, users: c.pool.users, in: c.inCount, out: c.outCount,
|
||||
})).concat(os.stream.nonSharedConnections.map(c => ({
|
||||
})).concat(stream.nonSharedConnections.map(c => ({
|
||||
id: c.id, name: c.name, channel: c.channel, users: null, in: c.inCount, out: c.outCount,
|
||||
})));
|
||||
conn.sort((a, b) => (a.id > b.id) ? 1 : -1);
|
||||
connections.value = conn;
|
||||
pools.value = os.stream.sharedConnectionPools;
|
||||
pools.value = stream.sharedConnectionPools;
|
||||
};
|
||||
const interval = setInterval(refreshStreamInfo, 1000);
|
||||
onBeforeUnmount(() => {
|
||||
|
@ -6,6 +6,7 @@
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
import XNotes from './notes.vue';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
import * as sound from '@/scripts/sound';
|
||||
|
||||
export default defineComponent({
|
||||
@ -92,33 +93,33 @@ export default defineComponent({
|
||||
this.query = {
|
||||
antennaId: this.antenna
|
||||
};
|
||||
this.connection = markRaw(os.stream.useChannel('antenna', {
|
||||
this.connection = markRaw(stream.useChannel('antenna', {
|
||||
antennaId: this.antenna
|
||||
}));
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'home') {
|
||||
endpoint = 'notes/timeline';
|
||||
this.connection = markRaw(os.stream.useChannel('homeTimeline'));
|
||||
this.connection = markRaw(stream.useChannel('homeTimeline'));
|
||||
this.connection.on('note', prepend);
|
||||
|
||||
this.connection2 = markRaw(os.stream.useChannel('main'));
|
||||
this.connection2 = markRaw(stream.useChannel('main'));
|
||||
this.connection2.on('follow', onChangeFollowing);
|
||||
this.connection2.on('unfollow', onChangeFollowing);
|
||||
} else if (this.src == 'local') {
|
||||
endpoint = 'notes/local-timeline';
|
||||
this.connection = markRaw(os.stream.useChannel('localTimeline'));
|
||||
this.connection = markRaw(stream.useChannel('localTimeline'));
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'social') {
|
||||
endpoint = 'notes/hybrid-timeline';
|
||||
this.connection = markRaw(os.stream.useChannel('hybridTimeline'));
|
||||
this.connection = markRaw(stream.useChannel('hybridTimeline'));
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'global') {
|
||||
endpoint = 'notes/global-timeline';
|
||||
this.connection = markRaw(os.stream.useChannel('globalTimeline'));
|
||||
this.connection = markRaw(stream.useChannel('globalTimeline'));
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'mentions') {
|
||||
endpoint = 'notes/mentions';
|
||||
this.connection = markRaw(os.stream.useChannel('main'));
|
||||
this.connection = markRaw(stream.useChannel('main'));
|
||||
this.connection.on('mention', prepend);
|
||||
} else if (this.src == 'directs') {
|
||||
endpoint = 'notes/mentions';
|
||||
@ -130,14 +131,14 @@ export default defineComponent({
|
||||
prepend(note);
|
||||
}
|
||||
};
|
||||
this.connection = markRaw(os.stream.useChannel('main'));
|
||||
this.connection = markRaw(stream.useChannel('main'));
|
||||
this.connection.on('mention', onNote);
|
||||
} else if (this.src == 'list') {
|
||||
endpoint = 'notes/user-list-timeline';
|
||||
this.query = {
|
||||
listId: this.list
|
||||
};
|
||||
this.connection = markRaw(os.stream.useChannel('userList', {
|
||||
this.connection = markRaw(stream.useChannel('userList', {
|
||||
listId: this.list
|
||||
}));
|
||||
this.connection.on('note', prepend);
|
||||
@ -148,7 +149,7 @@ export default defineComponent({
|
||||
this.query = {
|
||||
channelId: this.channel
|
||||
};
|
||||
this.connection = markRaw(os.stream.useChannel('channel', {
|
||||
this.connection = markRaw(stream.useChannel('channel', {
|
||||
channelId: this.channel
|
||||
}));
|
||||
this.connection.on('note', prepend);
|
||||
|
Reference in New Issue
Block a user