forked from nm3clol/nm3clol-express-app
fix: video player was still using hard-coded paths.
This commit is contained in:
parent
a86fe7f198
commit
07ec0a1c3e
|
@ -6,7 +6,7 @@ const dotenvExpand = require('dotenv-expand');
|
||||||
const process = require('process');
|
const process = require('process');
|
||||||
|
|
||||||
const env = {};
|
const env = {};
|
||||||
let dotEnvConfig = dotenv.config({ path: path.join(__dirname, '..', '.env'), processEnv: env });
|
let dotEnvConfig = dotenv.config({ path: path.join(__dirname, '.env'), process: dotenv.config({ path: path.join(__dirname, '..', '.env'), processEnv: env})});
|
||||||
dotEnvConfig = dotenvExpand.expand({ parsed: env, processEnv: env });
|
dotEnvConfig = dotenvExpand.expand({ parsed: env, processEnv: env });
|
||||||
|
|
||||||
const getAppHttpHost = () => env.APP_HTTP_HOST||'nm3clol-express-app';
|
const getAppHttpHost = () => env.APP_HTTP_HOST||'nm3clol-express-app';
|
||||||
|
|
|
@ -81,7 +81,6 @@ glob.globSync('**/*.md', {
|
||||||
const route = expressRoutePathFromFilePath(filePath);
|
const route = expressRoutePathFromFilePath(filePath);
|
||||||
const fullFilePath = path.join(config.pagesPath, filePath);
|
const fullFilePath = path.join(config.pagesPath, filePath);
|
||||||
let paths = route.split(path.posix.sep);
|
let paths = route.split(path.posix.sep);
|
||||||
paths[0] = 'public';
|
|
||||||
console.log(`Serving ${route} route as a page at ${fullFilePath}.`);
|
console.log(`Serving ${route} route as a page at ${fullFilePath}.`);
|
||||||
app.get(route, async (req, res) => {
|
app.get(route, async (req, res) => {
|
||||||
const fm = matter.read(fullFilePath);
|
const fm = matter.read(fullFilePath);
|
||||||
|
@ -94,7 +93,7 @@ glob.globSync('**/*.md', {
|
||||||
|
|
||||||
// console.log("Scanning for documents to create routes.");
|
// console.log("Scanning for documents to create routes.");
|
||||||
// glob.globSync('**/*{.pdf,.docx,.xlsx,.pptx,.doc,.xls,.ppt}', {
|
// glob.globSync('**/*{.pdf,.docx,.xlsx,.pptx,.doc,.xls,.ppt}', {
|
||||||
// cwd: path.join(__dirname, '..', 'public'),
|
// cwd: path.join(config.publicPath),
|
||||||
// matchBase: true,
|
// matchBase: true,
|
||||||
// follow: true,
|
// follow: true,
|
||||||
// }).forEach((filePath) => {
|
// }).forEach((filePath) => {
|
||||||
|
@ -102,7 +101,7 @@ glob.globSync('**/*.md', {
|
||||||
// return filePath.substring(0, filePath.length - path.extname(filePath).length).replaceAll(path.sep, path.posix.sep);
|
// return filePath.substring(0, filePath.length - path.extname(filePath).length).replaceAll(path.sep, path.posix.sep);
|
||||||
// };
|
// };
|
||||||
// const route = expressRoutePathFromFilePath(filePath);
|
// const route = expressRoutePathFromFilePath(filePath);
|
||||||
// const fullFilePath = path.join(__dirname, '..', 'public', filePath);
|
// const fullFilePath = path.join(config.publicPath, filePath);
|
||||||
// let paths = route.split(path.posix.sep);
|
// let paths = route.split(path.posix.sep);
|
||||||
// paths[0] = 'public';
|
// paths[0] = 'public';
|
||||||
// console.log(`Setting route for ${route}`);
|
// console.log(`Setting route for ${route}`);
|
||||||
|
@ -118,7 +117,7 @@ glob.globSync('**/*.md', {
|
||||||
//TODO: Rewrite this facility so that it utilizes Git index as a filesystem.
|
//TODO: Rewrite this facility so that it utilizes Git index as a filesystem.
|
||||||
console.log("Scanning for web archive HTML documents to create routes.");
|
console.log("Scanning for web archive HTML documents to create routes.");
|
||||||
glob.globSync('Web_Site_Archives/**/*{.htm,.html}', {
|
glob.globSync('Web_Site_Archives/**/*{.htm,.html}', {
|
||||||
cwd: path.join(__dirname, '..', 'public'),
|
cwd: config.publicPath,
|
||||||
matchBase: true,
|
matchBase: true,
|
||||||
follow: true,
|
follow: true,
|
||||||
}).forEach((filePath) => {
|
}).forEach((filePath) => {
|
||||||
|
@ -126,7 +125,7 @@ glob.globSync('Web_Site_Archives/**/*{.htm,.html}', {
|
||||||
return '/' + filePath.replaceAll(path.sep, path.posix.sep);
|
return '/' + filePath.replaceAll(path.sep, path.posix.sep);
|
||||||
};
|
};
|
||||||
const route = expressRoutePathFromFilePath(filePath);
|
const route = expressRoutePathFromFilePath(filePath);
|
||||||
const fullFilePath = path.join(__dirname, '..', 'public', filePath);
|
const fullFilePath = path.join(config.publicPath, filePath);
|
||||||
let paths = route.split(path.posix.sep);
|
let paths = route.split(path.posix.sep);
|
||||||
paths[0] = 'public';
|
paths[0] = 'public';
|
||||||
console.log(`Setting route for ${route}`);
|
console.log(`Setting route for ${route}`);
|
||||||
|
@ -141,7 +140,7 @@ glob.globSync('Web_Site_Archives/**/*{.htm,.html}', {
|
||||||
//TODO: Rewrite this facility so that it utilizes Git index as a filesystem.
|
//TODO: Rewrite this facility so that it utilizes Git index as a filesystem.
|
||||||
console.log("Scanning for archived videos to create routes.");
|
console.log("Scanning for archived videos to create routes.");
|
||||||
glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.json', 'Virginia_Energy/YouTube_Archive/**/*.info.json', 'Virginia_Governor/**/*.info.json'], {
|
glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.json', 'Virginia_Energy/YouTube_Archive/**/*.info.json', 'Virginia_Governor/**/*.info.json'], {
|
||||||
cwd: path.join(__dirname, '..', 'public'),
|
cwd: config.publicPath,
|
||||||
matchBase: true,
|
matchBase: true,
|
||||||
follow: true,
|
follow: true,
|
||||||
}).forEach((filePath) => {
|
}).forEach((filePath) => {
|
||||||
|
@ -153,16 +152,16 @@ glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.js
|
||||||
}
|
}
|
||||||
const directory = dirFromFilePath(filePath);
|
const directory = dirFromFilePath(filePath);
|
||||||
let videoURL = ""+glob.globSync("*.{mpg,mpeg,mp4,mkv,webm}", {
|
let videoURL = ""+glob.globSync("*.{mpg,mpeg,mp4,mkv,webm}", {
|
||||||
cwd: path.join(__dirname, '..', 'public', directory),
|
cwd: path.join(config.publicPath, directory),
|
||||||
matchBase: true,
|
matchBase: true,
|
||||||
follow: true,
|
follow: true,
|
||||||
}).pop();
|
}).pop();
|
||||||
let subtitleURL = ""+glob.globSync("*.en.vtt", {
|
let subtitleURL = ""+glob.globSync("*.en.vtt", {
|
||||||
cwd: path.join(__dirname, '..', 'public', directory),
|
cwd: path.join(config.publicPath, directory),
|
||||||
matchBase: true,
|
matchBase: true,
|
||||||
follow: true,
|
follow: true,
|
||||||
}).pop();
|
}).pop();
|
||||||
let subtitleFile = path.join(__dirname, '..', 'public', directory, subtitleURL);
|
let subtitleFile = path.join(config.publicPath, directory, subtitleURL);
|
||||||
const route = encodeURI(expressRoutePathFromFilePath(filePath));
|
const route = encodeURI(expressRoutePathFromFilePath(filePath));
|
||||||
let paths = filePath.substring(0, filePath.lastIndexOf(path.sep) > 0 ? filePath.lastIndexOf(path.sep) : filePath.length-1).split(path.sep);
|
let paths = filePath.substring(0, filePath.lastIndexOf(path.sep) > 0 ? filePath.lastIndexOf(path.sep) : filePath.length-1).split(path.sep);
|
||||||
paths = paths.map((name, idx, aPaths) => {
|
paths = paths.map((name, idx, aPaths) => {
|
||||||
|
@ -172,7 +171,7 @@ glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.js
|
||||||
url,
|
url,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const fullFilePath = path.join(__dirname, '..', 'public', filePath);
|
const fullFilePath = path.join(config.publicPath, filePath);
|
||||||
console.log(`Setting route for ${route}`);
|
console.log(`Setting route for ${route}`);
|
||||||
app.get(route, async (req, res) => {
|
app.get(route, async (req, res) => {
|
||||||
if (!req.path.endsWith('/')) {
|
if (!req.path.endsWith('/')) {
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
<% if (h.shouldShowDirectorySeparator({index})) { %>
|
<% if (h.shouldShowDirectorySeparator({index})) { %>
|
||||||
<span class="separator">› </span>
|
<span class="separator">› </span>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (h.shouldShowWelcomeBanner({paths})) { %>
|
<% if (h.shouldShowSiteWelcomeMessage({paths})) { %>
|
||||||
Welcome to <%= h.getDirectoryTitle({directory}) %>
|
<i> </i>
|
||||||
|
<%= h.getSiteWelcomeMessage() %>
|
||||||
<% } else if (h.shouldOmitLinkOnLastBreadcrumb({paths, index})) { %>
|
<% } else if (h.shouldOmitLinkOnLastBreadcrumb({paths, index})) { %>
|
||||||
<%= h.trimSlashes({path: value.name}) %>
|
<%= h.trimSlashes(value.name) %>
|
||||||
<% } else if (index == 0) { %>
|
<% } else if (index == 0) { %>
|
||||||
<a href="/"><%= h.getSiteName() %></a>
|
<a href="/"><%= h.getSiteName() %></a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user