diff --git a/public/css/app.css b/public/css/app.css index ff1fb2c..d2f2227 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -90,3 +90,27 @@ div.nonmedia p { label { text-align: center; } + +.video { + position: relative; +} + +.video .overlay { + position: absolute; + top: 0%; + left: 70%; + transform: translateY(0%) translateX(70%); + z-index: 1; + border-radius: 25px; + border: 2px solid #73AD21; + padding: 5px; + background-color: #eee; +} + +.video .overlay a { + color: #73AD21; + font-size: 12px; + font-weight: 400; + line-height: 20px; + text-align: center; +} diff --git a/public/js/index.js b/public/js/index.js index 9e5fe7e..948f363 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -9,6 +9,15 @@ function copyURI(evt) { }); } +function copyA(evt) { + evt.preventDefault(); + navigator.clipboard.writeText(absolutePath(evt.target.getAttribute('href'))).then(() => { + console.log("copied"); + }, () => { + console.log("failed"); + }); +} + function copyPath(evt) { navigator.clipboard.writeText(absolutePath(evt)).then(() => { console.log("copied"); diff --git a/routes/index.js b/routes/index.js index 6b489a2..676dc3a 100644 --- a/routes/index.js +++ b/routes/index.js @@ -103,6 +103,11 @@ router.get('/', function (req, res, next) { res.render('index', { user: req.user }); }); +router.get('/gifv/:file', function (req, res, next) { + let url = req.protocol + '://' + req.get('host') + '/uploads/' + req.params.file; + return res.render('gifv', { url: url }); +}); + router.post('/', upload.array('fileupload'), function(req, res, next) { if (!req.files || Object.keys(req.files).length === 0) { console.log(req) @@ -138,7 +143,6 @@ router.post('/sharex', [checkAuth, upload.array('fileupload')], function(req, re } }); - router.post('/:id(\\d+)/delete', function(req, res, next) { db.all('SELECT path FROM media WHERE id = ?', [ req.params.id ], function(err, path) { if (err) { return next(err); } diff --git a/views/gifv.ejs b/views/gifv.ejs new file mode 100644 index 0000000..7aef16e --- /dev/null +++ b/views/gifv.ejs @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/views/index.ejs b/views/index.ejs index a91f993..a6b384d 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -49,7 +49,13 @@ return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2);
<% if (extension(file.path) == ".mp4" || extension(file.path) == ".mov" || extension(file.path) == "webp") { %> - +
+ + <% } else if (extension(file.path) == ".jpg" || extension(file.path) == ".jpeg" || extension(file.path) == ".png" || extension(file.path) == ".gif" || extension(file.path) == ".webp" ) { %> <% } else {%>