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 LEXICON_SIZE 1024
#define MAINCSS "/new.css" #define MAINCSS "/nilfm.css"
#define FOOTER \ #define FOOTER \
"<a href='/git/'><img src='/img/git.svg' alt='visit the nilFM hack " \ "<a href='/git/'><img src='/img/git.svg' " \
"lab.'/></a>&nbsp;\n" \ "alt='nilFM hack " \
"<a rel='me' href='https://cafe.nilfm.cc/u/nilix'><img src='/img/honk.svg' " \ "lab'/></a>&nbsp;\n" \
"alt='visit me on the Fediverse.'/></a>&nbsp;\n" \
"<a href='https://webring.xxiivv.com'><img src='/img/webring.svg' " \ "<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" "<a href='/sitemap.html'>sitemap</a><br/>\n"
#define LICENSE \ #define LICENSE \
"<a rel='license' " \ "<a rel='license' " \
@ -17,21 +18,22 @@
#define SITEROOT "../www/" #define SITEROOT "../www/"
#define TAG_BODY_SIZE 4096 #define TAG_BODY_SIZE 4096
#define CONTACT \ #define CONTACT \
"contact: <a href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a> (<a " \ "contact: <a href='mailto:nilix@nilfm.cc' " \
"href='keys.html'>keys</a>)<br/>\n" \ "class='mono'>nilix@nilfm.cc</a> [<a " \
"href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc' " \
"class='mono'>0x90587A740FA4FFA0</a>]<br/>\n" \
"" ""
#define DOMAIN "https://nilfm.cc" #define DOMAIN "https://nilfm.cc"
#define FRONTCSS "/front.css" #define FRONTCSS "/nilfm.css"
#define ABOUT \ #define ABOUT \
"Derek Stevens &lt;<a " \ "Derek Stevens &lt;<a " \
"href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>&gt;<br/>\n" \ "href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>&gt;<br/>\n" \
"artist, programmer, philosopher<br/><br/>\n" \ "software artisan, digital philosopher<br/><br/>\n" \
"verify my signature: <a " \ "[<a " \
"href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc'>signing public " \ "href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc' " \
"key</a><br/>\n" \ "class='mono'>0x90587A740FA4FFA0" \
"send me an encrypted message: <a " \ "</a>]\n"
"href='/serv/F5672E001CC962BE3B6C8887C65B677280C66DE5.asc'>encryption " \ #define LOGO "<img src='/img/nilfm_blackHole_128.png' alt='blackhole://nilFM'/>"
"public key</a>\n" \
""
#define LOGO "<img src='/img/nilfm_blackHole_96.png' alt='blackHole://server'/>"
#define NAME "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/" 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) { int gettwtxt(FILE* f) {
char buf[1024] = {0}; char buf[1024] = {0};
char line[256]; char line[256];
char datebuf[16] = {0}; char datebuf[16] = {0};
char msgbuf[240] = {0}; char msgbuf[240] = {0};
char *l, *d, *m; 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"); scat(buf, "<div id='twtxtFeed'><h2>recent activity:</h2>\n<table>\n");
if (!twtxt) { if (!twtxt) {
error("Get twtxt feed", "no twtxt.txt"); return 1;
return 0;
} else { } else {
int i = 0; int i = 0;
while (fgets(line, 256, twtxt) && i < 3) { while (fgets(line, 256, twtxt) && i < 3) {
if (*line == '#') {
continue;
}
l = line; l = line;
while (*l != 'T') { while (*l != 'T') {
ccat(datebuf, *l++); ccat(datebuf, *l++);
@ -107,7 +110,7 @@ int gettwtxt(FILE* f) {
i++; i++;
} }
fclose(twtxt); 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"); scat(buf, "</div>\n");
fputs(buf, f); fputs(buf, f);
return 1; return 1;
@ -540,7 +543,7 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
if (target < 0) { if (target < 0) {
return error("Missing link", s); 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), '_', ' ')); fprintf(f, "%s</a>", scsw(stlc(s), '_', ' '));
l->refs[target]++; l->refs[target]++;
return 1; return 1;
@ -677,17 +680,14 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
fputs("</head>\n", f); fputs("</head>\n", f);
fputs("<body>\n", f); fputs("<body>\n", f);
/* header */ /* header */
if (SEPARATEH1) {
fputs("<header>\n", f); fputs("<header>\n", f);
if (ismetanav(name)) { if (ismetanav(name)) {
fputs("<h1>" LOGO "</h1>\n", f); fputs("<h1>" LOGO "</h1>\n", f);
} else { } else {
fputs("<a href='/'><h1>" LOGO "</h1></a>\n", f); fputs("<a href='/'><h1>" LOGO "</h1></a>\n", f);
} }
fputs("</header>\n", f); fputs("</header>\n", f);
/* about (main page only) */
if (ismetanav(name)) {
fputs("<div id='about'>" ABOUT "</div>\n", f);
} }
/* nav */ /* nav */
fputs("<nav>\n", f); fputs("<nav>\n", f);
@ -704,6 +704,8 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
printf(">>> Building failed: %s\n", name); printf(">>> Building failed: %s\n", name);
fputs("\n</main>", f); fputs("\n</main>", f);
} else { } else {
/* about & twtxt (main page only) */
fputs("<div id='about'>" ABOUT "</div>\n", f);
gettwtxt(f); gettwtxt(f);
} }
/* footer */ /* footer */
@ -797,6 +799,7 @@ void map(Lexicon* l) {
fprintf(siteMap, "</ul>\n"); fprintf(siteMap, "</ul>\n");
fclose(siteMap); fclose(siteMap);
fclose(build(fopen(dstpath, "w"), l, "sitemap", srcpath)); fclose(build(fopen(dstpath, "w"), l, "sitemap", srcpath));
remove("map.htm");
printf("Created sitemap\n"); printf("Created sitemap\n");
} }