Cleanup a lot of tab stops from 4 spaces to 2 and adjust other whitespace.

This commit is contained in:
David Ball 2024-06-24 01:00:18 -04:00
parent 6979c455ef
commit e0b93cf355
15 changed files with 314 additions and 347 deletions

View File

@ -1,4 +1,4 @@
export interface Breadcrumb {
title: string;
url: string;
title: string;
url: string;
}

View File

@ -2,24 +2,24 @@
* Needed until the conversion is completed.
*/
export interface IncorrectStyleSolrDocument {
id: string;
sha256sum: string[];
url: string[];
content_length: number[];
content_type: string[];
text: string[];
_version_?: number;
id: string;
sha256sum: string[];
url: string[];
content_length: number[];
content_type: string[];
text: string[];
_version_?: number;
}
/**
* Describes Solr full-text search properties for a document file in the public repository.
*/
export interface SolrDocument {
id: string;
sha256sum: string;
url: string;
content_length: number;
content_type: string;
text: string;
_version_?: number;
id: string;
sha256sum: string;
url: string;
content_length: number;
content_type: string;
text: string;
_version_?: number;
}

View File

@ -38,5 +38,5 @@ app.listen(config.appHttpPort, () => {
console.log(`To access your app, you can use the 127.0.0.1 host, http://127.0.0.1:${config.appHttpPort}.`);
console.log(`To access your app, you can use the ::1 host, http://[::1]:${config.appHttpPort}.`);
console.log(`To access your app, you might can use the app host name, ${config.appHttpUrl}.`);
console.log(`This app is configured to use the web site URL, ${config.siteUrl}.`);
console.log(`This app is configured to use the web site URL for URL generation, as needed, ${config.siteUrl}. Certain site features won't work correctly unless this is on a publicly accessible URL.`);
});

View File

@ -1,11 +1,11 @@
import { ReadStream } from 'fs'
import fetch from 'node-fetch'
let join = (...args: String[]) => {
let output = "";
args.forEach((arg) => {
output += arg;
})
return output;
let output = "";
args.forEach((arg) => {
output += arg;
})
return output;
};
import { ContentResource, MetadataResource } from './types.mjs'
import { Writable } from 'stream';

View File

@ -1,81 +1,81 @@
export interface MetadataResource {
'pdf:unmappedUnicodeCharsPerPage': string[]
'pdf:PDFVersion': string
'xmp:CreatorTool': string
'pdf:hasXFA': string
'access_permission:modify_annotations': string
'access_permission:can_print_degraded': string
'X-TIKA:Parsed-By-Full-Set': string[]
'pdf:num3DAnnotations': string
'dcterms:created': string
'language': string
'dcterms:modified': string
'dc:format': string
'pdf:docinfo:creator_tool': string
'pdf:overallPercentageUnmappedUnicodeChars': string
'access_permission:fill_in_form': string
'pdf:docinfo:modified': string
'pdf:hasCollection': string
'pdf:encrypted': string
'pdf:containsNonEmbeddedFont': string
'Content-Length': string
'pdf:hasMarkedContent': string
'Content-Type': string
'pdf:producer': string
'pdf:totalUnmappedUnicodeChars': string
'access_permission:extract_for_accessibility': string
'access_permission:assemble_document': string
'xmpTPg:NPages': string
'pdf:hasXMP': string
'pdf:charsPerPage': string[]
'access_permission:extract_content': string
'access_permission:can_print': string
'X-TIKA:Parsed-By': string[]
'pdf:annotationTypes': string
'access_permission:can_modify': string
'pdf:docinfo:producer': string
'pdf:docinfo:created': string
'pdf:annotationSubtypes': string
'pdf:containsDamagedFont': string
}
'pdf:unmappedUnicodeCharsPerPage': string[]
'pdf:PDFVersion': string
'xmp:CreatorTool': string
'pdf:hasXFA': string
'access_permission:modify_annotations': string
'access_permission:can_print_degraded': string
'X-TIKA:Parsed-By-Full-Set': string[]
'pdf:num3DAnnotations': string
'dcterms:created': string
'language': string
'dcterms:modified': string
'dc:format': string
'pdf:docinfo:creator_tool': string
'pdf:overallPercentageUnmappedUnicodeChars': string
'access_permission:fill_in_form': string
'pdf:docinfo:modified': string
'pdf:hasCollection': string
'pdf:encrypted': string
'pdf:containsNonEmbeddedFont': string
'Content-Length': string
'pdf:hasMarkedContent': string
'Content-Type': string
'pdf:producer': string
'pdf:totalUnmappedUnicodeChars': string
'access_permission:extract_for_accessibility': string
'access_permission:assemble_document': string
'xmpTPg:NPages': string
'pdf:hasXMP': string
'pdf:charsPerPage': string[]
'access_permission:extract_content': string
'access_permission:can_print': string
'X-TIKA:Parsed-By': string[]
'pdf:annotationTypes': string
'access_permission:can_modify': string
'pdf:docinfo:producer': string
'pdf:docinfo:created': string
'pdf:annotationSubtypes': string
'pdf:containsDamagedFont': string
}
export interface ContentResource {
'pdf:unmappedUnicodeCharsPerPage': string[]
'pdf:PDFVersion': string
'xmp:CreatorTool': string
'pdf:hasXFA': string
'access_permission:modify_annotations': string
'access_permission:can_print_degraded': string
'X-TIKA:Parsed-By-Full-Set': string[]
'pdf:num3DAnnotations': string
'dcterms:created': string
'dcterms:modified': string
'dc:format': string
'pdf:docinfo:creator_tool': string
'pdf:overallPercentageUnmappedUnicodeChars': string
'access_permission:fill_in_form': string
'pdf:docinfo:modified': string
'pdf:hasCollection': string
'pdf:encrypted': string
'pdf:containsNonEmbeddedFont': string
'Content-Length': string
'pdf:hasMarkedContent': string
'Content-Type': string
'pdf:producer': string
'pdf:totalUnmappedUnicodeChars': string
'access_permission:extract_for_accessibility': string
'access_permission:assemble_document': string
'xmpTPg:NPages': string
'pdf:hasXMP': string
'pdf:charsPerPage': string[]
'access_permission:extract_content': string
'access_permission:can_print': string
'X-TIKA:Parsed-By': string[]
'X-TIKA:content': string
'pdf:annotationTypes': string
'access_permission:can_modify': string
'pdf:docinfo:producer': string
'pdf:docinfo:created': string
'pdf:annotationSubtypes': string
'pdf:containsDamagedFont': string
}
export interface ContentResource {
'pdf:unmappedUnicodeCharsPerPage': string[]
'pdf:PDFVersion': string
'xmp:CreatorTool': string
'pdf:hasXFA': string
'access_permission:modify_annotations': string
'access_permission:can_print_degraded': string
'X-TIKA:Parsed-By-Full-Set': string[]
'pdf:num3DAnnotations': string
'dcterms:created': string
'dcterms:modified': string
'dc:format': string
'pdf:docinfo:creator_tool': string
'pdf:overallPercentageUnmappedUnicodeChars': string
'access_permission:fill_in_form': string
'pdf:docinfo:modified': string
'pdf:hasCollection': string
'pdf:encrypted': string
'pdf:containsNonEmbeddedFont': string
'Content-Length': string
'pdf:hasMarkedContent': string
'Content-Type': string
'pdf:producer': string
'pdf:totalUnmappedUnicodeChars': string
'access_permission:extract_for_accessibility': string
'access_permission:assemble_document': string
'xmpTPg:NPages': string
'pdf:hasXMP': string
'pdf:charsPerPage': string[]
'access_permission:extract_content': string
'access_permission:can_print': string
'X-TIKA:Parsed-By': string[]
'X-TIKA:content': string
'pdf:annotationTypes': string
'access_permission:can_modify': string
'pdf:docinfo:producer': string
'pdf:docinfo:created': string
'pdf:annotationSubtypes': string
'pdf:containsDamagedFont': string
}

