Skip to content
Merged
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
17 changes: 17 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
2024-12-14 Serghei Iakovlev <gnu@serghei.pl>

* 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 <gnu@serghei.pl>

* configure.ac: Removed debug-mode and werror logic, as well as
Expand Down
18 changes: 18 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions etc/brogw.desktop
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion src/brogw_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */


#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/brogw_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */


#ifndef BROGW_BROGW_CONFIG_H
Expand Down
2 changes: 1 addition & 1 deletion src/executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */


#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */


#ifndef BROGW_EXECUTOR_H
Expand Down
13 changes: 5 additions & 8 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */


#include <stdio.h>
Expand All @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/matcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */

#include <regex.h>
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/matcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */


#ifndef BROGW_MATCHER_H
Expand Down
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */


#include <ctype.h>
Expand Down
2 changes: 1 addition & 1 deletion src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>. */
along with Brogw. If not, see <https://www.gnu.org/licenses/>. */


#ifndef BROGW_UTILS_H
Expand Down
Loading