]> git.plutz.net Git - bookman/commitdiff
added footer, improved git integration, automatic http:// prefix for urls
authorpaul <paul@plutz.net>
Sat, 9 Dec 2017 19:18:58 +0000 (19:18 +0000)
committerpaul <paul@plutz.net>
Sat, 9 Dec 2017 19:18:58 +0000 (19:18 +0000)
svn path=/trunk/; revision=15

bookmarks.css
import.sh
index.cgi

index e37d70af0e3ad306e0aae0a348c7f1c67d3a05e3..e210965149a3df9e8dab4c2d56f3aa1a5380bd41 100644 (file)
@@ -9,9 +9,8 @@
   box-sizing: border-box;
 }
 
   box-sizing: border-box;
 }
 
-html, body {
-  background-color: #DDD;
-}
+html, body { background-color: #DDD; }
+body { position: absolute; width: 100%; min-height: 100%; }
 
 .folder, form.newfolder{
   display: block;
 
 .folder, form.newfolder{
   display: block;
@@ -171,3 +170,11 @@ html, body {
   margin: 0 .5ex;
 }
 
   margin: 0 .5ex;
 }
 
+footer {
+  position: absolute; bottom: 0;
+  display: block;
+  width: 100%;
+  padding: 1em;
+  background-color: white;
+  border-top: 1px solid black;
+}
index aec5ba1f52630a1a54daf9be45b50561d88205e6..1c8e1add431f5aea3c6a2fcb7e2880c2e503e0da 100755 (executable)
--- a/import.sh
+++ b/import.sh
@@ -25,7 +25,9 @@ import="$1"
 order=1000
 BDB="users/$(genid)"
 
 order=1000
 BDB="users/$(genid)"
 
-mkdir -p "${BDB}/favicons"
+mkdir users/
+git init "${BDB}" || mkdir "${BDB}"
+mkdir "${BDB}/favicons"
 
 while read l; do
   case "$l" in
 
 while read l; do
   case "$l" in
index 911e5eed684715e6e67cf5413617b33752f831d9..039781678491d01a06e87f0992fedfe1a41a275c 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -93,7 +93,7 @@ BDB="users/${COKID}"
 
 if [ -n "$QRYID" ]; then
   printf '%s 303 See Other\r\n' "$SERVER_PROTOCOL"
 
 if [ -n "$QRYID" ]; then
   printf '%s 303 See Other\r\n' "$SERVER_PROTOCOL"
-  printf 'Location: %s\r\n' "${SCRIPT_NAME}?${QUERY_STRING#id=*&}"
+  printf 'Location: %s\r\n' "${SCRIPT_NAME}?${QUERY_STRING#id=????????????}"
   SET_COOKIE +8640000 "id=${QRYID}"
   printf '\r\n'
   exit 0
   SET_COOKIE +8640000 "id=${QRYID}"
   printf '\r\n'
   exit 0
@@ -174,10 +174,10 @@ case "$(GET action)" in
     tfile="${BDB}/${target}.bm"
     if [ "$(POST control)" = confirm -a -f "$file" ]; then
       if [ "$target" = "____________" ]; then
     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
         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
         git -C "${BDB}" commit -m "Deleted folder ${fid}" -- "${fid}.bm" "${target}.bm" >&-
       fi
     fi
@@ -288,7 +288,6 @@ bookmarkgen(){
   url="$(GET nbmurl)"
   file="${BDB}/${fid}.bm"
 
   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 \
   if [ -z "$name" -a -n "$url" ]; then
     name="$(wget -O- "$url" \
             | head -c4096 \
@@ -297,6 +296,7 @@ bookmarkgen(){
   fi
 
   if [ -n "$fid" -o -n "$name" -o -n "$url" ]; then
   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
        <form class="dialog newbookmark" method="POST" action="${SCRIPT_NAME}?action=newbookmark">
           <h1>New Bookmark</h1>
@@ -496,6 +496,9 @@ cat <<EOF
     <input type="text" name="name" value="" placeholder="New Folder" />
     <button type="submit">New</button>
   </form>
     <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
 
 </body></HTML>
 EOF