Compare commits
12 Commits
248b3dc8bc
...
9c0dced205
Author | SHA1 | Date | |
---|---|---|---|
9c0dced205 | |||
575280ec87 | |||
4eb61f6f8c | |||
6907bd6823 | |||
8384a57b6a | |||
f3f2dfd381 | |||
56918b9358 | |||
379c178f59 | |||
e7fa9c027d | |||
f3631e59b2 | |||
889121e924 | |||
8bb49a0fac |
@ -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>
|
||||
|
@ -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"
|
||||
|
@ -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;
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user