forked from nm3clol/nm3clol-express-app
Added news articles from WJHL, Cardinal, and Bristol Herald Courier. Provided archive view. Patched web.config to try to get logging working again, but still not working.
This commit is contained in:
parent
efdd1161eb
commit
d1b3c7444d
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -132,7 +132,7 @@ dist
|
|||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# iisnode
|
||||
# iisnode logs
|
||||
iisnode/
|
||||
|
||||
# transpiler artifacts
|
||||
|
|
|
@ -109,6 +109,28 @@ glob.globSync('pages/**/*.md', {
|
|||
// });
|
||||
// });
|
||||
|
||||
console.log("Scanning for web archive HTML documents to create routes");
|
||||
glob.globSync('Web_Site_Archives/**/*{.htm,.html}', {
|
||||
cwd: path.join(__dirname, '..', 'public'),
|
||||
matchBase: true,
|
||||
follow: true,
|
||||
}).forEach((filePath) => {
|
||||
const expressRoutePathFromFilePath = (filePath) => {
|
||||
return '/' + filePath.replaceAll(path.sep, path.posix.sep);
|
||||
};
|
||||
const route = expressRoutePathFromFilePath(filePath);
|
||||
const fullFilePath = path.join(__dirname, '..', 'public', filePath);
|
||||
let paths = route.split(path.posix.sep);
|
||||
paths[0] = 'public';
|
||||
console.log(`Setting route for ${route}`);
|
||||
app.get(route, async (req, res) => {
|
||||
const html = fs.readFileSync(fullFilePath).toString();
|
||||
const renderData = { route, filePath, fullFilePath, req, paths, html };
|
||||
res.render("archive", { h: helpers, ...renderData });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Endpoints for all the site's YouTube videos.
|
||||
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'], {
|
||||
|
@ -220,7 +242,7 @@ app.get('*', async (req, res) => {
|
|||
source: "/OCR-Encoded-PDFs/Russell-County-Web-Site_2024-02-13_19_50_Modified-With-OCR-Encoding/:u(.*)",
|
||||
destination: "/Web_Site_Archives/Russell_County_Web_Site-2024-02-13_19_50_Modified_With_OCR_Encoding:u"
|
||||
},
|
||||
{ source: '/YouTube Channel', destination: '/Russell_County/Board_of_Supervisors/YouTube_Channel' },
|
||||
{ source: '/YouTube Channel', destination: '/Russell_County/Board_of_Supervisors/YouTube_Archive/@russellcountyvirginia8228' },
|
||||
// { source: '/YouTube Channel.zip', destination: '/Russell_County_BOS/YouTube_Channel.zip' },
|
||||
// { source: '/YouTube Channel/:u?', destination: '/Russell_County_BOS/YouTube_Channel/:u' },
|
||||
{ source: '/Project Reclaim [WI19KR9Ogwg].mkv', destination: '/YouTube_Archives/@VADMME/Project Reclaim [WI19KR9Ogwg].mkv' },
|
||||
|
|
|
@ -173,6 +173,14 @@ ul#files a.file.svg::before {
|
|||
background-color: #f44336;
|
||||
color: #fff;
|
||||
}
|
||||
.bg-primary ::selection {
|
||||
background-color: #fff;
|
||||
color: #f44336;
|
||||
}
|
||||
.bg-primary ::-moz-selection {
|
||||
background-color: #fff;
|
||||
color: #f44336;
|
||||
}
|
||||
header h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
|
1
views/archive.ejs
Normal file
1
views/archive.ejs
Normal file
|
@ -0,0 +1 @@
|
|||
<%-h.renderArchive(html)%>
|
|
@ -32,8 +32,13 @@ const getDirectoryName = ({directory}) => {
|
|||
};
|
||||
const getDirectoryTitle = ({directory}) => {
|
||||
directory = trimSlashes({path: directory});
|
||||
let title = trimSlashes({path: directory.replace("public", "")}).replaceAll(path.sep, path.posix.sep);
|
||||
return (directory=="public") ? getSiteName() : `${title} Listing - ${getSiteName()}`;
|
||||
let title = trimSlashes({path: directory.replace("public", "")})
|
||||
.replaceAll(path.sep, path.posix.sep)
|
||||
.replaceAll('_', ' ')
|
||||
.split('/')
|
||||
.reverse()
|
||||
.join(' - ');
|
||||
return (directory=="public") ? getSiteName() : `${title} - ${getSiteName()}`;
|
||||
};
|
||||
const getWelcomeBanner = ({directory}) => {
|
||||
//return trimSlashes({path: directory.replace("public", `Welcome to ${getSiteName()}`)});
|
||||
|
@ -80,6 +85,81 @@ const stripWebVTT = (webvttText) => {
|
|||
}
|
||||
return webvttText;
|
||||
};
|
||||
const renderArchive = (html, paths) => {
|
||||
// Header and Footer content
|
||||
const headHeaderContent = ``;
|
||||
const headFooterContent = `
|
||||
<!-- Dynamically Inserted Code by No Moss 3 Carbo Landfill Online Library -->
|
||||
<style>
|
||||
.__archived__content__, .__archived__content__ p { background-color: #f44336; color: #fff; font-size: 12pt; font-family: "Noto Serif", Times, "Times New Roman", serif; text-align: center; }
|
||||
.__archived__content__ h1 { font-family: "Cinzel Decorative", Verdana, Arial, sans-serif; color: #fff; font-weight: 700; font-size: 18pt; text-align: center; }
|
||||
.__archived__content__ h2 { font-family: "Covered By Your Grace", Verdana, Arial, sans-serif; color: #fff; font-weight: 700; font-size: 18pt; text-align: center; }
|
||||
.__archived__content__ { padding: 2rem; }
|
||||
.__archived__content__:first-of-type { margin-top: 0; margin-bottom: 0; }
|
||||
.__archived__content__:last-of-type { margin-top: 1rem; margin-bottom: 0; }
|
||||
.__archived__content__ .__archived__content__ p { margin-top: 1rem; }
|
||||
.__archived__content__ a:link, .__archived__content__ a:visited { color: #fff; }
|
||||
.__archived__content__ a:hover, .__archived__content__ a:active { text-decoration: none; }
|
||||
.__archived__content__ ::selection {
|
||||
background-color: #fff;
|
||||
color: #f44336;
|
||||
}
|
||||
.__archived__content__ ::-moz-selection {
|
||||
background-color: #fff;
|
||||
color: #f44336;
|
||||
}
|
||||
</style>
|
||||
<link href="https://fonts.googleapis.com/css?family=Cinzel+Decorative:100,200,300,400,500,600,700,800,900" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Covered+By+Your+Grace:100,200,300,400,500,600,700,800,900" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Noto+Serif:100,200,300,400,500,600,700,800,900" rel="stylesheet">
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-HQR3Z1EZQM"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-HQR3Z1EZQM');
|
||||
</script>
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8937572456576531" crossorigin="anonymous"></script>
|
||||
<!-- End dynamically inserted code -->
|
||||
`;
|
||||
const bodyHeaderContent = `
|
||||
<!-- Dynamically Inserted Code by No Moss 3 Carbo Landfill Online Library -->
|
||||
<div class="__archived__content__">
|
||||
<h1>No Moss 3 Carbo Landfill Online Library</h1>
|
||||
<h2>Archived Web Site</h2>
|
||||
<p>
|
||||
This is an archived version of the original website. Online features will not be functional. Do not submit any personal information to this archive.
|
||||
</p>
|
||||
<p>
|
||||
<a href="./">Current Directory Listing</a> | <a href="/">Back to Library Home</a>
|
||||
</p>
|
||||
</div>
|
||||
<!-- End dynamically inserted code -->
|
||||
`;
|
||||
const bodyFooterContent = `
|
||||
<!-- Dynamically Inserted Code by No Moss 3 Carbo Landfill Online Library -->
|
||||
<div class="__archived__content__">
|
||||
<p>
|
||||
This is an archived version of the original website. Online features will not be functional. Do not submit any personal information to this archive.
|
||||
</p>
|
||||
<p>
|
||||
<a href="./">Current Directory Listing</a> | <a href="/">Back to Library Home</a>
|
||||
</p>
|
||||
</div>
|
||||
<!-- End dynamically inserted code -->
|
||||
`;
|
||||
|
||||
// Add archive branding
|
||||
html = html.substring(0, html.indexOf('>', html.indexOf('<head')) + '>'.length) + headHeaderContent + html.substring(html.indexOf('>', html.indexOf('<head')) + '>'.length);
|
||||
html = html.substring(0, html.indexOf('</head>') + '</head>'.length) + headFooterContent + html.substring(html.indexOf('</head>') + '</head>'.length);
|
||||
html = html.substring(0, html.indexOf('>', html.indexOf('<body')) + '>'.length) + bodyHeaderContent + html.substring(html.indexOf('>', html.indexOf('<body')) + '>'.length);
|
||||
html = html.substring(0, html.indexOf('</body>') + '</body>'.length) + bodyFooterContent + html.substring(html.indexOf('</body>') + '</body>'.length);
|
||||
|
||||
// Output the modified HTML content
|
||||
return html;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
trimSlashes,
|
||||
|
@ -93,6 +173,7 @@ module.exports = {
|
|||
directoryContainsReadme,
|
||||
printReadme,
|
||||
stripWebVTT,
|
||||
renderArchive,
|
||||
md,
|
||||
moment,
|
||||
};
|
|
@ -1,8 +1,8 @@
|
|||
<configuration>
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<remove name="iisnode" />
|
||||
<add name="app" path="app/server.js" verb="*" modules="iisnode" resourceType="Unspecified" requireAccess="Script" />
|
||||
<remove name="iisnode" />
|
||||
<add name="iisnode" path="app/server.js" verb="*" modules="iisnode" resourceType="Unspecified" requireAccess="Script" />
|
||||
</handlers>
|
||||
<rewrite>
|
||||
<rules>
|
||||
|
@ -31,5 +31,6 @@
|
|||
<staticContent>
|
||||
<mimeMap fileExtension=".md" mimeType="text/markdown" />
|
||||
</staticContent>
|
||||
<iisnode asyncCompletionThreadCount="3" nodeProcessCountPerApplication="2" maxLogFileSizeInKB="51200" maxTotalLogFileSizeInKB="51200" maxLogFiles="20000" loggingEnabled="true" />
|
||||
</system.webServer>
|
||||
</configuration>
|
Loading…
Reference in New Issue
Block a user