From 4aa41514bfa15e4adb8b7872e89e83e00f1d824b Mon Sep 17 00:00:00 2001 From: Will Budic Date: Fri, 5 Apr 2024 19:06:51 +1100 Subject: [PATCH] stash --- app_lifelog_settings.cnf | 276 +++++++++++++++++++++++++++++ data/current_theme | 1 + htdocs/cgi-bin/kurac_login_ctr.cgi | 108 +++++++++++ startLightHTTPServer.sh | 2 +- 4 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 app_lifelog_settings.cnf create mode 100644 data/current_theme create mode 100755 htdocs/cgi-bin/kurac_login_ctr.cgi diff --git a/app_lifelog_settings.cnf b/app_lifelog_settings.cnf new file mode 100644 index 0000000..c7eb2ea --- /dev/null +++ b/app_lifelog_settings.cnf @@ -0,0 +1,276 @@ +!CNF3.1 +/* +This is the main configuration file for the LifeLog applications settings. +<> +<> +This is an Open Source License project -> https://choosealicense.com/licenses/isc/ +*/ + + + +/** + These are modifiable anon application settings in this config file. + These aew not reflected to the database config settings. +**/ +<<< APP_SETTINGS + // AUTO_LOGIN Credential format is:{alias}/{password} when set to zero it is disabled. + AUTO_LOGIN = 0 + // BACKUP_ENABLED -> To Enable (1), disable (0) backups to be restored from config page. + BACKUP_ENABLED = 1 + LOGOUT_IFRAME_ENABLED = true + FORCE_DEBUG_ON = 1 + LOG_DATA_PATH = data + CURRENT_THEME = "default" +>>> + +<>> +< + + NOTICE!   + The Alias entry is used for the database name here, + a new database will be created for you if it doesn't exist. + Make sure you note down your password. + +>> +/** + These are constant defaults configuration settings, they can't be modified by the application, + once set here but will be reflected to the config database settings. + These database settings can be changed than in turn. Or all restored from here. + These used to be kept in the past in a Settings.pm package, now it is here in the configuartion. + Notice -> Deleting entries from here will most likely break the application. +**/ +<<>> + +<<@<@SCRIPTS_CSS> + wsrc/effects.css + wsrc/feeds.css + wsrc/jquery-ui.css + wsrc/jquery-ui.theme.css +>> + +<<@<@SCRIPTS_JS> + wsrc/feeds.js +>> + +< + css : wsrc/main.css + colBG : '#c8fff8' + colSHDW : '#9baec8' + [Sun[ + css: 'wsrc/main_sun.css' + colBG: #FFD700 + colSHDW:#FFD700 + ]Sun] + [Moon[ + css: 'wsrc/main_moon.css' + colBG: #000000 + colSHDW:#DCDCDC + ]Moon] + [Earth[ + css: 'wsrc/main_earth.css' + colBG: #228B22 + colSHDW:#8FBC8F + ]Earth] +>> + + +######################################################################### + Note Remove -> '!' prefix to a tag name, to enable, set, + and override any previously set setting from now on, + it is from top to end file approach, in this type of configuration. +# + +# Default database driver is SQLite, anyhow. +# SQLite DB driver. +<>> + +# ProgresSQL DB driver. Remove '!' to enable. +<>> + + +# LOG actual variable size limit, - 8192 default, 128 minimum value. +<>> + +# Set the following to an database name, with external managed multiple users, that are to connect to a single database. +# Users have to be externally set, and alias is then used for their userid to be able to login. (Add user roles to AUTH table). +# By default this setting is disabled with 0, making alias name, its own log database, per user. +# +<>> + +# Timezoning, if set to 1, country locale setting for timezone in config page is ignored. +<>> + +# Public, enabled list of categories. Remove -> '!' prefix before tag name, to enable. Be careful what category you add/enable here. +# Public records view feature only, it doesn't allow new log entries to be added and have pin point searching of all existing. +<>>#File,System log and Event. +# Following is similar to AUTO_LOGIN setting above, and must be set. +<>> +<>> +< +$`$`$`$`Dollar Sign~ +€`€`€`€`Euro Sign~ +£`£`£`£`Pound Sign~ +¤`¤`¤`¤`Currency Sign~ +₽`₽`₽`Ruble Sign~ +Â¥`¥`¥`¥`Yen Sign~ +₨`₨`₨`Rupee Sign~ +à§³`৳`৳`Bengali Rupee Sign~ +฿`฿`฿`Thai Currency Symbol Baht~ +>> + +<help.pl +BankingPlugin->banking.pl +>> + +# @See help at bottom of config for all the following. + +<>> <- (Diary,System Log,Poetry) category id's only, does set in the config page also work. +<>> +<=6 AND >>> + +#For internal use only. +<<^CONFIG_META<200>The reserved id range for config table is from 200, upwards.>> + + + +# +# The following are initial setup and data using above declared constance's in places. We use this data instead of hardcoding a lot in the app. +# Modifying here after the fact of having run tje application is futile, a limp biscuit. +# Only during migration this file might be changed by the developer. +# The migration synchronisation might occure overwriting some values in this data placed settings. +# +< +ID` _PROPERTY_ `Description~ +00`$RELEASE_VER `LifeLog Application Version.~ +01`$REC_LIMIT `Records shown per page.~ +03`$TIME_ZONE `Australia/Sydney`Time zone of your country and city. +05`$PRC_WIDTH `Default presentation width for pages. +08`$LOG_PATH `Path to folder containing data. +10`$SESSN_EXPR `Login session expiration time setting, can be seconds, minutes or hours. +12`$DATE_UNI `Setting of how dates are displayed, universal yyyy-mm-dd or local dd-mm-yyyy. +14`$LANGUAGE `English`Default language locale. +18`$IMG_W_H `Default embedded image width. +20`$AUTO_WRD_LMT `Autocomplete word gathering limit. +22`$AUTO_LOGIN `Autologin option, that expires only if login out. Enter Credentials in main.cnf. +23`$AUTO_LOGOFF `Auto logoff on session expires, default is false. +24`$FRAME_SIZE `Youtube frame size settings, 0 - Large, 1 - Medium, 2- Small. +26`$RTF_SIZE `RTF Document height, 0 - Large, 1 - Medium, 2- Small. +28`$THEME `Standard`Theme to apply, Standard, Sun, Moon, Earth. +30`$DEBUG `Development page additional debug output, off (default) or on. +32`$KEEP_EXCS `Cache excludes between sessions, off (default) or on. +34`$VIEW_ALL_LMT `Limit of all records displayed for large logs. Set to 0, for unlimited. +36`$TRACK_LOGINS `Create system logs on login/logout of Life Log. +38`$COMPRESS_ENC `Compress Encode pages, default -> 0=false, 1=true. +40`$SUBPAGEDIR `Directory to scan for subpages like documents. +42`$DISP_ALL `Display whole log entry, default -> 1=true, 0=false for display single line only. +44`$TRANSPARENCY `Should log panel be transparent, default is yes or on. +50`$CURR_SYMBOL `Currency symbol. +52`$AUDIO_ENABLED`Enable/Disable audio on some events and actions. +>> +< +01|Unspecified `For quick uncategorized entries. +03|File System `Operating file system/Application short log. +06|System Log `Operating system important log. +09|Event `Event that occurred, meeting, historically important. +28|Personal `Personal log of historical importance, diary type. +32|Expense `Significant yearly expense. +35|Income `Significant yearly income. +40|Work `Work related entry, worth monitoring. +45|Food `Quick reference to recipes, observations. +50|Music `Music reference of interest. Youtube embedded. +52|Sport/Club `Sport or Social related entry. +55|Cars `Car(s) related entry. +60|Online `Online purchases (ebay, or received/ordered from online source). +88|Diary `Diary specific log and entry. Your daily yaddi-yadda that have decided to place here. +90|Fitness `Fitness steps, news, info, and useful links. Amount is steps. +>> +< +NOTES|DROP TABLE NOTES;' ver. 1.5 fts4 virtual tables have been scratched as they require special SQLite compilation. +LOG<5>|Run Query ' ver. 1.5 + +## HELP SECTION ON OPTIONS + + + Global view overrides. These get generated in the db if set on logon. And used instead of the normal data view. + Overrides must always show todays log entries, regardless of criteria. + Overrides don't affect category and keywords desired searches and views. They are mainly useful to filter out + the not required to see on the main pages. + NOTE - These settings AND on VW_LOG_WITH_EXCLUDES if they are set. VW_ prefix signifies, database view, + meaning this will be created. Based on the settings bellow you make. An interesting concept, don't you think? + +### PAGE_VIEW_EXCLUDES + + Setting to modify the page view to exclude older log entries by a list of categories from today minus days back. + This is to avoid and page only list relevant logs on logon. Searching by category will list them and still make visible. + value: {days=}{category id},.. days default to zero, if you don't want from yesterday to the past category entries listed. + +< <- (Diary,System Log,Poetry) category id's only, does set in the config page also work. + + +### VIEW_OVERRIDE_SYSLOGS overrides not to show system logs that are older than today. Same to CAT!=6 by default, +# Default is 0, disabled. + +### VIEW_OVERRIDE_WHERE + + This option overrides what log entries to filter out from the page view, in more detail. + It translated via keywords to appropriate required SQL. This filter by default is + not active on 24 hours old entries. PAGE_VIEW_EXCLUDES option entries are included. + +#### CAT is the ID_CAT column, keyword. +* i.e VIEW_OVERRIDE_WHERE= 6>, selects all categories from and category id 6. +PAGE_VIEW_EXCLUDES and VIEW_OVERRIDE_SYSLOGS don't have to be set. But preside if set. + +#### AND/OR keyword, logically joins the instructions. +* i.e VIEW_OVERRIDE_WHERE< CAT > 6 AND CAT != 'Personal' >, selects all categories from +category id 6, excluding resolved category entries. + +#### OLDER_THAN keyword translates to date column older than from today up to an specified date in the past. +* This is assigned by either months, days, hours. +** i.e VIEW_OVERRIDE_WHERE, this instructs skip older then to months logs and all sys logs. + +#### FROM/TO in either months, days, hours. +* Selects only FROM or TO an specified date only log entries. +** i.e VIEW_OVERRIDE_WHERE + +#### NOT keyword, logically negates. +** i.e VIEW_OVERRIDE_WHERE, select only log entries that contain attached RTF documents, if they +are older than 24 hours. Remember, the default filtering is on 24 hour and older log entries. +** i.e VIEW_OVERRIDE_WHERE, don't select log entries that contain attached RTF documents. +** i.e VIEW_OVERRIDE_WHERE, +category is not (!=), resolved category id by name. And also exclude all logs older than an year. +All is FROM to OLDER_THAN, affected. So from today (now) to FROM 'will' be paged, visible. diff --git a/data/current_theme b/data/current_theme new file mode 100644 index 0000000..3c9f8bf --- /dev/null +++ b/data/current_theme @@ -0,0 +1 @@ +Sun diff --git a/htdocs/cgi-bin/kurac_login_ctr.cgi b/htdocs/cgi-bin/kurac_login_ctr.cgi new file mode 100755 index 0000000..38980e3 --- /dev/null +++ b/htdocs/cgi-bin/kurac_login_ctr.cgi @@ -0,0 +1,108 @@ +#!/usr/bin/env perl +# +use strict; +use warnings; +use experimental qw( switch ); +use Exception::Class ('LifeLogException'); +use Syntax::Keyword::Try; +use CGI::Tiny; +no warnings qw(experimental::signatures); +use feature qw(signatures); +use utf8; +#use lib "/home/will/dev_new/LifeLog/htdocs/cgi-bin/system/modules"; +use lib "system/modules"; +use bignum qw/hex/; + +use Gzip::Faster; + +require CNFParser; +sub get_data_path($path){ + $path = "data" unless $path; # The default is data dir. + $path = "../../$path" unless (-e $path); #cgi executing path is not same to this project local one, so we try resolve. + mkdir $path unless -e $path; +return $path; +} +sub get_config_file_path { + my $file = 'app_lifelog_settings.cnf'; + $file = "../../$file" unless(-e $file); +return $file; +} +sub setup_with_last_used_theme($config, $path){ + $path = $path.'/current_theme'; + my $themes = $config -> getTree('THEMES'); + our $THEME = '/'; + if(-e $path){ + open my $fh, '<', $path or return $THEME; + $THEME = <$fh>;chomp($THEME); + close($fh); + } + my $ret = $$themes -> node($THEME); + return $$themes if(!$ret); + return $ret; +} + + + +#use CGI::Session '-ip_match'; +# use Data::Section::Simple 'get_data_section'; + +# cgi { +# my $cgi = $_; + +# # from templates/ +# my $tx = Text::Xslate->new(path => ['templates']); + +# # or from __DATA__ +# my $tx = Text::Xslate->new(path => [get_data_section]); + +# my $foo = $cgi->query_param('foo'); +# $cgi->render(html => $tx->render('index.tx', {foo => $foo})); +# }; + + +use CGI; +my $cgi = CGI->new(); + + + # $cgi->set_error_handler( + # sub { + # my ($cgi, $error, $rendered) = @_; + # chomp $error; + # $cgi->render(text=>qq(You have unfortunately hit an cgi-bin::CNFHTMLServiceError + #
$error

