use oauth2 password flow for webclient

This commit is contained in:
les
2020-01-27 00:47:03 +01:00
parent 6352cb3d12
commit b706333c85
21 changed files with 367 additions and 448 deletions

View File

@@ -8,13 +8,12 @@
</template>
<script>
import { mapState } from 'vuex'
import { Message } from 'element-ui'
import debounce from 'lodash/debounce'
import url from 'url'
export default {
name: 'embedEvent',
name: 'EmbedEvent',
data () {
return {
instance_hostname: '',
@@ -23,20 +22,7 @@ export default {
get_instance_info: debounce(this.getInstanceInfo, 500)
}
},
methods: {
getInstanceInfo () {
const instance_url = `https://${this.instance_hostname}/api/v1/instance`
fetch(instance_url)
.then( ret => ret.json())
.then(ret => {
this.instance = ret
this.proceed = true
})
.catch( e => {
this.proceed = false
})
}
},
computed: {
...mapState(['settings']),
domain () {
@@ -45,7 +31,6 @@ export default {
},
couldGo () {
// check if is mastodon
const instance_url = `https://${this.instance_hostname}/api/v1/instance`
this.get_instance_info()
return true
},
@@ -53,6 +38,19 @@ export default {
// check if exists
return `https://${this.instance_hostname}/authorize_interaction?uri=${this.settings.instance_name}@${this.domain}`
}
},
methods: {
getInstanceInfo () {
const instance_url = `https://${this.instance_hostname}/api/v1/instance`
this.$axios.$get(instance_url)
.then(ret => {
this.instance = ret
this.proceed = true
})
.catch(e => {
this.proceed = false
})
}
}
}
</script>
@@ -60,4 +58,4 @@ export default {
.instance_thumb {
height: 20px;
}
</style>
</style>