logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

attachment_setting.js (1132B)


  1. import Setting from './setting.js'
  2. import { fileTypeExt } from 'src/services/file_type/file_type.service.js'
  3. import MediaUpload from 'src/components/media_upload/media_upload.vue'
  4. import Attachment from 'src/components/attachment/attachment.vue'
  5. export default {
  6. ...Setting,
  7. props: {
  8. ...Setting.props,
  9. compact: Boolean,
  10. acceptTypes: {
  11. type: String,
  12. required: false,
  13. default: 'image/*'
  14. }
  15. },
  16. components: {
  17. ...Setting.components,
  18. MediaUpload,
  19. Attachment
  20. },
  21. computed: {
  22. ...Setting.computed,
  23. attachment () {
  24. const path = this.realDraftMode ? this.draft : this.state
  25. // The "server" part is primarily for local dev, but could be useful for alt-domain or multiuser usage.
  26. const url = path.includes('://') ? path : this.$store.state.instance.server + path
  27. return {
  28. mimetype: fileTypeExt(url),
  29. url
  30. }
  31. }
  32. },
  33. methods: {
  34. ...Setting.methods,
  35. setMediaFile (fileInfo) {
  36. if (this.realDraftMode) {
  37. this.draft = fileInfo.url
  38. } else {
  39. this.configSink(this.path, fileInfo.url)
  40. }
  41. }
  42. }
  43. }