Add Repo remove
This commit is contained in:
parent
0eed5f9fb7
commit
51250c37ad
4
Makefile
4
Makefile
@ -15,7 +15,7 @@ install:
|
||||
cp -vf target/release/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf target/release/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf data/wget.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf data/move_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf data/modify_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
|
||||
#cp -vf data/com.github.pikaos-linux.pikagnomelayouts.desktop $(DESTDIR)/usr/share/applications/
|
||||
#cp -vfr data/polkit-1 $(DESTDIR)/usr/share/
|
||||
@ -32,7 +32,7 @@ install_no_build_debug:
|
||||
cp -vf target/debug/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf target/debug/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf data/wget.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf data/move_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf data/modify_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||
cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
|
||||
#cp -vf data/com.github.pikaos-linux.pikagnomelayouts.desktop $(DESTDIR)/usr/share/applications/
|
||||
#cp -vfr data/polkit-1 $(DESTDIR)/usr/share/
|
||||
|
15
data/modify_repo.sh
Normal file
15
data/modify_repo.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#! /bin/bash
|
||||
if [[ "$1" == "deb822_move" ]]
|
||||
then
|
||||
mv -vf "/tmp/"$2".sources" "/etc/apt/sources.list.d/"$2".sources"
|
||||
elif [[ "$1" == "legacy_move" ]]
|
||||
then
|
||||
mv -vf "/tmp/"$2".list" "/etc/apt/sources.list.d/"$2".list"
|
||||
elif [[ "$1" == "delete_deb822" ]]
|
||||
then
|
||||
rm -rvf $2
|
||||
rm -rvf $3
|
||||
elif [[ "$1" == "delete_legacy" ]]
|
||||
then
|
||||
rm -rvf $2
|
||||
fi
|
@ -1,7 +0,0 @@
|
||||
#! /bin/bash
|
||||
if [[ "$1" == "deb822" ]]
|
||||
then
|
||||
mv -vf "/tmp/"$2".sources" "/etc/apt/sources.list.d/"$2".sources"
|
||||
else
|
||||
mv -vf "/tmp/"$2".list" "/etc/apt/sources.list.d/"$2".list"
|
||||
fi
|
@ -89,6 +89,9 @@
|
||||
"system_mirror_label0_label": "System Repository Mirror",
|
||||
"system_mirror_label1_label": "The Default URI/Mirror Used by the Base PikaOS System APT Repositories\n(Nest, Cockatiel, Canary, Pigeon, Parrot, Raven)",
|
||||
"unofficial_sources_label": "Un-Official APT Sources",
|
||||
"unofficial_source_add_button_tooltip_text": "Add a New Source",
|
||||
"unofficial_source_edit_button_tooltip_text": "Edit Selected Source",
|
||||
"unofficial_source_remove_button_tooltip_text": "Remove Selected Source",
|
||||
"unofficial_sources_label1_label": "Un-Official Custom APT Sources Added by The User or Some User Run Script\nThese Sources May Result in ABI/Dep Hell or Security Risks, and Thus Making a \"package-request\" is Recommended Over These Sources",
|
||||
"unofficial_sources_columnview_col0_title": "Apt Repository",
|
||||
"unofficial_sources_columnview_col1_title": "Enabled",
|
||||
@ -110,5 +113,9 @@
|
||||
"unofficial_source_signed_file_checkbutton_label": "Signed By File",
|
||||
"unofficial_source_signed_url_checkbutton_label": "Signed By URL",
|
||||
"key_download_error_dialog_heading": "GPG Download Error",
|
||||
"key_download_error_dialog_ok_label": "OK"
|
||||
"key_download_error_dialog_ok_label": "OK",
|
||||
"apt_src_remove_warning_dialog_heading": "Are You Sure?",
|
||||
"apt_src_remove_warning_dialog_body": "The Repositoy Will Be Deleted, And Any Packages Downloaded From It Might Get Overwritten",
|
||||
"apt_src_remove_warning_dialog_cancel_label": "Cancel",
|
||||
"apt_src_remove_warning_dialog_ok_label": "OK"
|
||||
}
|
401
src/bin/gui/apt_manage_page/add_dialog.rs
Normal file
401
src/bin/gui/apt_manage_page/add_dialog.rs
Normal file
@ -0,0 +1,401 @@
|
||||
use crate::apt_package_row::AptPackageRow;
|
||||
use adw::gio::SimpleAction;
|
||||
use adw::prelude::*;
|
||||
use apt_deb822_tools::Deb822Repository;
|
||||
use regex::Regex;
|
||||
use gtk::glib::{property::PropertyGet, clone, BoxedAnyObject};
|
||||
use gtk::*;
|
||||
use std::cell::Ref;
|
||||
use std::ops::Deref;
|
||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
||||
use rust_apt::cache::*;
|
||||
use rust_apt::new_cache;
|
||||
use rust_apt::records::RecordField;
|
||||
use std::cell::RefCell;
|
||||
use std::process::Command;
|
||||
use std::rc::Rc;
|
||||
use std::thread;
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
pub fn add_dialog_fn(window: adw::ApplicationWindow) {
|
||||
let unofficial_source_add_dialog_child_box = Box::builder()
|
||||
.hexpand(true)
|
||||
.orientation(Orientation::Vertical)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_name_entry = gtk::Entry::builder()
|
||||
.placeholder_text("WineHQ Debian")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_name_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_name_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_name_prefrencesgroup.add(&unofficial_source_add_name_entry);
|
||||
|
||||
let unofficial_source_add_uri_entry = gtk::Entry::builder()
|
||||
.placeholder_text("https://dl.winehq.org/wine-builds/debian")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_uri_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_uri_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_uri_prefrencesgroup.add(&unofficial_source_add_uri_entry);
|
||||
|
||||
let unofficial_source_add_suites_entry = gtk::Entry::builder()
|
||||
.placeholder_text("trixie bookworm sid")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_suites_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_suites_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_suites_prefrencesgroup.add(&unofficial_source_add_suites_entry);
|
||||
|
||||
let unofficial_source_add_components_entry = gtk::Entry::builder()
|
||||
.placeholder_text("main proprietary")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_components_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_components_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_components_prefrencesgroup.add(&unofficial_source_add_components_entry);
|
||||
|
||||
let unofficial_source_add_signed_entry = gtk::Entry::builder()
|
||||
.sensitive(false)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_signed_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_signed_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_signed_prefrencesgroup.add(&unofficial_source_add_signed_entry);
|
||||
|
||||
let unofficial_source_add_archs_entry = gtk::Entry::builder()
|
||||
.placeholder_text("amd64 arm64 i386")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_archs_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_archs_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_archs_prefrencesgroup.add(&unofficial_source_add_archs_entry);
|
||||
|
||||
let unofficial_source_add_box2 = gtk::Box::builder()
|
||||
.margin_top(10)
|
||||
.orientation(Orientation::Horizontal)
|
||||
.hexpand(true)
|
||||
.spacing(5)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_is_source_label = gtk::Label::builder()
|
||||
.label(t!("unofficial_source_add_is_source_label_label"))
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_is_source_switch = gtk::Switch::builder()
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.build();
|
||||
|
||||
let unofficial_source_signed_keyring_checkbutton = gtk::CheckButton::builder()
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.label(t!("unofficial_source_signed_keyring_checkbutton_label"))
|
||||
.active(true)
|
||||
.build();
|
||||
|
||||
let unofficial_source_signed_file_checkbutton = gtk::CheckButton::builder()
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.label(t!("unofficial_source_signed_file_checkbutton_label"))
|
||||
.group(&unofficial_source_signed_keyring_checkbutton)
|
||||
.build();
|
||||
|
||||
let unofficial_source_signed_url_checkbutton = gtk::CheckButton::builder()
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.label(t!("unofficial_source_signed_url_checkbutton_label"))
|
||||
.group(&unofficial_source_signed_keyring_checkbutton)
|
||||
.build();
|
||||
|
||||
//
|
||||
let unofficial_source_add_dialog_child_clamp = adw::Clamp::builder()
|
||||
.child(&unofficial_source_add_dialog_child_box)
|
||||
.maximum_size(500)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_viewport = gtk::ScrolledWindow::builder()
|
||||
.hexpand(true)
|
||||
.vexpand(true)
|
||||
.child(&unofficial_source_add_dialog_child_clamp)
|
||||
.hscrollbar_policy(PolicyType::Never)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_dialog = adw::MessageDialog::builder()
|
||||
.transient_for(&window)
|
||||
.extra_child(&unofficial_source_add_viewport)
|
||||
.heading(t!("unofficial_source_add_dialog_heading"))
|
||||
.width_request(700)
|
||||
.height_request(500)
|
||||
.build();
|
||||
|
||||
unofficial_source_add_dialog.add_response(
|
||||
"unofficial_source_add_dialog_add",
|
||||
&t!("unofficial_source_add_dialog_add_label").to_string(),
|
||||
);
|
||||
|
||||
unofficial_source_add_dialog.add_response(
|
||||
"unofficial_source_add_dialog_cancel",
|
||||
&t!("unofficial_source_add_dialog_cancel_label").to_string(),
|
||||
);
|
||||
|
||||
unofficial_source_add_dialog.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||
|
||||
unofficial_source_add_dialog.set_response_appearance(
|
||||
"unofficial_source_add_dialog_add",
|
||||
adw::ResponseAppearance::Suggested,
|
||||
);
|
||||
|
||||
unofficial_source_add_dialog.set_response_appearance(
|
||||
"unofficial_source_add_dialog_cancel",
|
||||
adw::ResponseAppearance::Destructive,
|
||||
);
|
||||
|
||||
//
|
||||
|
||||
let unofficial_source_add_dialog_clone0 = unofficial_source_add_dialog.clone();
|
||||
let unofficial_source_add_name_entry_clone0 = unofficial_source_add_name_entry.clone();
|
||||
let unofficial_source_add_uri_entry_clone0 = unofficial_source_add_uri_entry.clone();
|
||||
let unofficial_source_add_suites_entry_clone0 = unofficial_source_add_suites_entry.clone();
|
||||
let unofficial_source_add_components_entry_clone0 = unofficial_source_add_components_entry.clone();
|
||||
let unofficial_source_add_signed_entry_clone0 = unofficial_source_add_signed_entry.clone();
|
||||
let unofficial_source_signed_keyring_checkbutton_clone0 = unofficial_source_signed_keyring_checkbutton.clone();
|
||||
|
||||
let add_button_update_state = move || {
|
||||
if
|
||||
!unofficial_source_add_name_entry_clone0.text().is_empty() &&
|
||||
!unofficial_source_add_uri_entry_clone0.text().is_empty() &&
|
||||
!unofficial_source_add_suites_entry_clone0.text().is_empty() &&
|
||||
!unofficial_source_add_components_entry_clone0.text().is_empty()
|
||||
{
|
||||
if unofficial_source_signed_keyring_checkbutton_clone0.is_active() {
|
||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||
} else if !unofficial_source_add_signed_entry_clone0.text().is_empty() {
|
||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||
} else {
|
||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||
}
|
||||
} else {
|
||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
for entry in [
|
||||
&unofficial_source_add_name_entry,
|
||||
&unofficial_source_add_uri_entry,
|
||||
&unofficial_source_add_suites_entry,
|
||||
&unofficial_source_add_components_entry,
|
||||
&unofficial_source_add_signed_entry,
|
||||
] {
|
||||
entry.connect_text_notify(clone!(
|
||||
#[strong]
|
||||
add_button_update_state,
|
||||
move |_|
|
||||
{
|
||||
add_button_update_state();
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
unofficial_source_signed_keyring_checkbutton.connect_toggled(clone!(
|
||||
#[weak]
|
||||
unofficial_source_add_signed_entry,
|
||||
#[strong]
|
||||
add_button_update_state,
|
||||
move |checkbutton|
|
||||
{
|
||||
if checkbutton.is_active() {
|
||||
unofficial_source_add_signed_entry.set_sensitive(false);
|
||||
unofficial_source_add_signed_entry.set_placeholder_text(Some(""));
|
||||
add_button_update_state();
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
unofficial_source_signed_file_checkbutton.connect_toggled(clone!(
|
||||
#[weak]
|
||||
unofficial_source_add_signed_entry,
|
||||
#[strong]
|
||||
add_button_update_state,
|
||||
move |checkbutton|
|
||||
{
|
||||
if checkbutton.is_active() {
|
||||
unofficial_source_add_signed_entry.set_sensitive(true);
|
||||
unofficial_source_add_signed_entry.set_placeholder_text(Some("/etc/apt/keyrings/winehq-archive.key"));
|
||||
add_button_update_state();
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
unofficial_source_signed_url_checkbutton.connect_toggled(clone!(
|
||||
#[weak]
|
||||
unofficial_source_add_signed_entry,
|
||||
#[strong]
|
||||
add_button_update_state,
|
||||
move |checkbutton|
|
||||
{
|
||||
if checkbutton.is_active() {
|
||||
unofficial_source_add_signed_entry.set_sensitive(true);
|
||||
unofficial_source_add_signed_entry.set_placeholder_text(Some("https://dl.winehq.org/wine-builds/winehq.key"));
|
||||
add_button_update_state();
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
unofficial_source_add_box2.append(&unofficial_source_add_is_source_label);
|
||||
unofficial_source_add_box2.append(&unofficial_source_add_is_source_switch);
|
||||
unofficial_source_add_box2.append(&unofficial_source_signed_keyring_checkbutton);
|
||||
unofficial_source_add_box2.append(&unofficial_source_signed_file_checkbutton);
|
||||
unofficial_source_add_box2.append(&unofficial_source_signed_url_checkbutton);
|
||||
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_name_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_uri_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_suites_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_components_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_archs_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_box2);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_signed_prefrencesgroup);
|
||||
|
||||
unofficial_source_add_dialog.clone()
|
||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
match choice.as_str() {
|
||||
"unofficial_source_add_dialog_add" => {
|
||||
println!("add");
|
||||
let non_alphanum_regex = Regex::new(r"[^a-zA-Z0-9]").unwrap();
|
||||
let sign_method = if unofficial_source_signed_file_checkbutton.is_active() {
|
||||
1
|
||||
} else if unofficial_source_signed_url_checkbutton.is_active() {
|
||||
2
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let repo_file_name = non_alphanum_regex.replace_all(unofficial_source_add_name_entry.text().as_str(), "_").to_string().to_lowercase();
|
||||
let new_repo = Deb822Repository {
|
||||
repolib_name: Some(unofficial_source_add_name_entry.text().to_string()),
|
||||
filepath: format!("/etc/apt/sources.list.d/{}.source", repo_file_name),
|
||||
uris: Some(unofficial_source_add_uri_entry.text().to_string()),
|
||||
types: if unofficial_source_add_is_source_switch.is_active() {
|
||||
Some("deb deb-src".to_string())
|
||||
} else {
|
||||
Some("deb".to_string())
|
||||
},
|
||||
suites: Some(unofficial_source_add_suites_entry.text().to_string()),
|
||||
components: Some(unofficial_source_add_components_entry.text().to_string()),
|
||||
architectures: if unofficial_source_add_archs_entry.text().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(unofficial_source_add_archs_entry.text().to_string())
|
||||
},
|
||||
signed_by: match sign_method {
|
||||
1 => Some(unofficial_source_add_signed_entry.text().to_string()),
|
||||
2 => Some(format!("/etc/apt/keyrings/{}.gpg.key", repo_file_name)),
|
||||
_ => None
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
if sign_method == 2 {
|
||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/wget.sh", &unofficial_source_add_signed_entry.text().to_string(), &format!("/etc/apt/keyrings/{}.gpg.key", repo_file_name)).run() {
|
||||
Ok(_) => {
|
||||
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
|
||||
Ok(_) => {
|
||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "deb822_move", repo_file_name).run() {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
apt_src_create_error_dialog.add_response(
|
||||
"apt_src_create_error_dialog_ok",
|
||||
&t!("apt_src_create_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
apt_src_create_error_dialog.add_response(
|
||||
"apt_src_create_error_dialog_ok",
|
||||
&t!("apt_src_create_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let key_download_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("key_download_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
key_download_error_dialog.add_response(
|
||||
"key_download_error_dialog_ok",
|
||||
&t!("key_download_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
key_download_error_dialog.present();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
|
||||
Ok(_) => {
|
||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "deb822_move", repo_file_name).run() {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
apt_src_create_error_dialog.add_response(
|
||||
"apt_src_create_error_dialog_ok",
|
||||
&t!("apt_src_create_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
apt_src_create_error_dialog.add_response(
|
||||
"apt_src_create_error_dialog_ok",
|
||||
&t!("apt_src_create_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"apt_update_dialog_ignore" => {
|
||||
unofficial_source_add_dialog.close();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
use crate::apt_package_row::AptPackageRow;
|
||||
use add_dialog::add_dialog_fn;
|
||||
use adw::gio::SimpleAction;
|
||||
use adw::prelude::*;
|
||||
use apt_deb822_tools::Deb822Repository;
|
||||
@ -17,6 +18,8 @@ use std::rc::Rc;
|
||||
use std::thread;
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
mod add_dialog;
|
||||
|
||||
|
||||
pub fn apt_manage_page(
|
||||
window: adw::ApplicationWindow,
|
||||
@ -259,12 +262,12 @@ pub fn apt_manage_page(
|
||||
|
||||
//
|
||||
|
||||
unofficial_sources_selection_model.connect_selected_item_notify(|selection| {
|
||||
//let selection = selection.selected_item().unwrap();
|
||||
//let entry = selection.downcast_ref::<BoxedAnyObject>().unwrap();
|
||||
//let r: Ref<AptSourceConfig> = entry.borrow();
|
||||
//println!("{}", r.col2.to_string())
|
||||
});
|
||||
/*unofficial_sources_selection_model.connect_selected_item_notify(|selection| {
|
||||
let selection = selection.selected_item().unwrap();
|
||||
let entry = selection.downcast_ref::<BoxedAnyObject>().unwrap();
|
||||
let r: Ref<AptSourceConfig> = entry.borrow();
|
||||
println!("{}", r.col2.to_string())
|
||||
});*/
|
||||
unofficial_sources_columnview.append_column(&unofficial_sources_columnview_col0);
|
||||
unofficial_sources_columnview.append_column(&unofficial_sources_columnview_col1);
|
||||
|
||||
@ -299,14 +302,21 @@ pub fn apt_manage_page(
|
||||
|
||||
let unofficial_source_edit_button = Button::builder()
|
||||
.icon_name("document-edit-symbolic")
|
||||
.tooltip_text(t!("unofficial_source_edit_button"))
|
||||
.tooltip_text(t!("unofficial_source_edit_button_tooltip_text"))
|
||||
//.halign(Align::End)
|
||||
.valign(Align::End)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_button = Button::builder()
|
||||
.icon_name("list-add-symbolic")
|
||||
.tooltip_text(t!("unofficial_source_add_button"))
|
||||
.tooltip_text(t!("unofficial_source_add_button_tooltip_text"))
|
||||
//.halign(Align::End)
|
||||
.valign(Align::End)
|
||||
.build();
|
||||
|
||||
let unofficial_source_remove_button = Button::builder()
|
||||
.icon_name("edit-delete-symbolic")
|
||||
.tooltip_text(t!("unofficial_source_remove_button_tooltip_text"))
|
||||
//.halign(Align::End)
|
||||
.valign(Align::End)
|
||||
.build();
|
||||
@ -317,386 +327,52 @@ pub fn apt_manage_page(
|
||||
move
|
||||
|_|
|
||||
{
|
||||
let unofficial_source_add_dialog_child_box = Box::builder()
|
||||
.hexpand(true)
|
||||
.orientation(Orientation::Vertical)
|
||||
.build();
|
||||
add_dialog_fn(window.clone());
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
let unofficial_source_add_name_entry = gtk::Entry::builder()
|
||||
.placeholder_text("WineHQ Debian")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_name_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_name_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_name_prefrencesgroup.add(&unofficial_source_add_name_entry);
|
||||
|
||||
let unofficial_source_add_uri_entry = gtk::Entry::builder()
|
||||
.placeholder_text("https://dl.winehq.org/wine-builds/debian")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_uri_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_uri_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_uri_prefrencesgroup.add(&unofficial_source_add_uri_entry);
|
||||
|
||||
let unofficial_source_add_suites_entry = gtk::Entry::builder()
|
||||
.placeholder_text("trixie bookworm sid")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_suites_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_suites_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_suites_prefrencesgroup.add(&unofficial_source_add_suites_entry);
|
||||
|
||||
let unofficial_source_add_components_entry = gtk::Entry::builder()
|
||||
.placeholder_text("main proprietary")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_components_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_components_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_components_prefrencesgroup.add(&unofficial_source_add_components_entry);
|
||||
|
||||
let unofficial_source_add_signed_entry = gtk::Entry::builder()
|
||||
.sensitive(false)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_signed_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_signed_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_signed_prefrencesgroup.add(&unofficial_source_add_signed_entry);
|
||||
|
||||
let unofficial_source_add_archs_entry = gtk::Entry::builder()
|
||||
.placeholder_text("amd64 arm64 i386")
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_archs_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||
.title(t!("unofficial_source_add_archs_prefrencesgroup_title"))
|
||||
.build();
|
||||
|
||||
unofficial_source_add_archs_prefrencesgroup.add(&unofficial_source_add_archs_entry);
|
||||
|
||||
let unofficial_source_add_box2 = gtk::Box::builder()
|
||||
.margin_top(10)
|
||||
.orientation(Orientation::Horizontal)
|
||||
.hexpand(true)
|
||||
.spacing(5)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_is_source_label = gtk::Label::builder()
|
||||
.label(t!("unofficial_source_add_is_source_label_label"))
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_is_source_switch = gtk::Switch::builder()
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.build();
|
||||
|
||||
let unofficial_source_signed_keyring_checkbutton = gtk::CheckButton::builder()
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.label(t!("unofficial_source_signed_keyring_checkbutton_label"))
|
||||
.active(true)
|
||||
.build();
|
||||
|
||||
let unofficial_source_signed_file_checkbutton = gtk::CheckButton::builder()
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.label(t!("unofficial_source_signed_file_checkbutton_label"))
|
||||
.group(&unofficial_source_signed_keyring_checkbutton)
|
||||
.build();
|
||||
|
||||
let unofficial_source_signed_url_checkbutton = gtk::CheckButton::builder()
|
||||
.halign(Align::Start)
|
||||
.valign(Align::Center)
|
||||
.label(t!("unofficial_source_signed_url_checkbutton_label"))
|
||||
.group(&unofficial_source_signed_keyring_checkbutton)
|
||||
.build();
|
||||
|
||||
//
|
||||
let unofficial_source_add_dialog_child_clamp = adw::Clamp::builder()
|
||||
.child(&unofficial_source_add_dialog_child_box)
|
||||
.maximum_size(500)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_viewport = gtk::ScrolledWindow::builder()
|
||||
.hexpand(true)
|
||||
.vexpand(true)
|
||||
.child(&unofficial_source_add_dialog_child_clamp)
|
||||
.hscrollbar_policy(PolicyType::Never)
|
||||
.build();
|
||||
|
||||
let unofficial_source_add_dialog = adw::MessageDialog::builder()
|
||||
.transient_for(&window)
|
||||
.extra_child(&unofficial_source_add_viewport)
|
||||
.heading(t!("unofficial_source_add_dialog_heading"))
|
||||
.width_request(700)
|
||||
.height_request(500)
|
||||
.build();
|
||||
|
||||
unofficial_source_add_dialog.add_response(
|
||||
"unofficial_source_add_dialog_add",
|
||||
&t!("unofficial_source_add_dialog_add_label").to_string(),
|
||||
);
|
||||
|
||||
unofficial_source_add_dialog.add_response(
|
||||
"unofficial_source_add_dialog_cancel",
|
||||
&t!("unofficial_source_add_dialog_cancel_label").to_string(),
|
||||
);
|
||||
|
||||
unofficial_source_add_dialog.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||
|
||||
unofficial_source_add_dialog.set_response_appearance(
|
||||
"unofficial_source_add_dialog_add",
|
||||
adw::ResponseAppearance::Suggested,
|
||||
);
|
||||
|
||||
unofficial_source_add_dialog.set_response_appearance(
|
||||
"unofficial_source_add_dialog_cancel",
|
||||
adw::ResponseAppearance::Destructive,
|
||||
);
|
||||
|
||||
//
|
||||
|
||||
let unofficial_source_add_dialog_clone0 = unofficial_source_add_dialog.clone();
|
||||
let unofficial_source_add_name_entry_clone0 = unofficial_source_add_name_entry.clone();
|
||||
let unofficial_source_add_uri_entry_clone0 = unofficial_source_add_uri_entry.clone();
|
||||
let unofficial_source_add_suites_entry_clone0 = unofficial_source_add_suites_entry.clone();
|
||||
let unofficial_source_add_components_entry_clone0 = unofficial_source_add_components_entry.clone();
|
||||
let unofficial_source_add_signed_entry_clone0 = unofficial_source_add_signed_entry.clone();
|
||||
let unofficial_source_signed_keyring_checkbutton_clone0 = unofficial_source_signed_keyring_checkbutton.clone();
|
||||
|
||||
let add_button_update_state = move || {
|
||||
if
|
||||
!unofficial_source_add_name_entry_clone0.text().is_empty() &&
|
||||
!unofficial_source_add_uri_entry_clone0.text().is_empty() &&
|
||||
!unofficial_source_add_suites_entry_clone0.text().is_empty() &&
|
||||
!unofficial_source_add_components_entry_clone0.text().is_empty()
|
||||
{
|
||||
if unofficial_source_signed_keyring_checkbutton_clone0.is_active() {
|
||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||
} else if !unofficial_source_add_signed_entry_clone0.text().is_empty() {
|
||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||
} else {
|
||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||
unofficial_source_remove_button.connect_clicked(clone!(
|
||||
#[strong]
|
||||
window,
|
||||
move
|
||||
|_|
|
||||
{
|
||||
let selection = unofficial_sources_selection_model.selected_item().unwrap();
|
||||
let item = selection.downcast_ref::<BoxedAnyObject>().unwrap();
|
||||
let apt_src: Ref<AptSourceConfig> = item.borrow();
|
||||
let command = match apt_src.deref() {
|
||||
AptSourceConfig::DEB822(src) => {
|
||||
match &src.signed_by {
|
||||
Some(t) => {duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "delete_deb822", &src.filepath, t)}
|
||||
None => {duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "delete_legacy", &src.filepath)}
|
||||
}
|
||||
} else {
|
||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||
}
|
||||
AptSourceConfig::Legacy(list) => {duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "delete_legacy", &list.filepath)}
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
for entry in [
|
||||
&unofficial_source_add_name_entry,
|
||||
&unofficial_source_add_uri_entry,
|
||||
&unofficial_source_add_suites_entry,
|
||||
&unofficial_source_add_components_entry,
|
||||
&unofficial_source_add_signed_entry,
|
||||
] {
|
||||
entry.connect_text_notify(clone!(
|
||||
#[strong]
|
||||
add_button_update_state,
|
||||
move |_|
|
||||
{
|
||||
add_button_update_state();
|
||||
}
|
||||
)
|
||||
let apt_src_remove_warning_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_remove_warning_dialog_heading"))
|
||||
.body(t!("apt_src_remove_warning_dialog_body"))
|
||||
.transient_for(&window)
|
||||
.build();
|
||||
apt_src_remove_warning_dialog.add_response(
|
||||
"apt_src_remove_warning_dialog_cancel",
|
||||
&t!("apt_src_remove_warning_dialog_cancel_label").to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
unofficial_source_signed_keyring_checkbutton.connect_toggled(clone!(
|
||||
#[weak]
|
||||
unofficial_source_add_signed_entry,
|
||||
#[strong]
|
||||
add_button_update_state,
|
||||
move |checkbutton|
|
||||
{
|
||||
if checkbutton.is_active() {
|
||||
unofficial_source_add_signed_entry.set_sensitive(false);
|
||||
unofficial_source_add_signed_entry.set_placeholder_text(Some(""));
|
||||
add_button_update_state();
|
||||
}
|
||||
}
|
||||
)
|
||||
apt_src_remove_warning_dialog.add_response(
|
||||
"apt_src_remove_warning_dialog_ok",
|
||||
&t!("apt_src_remove_warning_dialog_ok_label").to_string(),
|
||||
);
|
||||
|
||||
unofficial_source_signed_file_checkbutton.connect_toggled(clone!(
|
||||
#[weak]
|
||||
unofficial_source_add_signed_entry,
|
||||
#[strong]
|
||||
add_button_update_state,
|
||||
move |checkbutton|
|
||||
{
|
||||
if checkbutton.is_active() {
|
||||
unofficial_source_add_signed_entry.set_sensitive(true);
|
||||
unofficial_source_add_signed_entry.set_placeholder_text(Some("/etc/apt/keyrings/winehq-archive.key"));
|
||||
add_button_update_state();
|
||||
}
|
||||
apt_src_remove_warning_dialog.set_response_appearance("apt_src_remove_warning_dialog_ok", adw::ResponseAppearance::Destructive);
|
||||
apt_src_remove_warning_dialog.clone()
|
||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
match choice.as_str() {
|
||||
"apt_src_remove_warning_dialog_ok" => {
|
||||
let _ = command.run().unwrap();
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
unofficial_source_signed_url_checkbutton.connect_toggled(clone!(
|
||||
#[weak]
|
||||
unofficial_source_add_signed_entry,
|
||||
#[strong]
|
||||
add_button_update_state,
|
||||
move |checkbutton|
|
||||
{
|
||||
if checkbutton.is_active() {
|
||||
unofficial_source_add_signed_entry.set_sensitive(true);
|
||||
unofficial_source_add_signed_entry.set_placeholder_text(Some("https://dl.winehq.org/wine-builds/winehq.key"));
|
||||
add_button_update_state();
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
unofficial_source_add_box2.append(&unofficial_source_add_is_source_label);
|
||||
unofficial_source_add_box2.append(&unofficial_source_add_is_source_switch);
|
||||
unofficial_source_add_box2.append(&unofficial_source_signed_keyring_checkbutton);
|
||||
unofficial_source_add_box2.append(&unofficial_source_signed_file_checkbutton);
|
||||
unofficial_source_add_box2.append(&unofficial_source_signed_url_checkbutton);
|
||||
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_name_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_uri_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_suites_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_components_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_archs_prefrencesgroup);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_box2);
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_signed_prefrencesgroup);
|
||||
|
||||
unofficial_source_add_dialog.clone()
|
||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
match choice.as_str() {
|
||||
"unofficial_source_add_dialog_add" => {
|
||||
println!("add");
|
||||
let non_alphanum_regex = Regex::new(r"[^a-zA-Z0-9]").unwrap();
|
||||
let sign_method = if unofficial_source_signed_file_checkbutton.is_active() {
|
||||
1
|
||||
} else if unofficial_source_signed_url_checkbutton.is_active() {
|
||||
2
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let repo_file_name = non_alphanum_regex.replace_all(unofficial_source_add_name_entry.text().as_str(), "_").to_string().to_lowercase();
|
||||
let new_repo = Deb822Repository {
|
||||
repolib_name: Some(unofficial_source_add_name_entry.text().to_string()),
|
||||
filepath: format!("/etc/apt/sources.list.d/{}.source", repo_file_name),
|
||||
uris: Some(unofficial_source_add_uri_entry.text().to_string()),
|
||||
types: if unofficial_source_add_is_source_switch.is_active() {
|
||||
Some("deb deb-src".to_string())
|
||||
} else {
|
||||
Some("deb".to_string())
|
||||
},
|
||||
suites: Some(unofficial_source_add_suites_entry.text().to_string()),
|
||||
components: Some(unofficial_source_add_components_entry.text().to_string()),
|
||||
architectures: if unofficial_source_add_archs_entry.text().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(unofficial_source_add_archs_entry.text().to_string())
|
||||
},
|
||||
signed_by: match sign_method {
|
||||
1 => Some(unofficial_source_add_signed_entry.text().to_string()),
|
||||
2 => Some(format!("/etc/apt/keyrings/{}.gpg.key", repo_file_name)),
|
||||
_ => None
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
if sign_method == 2 {
|
||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/wget.sh", &unofficial_source_add_signed_entry.text().to_string(), &format!("/etc/apt/keyrings/{}.gpg.key", repo_file_name)).run() {
|
||||
Ok(_) => {
|
||||
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
|
||||
Ok(_) => {
|
||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/move_repo.sh", "deb822", repo_file_name).run() {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
apt_src_create_error_dialog.add_response(
|
||||
"apt_src_create_error_dialog_ok",
|
||||
&t!("apt_src_create_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
apt_src_create_error_dialog.add_response(
|
||||
"apt_src_create_error_dialog_ok",
|
||||
&t!("apt_src_create_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let key_download_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("key_download_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
key_download_error_dialog.add_response(
|
||||
"key_download_error_dialog_ok",
|
||||
&t!("key_download_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
key_download_error_dialog.present();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
|
||||
Ok(_) => {
|
||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/move_repo.sh", "deb822", repo_file_name).run() {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
apt_src_create_error_dialog.add_response(
|
||||
"apt_src_create_error_dialog_ok",
|
||||
&t!("apt_src_create_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||
.body(e.to_string())
|
||||
.build();
|
||||
apt_src_create_error_dialog.add_response(
|
||||
"apt_src_create_error_dialog_ok",
|
||||
&t!("apt_src_create_error_dialog_ok_label").to_string(),
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"apt_update_dialog_ignore" => {
|
||||
unofficial_source_add_dialog.close();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
);
|
||||
@ -705,6 +381,7 @@ pub fn apt_manage_page(
|
||||
|
||||
unofficial_sources_edit_box.append(&unofficial_source_add_button);
|
||||
unofficial_sources_edit_box.append(&unofficial_source_edit_button);
|
||||
unofficial_sources_edit_box.append(&unofficial_source_remove_button);
|
||||
|
||||
unofficial_sources_box.append(&unofficial_sources_columnview);
|
||||
unofficial_sources_box.append(&unofficial_sources_edit_box);
|
||||
|
Loading…
Reference in New Issue
Block a user