fix trusted instances

This commit is contained in:
les 2020-11-17 00:31:55 +01:00
parent e87cbbad88
commit 0d036eb707
2 changed files with 22 additions and 2 deletions

View file

@ -3,6 +3,22 @@
v-btn(color='primary' text href='https://gancio.org') Gancio {{settings.version}}
v-btn(v-for='link in settings.footerLinks'
:key='link.label' color='primary' text :href='link.href') {{link.label}}
v-menu(v-if='settings.enable_trusted_instances && settings.trusted_instances && settings.trusted_instances.length'
offset-y bottom open-on-hover transition="slide-y-transition")
template(v-slot:activator="{ on, attrs }")
v-btn(v-bind='attrs' v-on='on' color='primary' text) {{$t('common.places')}}
v-list
v-list-item(v-for='instance in settings.trusted_instances'
:key='instance.name'
:href='instance.url'
two-line)
v-list-item-avatar
v-img(:src='`${instance.url}/favicon.ico`')
v-list-item-content
v-list-item-title {{instance.name}}
v-list-item-subtitle {{instance.label}}
//- v-btn(v-if='settings.enable_federation' text rel='me' @click.prevent='showFollowMe=true') follow me
//- v-btn(nuxt to='/about' text) about
//- v-btn(href='https://blog.gancio.org' text) blog

View file

@ -112,8 +112,11 @@ export default {
methods: {
...mapActions(['setSetting']),
async createTrustedInstance () {
if (!this.$refs.form.validate()) return
if (!this.$refs.form.validate()) { return }
try {
if (!this.instance_url.startsWith('http')) {
this.instance_url = `https://${this.instance_url}`
}
const instance = await axios.get(`${this.instance_url}/.well-known/nodeinfo/2.1`)
this.setSetting({
key: 'trusted_instances',
@ -123,7 +126,8 @@ export default {
label: instance.data.metadata.nodeLabel
})
})
this.instance_url = ''
this.$refs.form.reset()
this.dialogAddInstance = false
} catch (e) {
this.$root.$message(e, { color: 'error' })
}