diff --git a/ChangeLog b/ChangeLog index be38de3..67228db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2024-12-14 Serghei Iakovlev + + * src/main.c (main): Removed restrictive validation on input URLs. + Now allows any non-empty argument, including local files and custom + schemes, ensuring the program functions as a transparent router. + Added minimal check for empty string input. + + * src/main.c (main): Removed unnecessary debug statements + printing the number of loaded rules and the selected command. + + * src/*.c, src/*.h: Corrected typo in copyright notice. + + * etc/brogw.desktop: Updated to conform with the Desktop Entry + specification. Added 'Version', 'GenericName', and + 'StartupNotify' fields. Specified `Terminal=false` for graphical + environments. + 2024-12-13 Serghei Iakovlev * configure.ac: Removed debug-mode and werror logic, as well as diff --git a/NEWS b/NEWS index aad9959..90dd72d 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,24 @@ tested across these platforms. This is intended for future flexibility in feature toggles and platform-specific conditions. +** Routing to any input. +Brogw now supports routing of any non-empty input, including local +file paths (e.g., '~/file.html') and custom schemes (e.g., `file://`, +`ftp://`). Removed the restrictive check requiring input to start +with 'http://' or 'https://'. + +** Improved error handling. +Added validation to reject empty string inputs, e.g., 'brogw ""'. + +** Code cleanup. +Cleaned up runtime output by removing unnecessary debug logs. + +** Improved integration with desktop environments. +Updated the '.desktop' file to conform with the Freedesktop Desktop +Entry specification. Added 'Version', 'GenericName', 'Terminal' and +'StartupNofify' fields to ensure proper behavior in graphical +environments. + * Release 1.0, 2024-12-10 Initial release. diff --git a/etc/brogw.desktop b/etc/brogw.desktop index 054f516..427b485 100644 --- a/etc/brogw.desktop +++ b/etc/brogw.desktop @@ -1,7 +1,14 @@ +# For information about the Desktop Entry specification, +# see http://freedesktop.org/wiki/Specifications/desktop-entry-spec. + [Desktop Entry] +Version=1.0 Name=Brogw +GenericName=Web Browser Comment=Route links to appropriate web browser Type=Application Exec=brogw %u +Terminal=false Categories=Network;WebBrowser +StartupNotify=false MimeType=x-scheme-handler/http;x-scheme-handler/https; diff --git a/src/brogw_config.c b/src/brogw_config.c index 7a313fa..48b17b9 100644 --- a/src/brogw_config.c +++ b/src/brogw_config.c @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #include diff --git a/src/brogw_config.h b/src/brogw_config.h index 14318c3..263ab00 100644 --- a/src/brogw_config.h +++ b/src/brogw_config.h @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #ifndef BROGW_BROGW_CONFIG_H diff --git a/src/executor.c b/src/executor.c index 1439085..a1ec7ef 100644 --- a/src/executor.c +++ b/src/executor.c @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #include diff --git a/src/executor.h b/src/executor.h index 5563a30..10f199e 100644 --- a/src/executor.h +++ b/src/executor.h @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #ifndef BROGW_EXECUTOR_H diff --git a/src/main.c b/src/main.c index 2149934..0c40775 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #include @@ -33,14 +33,15 @@ int main(int argc, char *argv[]) { return 1; } - const char *url = argv[1]; - if (strncmp(url, "http://", 7) != 0 && strncmp(url, "https://", 8) != 0) { - fprintf(stderr, "Invalid URL. Must start with http:// or https://\n"); + if (argv[1][0] == '\0') { + fprintf(stderr, "Error: Empty URL or file path provided\n"); return 1; } + const char *url = argv[1]; Rule *rules = NULL; size_t rule_count = 0; + if (config_load_rules(&rules, &rule_count) != 0) { fprintf(stderr, "Error loading configuration\n"); return 1; @@ -49,10 +50,6 @@ int main(int argc, char *argv[]) { const char *default_browser = "firefox"; const char *command = matcher_find_command(url, rules, rule_count, default_browser); - // For now, just print how many rules we have loaded - printf("Loaded %zu rules.\n", rule_count); - printf("Command to execute: %s\n", command); - int ret = executor_run_command(command, url); if (ret != 0) { fprintf(stderr, "Failed to execute command: %s\n", command); diff --git a/src/matcher.c b/src/matcher.c index 97152ac..e0d90a9 100644 --- a/src/matcher.c +++ b/src/matcher.c @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #include #include diff --git a/src/matcher.h b/src/matcher.h index 0a0338a..e28f739 100644 --- a/src/matcher.h +++ b/src/matcher.h @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #ifndef BROGW_MATCHER_H diff --git a/src/utils.c b/src/utils.c index 3177e15..a234e0a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #include diff --git a/src/utils.h b/src/utils.h index 7a4cd9a..3f13042 100644 --- a/src/utils.h +++ b/src/utils.h @@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Brigw. If not, see . */ +along with Brogw. If not, see . */ #ifndef BROGW_UTILS_H