# HG changeset patch # User Christophe Lincoln # Date 1397349009 -7200 # Node ID 68248b2673ddf67321415f1962a64dc8bf500003 # Parent df18d42598b1b2c72d5180eb0421df5a95157acd Fix user bookmarks on first run diff -r df18d42598b1 -r 68248b2673dd data/bookmarks.cgi --- a/data/bookmarks.cgi Sun Apr 06 19:04:10 2014 +0000 +++ b/data/bookmarks.cgi Sun Apr 13 02:30:09 2014 +0200 @@ -31,6 +31,7 @@ a { text-decoration: none; } a:hover { text-decoration: underline; } li { list-style-type: none; color: #666; line-height: 1.4em; padding: 0; } footer { font-size: 80%; border-top: 2px solid #666; padding: 5px 0; } + textarea { width: 100%; height: 240px; font-size: 98%; } @@ -46,8 +47,9 @@ @@ -58,21 +60,49 @@ # Handle GET actions: continue or exit case " $(GET) " in + + *\ edit\ *) + header + html_header + cat << EOT +

Bookmarks Edit

+
+ + + +

+
+EOT + html_footer && exit 0 ;; + + *\ save\ *) + sed "s/$(echo -en '\r') /\n/g" > ${bookmarks} << EOT +$(GET content) +EOT + ;; + *\ raw\ *) # View bookmarks file header html_header - echo "

TazWeb: bookmarks.txt

" - echo "
" 
-		cat ${bookmarks}
+		echo '

Raw Bookmarks

' + echo "
"
+		IFS="|"
+		cat ${bookmarks} | cat ${bookmarks} | while read title url null
+		do
+			echo "$title | $url"
+		done
+		unset IFS
 		echo "
" html_footer && exit 0 ;; + *\ rm\ *) # Remove a bookmark item and continue url=$(GET rm) [ "$url" ] || continue sed -i s"#.*${url}.*##" ${bookmarks} sed -i "/^$/"d ${bookmarks} ;; + esac # Show all bookmarks diff -r df18d42598b1 -r 68248b2673dd data/bookmarks.txt --- a/data/bookmarks.txt Sun Apr 06 19:04:10 2014 +0000 +++ b/data/bookmarks.txt Sun Apr 13 02:30:09 2014 +0200 @@ -1,5 +1,5 @@ -SliTaz Website|http://www.slitaz.org| -SliTaz ARM|http://arm.slitaz.org| -Wikipedia|http://wikipedia.org/| -Twitter|http://twitter.com| -Google search|http://www.google.com/| +SliTaz Website|http://www.slitaz.org +SliTaz ARM|http://arm.slitaz.org +Wikipedia|http://wikipedia.org +Twitter|http://twitter.com +Google search|http://www.google.com diff -r df18d42598b1 -r 68248b2673dd src/main.c --- a/src/main.c Sun Apr 06 19:04:10 2014 +0000 +++ b/src/main.c Sun Apr 13 02:30:09 2014 +0200 @@ -522,11 +522,11 @@ if (!g_thread_supported()) g_thread_init(NULL); - /* Get a default home.html if missing */ - if (! g_file_test(CONFIG, G_FILE_TEST_EXISTS)) { - system("install -m 0777 $HOME/.config/tazweb"); + /* Get a default bookmarks.txt if missing */ + if (! g_file_test(BMTXT, G_FILE_TEST_EXISTS)) { + system("install -m 0777 -d $HOME/.config/tazweb"); system("install -m 0666 /usr/share/tazweb/bookmarks.txt \ - $HOME/.config/tazweb"); + $HOME/.config/tazweb/bookmarks.txt"); } /* Load the start page file or the url in argument */