updated the makefile and all that

This commit is contained in:
/dev/urandom 2020-03-14 20:27:53 +03:00
parent ea486d626a
commit 33251aa098
4 changed files with 45 additions and 12 deletions

View file

@ -11,23 +11,27 @@ PNGS = $(patsubst $(PAGEDIR)/%,$(OUTDIR)/%,$(_PNGS))
_PAGES = $(shell find $(PAGEDIR) -name \*.md)
PAGES_HTML = $(patsubst $(PAGEDIR)/%.md,$(OUTDIR)/%.html,$(_PAGES))
_DIRECTORIES = $(shell find $(PAGEDIR)/* -type d)
DIRECTORIES = $(patsubst $(PAGEDIR)/, $(OUTDIR)/, $(_PAGES))
_STATIC = $(shell find static/ -name \*)
OUT_STATIC = $(patsubst static/%,out/%,$(_STATIC))
.SUFFIXES:
.PHONY: all upload
all: $(PAGES_HTML) $(OUT_STATIC)
$(OUTDIR)/%.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl $(OUTDIR)
upload:
./upload.sh
$(OUTDIR)/%.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl
@mkdir -p $(@D)
theme -t $(TPLDIR)/default.tpl -o $@ $<
$(OUTDIR)/%: static/%
@mkdir -p $(@D)
cp -r $< $@
$(OUTDIR):
mkdir -p $(OUTDIR)
clean:
rm -rf out/*

View file

@ -38,8 +38,20 @@ body a:visited {
.footer {
background: #d3d7cf;
color: #555753;
font-family: sans-serif:
font-family: sans-serif;
font-size: 0.8em;
padding: 12pt 6pt;
}
.content {
margin: 0 6pt;
color: #2e3436;
}
.info, .warning, .error {
margin: 6pt;
padding: 6pt;
font-family: sans-serif;
}
.info {
@ -62,4 +74,9 @@ body a:visited {
color: white;
}
.spoiler {
border-left: 4px solid #2e3436;
background: #d3d7cf;
color: #2e3436;
visibility: hidden;
}

View file

@ -5,8 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?theme title?></title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<script src="/scripts.js"></script>
</head>
<body>
<body>
<div class="header">
<h2><a href="/">rnd's website</a> | </h2><h3><?theme title?></h3>
</div>
@ -14,6 +15,7 @@
<?theme body?>
</div>
<div class="footer">
Website created and updated by /dev/urandom.
</div>
</body>
</html>

View file

@ -12,19 +12,29 @@ source ./upload.pwd
LASTUPLOAD=`stat -c %Y upload.lasttime 2>/dev/null`
if [[ -z $LASTUPLOAD ]]; then LASTUPLOAD=0; fi
echo "Last upload at $LASTUPLOAD"
#echo "Last upload at $LASTUPLOAD"
FILES=`find out/ -type f`
UPFILES=()
UPARGS=()
for f in $FILES; do
MTIME=`stat -c %Y $f`
#echo "MTIME for $f: $MTIME"
if [[ $MTIME -gt $LASTUPLOAD ]]; then
REMOTENAME="${f#out/}"
echo "Uploading $REMOTENAME..."
curl -F "$REMOTENAME=@$f" "https://$N_USER:$N_PWD@neocities.org/api/upload"
echo "File $REMOTENAME needs uploading"
UPFILES+=("$REMOTENAME")
UPARGS+=("-F" "$REMOTENAME=@$f")
#curl -F "$REMOTENAME=@$f" "https://$N_USER:$N_PWD@neocities.org/api/upload"
fi
done
touch upload.lasttime
if [[ ${#UPARGS[@]} -gt 0 ]]; then
curl ${UPARGS[@]} "https://$N_USER:$N_PWD@neocities.org/api/upload" && touch upload.lasttime
else
echo "No files need to be uploaded."
fi