enhance: pizzaxでstreamingのuser storage updateイベントを監視して更新 (#8095)
* wip * wip? * ? * streamingのuser storage updateイベントを監視して更新 * 必要な時以外はストレージを更新しない * fix? * wip * fix * fix
This commit is contained in:
		
							parent
							
								
									99eb919f4e
								
							
						
					
					
						commit
						e159f15600
					
				
					 31 changed files with 98 additions and 53 deletions
				
			
		| 
						 | 
				
			
			@ -15,9 +15,10 @@
 | 
			
		|||
 | 
			
		||||
<script lang="ts">
 | 
			
		||||
import { defineAsyncComponent, defineComponent } from 'vue';
 | 
			
		||||
import { stream, popup, popups, uploads, pendingApiRequestsCount } from '@/os';
 | 
			
		||||
import { popup, popups, uploads, pendingApiRequestsCount } from '@/os';
 | 
			
		||||
import * as sound from '@/scripts/sound';
 | 
			
		||||
import { $i } from '@/account';
 | 
			
		||||
import { stream } from '@/stream';
 | 
			
		||||
 | 
			
		||||
export default defineComponent({
 | 
			
		||||
	components: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@
 | 
			
		|||
<script lang="ts">
 | 
			
		||||
import { defineComponent } from 'vue';
 | 
			
		||||
import * as os from '@/os';
 | 
			
		||||
import { stream } from '@/stream';
 | 
			
		||||
 | 
			
		||||
export default defineComponent({
 | 
			
		||||
	data() {
 | 
			
		||||
| 
						 | 
				
			
			@ -20,14 +21,14 @@ export default defineComponent({
 | 
			
		|||
	},
 | 
			
		||||
	computed: {
 | 
			
		||||
		stream() {
 | 
			
		||||
			return os.stream;
 | 
			
		||||
			return stream;
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		os.stream.on('_disconnected_', this.onDisconnected);
 | 
			
		||||
		stream.on('_disconnected_', this.onDisconnected);
 | 
			
		||||
	},
 | 
			
		||||
	beforeUnmount() {
 | 
			
		||||
		os.stream.off('_disconnected_', this.onDisconnected);
 | 
			
		||||
		stream.off('_disconnected_', this.onDisconnected);
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		onDisconnected() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -118,6 +118,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';
 | 
			
		||||
| 
						 | 
				
			
			@ -243,7 +244,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 && (
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,7 @@ import { computed, defineComponent, markRaw } from 'vue';
 | 
			
		|||
import * as Misskey from 'misskey-js';
 | 
			
		||||
import XNotes from '../notes.vue';
 | 
			
		||||
import * as os from '@/os';
 | 
			
		||||
import { stream } from '@/stream';
 | 
			
		||||
import * as sound from '@/scripts/sound';
 | 
			
		||||
import { scrollToBottom, getScrollPosition, getScrollContainer } from '@/scripts/scroll';
 | 
			
		||||
import follow from '@/directives/follow-append';
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +107,7 @@ export default defineComponent({
 | 
			
		|||
			sound.play(note.userId === this.$i.id ? 'noteMy' : 'note');
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		this.connection = markRaw(os.stream.useChannel('channel', {
 | 
			
		||||
		this.connection = markRaw(stream.useChannel('channel', {
 | 
			
		||||
			channelId: this.channelId
 | 
			
		||||
		}));
 | 
			
		||||
		this.connection.on('note', prepend);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,7 @@
 | 
			
		|||
import { computed, defineComponent, markRaw } from 'vue';
 | 
			
		||||
import XNotes from '../notes.vue';
 | 
			
		||||
import * as os from '@/os';
 | 
			
		||||
import { stream } from '@/stream';
 | 
			
		||||
import * as sound from '@/scripts/sound';
 | 
			
		||||
import { scrollToBottom, getScrollPosition, getScrollContainer } from '@/scripts/scroll';
 | 
			
		||||
import follow from '@/directives/follow-append';
 | 
			
		||||
| 
						 | 
				
			
			@ -90,23 +91,23 @@ export default defineComponent({
 | 
			
		|||
 | 
			
		||||
		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);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,6 +59,7 @@ import * as Acct from 'misskey-js/built/acct';
 | 
			
		|||
import { formatTimeString } from '@/scripts/format-time-string';
 | 
			
		||||
import { Autocomplete } from '@/scripts/autocomplete';
 | 
			
		||||
import * as os from '@/os';
 | 
			
		||||
import { stream } from '@/stream';
 | 
			
		||||
import { selectFiles } from '@/scripts/select-file';
 | 
			
		||||
import { notePostInterruptors, postFormActions } from '@/store';
 | 
			
		||||
import { throttle } from 'throttle-debounce';
 | 
			
		||||
| 
						 | 
				
			
			@ -130,7 +131,7 @@ export default defineComponent({
 | 
			
		|||
			imeText: '',
 | 
			
		||||
			typing: throttle(3000, () => {
 | 
			
		||||
				if (this.channel) {
 | 
			
		||||
					os.stream.send('typingOnChannel', { channel: this.channel });
 | 
			
		||||
					stream.send('typingOnChannel', { channel: this.channel });
 | 
			
		||||
				}
 | 
			
		||||
			}),
 | 
			
		||||
			postFormActions,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue