Compare commits

..

12 Commits

Author SHA1 Message Date
9c0dced205
cleanup 2022-03-24 02:22:50 +02:00
575280ec87
BANGER 2022-03-24 01:41:11 +02:00
4eb61f6f8c
pls work pls 2022-03-24 01:34:36 +02:00
6907bd6823
does the order matter? 2022-03-24 01:30:30 +02:00
8384a57b6a
PLS 2022-03-24 01:28:57 +02:00
f3f2dfd381
ölskahjgölkjh 2022-03-24 01:11:02 +02:00
56918b9358
meta tags pls 2022-03-24 01:08:31 +02:00
379c178f59
lol woops 2022-03-23 23:09:17 +02:00
e7fa9c027d
meta tags pls work 2022-03-23 23:05:15 +02:00
f3631e59b2
hnnng 2022-03-23 22:34:21 +02:00
889121e924
pls 2022-03-23 22:30:35 +02:00
8bb49a0fac
embeds maybe 2022-03-23 22:28:29 +02:00
4 changed files with 54 additions and 8 deletions

View File

@ -5,10 +5,10 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#ffafff" />
<meta
<!-- <meta
name="description"
content="Navy's homepage 😎"
/>
/> -->
<!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> -->
<!--
manifest.json provides metadata used when your web app is installed on a
@ -24,7 +24,20 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<meta property='og:type' content='video.other' />
<meta property='og:url' content='{{META_url}}' />
<!-- <meta property='og:image' content={{META_thumbnail}} /> -->
<meta property='og:video' content='{{META_url}}' />
<meta property='og:video:url' content={{META_srcUrl}} />
<meta property='og:video:secure_url' content={{META_srcUrl}} />
<meta property='og:video:type' content='video/mp4' />
<meta property="og:video:width" content="1280">
<meta property="og:video:height" content="720">
<title>Corgi Corner</title>
<meta name="description" content="{{META_description}}" />
<meta name='author' content='{{META_author}}' />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -34,6 +34,7 @@ const ClipEntry = ({ name, filename, uploader, thumbnail, duration, clickHandler
const VideoPlayer = ({ refF, video }) => {
// eslint-disable-next-line no-unused-vars
const { filename, name, thumbnail, uploader } = video;
const source = `/api/clips/${filename}`;
@ -41,13 +42,13 @@ const VideoPlayer = ({ refF, video }) => {
<div ref={refF} className='video-popup shadow'>
<Helmet>
<title>{name}</title>
{/* <title>{name}</title>
<meta name='author' content={uploader.name} />
<meta property='og:url' content={window.location.href} />
<meta property='og:image' content={`${window.location.origin}${thumbnailBase}${thumbnail}`} />
<meta property='og:video:type' content='text/html' />
<meta property='og:video:url' content={`${window.location.origin}${source}`} />
<meta property='og:type' content='video.other' />
<meta property='og:type' content='video.other' /> */}
</Helmet>
<div>
@ -104,7 +105,7 @@ const Media = () => {
<div className='media-page'>
<Helmet>
<title>V i d e o s</title>
{/* <title>V i d e o s</title> */}
<meta
name="description"
content="Page where I upload clips n stuff"

View File

@ -156,6 +156,13 @@ class ClipIndex extends EventEmitter {
return Object.values(this.index);
}
getByTitle(title) {
title = title.toLowerCase();
for (const entry of Object.values(this.index))
if (entry.name.toLowerCase() === title)
return entry;
}
}
module.exports = ClipIndex;

View File

@ -1,6 +1,7 @@
const { Endpoint } = require('../interfaces');
const path = require('path');
const express = require('express');
const fs = require('fs');
class Home extends Endpoint {
@ -21,20 +22,44 @@ class Home extends Endpoint {
const manifest = path.resolve(this.client.baseDirectory, '../client/build/manifest.json');
const favicon = path.resolve(this.client.baseDirectory, '../client/build/favicon.ico');
const robots = path.resolve(this.client.baseDirectory, '../client/build/robots.txt');
this.indexPath = path.resolve(this.client.baseDirectory, '../client/build/index.html');
this.client.app.use('/static', express.static(assets));
this.client.app.use('/manifest.json', express.static(manifest));
this.client.app.use('/favicon.ico', express.static(favicon));
this.client.app.use('/robots.txt', express.static(robots));
this.index = fs.readFileSync(this.indexPath, { encoding: 'utf-8' });
this.init();
}
async get(req, res) {
res.set('Cross-Origin-Resource-Policy', 'cross-origin');
const home = path.resolve(this.client.baseDirectory, '../client/build/index.html');
res.sendFile(home);
const { path } = req;
if ((/\/media\/.+/u).test(path)) {
const title = decodeURI(path.replace('/media/', ''));
const clip = this.client.clipIndex.getByTitle(title);
const baseUrl = `https://${this.client.domain}`;
const clientUrl = `${baseUrl}${path}`;
const thumbnailUrl = `${baseUrl}/api/thumbnails/${clip.thumbnail}`;
const clipUrl = `${baseUrl}/api/clips/${clip.filename}`;
const html = this.index
// .replace(`<title>Corgi Corner</title>`, clip.name)
.replace(/\{\{META_description\}\}/ug, 'A website I guess')
.replace(/\{\{META_author\}\}/ug, clip.uploader.tag)
.replace(/\{\{META_url\}\}/ug, clientUrl)
.replace(/\{\{META_thumbnail\}\}/ug, thumbnailUrl)
.replace(/\{\{META_srcUrl\}\}/ug, clipUrl);
return res.send(html);
}
// res.set('Cross-Origin-Resource-Policy', 'cross-origin');
//const home = path.resolve(this.client.baseDirectory, '../client/build/index.html');
res.sendFile(this.indexPath);
}