]> bicyclesonthemoon.info Git - ott/bsta/commitdiff
improve GOTO handling
authorb <rowerynaksiezycu@gmail.com>
Mon, 12 Feb 2024 23:15:11 +0000 (23:15 +0000)
committerb <rowerynaksiezycu@gmail.com>
Mon, 12 Feb 2024 23:15:11 +0000 (23:15 +0000)
bsta_lib.1.pm
viewer.1.pl

index 7545a90440d9e89b3cd94603a63f1ae2c2189fcc..8add7fab9d0cd622bf5854fe0f95d0bbf6e11de4 100644 (file)
@@ -1177,7 +1177,10 @@ sub print_viewer_page {
                merge_url(
                        {'path' => $viewer_url},
                        {
-                               'query' => {'g' => 1},
+                               'query' => {
+                                       'g' => 1,
+                                       'b' => $text_mode
+                               },
                                'fragment' => 'goto'
                        }
                );
@@ -1498,8 +1501,8 @@ sub print_viewer_page {
        print $fh '<a href="'.$_goto_url.'">GOTO</a>'."\n";
        print $fh '     <span style="float: right;">'."\n      ";
        if (
-               ($text_mode == TEXT_MODE->{'normal'}) &&
-               (!$goto)
+               ($text_mode == TEXT_MODE->{'normal'})
+               # && (!$goto)
        ){
                if ($show_words) {
                        print $fh '<a href="'.$_words_url.'">'.$words_link_text.'</a> | ';
index c7d74d9d4edb1401940671026c30cab5fe9a085f..338eb875d46bcc8420214b172167d35b870ef9df 100644 (file)
@@ -52,6 +52,7 @@ use bsta_lib (
 ###PERL_PATH_SEPARATOR:     PATH_SEPARATOR     = /
 
 ###PERL_CGI_PATH:           CGI_PATH           = /bsta/
+###PERL_CGI_GOTO_PATH:      CGI_GOTO_PATH      = /bsta/g
 ###PERL_CGI_VIEWER_PATH:    CGI_VIEWER_PATH    = /bsta/v
 
 ###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
@@ -121,6 +122,16 @@ if ($method eq 'POST') {
                exit fail_content_type($method, $http{'content-type'});
        }
 }
+
+if (
+       (defined $cgi{'f'}) &&
+       ($cgi{'f'} eq '') &&
+       ($cgi{'g'} ne '')
+) { # GOTO with no value
+       exit redirect($method, CGI_GOTO_PATH(), HTTP_STATUS->{'see_other'});
+}
+
+
 $no_cgi = (scalar (keys %cgi) == 0);
 
 $IP = get_remote_addr();