[ui] add admin in mobile / fix #63

This commit is contained in:
les 2019-12-10 22:58:10 +01:00
parent 8994cce1ad
commit 4015a54d57
5 changed files with 47 additions and 8 deletions

View file

@ -62,6 +62,10 @@ pre {
font-family: unset;
}
.el-message-box {
max-width: 95%;
}
.el-popover {
word-break: normal;
}

View file

@ -53,6 +53,13 @@
hr
.d-block.d-lg-none
el-dropdown
el-button.mr-1.mb-1(type='' icon='el-icon-arrow-down' size='mini') {{$t('common.admin')}}
el-dropdown-menu(slot='dropdown')
el-dropdown-item(@click.native='toggle') {{$t(event.is_visible?'common.hide':'common.confirm')}}
el-dropdown-item(@click.native='$router.replace(`/add/${event.id}`)') {{$t('common.edit')}}
el-dropdown-item(@click.native='remove') {{$t('common.remove')}}
el-button(plain size='mini' type='primary' v-clipboard:success='copyLink'
v-clipboard:copy='`${settings.baseurl}/event/${event.id}`') <i class='el-icon-paperclip'></i> {{$t('common.copy_link')}}
a.el-button.el-button--success.el-button--mini.is-plain(role='button' plain size='mini' type='success'
@ -258,6 +265,32 @@ export default {
}
},
methods: {
async remove () {
try {
await MessageBox.confirm(this.$t('event.remove_confirmation'), this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
type: 'error' })
await this.$axios.delete(`/user/event/${this.event.id}`)
this.delEvent(Number(this.event.id))
this.$router.replace('/')
} catch (e) {
console.error(e)
}
},
async toggle () {
try {
if (this.event.is_visible) {
await this.$axios.$get(`/event/unconfirm/${this.event.id}`)
this.event.is_visible = false
} else {
await this.$axios.$get(`/event/confirm/${this.event.id}`)
this.event.is_visible = true
}
} catch (e) {
console.error(e)
}
},
async hideResource (resource, hidden) {
await this.$axios.$put(`/resources/${resource.id}`, { hidden })
resource.hidden = hidden

View file

@ -38,14 +38,15 @@ const Helpers = {
const header = `keyId="${config.baseurl}/federation/u/${settingsController.settings.instance_name}",headers="(request-target) host date",signature="${signature_b64}"`
const ret = await fetch(inbox, {
headers: {
'Host': inboxUrl.hostname,
'Date': d.toUTCString(),
'Signature': header,
Host: inboxUrl.hostname,
Date: d.toUTCString(),
Signature: header,
'Content-Type': 'application/activity+json; charset=utf-8',
'Accept': 'application/activity+json, application/json; chartset=utf-8'
Accept: 'application/activity+json, application/json; chartset=utf-8'
},
method: 'POST',
body: JSON.stringify(message) })
body: JSON.stringify(message)
})
debug('sign %s => %s', ret.status, await ret.text())
},
@ -64,7 +65,7 @@ const Helpers = {
})
for (const sharedInbox in recipients) {
debug('Notify %s with event %s cc => %d', sharedInbox, event.title , recipients[sharedInbox].length)
debug('Notify %s with event %s cc => %d', sharedInbox, event.title, recipients[sharedInbox].length)
const body = {
id: `${config.baseurl}/federation/m/${event.id}#create`,
type,
@ -78,7 +79,7 @@ const Helpers = {
body['@context'] = [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
{ Hashtag: 'as:Hashtag' } ]
{ Hashtag: 'as:Hashtag' }]
Helpers.signAndSend(body, sharedInbox)
}
},

View file

@ -7,7 +7,7 @@ const version = require('../../package.json').version
router.use(cors())
router.get('/', async (req, res) => {
router.get('/', (req, res) => {
const ret = {
version: '1.0',
server: {

View file

@ -84,6 +84,7 @@ module.exports = {
},
async outbox (req, res) {
// TODO
const name = req.params.name
const page = req.query.page