1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-22 22:38:43 +01:00

Merge pull request #4892 from h3poteto/renovate/megalodon-10.x

Update dependency megalodon to v10
This commit is contained in:
AkiraFukushima 2024-03-19 01:17:00 +09:00 committed by GitHub
commit bd4634d704
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 20 deletions

View File

@ -27,7 +27,7 @@
"electron-serve": "^1.1.0",
"electron-store": "^8.1.0",
"emoji-mart": "^5.5.2",
"megalodon": "9.2.3",
"megalodon": "10.0.0",
"parse-link-header": "^2.0.0",
"react-blurhash": "^0.3.0",
"react-hotkeys-hook": "^4.4.1",

View File

@ -1,5 +1,5 @@
import { Account } from '@/db'
import generator, { Entity, MegalodonInterface, WebSocketInterface } from 'megalodon'
import { Entity, MegalodonInterface, WebSocketInterface } from 'megalodon'
import { useEffect, useState, useCallback, useRef } from 'react'
import { FormattedMessage, useIntl } from 'react-intl'
import { Virtuoso } from 'react-virtuoso'
@ -42,10 +42,8 @@ export default function Notifications(props: Props) {
setFilters(f)
const res = await loadNotifications(props.client)
setNotifications(res)
const instance = await props.client.getInstance()
const c = generator(props.account.sns, instance.data.urls.streaming_api, props.account.access_token, 'Whalebird')
updateMarker(props.client)
streaming.current = c.userSocket()
streaming.current = await props.client.userStreaming()
streaming.current.on('connect', () => {
console.log('connected to notifications')
})

View File

@ -1,5 +1,5 @@
import { Account } from '@/db'
import generator, { Entity, MegalodonInterface, WebSocketInterface } from 'megalodon'
import { Entity, MegalodonInterface, WebSocketInterface } from 'megalodon'
import { useEffect, useState, useCallback, useRef } from 'react'
import { Virtuoso } from 'react-virtuoso'
import Status from './status/Status'
@ -57,27 +57,25 @@ export default function Timeline(props: Props) {
setFilters(f)
const res = await loadTimeline(props.timeline, props.client)
setStatuses(res)
const instance = await props.client.getInstance()
const c = generator(props.account.sns, instance.data.urls.streaming_api, props.account.access_token, 'Whalebird')
setList(null)
switch (props.timeline) {
case 'home': {
streaming.current = c.userSocket()
streaming.current = await props.client.userStreaming()
break
}
case 'local': {
streaming.current = c.localSocket()
streaming.current = await props.client.localStreaming()
break
}
case 'public': {
streaming.current = c.publicSocket()
streaming.current = await props.client.publicStreaming()
break
}
default: {
const match = props.timeline.match(/list_(\d+)/)
if (match && match[1] && typeof match[1] === 'string') {
const res = await props.client.getList(match[1])
streaming.current = c.listSocket(match[1])
streaming.current = await props.client.listStreaming(match[1])
setList(res.data)
}
break

View File

@ -62,7 +62,6 @@ export const AccountsProvider: React.FC<Props> = ({ children }) => {
if (!account.id) return
// Start user streaming for notification
const client = generator(account.sns, account.url, account.access_token, 'Whalebird')
const instance = await client.getInstance()
const notifications = (await client.getNotifications()).data
try {
const res = await client.getMarkers(['notifications'])
@ -79,8 +78,7 @@ export const AccountsProvider: React.FC<Props> = ({ children }) => {
console.error(err)
}
const ws = generator(account.sns, instance.data.urls.streaming_api, account.access_token, 'Whalebird')
const socket = ws.userSocket()
const socket = await client.userStreaming()
streamings.current = Object.assign({}, streamings.current, {
[account.id]: socket
})

View File

@ -2711,7 +2711,7 @@ __metadata:
eslint: ^8.55.0
eslint-config-prettier: ^9.0.0
eslint-plugin-react: ^7.33.2
megalodon: 9.2.3
megalodon: 10.0.0
next: ^12.3.4
nextron: ^8.12.0
parse-link-header: ^2.0.0
@ -6501,9 +6501,9 @@ __metadata:
languageName: node
linkType: hard
"megalodon@npm:9.2.3":
version: 9.2.3
resolution: "megalodon@npm:9.2.3"
"megalodon@npm:10.0.0":
version: 10.0.0
resolution: "megalodon@npm:10.0.0"
dependencies:
"@badgateway/oauth2-client": ^2.3.0
"@types/ws": ^8.5.10
@ -6515,7 +6515,7 @@ __metadata:
object-assign-deep: ^0.4.0
uuid: ^9.0.1
ws: 8.16.0
checksum: 19a861b3b58f7bbdb6126a8981353e6fe650a2e0b302f1fc832982e7e9648749132ecb6f162408bb2c35f2601363e4adad2964f55d3076a6ae149b47f810dbdf
checksum: 668ec90e2b24d037b58c223acc0590185882ad901481276e4d48856241dfdc09bd6b9d2eee18e5e1ece3d0e0be74e00a792cec3113a999242fb08782b77d684f
languageName: node
linkType: hard