+ # + # ) + # ); + # } + # ); + +my $page = qq( + + +
+
+               

DEMO!

+

+ +); + # $cgi-> add_response_header('Expires', '1s'); + # $cgi-> add_response_header('Cache-Control', 'no-cache'); + # $cgi->reset_response_headers(); + # $cgi-> add_response_header('Content-Encoding', 'gzip'); + # $cgi-> add_response_header('Accept-Encoding','Vary'); + # $cgi-> render(text=>gzip($page)); + + +print $cgi->header(-expires => "1s", -charset => "UTF-8", -Content_Encoding => 'gzip'); +print gzip($page); + + exit 0; + +1; + +=begin copyright +Programed by : Will Budic +EContactHash : 990MWWLWM8C2MI8K (https://github.com/wbudic/EContactHash.md) +Source : https://github.com/wbudic/LifeLog +Open Source Code License -> https://github.com/wbudic/PerlCNF/blob/master/ISC_License.md +=cut copyright diff --git a/startLightHTTPServer.sh b/startLightHTTPServer.sh index 4d246e7..c125049 100755 --- a/startLightHTTPServer.sh +++ b/startLightHTTPServer.sh @@ -1,4 +1,4 @@ #!/bin/bash #Starting here in console mode. -sudo lighttpd -D -f ~/dev/LifeLog/lighttpd.conf \ No newline at end of file +sudo lighttpd -D -f lighttpd.conf \ No newline at end of file -- 2.34.1