BDB="users/${COKID}"
if [ -n "$QRYID" ]; then
- printf '%s 303 See Other\r\n' "$SERVER_PROTOCOL"
- printf 'Location: %s\r\n' "${SCRIPT_NAME}?${QUERY_STRING#id=*&}"
+ printf 'Status: 303 See Other\r\n'
+ printf 'Location: %s\r\n' "${SCRIPT_NAME}?${QUERY_STRING#id=????????????}"
SET_COOKIE +8640000 "id=${QRYID}"
printf '\r\n'
exit 0
cat <<-EOF
<!DOCTYPE HTML>
<HTML><head>
+ <meta name="viewport" content="width=device-width" />
<title>Bookman - New Collection</title>
</head><body id="newcollection">
<h1>You have not yet set up a collection on this server.</h1>
EOF
exit 0
elif ! [ -d "${BDB}" ]; then
- printf '%s 404 Not Found\r\n' "$SERVER_PROTOCOL"
+ printf 'Status: 404 Not Found\r\n'
printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'
cat <<-EOF
<!DOCTYPE HTML>
<HTML><head>
+ <meta name="viewport" content="width=device-width" />
<title>Bookman - 404</title>
</head><body id="missingcollection">
<h1>The collection you requested does not exist on this server.</h1>
{ git init "users/${NEWID}" || mkdir -p "users/${NEWID}"; } >&-
- printf '%s 303 See Other\r\n' "$SERVER_PROTOCOL"
+ printf 'Status: 303 See Other\r\n'
printf 'Location: %s\r\n' "${SCRIPT_NAME}?id=${NEWID}"
SET_COOKIE +8640000 "id=${NEWID}"
printf '\r\n'
tfile="${BDB}/${target}.bm"
if [ "$(POST control)" = confirm -a -f "$file" ]; then
if [ "$target" = "____________" ]; then
- rm -f "$file" >&-
+ rm -f "$file" "${file%.bm}.cache" >&-
git -C "${BDB}" commit -m "Deleted folder ${fid}" -- "${fid}.bm" >&-
elif tail -n+2 "$file" >>"$tfile"; then
- rm -f "$file" >&-
+ rm -f "$file" "${file%.bm}.cache" >&-
git -C "${BDB}" commit -m "Deleted folder ${fid}" -- "${fid}.bm" "${target}.bm" >&-
fi
fi
url="$(GET nbmurl)"
file="${BDB}/${fid}.bm"
- [ "$url" = "${url#*://}" ] && url="http://$url"
if [ -z "$name" -a -n "$url" ]; then
name="$(wget -O- "$url" \
| head -c4096 \
fi
if [ -n "$fid" -o -n "$name" -o -n "$url" ]; then
+ [ "$url" = "${url#*://}" ] && url="http://$url"
cat <<-EOF
<form class="dialog newbookmark" method="POST" action="${SCRIPT_NAME}?action=newbookmark">
<h1>New Bookmark</h1>
cat <<EOF
<!DOCTYPE HTML>
<HTML><head>
+ <meta name="viewport" content="width=device-width" />
<title>Bookman - Your Collection</title>
<link rel="stylesheet" type="text/css" href="bookmarks.css" />
</head><body id="collection">
<input type="text" name="name" value="" placeholder="New Folder" />
<button type="submit">New</button>
</form>
+ <footer>
+ <a href="${SCRIPT_NAME}?id=${COKID}">Permalink for this Collection</a>
+ </footer>
</body></HTML>
EOF