discord_embed: Tweak ui, tweak UX, remove strip.
All checks were successful
/ deploy (push) Successful in -78h32m42s
All checks were successful
/ deploy (push) Successful in -78h32m42s
This commit is contained in:
parent
86394efb1f
commit
de0a8b6f00
3 changed files with 71 additions and 42 deletions
|
@ -20,7 +20,7 @@ export default class ServeHandler extends Parent {
|
|||
'in_debug',
|
||||
'inputVideo',
|
||||
'inputImage'
|
||||
] })
|
||||
], strip: false })
|
||||
}
|
||||
|
||||
register(server) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "discord_embed",
|
||||
"version": "1.0.21",
|
||||
"version": "1.0.22",
|
||||
"port": 4120,
|
||||
"description": "AV1 discord server embed helper",
|
||||
"main": "index.js",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Discord Embedder from AV1 server 1.0.18</title>
|
||||
<title>Discord Embedder from AV1 server 1.0.22</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
{{ if (imageLink) { }}
|
||||
|
@ -47,7 +47,7 @@ body {
|
|||
text-rendering: optimizeSpeed;
|
||||
line-height: 1.5;
|
||||
font-size: 16px;
|
||||
padding: 1rem 0.5rem;
|
||||
padding: 1rem 0.5rem 3rem;
|
||||
font-family: sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--color);
|
||||
|
@ -117,14 +117,7 @@ input[type=submit] {
|
|||
background: var(--button-bg);
|
||||
color: var(--button-fg);
|
||||
padding: 0.25rem 1rem;
|
||||
margin: 1rem 0 2rem;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: var(--bg-content-alt);
|
||||
padding: 0.5rem;
|
||||
white-space: break-spaces;
|
||||
word-break: break-all;
|
||||
margin: 0rem 0 2rem;
|
||||
}
|
||||
|
||||
.row {
|
||||
|
@ -174,6 +167,10 @@ h1 {
|
|||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.warning {
|
||||
font-size: 0.9rem;
|
||||
color: #ffe69c;
|
||||
|
@ -182,8 +179,8 @@ h1 {
|
|||
|
||||
.alert {
|
||||
font-size: 0.9rem;
|
||||
color: #f1aeb5;
|
||||
margin-bottom: 0.5rem;
|
||||
margin: 0.5rem 0 1rem;
|
||||
color: hsl(353.7, 70.5%, 87%);
|
||||
}
|
||||
|
||||
.info {
|
||||
|
@ -196,16 +193,28 @@ h1 {
|
|||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.row.optional {
|
||||
background: #333;
|
||||
margin: 1rem -0.5rem 0;
|
||||
.optional {
|
||||
margin: 0 -0.5rem 0.5rem;
|
||||
padding: 0rem 0.5rem 1rem;
|
||||
background: var(--bg-content-alt);
|
||||
}
|
||||
|
||||
#testing {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 0.5rem !important;
|
||||
white-space: break-spaces;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
#previewVideo {
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
@ -223,43 +232,52 @@ h1 {
|
|||
</div>
|
||||
{{ } }}
|
||||
<form action="/" method="post" enctype="multipart/form-data" class="inside">
|
||||
<h1>Create/generate embed url</h1>
|
||||
<p class="warning">Please don't try to use <b>youtube.com</b> links or file sharing sites that don't allow direct link to the video. They will show a download page and won't embed properly (for example <b>mediafire.com</b>, <b>megaupload</b>, <b>drive.google.com</b>, etc.)<br><b>Those will all not work</b>. (You can test if embedding works by clicking play below in the video player after filling out the video link.)</p>
|
||||
<p class="info">Video upload sites that work are sites like <a href="https://catbox.moe/" target="_blank">catbox.moe</a> and other sites that allow direct link to video file.</p>
|
||||
<p class="alert"><b>HEVC/h.265 files will not embed or work</b>!</p>
|
||||
<p class="alert">Video files of .mkv <b>will also not work</b>! Only files like *.mov, *.mp4 and *.webm will work.</p>
|
||||
<h1>Embed {{ if (videoLink && imageLink) { }} another {{ } }} video for discord:</h1>
|
||||
<p>Use this tool to generate links that forces discord to try and play a video or movie directly inside discord. By default, discord will not show video playback for video links that are too large or not in proper format. This tool forces discord to at least try.</p>
|
||||
|
||||
<p class="warning">Only sites and filesharing sites that have direct link to the video will work and play in discord. Youtube has it's own player and will not work. Many video sites will have their own player and will not work.</p>
|
||||
|
||||
<p class="info">Video upload sites that work are sites like <a href="https://catbox.moe/" target="_blank">catbox.moe</a> and other sites that allow <b>direct link to video file</b> will work.</p>
|
||||
|
||||
{{ if (error) { }}<p class="error">{{=error}}</p>{{ } }}
|
||||
<label>Video link*</label>
|
||||
<p> </p>
|
||||
<label>Link to video file you want to play in discord*</label>
|
||||
<input id="inputVideo" type="text" name="video" value="{{=inputVideo}}">
|
||||
<p class="alert">
|
||||
<b>.mkv</b> video files will <b>not work</b>! <b>HEVC/h.265</b> will also <b>not work</b>! File hosting sites like <b>mediafire/dropbox/google drive</b> will also <b>not work</b>!<br>
|
||||
</p>
|
||||
<div class="row optional">
|
||||
<div class="row-item">
|
||||
<label>Optional: Image link (recommended, defaults to black cover)</label>
|
||||
<label>Optional: Link to image to show before discord user presses play</label>
|
||||
<input id="inputImage" type="text" name="image" value="{{=inputImage}}">
|
||||
</div>
|
||||
<span class="row-inbetween">or</span>
|
||||
<div class="row-item">
|
||||
<label>Optional: Upload image file (max 8MiB, recommended)</label>
|
||||
<input type="file" name="media">
|
||||
<label>Optional: Upload image to show before discord user presses play</label>
|
||||
<input type="file" name="media" type="image">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="submit" value="Generate short url">
|
||||
|
||||
<div id="testing" class="hidden">
|
||||
<p>Test area (does the video load and play? If not, it might not work on discord)</p>
|
||||
|
||||
<div class="center">
|
||||
<video class="hidden" id="previewVideo" controls poster="" preload="none">
|
||||
<source src="">
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<pre class="optional" id="generateurl">{{=siteUrlBase}}?v=<video link></pre>
|
||||
|
||||
<input type="submit" value="Generate shorter url">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
Preview:
|
||||
</p>
|
||||
<pre id="generateurl">
|
||||
{{=siteUrlBase}}?v=<video link>
|
||||
</pre>
|
||||
|
||||
<video class="hidden" id="previewVideo" controls poster="" preload="none">
|
||||
<source src="">
|
||||
</video>
|
||||
|
||||
<script type="text/javascript" nonce="{{=nonce}}">
|
||||
var defaultPoster = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQAAAALQAQAAAADnBuD7AAAAh0lEQVR42u3BMQEAAADCIPuntsROYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACkDsTfAAFMFnd/AAAAAElFTkSuQmCC';
|
||||
var baseSite = '{{=siteUrlBase}}';
|
||||
var existingVideoUrl = '{{=inputVideo}}';
|
||||
var testing = document.getElementById('testing');
|
||||
var generateurl = document.getElementById('generateurl');
|
||||
var inputVideo = document.getElementById('inputVideo');
|
||||
var inputImage = document.getElementById('inputImage');
|
||||
|
@ -279,9 +297,20 @@ h1 {
|
|||
previewVideo.classList.add('hidden')
|
||||
} else {
|
||||
generateurl.innerText = baseSite + '?v=' + encodeURIComponent(inputVideo.value) + (inputImage.value ? '&i=' + encodeURIComponent(inputImage.value) : '');
|
||||
previewVideo.poster = inputImage.value || defaultPoster;
|
||||
previewVideo.children[0].src = inputVideo.value;
|
||||
previewVideo.classList.remove('hidden')
|
||||
|
||||
previewVideo.pause();
|
||||
if (inputVideo.value !== existingVideoUrl) {
|
||||
previewVideo.setAttribute('poster', inputImage.value || defaultPoster);
|
||||
previewVideo.children[0].setAttribute('src', inputVideo.value);
|
||||
previewVideo.classList.remove('hidden');
|
||||
testing.classList.remove('hidden');
|
||||
} else {
|
||||
previewVideo.removeAttribute('poster');
|
||||
previewVideo.children[0].removeAttribute('src');
|
||||
previewVideo.classList.add('hidden')
|
||||
testing.classList.add('hidden');
|
||||
}
|
||||
previewVideo.load();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue