From: Will Budic Date: Tue, 18 Feb 2020 08:48:11 +0000 (+1100) Subject: Exception handling changes. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=d656514b9e06219bb33fbc3af079b300c0659802;p=LifeLog.git Exception handling changes. --- diff --git a/Current Development Check List.md b/Current Development Check List.md index 67da500..75b1a08 100644 --- a/Current Development Check List.md +++ b/Current Development Check List.md @@ -9,7 +9,19 @@ This version is not compatible in data structure to prior versions. Data migrati ### v.1.7 Encountered +* ✔Change all code to use Exceptions as project is becoming hard to manage. + * The harder it is to foresee possible problems, the less likely you will add unnecessary complexity. -- bud@ +* ✔ Notes to Log table should be other way in relationship direction. + * LOG.ID_RTF -> NOTES.rowid + * This is currently causing problems when the log renumerates, or entries are imported. +* Database backup tar ball, download button on config page. +* New Categories dropdown, grouping in ascending order and presenting in columns of five at a time. * New CNF Development. + * Migration is currently hard to maintain and data export and import is wrongly reliant to CVS. + * CVS imports are to be made obsolete in the future. +* ✔ In config page Categories section to appear after system settings. As less likelly to be changed. + * System Configuration section is to be sorted. As in future it is more likelly to grow. +* ✔ New system setting, $VIEW_ALL_LMT=1000. To limit view all records displayed on huge databases. * ✔ Provide system logs on stats page runs. * ✔ Menus updated in other pages to have button look. * ✔ main.cnf newer versions should have precedence to id and entry name to previously set or stored in db. @@ -20,8 +32,6 @@ This version is not compatible in data structure to prior versions. Data migrati * ✔ Mutli new alias access flood attack security trigger implementation. * ✔ Debug system settings implementaiton. * ✔ Delete page updated to show better display of entries. -* Provide sub alias login that sets data visible to only a set of categories. - * View specific based login on a different password. * ✔ Login page to indentify host. * ✔ Session cleanup on autologin not clearing properly. * A dbfix, should clear older entries as well. @@ -41,7 +51,9 @@ This version is not compatible in data structure to prior versions. Data migrati ## Planned New Possible Features of Minor Relevance -* Table sort in config system settings by variable name. +* Provide sub alias login that sets data visible to only a set of categories. + * View specific based login on a different password. +* ✔ Table sort in config system settings by variable name. * Enable automatic bold title heading for specified cattegories. * Theme colours to be revisited, bettered * Enable file attachment to log entries. @@ -56,12 +68,14 @@ This version is not compatible in data structure to prior versions. Data migrati ## Bugs ### v. 1.8 Encountered/Fixed -* Bug 17 - Editimg of entries on occasions, duplicates entries. -* Bug 16 - Saving new log entries with rtf overides previous log entries rtf. -* ✔ Issue 15 Date diff, showes upside down first range by current date with multiple selections. +* ✔ Issue 18 - Setting excludes for views, deliveres page but long delays with server finished exchange (page doesn't hang). + * The page is server delivered, if sections contain external internet links, this timeouts page browser delivery if the internet is down. +* ✔ Bug 17 - Editimg of entries on occasions, duplicates entries. +* ✔ Bug 16 - Saving new log entries with rtf overides previous log entries rtf. + * Issue 16.1 - Currently importing of records linked to rtf notes is not supported. +* ✔ Issue 15 Date diff, showes upside down first range by current date with multiple selections. * Range should be selected from date in selected latest to current date last as inbetween difference. - * ✔ Issue 14 Subpages pages links to main, restart main page session counter, making the main page fully usable. * Not really a bug. Session will expire but time remaining will be displayed wrong on the main page. * All subpages need either to inherit the counter, and jump user to the login screen if expired. diff --git a/Installation.txt b/Installation.txt index 80108d7..87e31cc 100644 --- a/Installation.txt +++ b/Installation.txt @@ -8,7 +8,7 @@ -- Note - Perl and some modules might take time to install as their fetched and tested for your computer. - + ## Install tiny thttpd web server. ## @@ -65,7 +65,7 @@ git clone https://github.com/wbudic/LifeLog.git -#Install cpanm to make installing other modules easier (you'll thank us later). +#Install cpanm to make installing other modules easier (you'll thank us later). #You need to type these commands into a Terminal emulator (Mac OS X, Win32, Linux) sudo apt install cpanminus @@ -105,24 +105,29 @@ NOTICE -> Above Perl installation and modules can take time as they build (compi -# LifeLOg Required Perl modules. - -sudo cpanm DateTime; -sudo cpanm DateTime::Format::Human::Duration -sudo cpanm DateTime::Format::SQLite; -sudo cpanm Text::CSV; -sudo cpanm Number::Bytes::Human; -sudo cpanm CGI::Session; -sudo cpanm Try::Tiny; -sudo cpanm Number/Bytes/Human.pm; -sudo cpanm Regexp::Common; -sudo cpanm JSON; -sudo cpanm Switch; -sudo cpanm install IPC::Run +# LifeLog Required Perl modules. + +### +# since 1.8 switched to: +# before was -> sudo cpanm Try::Tiny; +sudo cpan Log::Log4per +sudo cpan Syntax::Keyword::Try + +sudo cpan DateTime; +sudo cpan DateTime::Format::Human::Duration +sudo cpan DateTime::Format::SQLite; +sudo cpan Text::CSV; +sudo cpan Number::Bytes::Human; +sudo cpan CGI::Session; +sudo cpan Number/Bytes/Human.pm; +sudo cpan Regexp::Common; +sudo cpan JSON; +sudo cpan Switch; +sudo cpan install IPC::Run #Install DBI module -sudo cpanm DBI; -sudo cpanm DBD::SQLite; +sudo cpan DBI; +sudo cpan DBD::SQLite; #Final Perl Installation Notes @@ -130,7 +135,7 @@ This perl setup might take time and efforts. But, it is worth it. You get it build and tested professionally, based on your hardware. Platforms supported, Windows, Unix (all), Mac. -Installing perl as an developer, requires no sudo. +Installing perl as an developer, requires no sudo. But hence can't run server (system level) like. If developer and running perlbrew, recommended is to use @@ -145,7 +150,7 @@ cd /home/{user}/thttpd_dev/dbLifeLog sqlite3 -csv data_log.db "select * from LOG;" > current_log.csv ##Install LifeLog Independently -cd /home/{user}/ +cd /home/{user}/ git clone https://github.com/wbudic/LifeLog mkdir /home/{user}/thttpd_dev/dbLifeLog chmod +x /home/{user}/thttpd_dev/cgi-bin/*.cgi @@ -157,7 +162,7 @@ Access the webserver cgi-bin. http://localhost:8080/cgi-bin/main.cgi (this might redirect to login.cgi or config.cgi in the future) ##Install LifeLog Dependably (not automatic, manual developer way) -cd /home/{user}/ +cd /home/{user}/ git clone https://github.com/wbudic/LifeLog run thttpd with: cd LifeLog; ./startDevWebServer.sh @@ -168,7 +173,7 @@ Once created you must import the from above example current_log.csv cd /home/{user}/thttpd_dev/dbLifeLog see: http://www.sqlitetutorial.net/sqlite-import-csv/ -Example (data_dev1_2_log.db would be created as the latest version by the CGI created): +Example (data_dev1_2_log.db would be created as the latest version by the CGI created): cd /home/{user}/thttpd_dev/dbLifeLog sqlite3 data_dev1_2_log.db sqlite> .mode csv @@ -189,7 +194,7 @@ can be installed to start on reboot. sudo cp startDevWebServer.sh /etc/init.d/ -Modify the following to the path of your development environment +Modify the following to the path of your development environment where thttpd.conf file is in /etc/init.d/startDevWebServer.sh Modify line -> cd /home/will/thttpd_dev @@ -225,7 +230,7 @@ You can export and modify your added categories via an CSV file. Making sure the ID first column across all entries has a unique number. #Install AUTO_LOGIN -On a personal network or small network, you might prefere to auto login when browsing to the LifeLog, +On a personal network or small network, you might prefere to auto login when browsing to the LifeLog, instead of entering every time user name and password. It makese sense, as you are the only one using it, don't need that extra security. diff --git a/htdocs/cgi-bin/config.cgi b/htdocs/cgi-bin/config.cgi index 4b0b4d8..d6983e0 100755 --- a/htdocs/cgi-bin/config.cgi +++ b/htdocs/cgi-bin/config.cgi @@ -5,13 +5,14 @@ # use strict; use warnings; -use Try::Tiny; use Switch; use CGI; use CGI::Session '-ip_match'; use CGI::Carp qw ( fatalsToBrowser ); use DBI; +use Exception::Class ('LifeLogException'); +use Syntax::Keyword::Try; use DateTime; use DateTime::Format::SQLite; @@ -24,9 +25,6 @@ use lib "system/modules"; require Settings; ## -#This is the OS developer release key, replace on istallation. As it is not secure. -my $cipher_key = '95d7a85ba891da'; - #15mg data post limit $CGI::POST_MAX = 1024 * 15000; my ($LOGOUT,$ERROR) = (0,""); @@ -35,8 +33,8 @@ my $session = new CGI::Session("driver:File", $cgi, {Directory=>&Settings::logPa my $sid=$session->id(); my $dbname =$session->param('database'); my $userid =$session->param('alias'); -my $password=$session->param('passw'); -my $sys = `uname -n`; +my $pass =$session->param('passw'); +my $sys = `uname -n`; #my $acumululator=""; if(!$userid||!$dbname){ @@ -46,7 +44,7 @@ if(!$userid||!$dbname){ my $database = &Settings::logPath.$dbname; my $dsn= "DBI:SQLite:dbname=$database"; -my $db = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) or die "

Error->"& $DBI::errstri &"

"; +my $db = DBI->connect($dsn, $userid, $pass, { RaiseError => 1 }) or die "

Error->"& $DBI::errstri &"

"; ### Fetch settings Settings::getConfiguration($db); @@ -95,10 +93,10 @@ print qq(