From b86aee98b38a2fa887e479b4de02e04edf1c94a8 Mon Sep 17 00:00:00 2001 From: Kai Hendry Date: Sat, 28 Jan 2012 14:27:14 +0800 Subject: [PATCH] cleanups --- LICENSE | 2 +- clean-up-locks.sh | 1 + create.cgi | 44 +++++++++++++++----------------------------- main.js | 4 +++- 4 files changed, 20 insertions(+), 31 deletions(-) create mode 100755 clean-up-locks.sh diff --git a/LICENSE b/LICENSE index 8e2343c..bc325ea 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT/X Consortium License -© 2011 Kai Hendry +© 2011-2012 Kai Hendry Contributors to https://github.com/kaihendry/Greptweet Jamie Kitson Pádraig Brady diff --git a/clean-up-locks.sh b/clean-up-locks.sh new file mode 100755 index 0000000..32dd0ed --- /dev/null +++ b/clean-up-locks.sh @@ -0,0 +1 @@ +find $(dirname $0) -name lock | xargs rm -f diff --git a/create.cgi b/create.cgi index 0fbc917..0bd3f3d 100755 --- a/create.cgi +++ b/create.cgi @@ -54,27 +54,11 @@ END if test -d u/$id then - - echo Directory $id already exists echo Attempting an update - - cd u/$id - - ln -sf ../../index.html || true - ln -sf ../../grep.php || true - - if ! test -f lock - then - touch lock # Bug here if tab is closed before it's finished - ../../fetch-tweets.sh $id $old - rm lock # We need to also clear to lock if fetch-tweets was killed by Apache - else - echo Fetching already! - fi - else - if curl -sI http://api.twitter.com/1/users/lookup.xml?screen_name=${id} | grep -q "Status: 404 Not Found" + if curl -sI http://api.twitter.com/1/users/lookup.xml?screen_name=${id} | + grep -q "Status: 404 Not Found" then echo "$id does not exist on twitter.com :(" exit @@ -82,20 +66,22 @@ else echo Need to create u/$id mkdir u/$id - cd u/$id - ln -s ../../index.html - ln -s ../../grep.php +fi - if ! test -f lock - then - touch lock - ../../fetch-tweets.sh $id - rm lock - else - echo Fetching already! - fi +cd u/$id + +ln -sf ../../index.html || true +ln -sf ../../grep.php || true + +if ! test -f lock +then + touch lock + ../../fetch-tweets.sh $id + rm lock +else + echo Fetching already! Locks are cleared daily fi echo "" diff --git a/main.js b/main.js index 789c608..ee73112 100644 --- a/main.js +++ b/main.js @@ -34,7 +34,9 @@ $(document).ready(function() { $("input[type=text]").focus(); - $("#source").html('' + NAME + ' simple text backup file'); + footer = ''; + $("#source").html(footer); document.title = "Greptweet " + NAME; });