Change to send timeline result
This commit is contained in:
parent
088599f88c
commit
e0fc3df242
|
@ -42,13 +42,15 @@ export default class AddColumn extends Vue {
|
|||
|
||||
public addTL() {
|
||||
this.showInput = false
|
||||
this.pubTL.push(this.instance)
|
||||
let instance = this.instance
|
||||
|
||||
this.pubTL.push(instance)
|
||||
this.timeline()
|
||||
}
|
||||
|
||||
public timeline() {
|
||||
this.pubTL.forEach(function (value) {
|
||||
ipcRenderer.send('no-auth-streaming', value);
|
||||
ipcRenderer.send('no-auth-timeline', value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ button {
|
|||
--btn-bg-color: var(--bg-color) !important;
|
||||
}
|
||||
|
||||
font-size: 1em;
|
||||
font-size: var(--font-size);
|
||||
margin: 0 0.5em;
|
||||
padding: 0.8em 2em;
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ export default class Streaming {
|
|||
}
|
||||
|
||||
public static ready() {
|
||||
ipcMain.on('open-streaming', (_: Event, domain: string, type: string) => {
|
||||
return this.shared.openStreaming(domain, type)
|
||||
ipcMain.on('open-streaming', (_: Event, name: string, type: string) => {
|
||||
return this.shared.openStreaming(name, type)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -23,20 +23,20 @@ export default class Streaming {
|
|||
this.sockets = new Map()
|
||||
}
|
||||
|
||||
private openStreaming(clientName: string, type: string) {
|
||||
private openStreaming(name: string, type: string) {
|
||||
let client: Mastodon
|
||||
let stream: string
|
||||
|
||||
switch (type) {
|
||||
case 'no-auth':
|
||||
client = Client.getNoAuthClient(clientName)
|
||||
client = Client.getNoAuthClient(name)
|
||||
stream = 'public:local'
|
||||
break
|
||||
default:
|
||||
return
|
||||
}
|
||||
|
||||
let socketName = clientName + ':' + type
|
||||
let socketName = name + ':' + type
|
||||
if (this.sockets.has(socketName)) {
|
||||
return
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ export default class Streaming {
|
|||
|
||||
socket.on('update', (status: Status) => {
|
||||
if (Window.windowMap.has('main')) {
|
||||
Window.windowMap.get('main')!.webContents.send(`update-${clientName}-${type}`, status)
|
||||
Window.windowMap.get('main')!.webContents.send(`update-${name}-${type}`, status)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -59,7 +59,7 @@ export default class Streaming {
|
|||
|
||||
socket.on('delete', (id: number) => {
|
||||
if (Window.windowMap.has('main')) {
|
||||
Window.windowMap.get('main')!.webContents.send(`delete-${clientName}-${type}`, id)
|
||||
Window.windowMap.get('main')!.webContents.send(`delete-${name}-${type}`, id)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
import {
|
||||
ipcMain
|
||||
} from 'electron'
|
||||
import Mastodon, { Status, Response } from 'megalodon'
|
||||
import { Status, Response } from 'megalodon'
|
||||
|
||||
import Client from './Client'
|
||||
import Window from './Window'
|
||||
|
||||
export default class Timeline {
|
||||
public static ready() {
|
||||
ipcMain.on('no-auth-streaming', (event: Event, instance: string) => {
|
||||
const client = Client.getNoAuthClient(instance)
|
||||
ipcMain.on('no-auth-timeline', async (event: Event, name: string) => {
|
||||
const client = Client.getNoAuthClient(name)
|
||||
let res: Response<[Status]> = await client.get<[Status]>('/timelines/public?local=true')
|
||||
|
||||
client.get<[Status]>('/timelines/public?local=true')
|
||||
.then((resp: Response<[Status]>) => {
|
||||
console.log(resp.data)
|
||||
})
|
||||
if (Window.windowMap.has('main')) {
|
||||
Window.windowMap.get('main')!.webContents.send(`timeline-${name}-no-auth`, res.data)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user