1
0
Fork 0
mirror of https://github.com/mat-1/matdoesdev.git synced 2025-08-02 06:36:04 +00:00

crawl txt and md

This commit is contained in:
mat 2024-06-24 02:08:10 +00:00
parent d1d2d78195
commit 2451e29498
2 changed files with 77 additions and 37 deletions

108
Caddyfile
View file

@ -1,3 +1,7 @@
# xcaddy build \
# --with github.com/mat-1/matdoesdev-caddy
(https_redirect) {
@do_https_redirect {
not header_regexp veryoldbrowser User-Agent Navigator|MSIE|Mosaic|Kindle|^curl|NintendoBrowser/
@ -39,15 +43,15 @@ http://matdoes.dev https://matdoes.dev http://matctazmu565vivubva3p3bulaneangiff
not path /dot_git/*
}
# respond @chrome "This site is best viewed with Firefox (or any browser that isn't Chrome).
#If you're unable to use Firefox, you can also access this website via SSH, Gemini, Gopher, Finger, Telnet, and some others." 403
#If you're unable to use Firefox, you can also access this website via SSH, Gemini, Gopher, Finger, Telnet, and some others." 403
# easter egg that makes old browsers show the retro page
@retro_redirect {
path /
header_regexp oldbrowser User-Agent PaleMoon|Trident|MSIE|Netscape|Navigator
header_regexp oldbrowser User-Agent PaleMoon|Trident|MSIE|Netscape|Navigator|Mosaic
}
redir @retro_redirect /retro 302
redir @retro_redirect http://matdoes.dev/retro 302
root * /www
file_server {
@ -66,6 +70,22 @@ http://matdoes.dev https://matdoes.dev http://matctazmu565vivubva3p3bulaneangiff
rewrite @json_index /.json
rewrite @json {path}.json
# redirect to .txt if the user requested text/plain
@txt {
header Accept text/plain
not path *.txt
}
@txt_index {
header Accept text/plain
path /
}
rewrite @txt_index /.txt
rewrite @txt {path}.txt
# rewrite /.txt to /index.txt
handle {
rewrite /.txt /index.txt
}
# don't require .html
try_files {path} {path}.html
@ -102,11 +122,11 @@ http://matdoes.dev https://matdoes.dev http://matctazmu565vivubva3p3bulaneangiff
}
}
route /buttons/stats.json {
uri strip_prefix /buttons
file_server {
root /opt/x227f
}
}
uri strip_prefix /buttons
file_server {
root /opt/x227f
}
}
handle_path /buttons/i/* {
try_files {path} {path}.png {path}.gif {path}.jpg {path}.webp {path}.avif {path}.bmp
root * /opt/x227f/buttons
@ -121,12 +141,21 @@ http://matdoes.dev https://matdoes.dev http://matctazmu565vivubva3p3bulaneangiff
header Content-Encoding gzip
}
handle_path /shwecky {
reverse_proxy https://shrecked.dev {
header_up Host shrecked.dev
}
}
route /status.json {
reverse_proxy 127.0.0.1:9247 {
rewrite /
}
}
handle_errors 400 {
respond "🐟"
}
handle_errors {
@should_be_404 {
expression {http.error.status_code} == 404
@ -153,25 +182,25 @@ http://matdoes.dev https://matdoes.dev http://matctazmu565vivubva3p3bulaneangiff
}
staging.matdoes.dev {
root * /www-staging
file_server {
precompressed br gzip
}
root * /www-staging
file_server {
precompressed br gzip
}
# redirect to .json if the user requested application/json
@json {
header Accept application/json
not path *.json
}
@json_index {
header Accept application/json
path /
}
rewrite @json_index /.json
rewrite @json {path}.json
# redirect to .json if the user requested application/json
@json {
header Accept application/json
not path *.json
}
@json_index {
header Accept application/json
path /
}
rewrite @json_index /.json
rewrite @json {path}.json
# don't require .html
try_files {path} {path}.html
# don't require .html
try_files {path} {path}.html
handle /robots.txt {
respond "User-agent: *
@ -219,7 +248,6 @@ matrix.matdoes.dev matrix.matdoes.dev:8448 {
}
}
stats.matrix.matdoes.dev {
reverse_proxy 127.0.0.1:81
}
@ -248,14 +276,24 @@ http://s.matdoes.dev https://s.matdoes.dev {
reverse_proxy 127.0.0.1:28019
}
staging.s.matdoes.dev {
reverse_proxy 127.0.0.1:28020
}
mail.matdoes.dev {
respond "mat's mail server :)"
}
matdoes.dev. {
# tls /home/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/matdoes.dev/matdoes.dev.crt /home/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/matdoes.dev/matdoes.dev.key
respond "meow"
}
jmap.matdoes.dev {
log {
output stdout
}
log {
output stdout
}
header Access-Control-Allow-Origin "*"
header Access-Control-Allow-Methods "*"
@ -263,7 +301,7 @@ jmap.matdoes.dev {
reverse_proxy https://localhost:8080 {
transport http {
tls
tls
tls_insecure_skip_verify
}
}
@ -296,10 +334,6 @@ hetzner.matdoes.dev {
respond "uwu" 402
}
xmpp.matdoes.dev {
respond ""
}
mcassets.matdoes.dev {
reverse_proxy 127.0.0.1:10573
}
@ -315,3 +349,7 @@ www.www.matdoes.dev {
www.matdoes.dev {
redir https://matdoes.dev{uri}
}
seized.matdoes.dev {
reverse_proxy 127.0.0.1:11270
}

View file

@ -1,11 +1,13 @@
<script lang="ts">
import type { PageData } from "./$types"
import type { PageData } from './$types'
export let data: PageData
const { page, slug } = data
</script>
<!-- make sveltekit crawl to the json api -->
<!-- make sveltekit crawl to the json, txt, and md api -->
<div style="display:none"><a href="{slug}.json">JSON API</a></div>
<div style="display:none"><a href="{slug}.txt">txt</a></div>
<div style="display:none"><a href="{slug}.md">md</a></div>
<svelte:component this={page} />