View File

@ -1,122 +1,105 @@
<!DOCTYPE html>
<html>
<head>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<style>
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
}
main,
aside,
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
}
main,
aside,
section {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
main {
height: 100%;
}
aside {
background: #000;
flex-shrink: 1;
padding: 30px 20px;
}
aside p {
margin: 0;
color: #999999;
font-size: 14px;
line-height: 24px;
}
aside a {
color: #fff;
text-decoration: none;
}
section span {
font-size: 24px;
font-weight: 500;
display: block;
border-bottom: 1px solid #EAEAEA;
text-align: center;
padding-bottom: 20px;
width: 100px;
}
section p {
font-size: 14px;
font-weight: 400;
}
section span+p {
margin: 20px 0 0 0;
}
@media (min-width: 768px) {
section {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
height: 40px;
flex-direction: row;
}
main {
height: 100%;
}
aside {
background: #000;
flex-shrink: 1;
padding: 30px 20px;
}
aside p {
margin: 0;
color: #999999;
font-size: 14px;
line-height: 24px;
}
aside a {
color: #fff;
text-decoration: none;
}
section span {
font-size: 24px;
font-weight: 500;
display: block;
border-bottom: 1px solid #EAEAEA;
text-align: center;
padding-bottom: 20px;
width: 100px;
}
section span,
section p {
font-size: 14px;
font-weight: 400;
height: 100%;
line-height: 40px;
}
section span {
border-bottom: 0;
border-right: 1px solid #EAEAEA;
padding: 0 20px 0 0;
width: auto;
}
section span+p {
margin: 20px 0 0 0;
margin: 0;
padding-left: 20px;
}
@media (min-width: 768px) {
section {
height: 40px;
flex-direction: row;
}
section span,
section p {
height: 100%;
line-height: 40px;
}
section span {
border-bottom: 0;
border-right: 1px solid #EAEAEA;
padding: 0 20px 0 0;
width: auto;
}
section span+p {
margin: 0;
padding-left: 20px;
}
aside {
padding: 50px 0;
}
aside p {
max-width: 520px;
text-align: center;
}
aside {
padding: 50px 0;
}
aside p {
max-width: 520px;
text-align: center;
}
}
</style>
</head>
<body>
</head>
<body>
<main>
<section>
<span><% if (typeof statusCode !== 'undefined') { %><%= statusCode %><% } %></span>
<p><% if (typeof message !== 'undefined') { %><%= message %><% } %></p>
</section>
<section>
<span><% if (typeof statusCode !== 'undefined') { %><%= statusCode %><% } %></span>
<p><% if (typeof message !== 'undefined') { %><%= message %><% } %></p>
</section>
</main>
</body>
</body>
</html>

View File

@ -1,18 +1,18 @@
<img id="no-trash-svg" alt="" src="/svg/no-trash.svg" class="no-trash-svg" onload="" />
<script>
function is_iOS() {
return [
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod'
].includes(navigator.platform)
// iPad on iOS 13 detection
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}
if (is_iOS() && navigator.userAgent.indexOf('AppleWebKit')) {
document.getElementById("no-trash-svg").style.visibility = "hidden";
}
function is_iOS() {
return [
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod'
].includes(navigator.platform)
// iPad on iOS 13 detection
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}
if (is_iOS() && navigator.userAgent.indexOf('AppleWebKit')) {
document.getElementById("no-trash-svg").style.visibility = "hidden";
}
</script>

View File

@ -4,18 +4,13 @@
<title><%= (typeof fm.title !== 'undefined') ? `${fm.title} - ${h.getSiteName()}` : h.getSiteName() %></title>
<%- include('./includes/common-head.ejs') %>
</head>
<body onload="initPage()">
<%- include('./includes/top-navbar.ejs') %>
<%- include('./includes/no-trash-svg.ejs') %>
<main class="container">
<header>
<%- include('./includes/breadcrumbs.ejs') %>
</header>
<% if (typeof content !== 'undefined') {%>
<div class="row p-4 pb-0 pe-lg-0 pt-lg-5 align-items-center rounded-3 border shadow-lg">
<div class="col-lg-12 p-3 p-lg-5 pt-lg-3">
@ -29,7 +24,6 @@
</div>
</div>
<% } %>
<ul id="files" class="list-group shadow-lg">
<% if (typeof files !== 'undefined') files.forEach(function(value, index) { %>
<li class="list-group-item list-group-item-action flex-column align-items-start">
@ -40,7 +34,6 @@
<% }) %>
</ul>
</main>
<%- include('./includes/bottom-navbar.ejs') %>
<%- include('./includes/bottom-scripts.ejs') %>
</body>

View File

@ -1,35 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Search Error for <%- query %> - <%- h.getSiteName() %></title>
<%- include('./includes/common-head.ejs') %>
</head>
<body>
<%- include('./includes/top-navbar.ejs') %>
<%- include('./includes/no-trash-svg.ejs') %>
<main class="container">
<header>
<%- include('./includes/breadcrumbs.ejs') %>
</header>
<div class="mt-3 p-3">
<p>
Disclaimer: Use of the search feature is subject to both the <a href="/search-policy">Search
Policy</a> and the <a href="/privacy-policy">Privacy Policy</a>.
</p>
</div>
<div id="searchError" class="mt-3 shadow-lg p-lg-5">
<% if (typeof error !== 'undefined') {%>
<p>An error occurred while attempting to perform a search.</p>
<% if (typeof query !== 'undefined') {%><p><b>Search Query:</b> <span id="search-query"><%= query %></span></p><% } %>
<% if (typeof error.code !== 'undefined') {%><p><b>Error Code:</b> <span id="error-code"><%= error.code %></span></p><% } %>
<% if (typeof error.message !== 'undefined') {%><p><b>Error Message:</b> <span id="error-message"><%= error.message %></span></p><% } %>
<% if (typeof error.innerError !== 'undefined' && typeof error.innerError.error !== 'undefined') { %>
<% if (typeof error.innerError.error.msg !== 'undefined') {%><p><b>Inner Error Message:</b> <span id="inner-error-message"><%- error.innerError.error.msg.replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\n", '<br>') %></span></p><% } %>
<head>
<title>Search Error for <%- query %> - <%- h.getSiteName() %></title>
<%- include('./includes/common-head.ejs') %>
</head>
<body>
<%- include('./includes/top-navbar.ejs') %>
<%- include('./includes/no-trash-svg.ejs') %>
<main class="container">
<header>
<%- include('./includes/breadcrumbs.ejs') %>
</header>
<div class="mt-3 p-3">
<p>
Disclaimer: Use of the search feature is subject to both the <a href="/search-policy">Search
Policy</a> and the <a href="/privacy-policy">Privacy Policy</a>.
</p>
</div>
<div id="searchError" class="mt-3 shadow-lg p-lg-5">
<% if (typeof error !== 'undefined') {%>
<p>An error occurred while attempting to perform a search.</p>
<% if (typeof query !== 'undefined') {%><p><b>Search Query:</b> <span id="search-query"><%= query %></span></p><% } %>
<% if (typeof error.code !== 'undefined') {%><p><b>Error Code:</b> <span id="error-code"><%= error.code %></span></p><% } %>
<% if (typeof error.message !== 'undefined') {%><p><b>Error Message:</b> <span id="error-message"><%= error.message %></span></p><% } %>
<% if (typeof error.innerError !== 'undefined' && typeof error.innerError.error !== 'undefined') { %>
<% if (typeof error.innerError.error.msg !== 'undefined') {%><p><b>Inner Error Message:</b> <span id="inner-error-message"><%- error.innerError.error.msg.replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\n", '<br>') %></span></p><% } %>
<% } %>
<% } %>
<% } %>
</div>
<%- include('./includes/bottom-navbar.ejs') %>
<%- include('./includes/bottom-scripts.ejs') %>
</body>
</div>
<%- include('./includes/bottom-navbar.ejs') %>
<%- include('./includes/bottom-scripts.ejs') %>
</body>
</html>

View File

@ -1,73 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Search Results for <%- query %> - <%- h.getSiteName() %></title>
<%- include('./includes/common-head.ejs') %>
</head>
<body>
<%- include('./includes/top-navbar.ejs') %>
<%- include('./includes/no-trash-svg.ejs') %>
<main class="container">
<header>
<%- include('./includes/breadcrumbs.ejs') %>
</header>
<div class="container">
<p>
Disclaimer: Use of the search feature is subject to both the <a href="/search-policy">Search
Policy</a> and the <a href="/privacy-policy">Privacy Policy</a>.
</p>
</div>
<% if (typeof response !== "undefined" && typeof response.numFound !== "undefined" && typeof response.docs !== "undefined" && typeof highlighting !== "undefined") { %>
<div id="searchResults" class="mt-3 shadow-lg">
<!-- Search results will be dynamically populated here -->
<% if (response.numFound == 0) { %>
<p>No documents found matching the search query.</p>
<% } else { %>
<ul class="list-group shadow-lg">
<% response.docs.forEach(doc => { %>
<li class="list-group-item list-group-item-action flex-column align-items-start">
<h5><%= doc.title %></h5>
<% if (highlighting[doc.id] && highlighting[doc.id].text) { %>
<% highlighting[doc.id].text.forEach(snippet => { %>
<pre><%- h.stripWebVTT(snippet) %></pre>
<% }); %>
<% } else { %>
<!-- <p>No highlight available.</p> -->
<% } %>
<a href="<%= doc.url %>"><%= doc.url %></a>
</li>
<% }); %>
</ul>
<% } %>
</div>
<head>
<title>Search Results for <%- query %> - <%- h.getSiteName() %></title>
<%- include('./includes/common-head.ejs') %>
</head>
<body>
<%- include('./includes/top-navbar.ejs') %>
<%- include('./includes/no-trash-svg.ejs') %>
<main class="container">
<header>
<%- include('./includes/breadcrumbs.ejs') %>
</header>
<div class="container">
<p>
Disclaimer: Use of the search feature is subject to both the <a href="/search-policy">Search
Policy</a> and the <a href="/privacy-policy">Privacy Policy</a>.
</p>
</div>
<% } %>
<!-- Pagination controls -->
<% if (typeof totalPages !== "undefined" && totalPages) { %>
<nav aria-label="Search results pagination">
<ul class="pagination justify-content-center mt-4">
<% if (page > 1) { %>
<li class="page-item">
<a class="page-link" href="/search?q=<%= query %>&page=<%= page - 1 %>&pageSize=<%= pageSize %>">Previous</a>
</li>
<% } %>
<% for (let i = Math.max(Math.min(page - 7, totalPages - 14), 1); i <= Math.min(totalPages, Math.max(page - 7, 1) + 14); i++) { %>
<li class="page-item <%= i == page ? 'active' : '' %>">
<a class="page-link" href="/search?q=<%= query %>&page=<%= i %>&pageSize=<%= pageSize %>"><%= i %></a>
</li>
<% } %>
<% if (page < totalPages) { %>
<li class="page-item">
<a class="page-link" href="/search?q=<%= query %>&page=<%= parseInt(page) + 1 %>&pageSize=<%= pageSize %>">Next</a>
</li>
<% } %>
</ul>
</nav>
<p class="center">Page <%= page %> out of <%= totalPages %>. Displaying results <%= (page-1)*pageSize+1 %> through <%= Math.min(page*pageSize, totalResults) %> out of <%= totalResults %> total results.</p>
<% } %>
</main>
<%- include('./includes/bottom-navbar.ejs') %>
<%- include('./includes/bottom-scripts.ejs') %>
</body>
<% if (typeof response !== "undefined" && typeof response.numFound !== "undefined" && typeof response.docs !== "undefined" && typeof highlighting !== "undefined") { %>
<div id="searchResults" class="mt-3 shadow-lg">
<!-- Search results will be dynamically populated here -->
<% if (response.numFound == 0) { %>
<p>No documents found matching the search query.</p>
<% } else { %>
<ul class="list-group shadow-lg">
<% response.docs.forEach(doc => { %>
<li class="list-group-item list-group-item-action flex-column align-items-start">
<h5><%= doc.title %></h5>
<% if (highlighting[doc.id] && highlighting[doc.id].text) { %>
<% highlighting[doc.id].text.forEach(snippet => { %>
<pre><%- h.stripWebVTT(snippet) %></pre>
<% }); %>
<% } else { %>
<!-- <p>No highlight available.</p> -->
<% } %>
<a href="<%= doc.url %>"><%= doc.url %></a>
</li>
<% }); %>
</ul>
<% } %>
</div>
</div>
<% } %>
<!-- Pagination controls -->
<% if (typeof totalPages !== "undefined" && totalPages) { %>
<nav aria-label="Search results pagination">
<ul class="pagination justify-content-center mt-4">
<% if (page > 1) { %>
<li class="page-item">
<a class="page-link" href="/search?q=<%= query %>&page=<%= page - 1 %>&pageSize=<%= pageSize %>">Previous</a>
</li>
<% } %>
<% for (let i = Math.max(Math.min(page - 7, totalPages - 14), 1); i <= Math.min(totalPages, Math.max(page - 7, 1) + 14); i++) { %>
<li class="page-item <%= i == page ? 'active' : '' %>">
<a class="page-link" href="/search?q=<%= query %>&page=<%= i %>&pageSize=<%= pageSize %>"><%= i %></a>
</li>
<% } %>
<% if (page < totalPages) { %>
<li class="page-item">
<a class="page-link" href="/search?q=<%= query %>&page=<%= parseInt(page) + 1 %>&pageSize=<%= pageSize %>">Next</a>
</li>
<% } %>
</ul>
</nav>
<p class="center">Page <%= page %> out of <%= totalPages %>. Displaying results <%= (page-1)*pageSize+1 %> through <%= Math.min(page*pageSize, totalResults) %> out of <%= totalResults %> total results.</p>
<% } %>
</main>
<%- include('./includes/bottom-navbar.ejs') %>
<%- include('./includes/bottom-scripts.ejs') %>
</body>
</html>

View File

@ -4,17 +4,13 @@
<title><%=h.getDirectoryTitle(directory)%></title>
<%- include('./includes/common-head.ejs') %>
</head>
<body onload="initPage()">
<%- include('./includes/top-navbar.ejs') %>
<%- include('./includes/no-trash-svg.ejs') %>
<main class="container">
<header>
<%- include('./includes/breadcrumbs.ejs') %>
</header>
<% if (typeof videoURL !== 'undefined') {%>
<div class="row p-4 pb-0 pe-lg-0 pt-lg-5 align-items-center rounded-3 border shadow-lg">
<div class="col-lg-12 p-3 p-lg-5 pt-lg-3">
@ -49,7 +45,6 @@
</div>
</div>
<% } %>
<% if (typeof subtitleVTT !== 'undefined') {%>
<div class="row p-4 pb-0 pe-lg-0 pt-lg-5 align-items-center rounded-3 border shadow-lg" style="max-height:65vh;overflow-y:scroll">
<div class="col-lg-12 p-3 p-lg-5 pt-lg-3">
@ -65,9 +60,7 @@
</div>
</div>
<% } %>
</main>
<%- include('./includes/bottom-navbar.ejs') %>
<%- include('./includes/bottom-scripts.ejs') %>
</body>