1
0
Fork 0
mirror of https://github.com/mat-1/matdoesdev.git synced 2025-08-02 14:46: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

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/
@ -45,9 +49,9 @@ http://matdoes.dev https://matdoes.dev http://matctazmu565vivubva3p3bulaneangiff
# 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
@ -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
@ -219,7 +248,6 @@ matrix.matdoes.dev matrix.matdoes.dev:8448 {
}
}
stats.matrix.matdoes.dev {
reverse_proxy 127.0.0.1:81
}
@ -248,10 +276,20 @@ 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
@ -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} />