Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE REQUEST: Support local file URLs in IBM Notifier’s Help Button #256

Open
owainri opened this issue Nov 15, 2024 · 0 comments
Open
Labels
enhancement New feature or request
Milestone

Comments

@owainri
Copy link

owainri commented Nov 15, 2024

Is your feature request related to a problem? Please describe.
I was trying to configure the Help button in IBM Notifier to link to a local file, so users could quickly access a PDF version of a Confluence Super help guide - negating the risk of needing to re-authenticate. In cases where a session (like Okta) has timed out, users might be discouraged from engaging with resources if they’re prompted to log in again just to view a document.

To avoid this, I packaged a PDF version of the documentation and configured the Help button to open it directly from a local path. However, I found that Super currently doesn't support file:// URLs, so IBM Notifier couldn’t open local files as intended and just displayed the file path as text.

Proposed solution.
I modified the set_display_strings_optional_buttons function to recognise file:// URLs, allowing IBM Notifier’s Help button to open local files directly without requiring an external network connection or authentication. This small adjustment makes it easier to link to local resources like PDFs, reducing disruptions for end-users.

Additional context
Here’s the modified code snippet that adds file:// support:

if [[ -n "${display_help_button_string}" ]]; then
	if [[ $(echo "${display_help_button_string}" | grep -c '^http://\|^https://\|^mailto:\|^jamfselfservice://\|^file://') -gt 0 ]]; then
		if [[ $(echo "${display_help_button_string}" | grep -c '^file://') -gt 0 ]]; then
			ibm_notifier_array+=(-help_button_cta_type link -help_button_cta_payload "${display_help_button_string}")
		elif [[ $(echo "${display_help_button_string_option}" | grep -c '^http://\|^https://') -gt 0 ]]; then
			curl_response=$(curl -Is "${display_help_button_string_option}" | head -1)
			[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: curl_response is: ${curl_response}"
			if [[ $(echo "${curl_response}" | grep -c '200') -gt 0 ]] || [[ $(echo "${curl_response}" | grep -c '302') -gt 0 ]]; then
				ibm_notifier_array+=(-help_button_cta_type link -help_button_cta_payload "${display_help_button_string}")
			else
				log_super "Warning: Help button not shown because URL is unreachable: ${display_help_button_string}"
			fi
		else
			ibm_notifier_array+=(-help_button_cta_type link -help_button_cta_payload "${display_help_button_string}")
		fi
	else
		ibm_notifier_array+=(-help_button_cta_type infopopup -help_button_cta_payload "${display_help_button_string}")
	fi
fi
@Macjutsu Macjutsu added the enhancement New feature or request label Nov 15, 2024
@Macjutsu Macjutsu added this to the v5.x.x milestone Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants