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

Url handlers #5059

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion anaconda.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ mkdir %{buildroot}%{_datadir}/anaconda/addons
# Create an empty directory for post-scripts
mkdir %{buildroot}%{_datadir}/anaconda/post-scripts

desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{buildroot}%{_datadir}/applications/anaconda-storage.desktop

%if %{with live}
# required for live installations
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{buildroot}%{_datadir}/applications/liveinst.desktop
Expand Down Expand Up @@ -421,7 +423,7 @@ rm -rf \
%{_bindir}/liveinst
%{_datadir}/polkit-1/actions/*
%{_libexecdir}/liveinst-setup.sh
%{_datadir}/applications/*.desktop
%{_datadir}/applications/liveinst.desktop
%{_datadir}/anaconda/gnome
%{_sysconfdir}/xdg/autostart/*.desktop

Expand All @@ -448,6 +450,7 @@ rm -rf \
%dir %{_datadir}/anaconda/firefox-theme/live/chrome
%{_datadir}/anaconda/firefox-theme/live/user.js
%{_datadir}/anaconda/firefox-theme/live/chrome/userChrome.css
%{_datadir}/applications/anaconda-storage.desktop
%{_libexecdir}/webui-desktop

%files gui
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ AC_CONFIG_FILES([Makefile
data/liveinst/gnome/Makefile
data/systemd/Makefile
data/dbus/Makefile
data/url-handlers/Makefile
data/window-manager/Makefile
data/window-manager/config/Makefile
po/Makefile
Expand Down
2 changes: 1 addition & 1 deletion data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# 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/>.

SUBDIRS = command-stubs liveinst systemd pixmaps window-manager dbus conf.d profile.d
SUBDIRS = command-stubs liveinst systemd pixmaps window-manager dbus conf.d profile.d url-handlers

CLEANFILES = *~

Expand Down
21 changes: 21 additions & 0 deletions data/url-handlers/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# url-handlers/Makefile.am for anaconda
#
# Copyright (C) 2023 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/>.

desktopdir = $(datadir)/applications
dist_desktop_DATA = anaconda-storage.desktop

MAINTAINERCLEANFILES = Makefile.in
6 changes: 6 additions & 0 deletions data/url-handlers/anaconda-storage.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Name=Anaconda Storage
Comment on lines +1 to +2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this appear anywhere visible to the user? I.e. does this need i18n?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, it's NoDisplay=true, shouldn't show up anywhere in the ui

Exec=blivet-gui
Type=Application
MimeType=x-scheme-handler/anaconda-storage;
NoDisplay=true
3 changes: 3 additions & 0 deletions ui/webui/firefox-theme/default/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ user_pref("datareporting.policy.dataSubmissionEnabled", false);
user_pref("toolkit.telemetry.unified", false);
user_pref("trailhead.firstrun.didSeeAboutWelcome", true);

// Allow anaconda-storage url handler
user_pref("network.protocol-handler.external.anaconda-storage", true);

3 changes: 3 additions & 0 deletions ui/webui/firefox-theme/live/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ user_pref("datareporting.policy.dataSubmissionEnabled", false);
user_pref("toolkit.telemetry.unified", false);
user_pref("trailhead.firstrun.didSeeAboutWelcome", true);

// Allow anaconda-storage url handler
user_pref("network.protocol-handler.external.anaconda-storage", true);

8 changes: 7 additions & 1 deletion ui/webui/src/components/storage/InstallationMethod.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,13 @@ const ModifyStorageButton = ({ isBootIso }) => {
}

return (
<Button variant="link" icon={<WrenchIcon />} onClick={() => cockpit.spawn(["blivet-gui"])}>
<Button variant="link" icon={<WrenchIcon />}
onClick={() => {
const onBeforeUnload = window.onbeforeunload;
window.onbeforeunload = null;
window.location.href = "anaconda-storage:";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it have the correct address afterwards?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not redirecting away from anaconda if that's what you mean. It's akin to having a "mailto:" link in a web page. it just fires up the email client^W^Wblivet

window.onbeforeunload = onBeforeUnload;
}}>
{_("Modify storage")}
</Button>
);
Expand Down
Loading