diff options
| author | Henry Jameson <me@hjkos.com> | 2021-04-09 19:09:22 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2021-04-09 19:14:05 +0300 |
| commit | d695dcaff91ce616549dc54c02b8bf9167f2be58 (patch) | |
| tree | 74ffd66cae8ccd38591c805d8e65a45dac733fb8 /src | |
| parent | 8b96ea93776fd1eb462a7c54822d4f8ad6a9e776 (diff) | |
experimental flash support through ruffle
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/attachment/attachment.js | 2 | ||||
| -rw-r--r-- | src/components/attachment/attachment.vue | 2 | ||||
| -rw-r--r-- | src/components/flash/flash.js | 16 | ||||
| -rw-r--r-- | src/components/flash/flash.vue | 15 | ||||
| -rw-r--r-- | src/services/file_type/file_type.service.js | 4 |
5 files changed, 39 insertions, 0 deletions
diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 5f5779a0..8849f501 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -1,4 +1,5 @@ import StillImage from '../still-image/still-image.vue' +import Flash from '../flash/flash.vue' import VideoAttachment from '../video_attachment/video_attachment.vue' import nsfwImage from '../../assets/nsfw.png' import fileTypeService from '../../services/file_type/file_type.service.js' @@ -43,6 +44,7 @@ const Attachment = { } }, components: { + Flash, StillImage, VideoAttachment }, diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 2c1c1682..2102127d 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -117,6 +117,8 @@ <!-- eslint-enable vue/no-v-html --> </div> </div> + + <Flash v-if="type === 'flash'" :src="attachment.large_thumb_url || attachment.url" /> </div> </template> diff --git a/src/components/flash/flash.js b/src/components/flash/flash.js new file mode 100644 index 00000000..f768ead8 --- /dev/null +++ b/src/components/flash/flash.js @@ -0,0 +1,16 @@ +const Flash = { + props: [ + 'src' + ], + created: function () { + this.$nextTick(function () { + const ruffle = window.RufflePlayer.newest() + const player = ruffle.createPlayer() + const container = this.$refs.cunt + container.appendChild(player) + player.load(this.src) + }) + } +} + +export default Flash diff --git a/src/components/flash/flash.vue b/src/components/flash/flash.vue new file mode 100644 index 00000000..510fe6d2 --- /dev/null +++ b/src/components/flash/flash.vue @@ -0,0 +1,15 @@ +<template> + <div + class="Flash" + ref="cunt" + /> +</template> + +<script src="./flash.js"></script> + +<style lang="scss"> +@import '../../_variables.scss'; +.Flash { + display: block; +} +</style> diff --git a/src/services/file_type/file_type.service.js b/src/services/file_type/file_type.service.js index 2a046bec..5182ecd1 100644 --- a/src/services/file_type/file_type.service.js +++ b/src/services/file_type/file_type.service.js @@ -2,6 +2,10 @@ // or the entire service could be just mimetype service that only operates // on mimetypes and not files. Currently the naming is confusing. const fileType = mimetype => { + if (mimetype.match(/flash/)) { + return 'flash' + } + if (mimetype.match(/text\/html/)) { return 'html' } |
