Merge 4dd445e0f0
into 61b9f81e39
This commit is contained in:
commit
70abed7b83
6 changed files with 38 additions and 7 deletions
|
@ -45,6 +45,8 @@
|
|||
|
||||
.post-content
|
||||
margin: 0
|
||||
background-size: cover
|
||||
background-repeat: no-repeat
|
||||
|
||||
.after-mobile-controls
|
||||
width: 100%
|
||||
|
|
|
@ -28,5 +28,6 @@
|
|||
<div id='content-holder'></div>
|
||||
<script type='text/javascript' src='js/vendor.min.js'></script>
|
||||
<script type='text/javascript' src='js/app.min.js'></script>
|
||||
<script type='text/javascript' src='https://unpkg.com/@ruffle-rs/ruffle' async></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class='post-content post-type-<%- ctx.post.type %>'>
|
||||
<div class='post-content post-type-<%- ctx.post.type %>' style='<%- ctx.post.type === 'flash' ? 'background-image: url('+ctx.post.thumbnailUrl+')' : '' %>'>
|
||||
<% if (['image', 'animation'].includes(ctx.post.type)) { %>
|
||||
|
||||
<img class='resize-listener' alt='' src='<%- ctx.post.contentUrl %>'/>
|
||||
|
@ -6,8 +6,9 @@
|
|||
<% } else if (ctx.post.type === 'flash') { %>
|
||||
|
||||
<object class='resize-listener' width='<%- ctx.post.canvasWidth %>' height='<%- ctx.post.canvasHeight %>' data='<%- ctx.post.contentUrl %>'>
|
||||
<param name='wmode' value='opaque'/>
|
||||
<param name='wmode' value='transparent'/>
|
||||
<param name='movie' value='<%- ctx.post.contentUrl %>'/>
|
||||
<div class='messages'><div class='message-wrapper'><div class='message error'>Your browser does not support Flash.</div></div></div>
|
||||
</object>
|
||||
|
||||
<% } else if (ctx.post.type === 'video') { %>
|
||||
|
|
|
@ -42,6 +42,17 @@ const pools = require("./pools.js");
|
|||
const api = require("./api.js");
|
||||
const settings = require("./models/settings.js");
|
||||
|
||||
const rgb2hex = (rgb) => `#${rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/).slice(1).map(n => parseInt(n, 10).toString(16).padStart(2, '0')).join('')}`
|
||||
|
||||
window.RufflePlayer = window.RufflePlayer || {};
|
||||
window.RufflePlayer.config = {
|
||||
"polyfills": true,
|
||||
"autoplay": "off",
|
||||
"warnOnUnsupportedContent": false,
|
||||
"showSwfDownload": true,
|
||||
"splashScreen": false,
|
||||
};
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => api.fetchConfig())
|
||||
.then(
|
||||
|
@ -99,6 +110,8 @@ Promise.resolve()
|
|||
if (settings.get().darkTheme) {
|
||||
document.body.classList.add("darktheme");
|
||||
}
|
||||
|
||||
window.RufflePlayer.config.autoplay = settings.get().autoplayVideos ? "auto" : "off"
|
||||
})
|
||||
.then(() => api.loginFromCookies())
|
||||
.then(
|
||||
|
|
|
@ -30,6 +30,7 @@ class SettingsView extends events.EventTarget {
|
|||
|
||||
_evtSubmit(e) {
|
||||
e.preventDefault();
|
||||
window.RufflePlayer.config.autoplay = this._find("autoplay-videos").checked ? "auto" : "off"
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("submit", {
|
||||
detail: {
|
||||
|
|
|
@ -28,6 +28,9 @@ class Image:
|
|||
def __init__(self, content: bytes) -> None:
|
||||
self.content = content
|
||||
self._reload_info()
|
||||
if self.info["format"]["format_name"] == "swf":
|
||||
self.content = self.swf_to_png()
|
||||
self._reload_info()
|
||||
|
||||
@property
|
||||
def width(self) -> int:
|
||||
|
@ -60,10 +63,7 @@ class Image:
|
|||
"png",
|
||||
"-",
|
||||
]
|
||||
if (
|
||||
"duration" in self.info["format"]
|
||||
and self.info["format"]["format_name"] != "swf"
|
||||
):
|
||||
if "duration" in self.info["format"]:
|
||||
duration = float(self.info["format"]["duration"])
|
||||
if duration > 3:
|
||||
cli = [
|
||||
|
@ -76,6 +76,19 @@ class Image:
|
|||
self.content = content
|
||||
self._reload_info()
|
||||
|
||||
def swf_to_png(self) -> bytes:
|
||||
return self._execute(
|
||||
[
|
||||
"--silent",
|
||||
"-g",
|
||||
"gl",
|
||||
"--",
|
||||
"{path}",
|
||||
"-",
|
||||
],
|
||||
program="exporter",
|
||||
)
|
||||
|
||||
def to_png(self) -> bytes:
|
||||
return self._execute(
|
||||
[
|
||||
|
@ -315,7 +328,7 @@ class Image:
|
|||
)
|
||||
assert "format" in self.info
|
||||
assert "streams" in self.info
|
||||
if len(self.info["streams"]) < 1:
|
||||
if len(self.info["streams"]) < 1 and self.info["format"]["format_name"] != "swf":
|
||||
logger.warning("The video contains no video streams.")
|
||||
raise errors.ProcessingError(
|
||||
"The video contains no video streams."
|
||||
|
|
Reference in a new issue