Merge branch 'flash-support' into shigusegubu
* flash-support: Play-on-click, layout improvements. No longer need to put ruffle stuff in source tree. Made ruffle not use polyfills also. experimental flash support through ruffle
This commit is contained in:
commit
defb81b250
10 changed files with 741 additions and 202 deletions
|
|
@ -21,6 +21,7 @@ var compiler = webpack(webpackConfig)
|
||||||
|
|
||||||
var devMiddleware = require('webpack-dev-middleware')(compiler, {
|
var devMiddleware = require('webpack-dev-middleware')(compiler, {
|
||||||
publicPath: webpackConfig.output.publicPath,
|
publicPath: webpackConfig.output.publicPath,
|
||||||
|
writeToDisk: true,
|
||||||
stats: {
|
stats: {
|
||||||
colors: true,
|
colors: true,
|
||||||
chunks: false
|
chunks: false
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ var config = require('../config')
|
||||||
var utils = require('./utils')
|
var utils = require('./utils')
|
||||||
var projectRoot = path.resolve(__dirname, '../')
|
var projectRoot = path.resolve(__dirname, '../')
|
||||||
var ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin')
|
var ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin')
|
||||||
|
var CopyPlugin = require('copy-webpack-plugin');
|
||||||
|
|
||||||
var env = process.env.NODE_ENV
|
var env = process.env.NODE_ENV
|
||||||
// check env & config/index.js to decide weither to enable CSS Sourcemaps for the
|
// check env & config/index.js to decide weither to enable CSS Sourcemaps for the
|
||||||
|
|
@ -93,6 +94,19 @@ module.exports = {
|
||||||
new ServiceWorkerWebpackPlugin({
|
new ServiceWorkerWebpackPlugin({
|
||||||
entry: path.join(__dirname, '..', 'src/sw.js'),
|
entry: path.join(__dirname, '..', 'src/sw.js'),
|
||||||
filename: 'sw-pleroma.js'
|
filename: 'sw-pleroma.js'
|
||||||
|
}),
|
||||||
|
// This copies Ruffle's WASM to a directory so that JS side can access it
|
||||||
|
new CopyPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: "node_modules/ruffle-mirror/*",
|
||||||
|
to: "static/ruffle",
|
||||||
|
flatten: true
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: {
|
||||||
|
concurrency: 100,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
"phoenix": "^1.3.0",
|
"phoenix": "^1.3.0",
|
||||||
"portal-vue": "^2.1.4",
|
"portal-vue": "^2.1.4",
|
||||||
"punycode.js": "^2.1.0",
|
"punycode.js": "^2.1.0",
|
||||||
|
"ruffle-mirror": "^2021.4.10",
|
||||||
"v-click-outside": "^2.1.1",
|
"v-click-outside": "^2.1.1",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-i18n": "^7.3.2",
|
"vue-i18n": "^7.3.2",
|
||||||
|
|
@ -57,6 +58,7 @@
|
||||||
"chalk": "^1.1.3",
|
"chalk": "^1.1.3",
|
||||||
"chromedriver": "^87.0.1",
|
"chromedriver": "^87.0.1",
|
||||||
"connect-history-api-fallback": "^1.1.0",
|
"connect-history-api-fallback": "^1.1.0",
|
||||||
|
"copy-webpack-plugin": "^6.4.1",
|
||||||
"cross-spawn": "^4.0.2",
|
"cross-spawn": "^4.0.2",
|
||||||
"css-loader": "^0.28.0",
|
"css-loader": "^0.28.0",
|
||||||
"custom-event-polyfill": "^1.0.7",
|
"custom-event-polyfill": "^1.0.7",
|
||||||
|
|
@ -111,7 +113,7 @@
|
||||||
"url-loader": "^1.1.2",
|
"url-loader": "^1.1.2",
|
||||||
"vue-loader": "^14.0.0",
|
"vue-loader": "^14.0.0",
|
||||||
"vue-style-loader": "^4.0.0",
|
"vue-style-loader": "^4.0.0",
|
||||||
"webpack": "^4.0.0",
|
"webpack": "^4.44.0",
|
||||||
"webpack-dev-middleware": "^3.6.0",
|
"webpack-dev-middleware": "^3.6.0",
|
||||||
"webpack-hot-middleware": "^2.12.2",
|
"webpack-hot-middleware": "^2.12.2",
|
||||||
"webpack-merge": "^0.14.1"
|
"webpack-merge": "^0.14.1"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import StillImage from '../still-image/still-image.vue'
|
import StillImage from '../still-image/still-image.vue'
|
||||||
|
import Flash from '../flash/flash.vue'
|
||||||
import VideoAttachment from '../video_attachment/video_attachment.vue'
|
import VideoAttachment from '../video_attachment/video_attachment.vue'
|
||||||
import nsfwImage from '../../assets/nsfw.png'
|
import nsfwImage from '../../assets/nsfw.png'
|
||||||
import fileTypeService from '../../services/file_type/file_type.service.js'
|
import fileTypeService from '../../services/file_type/file_type.service.js'
|
||||||
|
|
@ -43,6 +44,7 @@ const Attachment = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
Flash,
|
||||||
StillImage,
|
StillImage,
|
||||||
VideoAttachment
|
VideoAttachment
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,8 @@
|
||||||
<!-- eslint-enable vue/no-v-html -->
|
<!-- eslint-enable vue/no-v-html -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Flash v-if="type === 'flash'" :src="attachment.large_thumb_url || attachment.url" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -172,6 +174,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.non-gallery.attachment {
|
.non-gallery.attachment {
|
||||||
|
&.flash,
|
||||||
&.video {
|
&.video {
|
||||||
flex: 1 0 40%;
|
flex: 1 0 40%;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
45
src/components/flash/flash.js
Normal file
45
src/components/flash/flash.js
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
import RuffleService from '../../services/ruffle_service/ruffle_service.js'
|
||||||
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
import { faStop } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
|
library.add(
|
||||||
|
faStop,
|
||||||
|
)
|
||||||
|
|
||||||
|
const Flash = {
|
||||||
|
props: [ 'src' ],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
player: false, // can be true, "hidden", false. hidden = element exists
|
||||||
|
loaded: false,
|
||||||
|
ruffleInstance: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openPlayer () {
|
||||||
|
if (this.player) return // prevent double-loading
|
||||||
|
this.player = 'hidden'
|
||||||
|
RuffleService.getRuffle().then((ruffle) => {
|
||||||
|
const player = ruffle.newest().createPlayer()
|
||||||
|
player.config = {
|
||||||
|
letterbox: 'on'
|
||||||
|
}
|
||||||
|
const container = this.$refs.cunt
|
||||||
|
container.appendChild(player)
|
||||||
|
player.style.width = '100%'
|
||||||
|
player.style.height = '100%'
|
||||||
|
player.load(this.src).then(() => {
|
||||||
|
this.player = true
|
||||||
|
})
|
||||||
|
this.ruffleInstance = player
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closePlayer () {
|
||||||
|
console.log(this.ruffleInstance)
|
||||||
|
this.ruffleInstance.remove()
|
||||||
|
this.player = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Flash
|
||||||
62
src/components/flash/flash.vue
Normal file
62
src/components/flash/flash.vue
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
<template>
|
||||||
|
<div class="Flash">
|
||||||
|
<div
|
||||||
|
v-if="player"
|
||||||
|
ref="cunt"
|
||||||
|
class="player"
|
||||||
|
:class="{ hidden: player === 'hidden' }"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
v-if="player === false || player === 'hidden'"
|
||||||
|
@click="openPlayer"
|
||||||
|
class="button-unstyled placeholder"
|
||||||
|
>
|
||||||
|
<span v-if="player === 'hidden'" class="label">
|
||||||
|
{{ $t('general.loading') }}
|
||||||
|
</span>
|
||||||
|
<span v-else class="label">
|
||||||
|
{{ $t('general.flash_content') }}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-if="player"
|
||||||
|
class="button-unstyled hider"
|
||||||
|
@click="closePlayer"
|
||||||
|
>
|
||||||
|
<FAIcon icon="stop" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./flash.js"></script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '../../_variables.scss';
|
||||||
|
.Flash {
|
||||||
|
width: 100%;
|
||||||
|
height: 260px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.player {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hider {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
visibility: 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -79,7 +79,8 @@
|
||||||
"role": {
|
"role": {
|
||||||
"admin": "Admin",
|
"admin": "Admin",
|
||||||
"moderator": "Moderator"
|
"moderator": "Moderator"
|
||||||
}
|
},
|
||||||
|
"flash_content": "Click to show Flash content using Ruffle (Experimental)"
|
||||||
},
|
},
|
||||||
"image_cropper": {
|
"image_cropper": {
|
||||||
"crop_picture": "Crop picture",
|
"crop_picture": "Crop picture",
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
// or the entire service could be just mimetype service that only operates
|
// or the entire service could be just mimetype service that only operates
|
||||||
// on mimetypes and not files. Currently the naming is confusing.
|
// on mimetypes and not files. Currently the naming is confusing.
|
||||||
const fileType = mimetype => {
|
const fileType = mimetype => {
|
||||||
|
if (mimetype.match(/flash/)) {
|
||||||
|
return 'flash'
|
||||||
|
}
|
||||||
|
|
||||||
if (mimetype.match(/text\/html/)) {
|
if (mimetype.match(/text\/html/)) {
|
||||||
return 'html'
|
return 'html'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue