Skip to content

Commit

Permalink
Fix to change how on load errors are handled
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Jan 18, 2023
1 parent 36f74e8 commit cd53e6a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
7 changes: 4 additions & 3 deletions authentic-init.pl
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,10 @@ sub embed_favicon
$manifest_contents =~ s/\%desc\%/$manifest_desc/;
$manifest_contents =~ s/\%prod\%/$product_name/g;
$manifest_contents =~ s/\%color\%/$theme_user_color/;
$main::ignore_errors = 1;
write_file_contents("$theme_config_dir/manifest-$product_name.json", $manifest_contents) if (-w $theme_config_dir);
$main::ignore_errors = 0;
eval {
$main::error_must_die = 1;
write_file_contents("$theme_config_dir/manifest-$product_name.json", $manifest_contents) if (-w $theme_config_dir);
};

print ' <script src="' . $theme_webprefix . '/service-worker.js" defer></script>' . "\n";
print ' <link ' . $ref_link . ' crossorigin="use-credentials" rel="manifest" href="' .
Expand Down
26 changes: 15 additions & 11 deletions authentic.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,8 @@ sub theme_ui_alert_box
} elsif ($class eq "danger") {
$type = 'alert-danger', $tmsg = ($theme_text{'theme_xhred_global_error'} . '!'), $fa = 'fa-bolt';
} elsif ($class eq "danger-fatal") {
$type = 'alert-danger-fatal', $tmsg = ($theme_text{'theme_xhred_global_error_fatal'} . '!'), $fa = 'fa-exclamation-triangle';
$type = 'alert-danger-fatal', $tmsg = ($theme_text{'theme_xhred_global_error_fatal'} . '!'),
$fa = 'fa-exclamation-triangle';
}

my $tmsg_space = " ";
Expand Down Expand Up @@ -1333,18 +1334,20 @@ sub theme_redirect
print "Location: $arg1\n\n";
return;
} elsif (string_contains($arg1, '../')) {
$main::ignore_errors = 1;
set_theme_temp_data('redirected', $arg1) if ($arg1 !~ /switch\.cgi/);
$main::ignore_errors = 0;
eval {
$main::error_must_die = 1;
set_theme_temp_data('redirected', $arg1) if ($arg1 !~ /switch\.cgi/);
};
print "Location: $arg1\n\n";
return;
}

if (!theme_redirect_download($url)) {
$main::ignore_errors = 1;
set_theme_temp_data('redirected', $url)
if (!theme_set_redirect_forbidden($url));
$main::ignore_errors = 0;
eval {
$main::error_must_die = 1;
set_theme_temp_data('redirected', $url)
if (!theme_set_redirect_forbidden($url));
};
print "Location: $url\n\n";
}
}
Expand Down Expand Up @@ -1508,10 +1511,11 @@ sub theme_ui_text_color
return "<span class=\"ui_text_color text_type_$type text-$type\">$text</span>\n";
}

sub theme_error {
my $error_what = ($main::whatfailed ? "$main::whatfailed : " : "");
sub theme_error
{
my $error_what = ($main::whatfailed ? "$main::whatfailed : " : "");
my $error_message = join(", ", @_);
my $error = html_escape(html_strip(($error_what . $error_message)));
my $error = html_escape(html_strip(($error_what . $error_message)));
print ui_alert_box("<tt class='font-size-90pf'>$error</tt>", 'danger-fatal', undef, 1);
}

Expand Down

0 comments on commit cd53e6a

Please sign in to comment.