quine-linux/installer/anaconda-webui/vendor/browser-ext

41 lines
1.5 KiB
Text
Raw Normal View History

#!/bin/bash
#
# Copyright (C) 2025 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This should be eventually get shared across projects:
# https://issues.redhat.com/browse/INSTALLER-3755
# Get the default browser for the 'https' protocol
DEFAULT_BROWSER=$(xdg-mime query default x-scheme-handler/https)
URL="${1/extlink/https}"
# If Firefox is the default browser, use the custom profile
if [[ "$DEFAULT_BROWSER" == "org.mozilla.firefox.desktop" ]]; then
# Create a temporary Firefox profile
PROFILE_DIR="/tmp/anaconda-extlink-firefox-profile"
mkdir -p "$PROFILE_DIR"
# Copy the custom user.js for the Firefox settings
cp /usr/share/anaconda/firefox-theme/extlink/user.js "$PROFILE_DIR/"
# Launch Firefox with the custom profile
/usr/bin/firefox --profile "$PROFILE_DIR" --no-remote "$URL"
else
# For any other browser, use xdg-open
xdg-open "$URL"
fi