small changes to accomodate the site reorg; v1.1

This commit is contained in:
Iris Lightshard 2023-01-12 00:19:55 -07:00
parent eb80d36ef6
commit bccea6d1d8
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 53 additions and 42 deletions

View file

@ -1,13 +1,14 @@
#define DESC "lair of drkste aka nilix: artist, programmer, philosopher"
#define DESC "lair of drkste aka nilix: software artisan, digital philosopher"
#define LEXICON_SIZE 1024
#define MAINCSS "/new.css"
#define MAINCSS "/nilfm.css"
#define FOOTER \
"<a href='/git/'><img src='/img/git.svg' alt='visit the nilFM hack " \
"lab.'/></a>&nbsp;\n" \
"<a rel='me' href='https://cafe.nilfm.cc/u/nilix'><img src='/img/honk.svg' " \
"alt='visit me on the Fediverse.'/></a>&nbsp;\n" \
"<a href='/git/'><img src='/img/git.svg' " \
"alt='nilFM hack " \
"lab'/></a>&nbsp;\n" \
"<a href='https://webring.xxiivv.com'><img src='/img/webring.svg' " \
"alt='visit the Webring.'/></a><br/>\n" \
"alt='xxiivv webring'/></a>&nbsp;\n<a " \
"href='https://lightcrystal.systems'><img " \
"src='/img/lightcrystal_bw_small.svg' alt='lightcrystal.systems'/><br/>\n" \
"<a href='/sitemap.html'>sitemap</a><br/>\n"
#define LICENSE \
"<a rel='license' " \
@ -17,21 +18,22 @@
#define SITEROOT "../www/"
#define TAG_BODY_SIZE 4096
#define CONTACT \
"contact: <a href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a> (<a " \
"href='keys.html'>keys</a>)<br/>\n" \
"contact: <a href='mailto:nilix@nilfm.cc' " \
"class='mono'>nilix@nilfm.cc</a> [<a " \
"href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc' " \
"class='mono'>0x90587A740FA4FFA0</a>]<br/>\n" \
""
#define DOMAIN "https://nilfm.cc"
#define FRONTCSS "/front.css"
#define FRONTCSS "/nilfm.css"
#define ABOUT \
"Derek Stevens &lt;<a " \
"href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>&gt;<br/>\n" \
"artist, programmer, philosopher<br/><br/>\n" \
"verify my signature: <a " \
"href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc'>signing public " \
"key</a><br/>\n" \
"send me an encrypted message: <a " \
"href='/serv/F5672E001CC962BE3B6C8887C65B677280C66DE5.asc'>encryption " \
"public key</a>\n" \
""
#define LOGO "<img src='/img/nilfm_blackHole_96.png' alt='blackHole://server'/>"
"software artisan, digital philosopher<br/><br/>\n" \
"[<a " \
"href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc' " \
"class='mono'>0x90587A740FA4FFA0" \
"</a>]\n"
#define LOGO "<img src='/img/nilfm_blackHole_128.png' alt='blackhole://nilFM'/>"
#define NAME "nilFM"
#define TWTXT "/twtxt.txt"
#define SEPARATEH1 0

View file

@ -1,3 +1,9 @@
#!/bin/sh
DEST="nilix@lynx.uberspace.de:~/lib/nilfm/"
rsync -avK --delete ../ ${DEST}
if [ -z "$1" ]; then
rsync -avK --delete ../ ${DEST}
elif [ "$1" = "--resync" ]; then
rsync -avk --delete ${DEST} ../
fi

21
main.c
View file

@ -69,20 +69,23 @@ int findf(Lexicon* l, char* f) {
}
int gettwtxt(FILE* f) {
char buf[1024] = {0};
char line[256];
char datebuf[16] = {0};
char msgbuf[240] = {0};
char *l, *d, *m;
FILE* twtxt = fopen(SITEROOT "twtxt.txt", "r");
FILE* twtxt = fopen(SITEROOT TWTXT, "r");
scat(buf, "<div id='twtxtFeed'><h2>recent activity:</h2>\n<table>\n");
if (!twtxt) {
error("Get twtxt feed", "no twtxt.txt");
return 0;
return 1;
} else {
int i = 0;
while (fgets(line, 256, twtxt) && i < 3) {
if (*line == '#') {
continue;
}
l = line;
while (*l != 'T') {
ccat(datebuf, *l++);
@ -107,7 +110,7 @@ int gettwtxt(FILE* f) {
i++;
}
fclose(twtxt);
scat(buf, "</table><a href='/twtxt.txt'>see all</a>\n");
scat(buf, "</table><a href='" TWTXT "'>see all</a>\n");
scat(buf, "</div>\n");
fputs(buf, f);
return 1;
@ -540,7 +543,7 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
if (target < 0) {
return error("Missing link", s);
}
fprintf(f, "<a href='./%s.html' class='local'>", scsw(stlc(s), ' ', '_'));
fprintf(f, "<a href='/%s.html' class='local'>", scsw(stlc(s), ' ', '_'));
fprintf(f, "%s</a>", scsw(stlc(s), '_', ' '));
l->refs[target]++;
return 1;
@ -677,17 +680,14 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
fputs("</head>\n", f);
fputs("<body>\n", f);
/* header */
if (SEPARATEH1) {
fputs("<header>\n", f);
if (ismetanav(name)) {
fputs("<h1>" LOGO "</h1>\n", f);
} else {
fputs("<a href='/'><h1>" LOGO "</h1></a>\n", f);
}
fputs("</header>\n", f);
/* about (main page only) */
if (ismetanav(name)) {
fputs("<div id='about'>" ABOUT "</div>\n", f);
}
/* nav */
fputs("<nav>\n", f);
@ -704,6 +704,8 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
printf(">>> Building failed: %s\n", name);
fputs("\n</main>", f);
} else {
/* about & twtxt (main page only) */
fputs("<div id='about'>" ABOUT "</div>\n", f);
gettwtxt(f);
}
/* footer */
@ -797,6 +799,7 @@ void map(Lexicon* l) {
fprintf(siteMap, "</ul>\n");
fclose(siteMap);
fclose(build(fopen(dstpath, "w"), l, "sitemap", srcpath));
remove("map.htm");
printf("Created sitemap\n");
}