Compare commits

..

No commits in common. "de0a8b6f002fc77c343b99aebff4f6d39ce83065" and "3dbcc18da8b98e6dda7d73be17ed31220c742ca2" have entirely different histories.

4 changed files with 49 additions and 79 deletions

View file

@ -43,6 +43,9 @@ export default class Server {
// Create our server
this.flaska = new Flaska(this.flaskaOptions, this.http)
// Create our database pool
this.runCreateDatabase()
// configure our server
if (config.get('NODE_ENV') === 'development') {
this.flaska.devMode()
@ -118,13 +121,9 @@ export default class Server {
}
run() {
return Promise.all([
this.runCreateServer(),
this.runCreateDatabase(),
]).then(() => {
return this.runRegisterRoutes()
}).then(() => {
this.runCreateServer()
this.runRegisterRoutes()
return this.runStartListen()
})
}
}

View file

@ -20,7 +20,7 @@ export default class ServeHandler extends Parent {
'in_debug',
'inputVideo',
'inputImage'
], strip: false })
] })
}
register(server) {

View file

@ -1,6 +1,6 @@
{
"name": "discord_embed",
"version": "1.0.22",
"version": "1.0.21",
"port": 4120,
"description": "AV1 discord server embed helper",
"main": "index.js",

View file

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Discord Embedder from AV1 server 1.0.22</title>
<title>Discord Embedder from AV1 server 1.0.18</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 3rem;
padding: 1rem 0.5rem;
font-family: sans-serif;
background: var(--bg);
color: var(--color);
@ -117,7 +117,14 @@ input[type=submit] {
background: var(--button-bg);
color: var(--button-fg);
padding: 0.25rem 1rem;
margin: 0rem 0 2rem;
margin: 1rem 0 2rem;
}
pre {
background: var(--bg-content-alt);
padding: 0.5rem;
white-space: break-spaces;
word-break: break-all;
}
.row {
@ -167,10 +174,6 @@ h1 {
margin-bottom: 1rem;
}
p {
margin-bottom: 0.5rem;
}
.warning {
font-size: 0.9rem;
color: #ffe69c;
@ -179,8 +182,8 @@ p {
.alert {
font-size: 0.9rem;
margin: 0.5rem 0 1rem;
color: hsl(353.7, 70.5%, 87%);
color: #f1aeb5;
margin-bottom: 0.5rem;
}
.info {
@ -193,28 +196,16 @@ p {
text-decoration: underline;
}
.optional {
margin: 0 -0.5rem 0.5rem;
.row.optional {
background: #333;
margin: 1rem -0.5rem 0;
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;
}
@ -232,52 +223,43 @@ pre {
</div>
{{ } }}
<form action="/" method="post" enctype="multipart/form-data" class="inside">
<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>
<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>
{{ if (error) { }}<p class="error">{{=error}}</p>{{ } }}
<p> </p>
<label>Link to video file you want to play in discord*</label>
<label>Video link*</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: Link to image to show before discord user presses play</label>
<label>Optional: Image link (recommended, defaults to black cover)</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 to show before discord user presses play</label>
<input type="file" name="media" type="image">
<label>Optional: Upload image file (max 8MiB, recommended)</label>
<input type="file" name="media">
</div>
</div>
<div id="testing" class="hidden">
<p>Test area (does the video load and play? If not, it might not work on discord)</p>
<input type="submit" value="Generate short url">
</form>
<p>
Preview:
</p>
<pre id="generateurl">
{{=siteUrlBase}}?v=&lt;video link&gt;
</pre>
<div class="center">
<video class="hidden" id="previewVideo" controls poster="" preload="none">
<source src="">
</video>
</div>
<pre class="optional" id="generateurl">{{=siteUrlBase}}?v=&lt;video link&gt;</pre>
<input type="submit" value="Generate shorter url">
</div>
</form>
<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');
@ -297,20 +279,9 @@ pre {
previewVideo.classList.add('hidden')
} else {
generateurl.innerText = baseSite + '?v=' + encodeURIComponent(inputVideo.value) + (inputImage.value ? '&i=' + encodeURIComponent(inputImage.value) : '');
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();
previewVideo.poster = inputImage.value || defaultPoster;
previewVideo.children[0].src = inputVideo.value;
previewVideo.classList.remove('hidden')
}
};