From 24f0c9c42d98965f99b5e9eec8e2988e0fda80a5 Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 2 Oct 2018 23:07:15 -0400 Subject: [PATCH 1/3] enabled the --i2p flag. --- usr/lib/open_link_confirmation | 51 ++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/usr/lib/open_link_confirmation b/usr/lib/open_link_confirmation index 335942c..07b668b 100755 --- a/usr/lib/open_link_confirmation +++ b/usr/lib/open_link_confirmation @@ -28,10 +28,54 @@ source_config() { done } +parse_cmd_options() { + ## Thanks to: + ## http://mywiki.wooledge.org/BashFAQ/035 + + while : + do + case $1 in + --i2p) + tb_using_i2p="--i2p" + tb_title="i2p Browser" + shift + ;; + --) + shift + break + ;; + *) + break + ;; + esac + done + + ## If there are input files (for example) that follow the options, they + ## will remain in the "$@" positional parameters. + + local other_args + other_args="$@" + if [ "$other_args" = "" ]; then + have_other_args="false" + if [ "$LINK" = "" ]; then + LINK="$DEFAULT_LINK" + if [ "$open_link_confirmation_maybe_skip" = "true" ]; then + open_link_confirmation_skip="true" + fi + fi + else + have_other_args="true" + tor_other_args="$@" + echo "$tor_other_args" + fi +} + preparation() { ## Used by tb-starter. export OPEN_LINK_CONFIRMATION="true" + [ -n "$tb_title" ] || tb_title="Tor Browser" + if [ "$#" = "0" ]; then ## Zero arguments. is_file="0" @@ -106,7 +150,7 @@ gateway() { title="Link Confirm Open ERROR" msg="

Link Confirm Open does not support opening links on Gateway for security reasons.

-

Use Tor Browser under Workstation to browse the internet.

" +

Use $tb_title under Workstation to browse the internet.

" question="" button="ok" /usr/lib/msgcollector/generic_gui_message "error" "$title" "$msg" "$question" "$button" @@ -140,7 +184,7 @@ qubes_redirect() {

$input_object_stripped_and_trimmed$extra_long_link

Please copy the link to the Workstation and open it there.

-

Use Tor Browser under Workstation to browse the internet.

+

Use $tb_title under Workstation to browse the internet.

Debugging information:

link_confirmation_vm_open_tool: $link_confirmation_vm_open_tool @@ -173,7 +217,7 @@ workstation() { ## Prettier name in default case. if [ "$open_in_tool_bin_name" = "x-www-browser (/usr/bin/torbrowser)" ]; then - open_in_tool_bin_name="Tor Browser" + open_in_tool_bin_name="$tb_title" fi fi @@ -271,6 +315,7 @@ final() { main_function() { source_config "$@" + parse_cmd_options "$@" preparation "$@" if [ -f "/var/run/qubes/this-is-templatevm" ]; then From 016cb959bbf510c70cdba33024d447e0eb98c7d2 Mon Sep 17 00:00:00 2001 From: idk Date: Thu, 4 Oct 2018 13:29:05 -0400 Subject: [PATCH 2/3] label non-Tor browsers --- usr/lib/open_link_confirmation | 51 ++++------------------------------ 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/usr/lib/open_link_confirmation b/usr/lib/open_link_confirmation index 07b668b..76b0b96 100755 --- a/usr/lib/open_link_confirmation +++ b/usr/lib/open_link_confirmation @@ -28,54 +28,10 @@ source_config() { done } -parse_cmd_options() { - ## Thanks to: - ## http://mywiki.wooledge.org/BashFAQ/035 - - while : - do - case $1 in - --i2p) - tb_using_i2p="--i2p" - tb_title="i2p Browser" - shift - ;; - --) - shift - break - ;; - *) - break - ;; - esac - done - - ## If there are input files (for example) that follow the options, they - ## will remain in the "$@" positional parameters. - - local other_args - other_args="$@" - if [ "$other_args" = "" ]; then - have_other_args="false" - if [ "$LINK" = "" ]; then - LINK="$DEFAULT_LINK" - if [ "$open_link_confirmation_maybe_skip" = "true" ]; then - open_link_confirmation_skip="true" - fi - fi - else - have_other_args="true" - tor_other_args="$@" - echo "$tor_other_args" - fi -} - preparation() { ## Used by tb-starter. export OPEN_LINK_CONFIRMATION="true" - [ -n "$tb_title" ] || tb_title="Tor Browser" - if [ "$#" = "0" ]; then ## Zero arguments. is_file="0" @@ -217,7 +173,11 @@ workstation() { ## Prettier name in default case. if [ "$open_in_tool_bin_name" = "x-www-browser (/usr/bin/torbrowser)" ]; then - open_in_tool_bin_name="$tb_title" + if [ "$tb_using_i2p" = "--i2p" ]; then + open_in_tool_bin_name="$tb_title" + else + open_in_tool_bin_name="Tor Browser" + fi fi fi @@ -315,7 +275,6 @@ final() { main_function() { source_config "$@" - parse_cmd_options "$@" preparation "$@" if [ -f "/var/run/qubes/this-is-templatevm" ]; then From 128bf0b0140a1689892c3541b0a0b927fe8a6582 Mon Sep 17 00:00:00 2001 From: idk Date: Mon, 8 Oct 2018 01:10:19 -0400 Subject: [PATCH 3/3] That's... not really a fallback anymore, but it should always work. --- usr/lib/open_link_confirmation | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/usr/lib/open_link_confirmation b/usr/lib/open_link_confirmation index 76b0b96..69eaeb6 100755 --- a/usr/lib/open_link_confirmation +++ b/usr/lib/open_link_confirmation @@ -173,15 +173,12 @@ workstation() { ## Prettier name in default case. if [ "$open_in_tool_bin_name" = "x-www-browser (/usr/bin/torbrowser)" ]; then - if [ "$tb_using_i2p" = "--i2p" ]; then - open_in_tool_bin_name="$tb_title" - else - open_in_tool_bin_name="Tor Browser" - fi + open_in_tool_bin_name="Tor Browser" fi fi ## Fallback. + [ ! -n "$tb_title" ] || open_in_tool_bin_name="$tb_title" [ -n "$open_in_tool_bin_name" ] || open_in_tool_bin_name="$open_in_tool_bin" if [ "$open_in_tool_bin_name_readlink" = "$BASH_SOURCE" ]; then