diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c
index 9bfe20c..866d335 100644
--- a/source/ubl-settings-logging.c
+++ b/source/ubl-settings-logging.c
@@ -411,7 +411,7 @@ void on_inspector_update(GtkWidget *self, inspector_window *window){
dictionary *dict=NULL;
for_dictionaries (dict,window->terminals){
GtkWidget *terminal = (GtkWidget*)dict->data;
- yon_terminal_integrated_start(terminal,yon_char_unite("cat ",dict->key," | sed -r \"s/\\x1B\\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g\"",NULL));
+ yon_terminal_integrated_start(terminal,read_log_command(dict->key));
}
}
}
@@ -1234,6 +1234,32 @@ void on_logrotate_save(GtkWidget *, dictionary *dict){
char *before = (char*)gtk_entry_get_text(GTK_ENTRY(window->CommandBeforeEntry));
char *after = (char*)gtk_entry_get_text(GTK_ENTRY(window->CommandAfterEntry));
char *endwork = (char*)gtk_entry_get_text(GTK_ENTRY(window->EndworkCommandEntry));
+
+ if (!check_command_is_legit(before_once)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),COMMAND_INVALID_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(window->CommandBeforeOnceEntry);
+ return;
+ }
+ if (!check_command_is_legit(after_once)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),COMMAND_INVALID_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(window->CommandAfterOnceEntry);
+ return;
+ }
+ if (!check_command_is_legit(before)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),COMMAND_INVALID_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(window->CommandBeforeEntry);
+ return;
+ }
+ if (!check_command_is_legit(after)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),COMMAND_INVALID_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(window->CommandAfterEntry);
+ return;
+ }
+ if (!check_command_is_legit(endwork)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),COMMAND_INVALID_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(window->EndworkCommandEntry);
+ return;
+ }
sharedscripts = "sharedscripts";
if (!yon_char_is_empty(before_once)) {
before_once = yon_char_replace(before_once,"\"","=--");
diff --git a/source/ubl-settings-logging.h b/source/ubl-settings-logging.h
index 2501b9d..ef1cc39 100644
--- a/source/ubl-settings-logging.h
+++ b/source/ubl-settings-logging.h
@@ -48,6 +48,8 @@
#define logrotate_config_path "/etc/logrotate.d/"
#define custom_logs_saving_file_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/logwatcher.csv",NULL)
+#define read_log_command(command) yon_debug_output("%s\n",yon_char_unite("sed -r \"s/\\x1B\\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g\" ",command,NULL))
+
#define LocalePath "/usr/share/locale"
#define LocaleName "ubl-settings-logging"
@@ -84,6 +86,8 @@
#define enable_icon_name "com.ublinux.ubl-settings-logging.check-symbolic"
#define disable_icon_name "com.ublinux.ubl-settings-logging.uncheck-symbolic"
+#define check_command_is_legit(command) !system(yon_char_unite("bash -c \"set -u; command -v ",command,"\"",NULL))
+
#define yon_add_space_if_exists(string) yon_char_is_empty(string) ? "" : yon_char_append(",",string)
typedef char* string;
string version_application;
diff --git a/source/ubl-strings.h b/source/ubl-strings.h
index 597bf85..e7687a4 100644
--- a/source/ubl-strings.h
+++ b/source/ubl-strings.h
@@ -43,6 +43,7 @@
#define SYSLOG_DESCRIPTION_LABEL _("System log")
#define XORG_DESCRIPTION_LABEL _("X.org display server log")
#define XSESSION_DESCRIPTION_LABEL _("Graphics X session log")
+#define SAVE_LABEL _("Save")
//ubl-settings-logging-inspector.glade
#define INSPECTOR_TITLE_LABEL _("Logs and events - log inspector")
@@ -174,6 +175,7 @@
#define EMPTY_IMPORTANT_LABEL _("Empty important field")
#define REPEAT_PATHS_LABEL _("Repeating paths")
#define WRITE_IMPORTANT_LABEL _("Write down all important fields")
+#define COMMAND_INVALID_LABEL _("Command is invalid")
//ubl-settings-logging-logrotate-table.glade
#define TABLE_TITLE_LABEL _("Logs and events - logrotate table")
diff --git a/ubl-settings-logging-add.glade b/ubl-settings-logging-add.glade
index 6373ad5..365e93d 100644
--- a/ubl-settings-logging-add.glade
+++ b/ubl-settings-logging-add.glade
@@ -59,38 +59,15 @@
False
5
vertical
- 5
@@ -119,8 +96,8 @@
True
False
- 5
- 5
+ 4
+ 4
vertical
5
@@ -499,6 +476,31 @@
com.ublinux.ubl-settings-logging
+
+
+ Cancel
+ True
+ True
+ True
+ image1
+
+
+ 1
+
+
+
+
+ Save
+ True
+ True
+ True
+ image2
+
+
+ end
+ 2
+
+
diff --git a/ubl-settings-logging-filechooser.glade b/ubl-settings-logging-filechooser.glade
index 84db281..94f9a1c 100644
--- a/ubl-settings-logging-filechooser.glade
+++ b/ubl-settings-logging-filechooser.glade
@@ -1,12 +1,12 @@
-
+
True
False
- process-stop-symbolic
+ com.ublinux.libublsettingsui-gtk3.cancel-symbolic
True
@@ -101,7 +101,6 @@
@@ -1056,6 +1000,43 @@
com.ublinux.ubl-settings-logging
+
+
+ Cancel
+ True
+ True
+ True
+ image1
+
+
+ 1
+
+
+
+
+ Reset
+ True
+ True
+ True
+ image5
+
+
+ 2
+
+
+
+
+ Save
+ True
+ True
+ True
+ image2
+
+
+ end
+ 3
+
+
diff --git a/ubl-settings-logging-logrotate-table.glade b/ubl-settings-logging-logrotate-table.glade
index bbc41e5..9d6f8a4 100644
--- a/ubl-settings-logging-logrotate-table.glade
+++ b/ubl-settings-logging-logrotate-table.glade
@@ -1,5 +1,5 @@
-
+
@@ -22,7 +22,7 @@
True
False
- process-stop-symbolic
+ com.ublinux.libublsettingsui-gtk3.cancel-symbolic
True
@@ -339,48 +339,6 @@
0
-
-
- True
- False
- end
- 5
- True
-
-
- Cancel
- True
- True
- True
- image1
-
-
- False
- True
- 0
-
-
-
-
- Save
- True
- True
- True
- image2
-
-
- False
- True
- 1
-
-
-
-
- False
- True
- 1
-
-
True
@@ -394,7 +352,6 @@