Add status id list

This commit is contained in:
kPherox 2019-04-24 06:07:15 +09:00
parent e0fc3df242
commit e81cf581ef
No known key found for this signature in database
GPG Key ID: C04751C2BFA2F62D
3 changed files with 16 additions and 7 deletions

View File

@ -11,7 +11,8 @@
</div> </div>
<div id="timelines"> <div id="timelines">
<div v-for="(value, key, index) in pubTL" :key="index" class="tl"> <div v-for="(value, key, index) in pubTL" :key="index" class="tl">
{{value}} {{value.name}}
<div v-for="(status, key, index) in value.statuses" :key="index" class="tl">{{status.id}}</div>
</div> </div>
</div> </div>
<BaseButton <BaseButton
@ -26,10 +27,15 @@
<script lang="ts"> <script lang="ts">
import { ipcRenderer } from 'electron' import { ipcRenderer } from 'electron'
import { Component, Vue } from 'vue-property-decorator' import { Component, Vue } from 'vue-property-decorator'
import { Status } from 'megalodon'
type Instance = string type Instance = string
type showInput = boolean type showInput = boolean
type Timelines = string[] type Timeline = {
name: string
statuses: Status[]
}
type Timelines = Timeline[]
@Component @Component
export default class AddColumn extends Vue { export default class AddColumn extends Vue {
public instance: Instance = '' public instance: Instance = ''
@ -44,13 +50,16 @@ export default class AddColumn extends Vue {
this.showInput = false this.showInput = false
let instance = this.instance let instance = this.instance
this.pubTL.push(instance) this.pubTL.push({ name: instance, statuses: [] })
this.timeline() this.timeline()
} }
public timeline() { public timeline() {
this.pubTL.forEach(function (value) { this.pubTL.forEach(function (tl) {
ipcRenderer.send('no-auth-timeline', value); ipcRenderer.on(`timeline-${tl.name}-no-auth`, (_: Event, statuses: Status[]) => {
tl.statuses = statuses
})
ipcRenderer.send('no-auth-timeline', tl.name)
}); });
} }
} }

View File

@ -1,7 +1,7 @@
import Mastodon from 'megalodon' import Mastodon from 'megalodon'
type Protocol = 'http' | 'ws' type Protocol = 'http' | 'websocket'
export default class Clients { export default class Clients {
// Authorized Accounts. keyには`@username@domain`を設定します // Authorized Accounts. keyには`@username@domain`を設定します

View File

@ -29,7 +29,7 @@ export default class Streaming {
switch (type) { switch (type) {
case 'no-auth': case 'no-auth':
client = Client.getNoAuthClient(name) client = Client.getNoAuthClient(name, 'websocket')
stream = 'public:local' stream = 'public:local'
break break
default: default: