|
|
|
|
@ -81,7 +81,6 @@ glob.globSync('**/*.md', {
|
|
|
|
|
const route = expressRoutePathFromFilePath(filePath);
|
|
|
|
|
const fullFilePath = path.join(config.pagesPath, filePath);
|
|
|
|
|
let paths = route.split(path.posix.sep);
|
|
|
|
|
paths[0] = 'public';
|
|
|
|
|
console.log(`Serving ${route} route as a page at ${fullFilePath}.`);
|
|
|
|
|
app.get(route, async (req, res) => {
|
|
|
|
|
const fm = matter.read(fullFilePath);
|
|
|
|
|
@ -94,7 +93,7 @@ glob.globSync('**/*.md', {
|
|
|
|
|
|
|
|
|
|
// console.log("Scanning for documents to create routes.");
|
|
|
|
|
// glob.globSync('**/*{.pdf,.docx,.xlsx,.pptx,.doc,.xls,.ppt}', {
|
|
|
|
|
// cwd: path.join(__dirname, '..', 'public'),
|
|
|
|
|
// cwd: path.join(config.publicPath),
|
|
|
|
|
// matchBase: true,
|
|
|
|
|
// follow: true,
|
|
|
|
|
// }).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);
|
|
|
|
|
// };
|
|
|
|
|
// 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);
|
|
|
|
|
// paths[0] = 'public';
|
|
|
|
|
// 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.
|
|
|
|
|
console.log("Scanning for web archive HTML documents to create routes.");
|
|
|
|
|
glob.globSync('Web_Site_Archives/**/*{.htm,.html}', {
|
|
|
|
|
cwd: path.join(__dirname, '..', 'public'),
|
|
|
|
|
cwd: config.publicPath,
|
|
|
|
|
matchBase: true,
|
|
|
|
|
follow: true,
|
|
|
|
|
}).forEach((filePath) => {
|
|
|
|
|
@ -126,7 +125,7 @@ glob.globSync('Web_Site_Archives/**/*{.htm,.html}', {
|
|
|
|
|
return '/' + filePath.replaceAll(path.sep, path.posix.sep);
|
|
|
|
|
};
|
|
|
|
|
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);
|
|
|
|
|
paths[0] = 'public';
|
|
|
|
|
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.
|
|
|
|
|
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'], {
|
|
|
|
|
cwd: path.join(__dirname, '..', 'public'),
|
|
|
|
|
cwd: config.publicPath,
|
|
|
|
|
matchBase: true,
|
|
|
|
|
follow: true,
|
|
|
|
|
}).forEach((filePath) => {
|
|
|
|
|
@ -153,16 +152,16 @@ glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.js
|
|
|
|
|
}
|
|
|
|
|
const directory = dirFromFilePath(filePath);
|
|
|
|
|
let videoURL = ""+glob.globSync("*.{mpg,mpeg,mp4,mkv,webm}", {
|
|
|
|
|
cwd: path.join(__dirname, '..', 'public', directory),
|
|
|
|
|
cwd: path.join(config.publicPath, directory),
|
|
|
|
|
matchBase: true,
|
|
|
|
|
follow: true,
|
|
|
|
|
}).pop();
|
|
|
|
|
let subtitleURL = ""+glob.globSync("*.en.vtt", {
|
|
|
|
|
cwd: path.join(__dirname, '..', 'public', directory),
|
|
|
|
|
cwd: path.join(config.publicPath, directory),
|
|
|
|
|
matchBase: true,
|
|
|
|
|
follow: true,
|
|
|
|
|
}).pop();
|
|
|
|
|
let subtitleFile = path.join(__dirname, '..', 'public', directory, subtitleURL);
|
|
|
|
|
let subtitleFile = path.join(config.publicPath, directory, subtitleURL);
|
|
|
|
|
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);
|
|
|
|
|
paths = paths.map((name, idx, aPaths) => {
|
|
|
|
|
@ -172,7 +171,7 @@ glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.js
|
|
|
|
|
url,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
const fullFilePath = path.join(__dirname, '..', 'public', filePath);
|
|
|
|
|
const fullFilePath = path.join(config.publicPath, filePath);
|
|
|
|
|
console.log(`Setting route for ${route}`);
|
|
|
|
|
app.get(route, async (req, res) => {
|
|
|
|
|
if (!req.path.endsWith('/')) {
|
|
|
|
|
|