From 8ceeceb54fe4db1fce09a467ad493338f13fd4ef Mon Sep 17 00:00:00 2001 From: b Date: Fri, 29 Dec 2023 12:20:19 +0000 Subject: [PATCH] continued bugfix of 2words & index & launch --- 2words.1.pl | 203 ++------------------------------------------------ bsta_lib.1.pm | 6 +- viewer.1.pl | 13 ++-- 3 files changed, 19 insertions(+), 203 deletions(-) diff --git a/2words.1.pl b/2words.1.pl index 186e31a..2c1cca6 100644 --- a/2words.1.pl +++ b/2words.1.pl @@ -50,12 +50,8 @@ use File::Copy; ###PERL_CGI_PATH: CGI_PATH = /bsta/ ###PERL_CGI_2WORDS_PATH: CGI_2WORDS_PATH = /bsta/2words -###PERL_CGI_CSS_PATH: CGI_CSS_PATH = /bsta/bsta.css -###PERL_CGI_LOGO_PATH: CGI_LOGO_PATH = /bsta/botmlogo.png -###PERL_CGI_VIEWER_PATH: CGI_VIEWER_PATH = /bsta/v ###PERL_DATA_PATH: DATA_PATH = /botm/data/bsta/ -###PERL_DATA_COIN_PATH: DATA_COIN_PATH = /botm/data/bsta/coincidence ###PERL_DATA_DEFAULT_PATH: DATA_DEFAULT_PATH = /botm/data/bsta/default ###PERL_DATA_LIST_PATH: DATA_LIST_PATH = /botm/data/bsta/list ###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings @@ -63,14 +59,8 @@ use File::Copy; ###PERL_DATA_STORY_PATH: DATA_STORY_PATH = /botm/data/bsta/story ###PERL_WWW_PATH: WWW_PATH = /botm/www/1190/bsta/ -###PERL_WWW_INDEX_PATH: WWW_INDEX_PATH = /botm/www/1190/bsta/index.htm -###PERL_WEBSITE: WEBSITE = 1190.bicyclesonthemoon.info ###PERL_WEBSITE_NAME: WEBSITE_NAME = Bicycles on the Moon -###PERL_FAVICON_PATH: FAVICON_PATH = /img/favicon.png - -###PERL_COIN_DATE: COIN_DATE = 13-Nov-2016 22:15 -###PERL_INTF_DATE: INTF_DATE = 28-Sep-2016 20:34 ###PERL_STORY_LENGTH: STORY_LENGTH = 16 ###PERL_PAGE_LENGTH: PAGE_LENGTH = 16 @@ -312,21 +302,26 @@ if (open ($story_file,"+<:encoding(UTF-8)",DATA_STORY_PATH())){ my $frame_file; my $in_path; my $out_path; + my $ext; # prepare to ONG frame 0! $frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), 0); %frame_data = read_data_file($frame_data_path); %default = read_data_file(DATA_DEFAULT_PATH()); - %frame_data = merge_settings(\%default, \%frame_data); - $frame_file = sprintf($settings{'frame'}, 0, $frame_data{'ext'}); + $ext = (defined($frame_data{'ext'})) ? + $frame_data{'ext'} : + $default{'ext'}; + + $frame_file = sprintf($settings{'frame'}, 0, $ext); $in_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame_file);; $out_path = join_path(PATH_SEPARATOR(), WWW_PATH(), $frame_file); # set ONG time of frame 0 # NOTE: might get overwritten later if ONG not launched $frame_data{'ongtime'} = $time; + $frame_data{'timer'} = 0; write_data_file($frame_data_path, '', '', \%frame_data); # update the GOTO list with frame 0 @@ -394,7 +389,7 @@ if($method eq 'HEAD') { my $max_page = int(($story_id - FIRSTPAGE_LENGTH - 1) / PAGE_LENGTH) + 1; my $newer_available = ($page > 0); my $older_available = ($page < $max_page); -my $show_intf = ($intf_pass == 1) && ($ong_state == STATE=>{'inactive'}); +my $show_intf = ($intf_pass == 1) && ($ong_state == STATE->{'inactive'}); my $id_start = $story_id-1 -( ($page == 0) ? 0 : ( @@ -632,185 +627,3 @@ print ' '."\n"; print_html_body_end(\*STDOUT); print_html_end(\*STDOUT); - -# sub writeindex { - # (my $indexpath, my $pass, my $mode, my $pause) = @_; - # my $indexfile; - # my $indexof; - - # if(ref($indexpath)) { - # $indexfile=$indexpath; - # unless (seek($indexfile, 0, 0)) { - # return 0; - # } - # } - # else { - # unless (open ($indexfile, ">", $indexpath)) { - # return 0; - # } - # } - - # $indexof = CGI_PATH; - # $indexof =~ s/\/$//g; - - # my %coin = readdatafile(DATA_COIN_PATH); - - # if ($pass != 1) { - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ' '."\n"; - # print $indexfile ' Index of '.$indexof.''."\n"; - # print $indexfile ' '."\n"; - # print $indexfile ' '."\n"; - # print $indexfile '

Index of '.$indexof.'

'."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile '
[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[DIR]2words/'.INTF_DATE.' -  
[DIR]coin/'.COIN_DATE.' - Coincidence

'."\n"; - # print $indexfile '
Apache/2.2.22 (Debian) Server at '.WEBSITE.' Port 80
'."\n"; - # print $indexfile ''."\n"; - # } - # else { - # my %framedata; - # my %nextframedata; - # my %default; - - # %framedata = readdatafile(DATA_PATH.0); - # %nextframedata = readdatafile(DATA_PATH.1); - # %default=readdatafile(DATA_DEFAULT_PATH); - - # # if($mode == 16 && $pause) { - # # $framedata{'ongtime'} = $time; - # # writedatafile(DATA_PATH.0,%framedata); - # # } - - # foreach my $ind (keys %default) { - # unless(defined($framedata{$ind})){ - # $framedata{$ind}=$default{$ind}; - # } - # unless(defined($nextframedata{$ind})){ - # $nextframedata{$ind}=$default{$ind}; - # } - # } - - - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''; - # if($mode == 8 || $mode == 4) { - # print $indexfile 'Index of'; - # } - # elsif($mode == 16) { - # print $indexfile entityencode($settings{'story'}); - # if($pause) { - # print $indexfile ' • '.WEBSITE_NAME; - # } - # } - # else { - # print $indexfile 'Index of '.$indexof; - # } - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile ''."\n"; - # print $indexfile '
'."\n"; - - # print $indexfile '
'."\n"; - - # print $indexfile '
'."\n"; - # print $indexfile '

'; - # if($mode == 8 || $mode == 4) { - # print $indexfile 'Index of'; - # } - # elsif($mode == 16) { - # print $indexfile entityencode($settings{'story'}); - # } - # else { - # print $indexfile 'Index of '.$indexof; - # } - # print $indexfile '

'."\n"; - # print $indexfile '
'."\n"; - - # print $indexfile '
'."\n"; - # print $indexfile '0'."\n"; - - # print $indexfile '
'."\n"; - # print $indexfile '
'."\n"; - # if($mode == 8 || $mode == 4) { - # print $indexfile '[DIR] Parent Directory
[DIR] yyyyb/'."\n"; - # } - # elsif ($mode == 16) { - # if($pause) { - # print $indexfile bb2ht($framedata{'content'})."\n"; - # } - # else { - # print $indexfile "...\n"; - # } - # } - # else { - # print $indexfile '[DIR] Parent Directory
'."\n"; - # print $indexfile '[DIR] 2words/ '.INTF_DATE.' -
'."\n"; - # print $indexfile '[DIR] coin/ '.COIN_DATE.' - '.entityencode($coin{'server'})."\n"; - # } - # print $indexfile '
'."\n"; - - # print $indexfile '
'."\n"; - # if ($mode == 8) { - # print $indexfile '[EE:EE:EE]'."\n"; - # } - # elsif ($mode == 4) { - # print $indexfile '[EE:EE:EE]'."\n"; - # } - # elsif ($mode == 16) { - # if($pause) { - # print $indexfile '[00:00:00]
'."\n"; - # print $indexfile '>'.entityencode($nextframedata{'title'}).''."\n"; - # } - # else { - # print $indexfile '[--:--:--]
'."\n"; - # print $indexfile '>..._'."\n"; - # } - # } - # else { - # } - # print $indexfile '
'."\n"; - - # print $indexfile '
'."\n"; - - # print $indexfile '
'."\n"; - # print $indexfile ''.WEBSITE.''."\n"; - - # print $indexfile ''."\n"; - # } - - # unless (ref($indexpath)) { - # close ($indexfile); - # } - # else { - # truncate ($indexfile , tell($indexfile)); - # } - - # return 1; -# } diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index 1c19400..ee800e5 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -1354,7 +1354,6 @@ sub write_index { $frame_file = 'intf-tr.gif'; $undertext = '...'; $timer = '--'; - $timer_color = 'br'; } elsif ($mode == INTF_STATE->{'<<'}) { $title = 'Index of'; @@ -1362,10 +1361,11 @@ sub write_index { $show_parent_dir = 1; $show_yb = 1; $timer = 'EE'; + $timer_color = 'br'; } elsif ($mode == INTF_STATE->{'>>'}) { $title = 'Index of'; - $frame_file = 'intf-ll.gif'; + $frame_file = 'intf-pp.gif'; $show_parent_dir = 1; $show_yb = 1; $timer = 'EE'; @@ -1396,7 +1396,7 @@ sub write_index { print_html_start($fh); print_html_head_start($fh); - print $fh ' '.$_title.' $bull; '.$_website_name.''."\n"; + print $fh ' '.$_title.' • '.$_website_name.''."\n"; print_html_head_end($fh); print_html_body_start($fh); diff --git a/viewer.1.pl b/viewer.1.pl index 9205be6..7eb559c 100644 --- a/viewer.1.pl +++ b/viewer.1.pl @@ -176,6 +176,8 @@ if (open ($state_file, "+<:encoding(UTF-8)", DATA_STATE_PATH())) { my $frame_file; my $in_path; my $out_path; + my $ext; + my $ong_time = int($settings{'firstongtime'}); %story = read_data_file(DATA_STORY_PATH()); %goto_list = read_data_file(DATA_LIST_PATH); @@ -188,6 +190,7 @@ if (open ($state_file, "+<:encoding(UTF-8)", DATA_STATE_PATH())) { # update ONG time of frame 1 $frame_data{'ongtime'} = $time; + $frame_data{'timer'} = $ong_time; write_data_file($frame_data_path, '', '', \%frame_data); # set initial state @@ -197,15 +200,15 @@ if (open ($state_file, "+<:encoding(UTF-8)", DATA_STATE_PATH())) { $state{'ip2'} = '0.0.0.0'; $state{'ip3'} = ''; $state{'nextong'} = (int($time / 3600) + int($settings{'firstongtime'})) * 3600 ; - $state{'ongtime'} = int($settings{'firstongtime'}); + $state{'ongtime'} = $ong_time; # prepare to ONG frame 1 # determine frame file & paths - unless (defined($frame_data{'ext'})){ - $frame_data{'ext'} = $default{'ext'}; - } - $frame_file = sprintf($settings{'frame'}, $frame, $frame_data{'ext'}); + $ext = (defined($frame_data{'ext'})) ? + $frame_data{'ext'} : + $default{'ext'}; + $frame_file = sprintf($settings{'frame'}, $frame, $ext); $in_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame_file); $out_path = join_path(PATH_SEPARATOR(), WWW_PATH(), $frame_file); -- 2.30.2