update docs, add honk syndication
This commit is contained in:
parent
15cc1c55b5
commit
3eeac950d3
10 changed files with 115 additions and 54 deletions
|
@ -13,7 +13,6 @@ IndentCaseLabels: true
|
||||||
SpaceBeforeParens: ControlStatements
|
SpaceBeforeParens: ControlStatements
|
||||||
AlignAfterOpenBracket: AlwaysBreak
|
AlignAfterOpenBracket: AlwaysBreak
|
||||||
BinPackArguments: false
|
BinPackArguments: false
|
||||||
BinPackArguments: false
|
|
||||||
PointerAlignment: Left
|
PointerAlignment: Left
|
||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
Copyright 2021 Derek Stevens
|
Copyright 2021 Iris Lightshard
|
||||||
Copyright 2021 Devine Lu Linvega
|
Copyright 2021 Devine Lu Linvega
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
10
README.md
10
README.md
|
@ -17,6 +17,8 @@ Eureka also parses a [twtxt](https://twtxt.readthedocs.io/en/latest/) file at `S
|
||||||
5. Create a new page, eg `inc/my_first_page.htm` (see the markup section below).
|
5. Create a new page, eg `inc/my_first_page.htm` (see the markup section below).
|
||||||
6. Edit your `inc/meta.nav.htm` again to reference your new page.
|
6. Edit your `inc/meta.nav.htm` again to reference your new page.
|
||||||
7. Run `./build.sh` again! You will be warned of any orphaned files.
|
7. Run `./build.sh` again! You will be warned of any orphaned files.
|
||||||
|
8. Deploy with `./deploy.sh`. `--syndicate` will syndicate the latest twtxt to the honknet.
|
||||||
|
9. Revert changes and restore local with the live site with `./deploy.sh --resync`.
|
||||||
|
|
||||||
## build options
|
## build options
|
||||||
|
|
||||||
|
@ -34,6 +36,8 @@ Combined argument format like `./build.sh -rdt "twt stuff"` is not supported. Us
|
||||||
|
|
||||||
If you run into issues with your markup crashing `eureka`, edit the `build.sh` file to uncomment the linux debug build line and comment the fast build; this will show you a stack trace of where you are running into buffer overflows, and give you a hint of where your markup is messed up. To see the individual file that has the error, also uncomment the line in `fpinject()` that prints the file names.
|
If you run into issues with your markup crashing `eureka`, edit the `build.sh` file to uncomment the linux debug build line and comment the fast build; this will show you a stack trace of where you are running into buffer overflows, and give you a hint of where your markup is messed up. To see the individual file that has the error, also uncomment the line in `fpinject()` that prints the file names.
|
||||||
|
|
||||||
|
If you find a bug, let me know.
|
||||||
|
|
||||||
# markup
|
# markup
|
||||||
|
|
||||||
There is a markup language which makes writing long blog posts, memex entries, etc easier by reducing the need for typing out HTML tags:
|
There is a markup language which makes writing long blog posts, memex entries, etc easier by reducing the need for typing out HTML tags:
|
||||||
|
@ -128,14 +132,14 @@ The following macros are available in `config.h` to customize to your liking.
|
||||||
- **NAME**: the title of the site
|
- **NAME**: the title of the site
|
||||||
- **DOMAIN**: currently unused
|
- **DOMAIN**: currently unused
|
||||||
- **LOGO_HTML**: HTML to put in the header h1 verbatim
|
- **LOGO_HTML**: HTML to put in the header h1 verbatim
|
||||||
- **ABOUT_HTML**: HTML content for the front page, placed between `<header>` and `<nav>`
|
- **ABOUT_HTML**: HTML content for the front page
|
||||||
- **CONTACT_HTML**: the contact info line at the bottom of every page (except the front page, where it would typically already be in **@ABOUT**
|
- **CONTACT_HTML**: the contact info line at the bottom of every page (except the front page, where it would typically already be in **@ABOUT**
|
||||||
- **FOOTER_HTML**: arbitrary footer HTML
|
- **FOOTER_HTML**: arbitrary footer HTML
|
||||||
- **LICENSE_HTML**: the license link at the bottom of every page
|
- **LICENSE_HTML**: the license link at the bottom of every page
|
||||||
- **SITEROOT**: the path where the rendered HTML is placed; include trailing slash
|
- **SITEROOT**: the path where the rendered HTML is placed; include trailing slash
|
||||||
- **MAINCSS** and **FRONTCSS**: to differentiate styles used for the landing page and the rest of the site
|
- **MAINCSS** and **FRONTCSS**: to differentiate styles used for the landing page and the rest of the site
|
||||||
- **TWTXT**: path to the twtxt file relative to the SITEROOT; if you don't want twtxt on the front page, use a nonexistent filename
|
- **TWTXT**: path to the twtxt file relative to the SITEROOT; if you don't want twtxt on the front page, use a nonexistent filename
|
||||||
|
- **IS_HTML5_VIDEO_ENABLED**: if videos are embedded or just linked to with a poster image
|
||||||
|
- **IS_NAV_IN_HEADER**: if the nav is inside the header or its sibling
|
||||||
|
|
||||||
# deployment
|
|
||||||
|
|
||||||
Static sites are dead easy to deploy. Included in the repo is the deployment script I use - you can easily adapt this to your own use case.
|
|
||||||
|
|
6
build.sh
6
build.sh
|
@ -16,13 +16,15 @@ if [ ! -e inc/meta.nav.htm ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Lint
|
# Lint
|
||||||
clang-format -i main.c config.h
|
if which clang-format > /dev/null; then
|
||||||
|
clang-format -i main.c config.h
|
||||||
|
fi
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -f ./main
|
rm -f ./main
|
||||||
|
|
||||||
# Linux(debug)
|
# Linux(debug)
|
||||||
#cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wuninitialized -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined main.c -o main
|
# cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wuninitialized -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined main.c -o main
|
||||||
|
|
||||||
# Linux(fast)
|
# Linux(fast)
|
||||||
cc main.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o main
|
cc main.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o main
|
||||||
|
|
31
config.def.h
31
config.def.h
|
@ -1,28 +1,21 @@
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
#define SITEMAP "all_pages"
|
#define SITEMAP "all_pages"
|
||||||
#define DOMAIN "https://nilfm.cc"
|
#define DOMAIN "https://amotherfucking.website"
|
||||||
#define DEPLOY_DEST "nilix@nilfm.cc:~/lib/nilfm/"
|
#define DEPLOY_DEST "usr@amotherfucking.website:/opt/site/"
|
||||||
#define DEPLOY_IDENT "id_sub"
|
#define DEPLOY_IDENT "id_sub"
|
||||||
#define TAG_BODY_SIZE 4096
|
#define TAG_BODY_SIZE 4096
|
||||||
#define LOGO_HTML "<img src='/img/nilfm_blackHole_128.png' alt='blackhole://nilFM'/>"
|
#define LOGO_HTML "<img src='/img/logo.png' alt='a website'/>"
|
||||||
#define MAINCSS "/nilfm.css?v=20230819.0"
|
#define MAINCSS "/main.css"
|
||||||
#define FOOTER_HTML "<div style='float:right;text-align:center;'><a href='https://hacklab.nilfm.cc' target='_blank'><img src='/img/git.svg' alt='nilFM hack lab'/></a> \n" \
|
#define FOOTER_HTML "peekaboo"
|
||||||
"<a href='https://cafe.nilfm.cc/u/nilix' target='_blank'><img src='/img/honk.svg' alt='honk'/></a> \n" \
|
#define LICENSE_HTML "<a rel='license' target='_blank' href='/legal.html'>legal</a>"
|
||||||
"<a href='https://webring.xxiivv.com' target='_blank'><img src='/img/webring.svg' alt='xxiivv webring'/></a> \n" \
|
#define DESC "website eeeeeeee"
|
||||||
"<a href='https://lightcrystal.systems' target='_blank'><img src='/img/lightcrystal_bw_small.svg' alt='lightcrystal.systems'/> \n" \
|
|
||||||
""
|
|
||||||
#define LICENSE_HTML "<a rel='license' target='_blank' href='/legal.html'><img src='/img/cc.svg' alt='legal stuff'/></a></div>"
|
|
||||||
#define DESC "lair of drkste aka nilix: software artisan, digital philosopher"
|
|
||||||
#define IS_NAV_IN_HEADER 01
|
#define IS_NAV_IN_HEADER 01
|
||||||
#define LEXICON_SIZE 1024
|
#define LEXICON_SIZE 1024
|
||||||
#define CONTACT_HTML "contact: <a href='mailto:nilix@nilfm.cc' class='mono'>nilix@nilfm.cc</a><br/><a href='/serv/76CD8BF07977D23EC494EA93F54E0D40695271D4.asc' style='font-family:monospace;display:inline-block;max-width:24ch;'>76CD 8BF0 7977 D23E C494 EA93 F54E 0D40 6952 71D4</a>\n" \
|
#define CONTACT_HTML "<a href='mailto:person@domain.net' class='mono'contact me</a>"
|
||||||
""
|
#define FRONTCSS "/front.css"
|
||||||
#define FRONTCSS "/nilfm.css?v=20230819.0"
|
|
||||||
#define SITEROOT "../www/"
|
#define SITEROOT "../www/"
|
||||||
#define TWTXT "/twtxt.txt"
|
#define TWTXT "/twtxt.txt"
|
||||||
#define ABOUT_HTML "Derek Stevens <<a style='font-family:monospace;' href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>><br/>\n" \
|
#define ABOUT_HTML "<h2>Welcome to this website</h2>"
|
||||||
"software artisan, digital philosopher<br/><br/>\n" \
|
#define NAME "a website"
|
||||||
"<a href='/serv/76CD8BF07977D23EC494EA93F54E0D40695271D4.asc' style='font-family:monospace;display:inline-block;max-width:24ch;'>76CD 8BF0 7977 D23E C494 EA93 F54E 0D40 6952 71D4</a>\n" \
|
#define IS_HTML5_VIDEO_ENABLED 0
|
||||||
""
|
|
||||||
#define NAME "nilFM"
|
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
11
deploy.sh
11
deploy.sh
|
@ -2,9 +2,14 @@
|
||||||
|
|
||||||
DEST=$(grep "#define DEPLOY_DEST" config.h | awk '{print $3}' | sed -e 's/"//g')
|
DEST=$(grep "#define DEPLOY_DEST" config.h | awk '{print $3}' | sed -e 's/"//g')
|
||||||
IDENT=$(grep "#define DEPLOY_IDENT" config.h | awk '{print $3}' | sed -e 's/"//g')
|
IDENT=$(grep "#define DEPLOY_IDENT" config.h | awk '{print $3}' | sed -e 's/"//g')
|
||||||
|
SITEROOT=$(grep "#define SITEROOT" config.h | awk '{print $3}' | sed -e 's/"//g')
|
||||||
|
TWTXT=$(grep "#define TWTXT" config.h | awk '{print $3}' | sed -e 's/"//g')
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ "$1" = "--resync" ]; then
|
||||||
rsync -avK -e "ssh -i ~/.ssh/${IDENT}" --delete ../ ${DEST}
|
|
||||||
elif [ "$1" = "--resync" ]; then
|
|
||||||
rsync -avk -e "ssh -i ~/.ssh/${IDENT}" --delete ${DEST} ../
|
rsync -avk -e "ssh -i ~/.ssh/${IDENT}" --delete ${DEST} ../
|
||||||
|
else
|
||||||
|
rsync -avK -e "ssh -i ~/.ssh/${IDENT}" --delete ../ ${DEST}
|
||||||
|
if [ "$1" = "--syndicate" ] && [ $? -eq 0 ]; then
|
||||||
|
./underbbs.sh honk "$(head -n 1 ${SITEROOT}/${TWTXT})"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
53
main.c
53
main.c
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/dir.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ int gettwtxt(FILE* f) {
|
||||||
char line[256];
|
char line[256];
|
||||||
char datebuf[16] = {0};
|
char datebuf[16] = {0};
|
||||||
char msgbuf[240] = {0};
|
char msgbuf[240] = {0};
|
||||||
|
char urlbuf[256] = {0};
|
||||||
char *l, *d, *m;
|
char *l, *d, *m;
|
||||||
FILE* twtxt = fopen(SITEROOT TWTXT, "r");
|
FILE* twtxt = fopen(SITEROOT TWTXT, "r");
|
||||||
|
|
||||||
|
@ -83,6 +84,7 @@ int gettwtxt(FILE* f) {
|
||||||
} else {
|
} else {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (fgets(line, 256, twtxt) && i < 3) {
|
while (fgets(line, 256, twtxt) && i < 3) {
|
||||||
|
int has_url = 0;
|
||||||
if (*line == '#') {
|
if (*line == '#') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -93,11 +95,31 @@ int gettwtxt(FILE* f) {
|
||||||
while (*l != '\t') {
|
while (*l != '\t') {
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
scat(msgbuf, l);
|
while (*l) {
|
||||||
scat(buf, "<tr><td style='white-space:nowrap;vertical-align: top;'>");
|
if (*l == '|') {
|
||||||
|
has_url = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ccat(msgbuf, *l++);
|
||||||
|
}
|
||||||
|
l++;
|
||||||
|
scat(urlbuf, l);
|
||||||
|
scat(
|
||||||
|
buf,
|
||||||
|
"<tr><td class='twtxt-date' style='white-space:nowrap;vertical-align: "
|
||||||
|
"top;'>");
|
||||||
scat(buf, datebuf);
|
scat(buf, datebuf);
|
||||||
scat(buf, ":</td><td> ");
|
scat(buf, "</td><td class='twtxt-twt'> ");
|
||||||
scat(buf, msgbuf);
|
|
||||||
|
if (has_url) {
|
||||||
|
scat(buf, "<a href='");
|
||||||
|
scat(buf, urlbuf);
|
||||||
|
scat(buf, "'>");
|
||||||
|
scat(buf, msgbuf);
|
||||||
|
scat(buf, "</a>");
|
||||||
|
} else {
|
||||||
|
scat(buf, msgbuf);
|
||||||
|
}
|
||||||
scat(buf, "</td></tr>\n");
|
scat(buf, "</td></tr>\n");
|
||||||
d = datebuf;
|
d = datebuf;
|
||||||
while (*d) {
|
while (*d) {
|
||||||
|
@ -367,14 +389,19 @@ int fpvideo(FILE* f, char* s) {
|
||||||
}
|
}
|
||||||
thumbtrans(src, thumb);
|
thumbtrans(src, thumb);
|
||||||
|
|
||||||
fprintf(
|
if (IS_HTML5_VIDEO_ENABLED) {
|
||||||
f,
|
fprintf(
|
||||||
"<video id='%s' src='%s' controls preload='metadata' poster='%s'>\n",
|
f,
|
||||||
id,
|
"<video id='%s' src='%s' controls preload='metadata' poster='%s'>\n",
|
||||||
href,
|
id,
|
||||||
thumb);
|
href,
|
||||||
fprintf(f, "<a href='%s'><img src='%s' alt=''%s'></a>\n", href, thumb, alt);
|
thumb);
|
||||||
fprintf(f, "</video>\n");
|
}
|
||||||
|
|
||||||
|
fprintf(f, "<a href='%s'><img src='%s' alt='%s'></a>\n", href, thumb, alt);
|
||||||
|
if (IS_HTML5_VIDEO_ENABLED) {
|
||||||
|
fprintf(f, "</video>\n");
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,12 @@ SIZE=500
|
||||||
|
|
||||||
# transform path to /img/*/.thumb/
|
# transform path to /img/*/.thumb/
|
||||||
pathtrans() {
|
pathtrans() {
|
||||||
filename=$(echo $1 | awk -F/ '{print $NF}')
|
filename=$(basename "${1%.*}")
|
||||||
filename=$(echo ${filename} | awk 'BEGIN{FS=OFS="."}{NF--; print $0}')
|
pathname="${1%/*}"
|
||||||
transform=$(echo $1 | awk 'BEGIN{FS=OFS="/"}{NF--; print $0}')
|
if [ ! -d ${pathname}/.thumb ]; then
|
||||||
if [ ! -d ${transform}/.thumb ]; then
|
mkdir ${pathname}/.thumb/
|
||||||
mkdir ${transform}/.thumb/
|
|
||||||
fi
|
fi
|
||||||
transform=${transform}/.thumb/${filename}.png
|
echo "${pathname}/.thumb/${filename}.png"
|
||||||
echo ${transform}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# generate thumbnails in /img/*/.thumb/
|
# generate thumbnails in /img/*/.thumb/
|
||||||
|
@ -23,19 +21,19 @@ resize() {
|
||||||
fi
|
fi
|
||||||
if [ ! -f ${output} ]; then
|
if [ ! -f ${output} ]; then
|
||||||
echo "Stripping metadata from $1"
|
echo "Stripping metadata from $1"
|
||||||
convert $1 -strip $1
|
convert "$1" -strip "$1"
|
||||||
echo "Generating thumbnail for $1"
|
echo "Generating thumbnail for $1"
|
||||||
convert $1 -strip -auto-orient -resize ${SIZE} -dither FloydSteinberg -colors 16 ${output}
|
convert "$1" -strip -auto-orient -resize ${SIZE} -dither FloydSteinberg -colors 16 ${output}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z $1 ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "usage: $0 [build|clean]"
|
echo "usage: $0 [build|clean]"
|
||||||
else
|
else
|
||||||
case $1 in
|
case $1 in
|
||||||
"build")
|
"build")
|
||||||
echo "Updating thumbnails cache"
|
echo "Updating thumbnails cache"
|
||||||
for x in $(find ${SRC}/*/*); do resize $x; done;;
|
for x in $(find ${SRC}/*/*); do resize "$x"; done;;
|
||||||
"clean")
|
"clean")
|
||||||
echo "Cleaning thumbnails cache"
|
echo "Cleaning thumbnails cache"
|
||||||
rm -rf ${SRC}/*/.thumb
|
rm -rf ${SRC}/*/.thumb
|
||||||
|
|
2
tw.sh
2
tw.sh
|
@ -5,7 +5,7 @@ twtxt=$(grep "#define TWTXT" config.h | awk '{print $3}' | sed -e 's/"//g')
|
||||||
twt(){
|
twt(){
|
||||||
self=$(mktemp)
|
self=$(mktemp)
|
||||||
new=$(mktemp)
|
new=$(mktemp)
|
||||||
echo "$(date -Is)\t$@" > ${self}
|
echo "$(/sbin/date -Is)\t$@" > ${self}
|
||||||
cat ${self} ${siteroot}${twtxt} > ${new}
|
cat ${self} ${siteroot}${twtxt} > ${new}
|
||||||
cp ${new} ${siteroot}${twtxt}
|
cp ${new} ${siteroot}${twtxt}
|
||||||
rm ${new}
|
rm ${new}
|
||||||
|
|
33
underbbs.sh
Executable file
33
underbbs.sh
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. ~/.config/underbbs/cli
|
||||||
|
|
||||||
|
helpme() {
|
||||||
|
echo "later"
|
||||||
|
}
|
||||||
|
|
||||||
|
syndicate_honk() {
|
||||||
|
# authenticate to the honknet
|
||||||
|
local token=$(curl -X POST -F "username=${HONK_USERNAME}" -F "password=${HONK_PASSWORD}" -F "gettoken=1" ${HONK_URL}/dologin)
|
||||||
|
# it's gonna be honked
|
||||||
|
local result=$(curl -X POST -F "action=honk" -F "token=${token}" -F "noise=$@" ${HONK_URL}/api)
|
||||||
|
echo $result
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
helpme
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
adapter=$1
|
||||||
|
|
||||||
|
shift
|
||||||
|
|
||||||
|
case $adapter in
|
||||||
|
honk)
|
||||||
|
noise=$(echo "$@" | sed -e 's/|/\|/')
|
||||||
|
syndicate_honk "$noise"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
helpme ;;
|
||||||
|
esac
|
Loading…
Reference in a new issue