Compare commits
2 commits
master
...
feature/ca
Author | SHA1 | Date | |
---|---|---|---|
479392d0f1 | |||
795e078a0d |
6 changed files with 293 additions and 23 deletions
194
.gitignore
vendored
Normal file
194
.gitignore
vendored
Normal file
|
@ -0,0 +1,194 @@
|
|||
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,nextjs,node
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,nextjs,node
|
||||
|
||||
### NextJS ###
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
### Node Patch ###
|
||||
# Serverless Webpack directories
|
||||
.webpack/
|
||||
|
||||
# Optional stylelint cache
|
||||
|
||||
# SvelteKit build / generate output
|
||||
.svelte-kit
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
### VisualStudioCode Patch ###
|
||||
# Ignore all local history of files
|
||||
.history
|
||||
.ionide
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,nextjs,node
|
23
src/caddy-log-parser/index.html
Normal file
23
src/caddy-log-parser/index.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Caddy log parser | nexy7574.co.uk</title>
|
||||
<script src="script.js" defer></script>
|
||||
<link rel="stylesheet" href="../index.css">
|
||||
<link rel="stylesheet" href="../responsive.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Caddy log parser</h1>
|
||||
<form enctype="multipart/form-data">
|
||||
<label for="file">Select log file</label>
|
||||
<input type="file" name="file" id="file" required>
|
||||
<button type="submit">Parse</button>
|
||||
</form>
|
||||
<hr/>
|
||||
<div id="output"></div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
54
src/caddy-log-parser/script.js
Normal file
54
src/caddy-log-parser/script.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
function createAccessLogSection(json) {
|
||||
const section = document.createElement('section');
|
||||
section.classList.add('access-log');
|
||||
section.innerHTML = `
|
||||
<code class="block"><pre>${JSON.stringify(json, null, 2)}</pre></code>
|
||||
`;
|
||||
return section;
|
||||
}
|
||||
|
||||
function onSubmit(event) {
|
||||
event.preventDefault();
|
||||
const fileInput = document.getElementById('file');
|
||||
const file = fileInput.files[0];
|
||||
const reader = new FileReader();
|
||||
const output = document.getElementById('output');
|
||||
|
||||
reader.onload = function(e) {
|
||||
const contents = e.target.result;
|
||||
const lines = contents.split('\n');
|
||||
output.innerHTML = '';
|
||||
|
||||
for (let line of lines) {
|
||||
let json;
|
||||
try {
|
||||
json = JSON.parse(line);
|
||||
} catch (e) {
|
||||
console.error('Error parsing line: ', line);
|
||||
console.error(e);
|
||||
continue;
|
||||
}
|
||||
console.debug(json);
|
||||
if(json.logger.includes("http.log.access")) {
|
||||
const section = createAccessLogSection(json);
|
||||
output.appendChild(section);
|
||||
}
|
||||
};
|
||||
|
||||
fileInput.value = null;
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
}
|
||||
|
||||
|
||||
function addListener() {
|
||||
const form = document.getElementsByTagName('form')[0];
|
||||
form.addEventListener(
|
||||
"submit",
|
||||
onSubmit
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener("DOMContentLoaded", addListener);
|
0
src/caddy-log-parser/style.css
Normal file
0
src/caddy-log-parser/style.css
Normal file
23
src/faq.css
23
src/faq.css
|
@ -10,26 +10,3 @@
|
|||
.question p {
|
||||
font-size: large
|
||||
}
|
||||
|
||||
code.block {
|
||||
display: block;
|
||||
padding: 1em;
|
||||
margin: 1em 0;
|
||||
background-color: #1f1f1f;
|
||||
color: #dcdcdc;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
border-radius: 5px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
code.inline {
|
||||
background-color: #1f1f1f;
|
||||
color: #dcdcdc;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
font-size: initial;
|
||||
line-height: 1.2;
|
||||
border-radius: 3px;
|
||||
padding: 0.4em 0.6em;
|
||||
}
|
||||
|
|
|
@ -108,3 +108,25 @@ table tr:hover {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
code.block {
|
||||
display: block;
|
||||
padding: 1em;
|
||||
margin: 1em 0;
|
||||
background-color: #1f1f1f;
|
||||
color: #dcdcdc;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
border-radius: 5px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
code.inline {
|
||||
background-color: #1f1f1f;
|
||||
color: #dcdcdc;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
font-size: initial;
|
||||
line-height: 1.2;
|
||||
border-radius: 3px;
|
||||
padding: 0.4em 0.6em;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue