From 128c98567559d443bbb184dff247090eb5b28a8d Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 19 May 2020 04:18:43 +0200 Subject: README.md: Fix syntax --- README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'README.md') diff --git a/README.md b/README.md index 22846e1..29e6b04 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ You need to have gettext installed. If you want a GUI, poedit exists and Weblate ## Manual Installation Dependencies are: + - C11 Compiler (such as clang or gcc) - [WebKitGTK](https://webkitgtk.org/), only the latest stable is supported - POSIX make with extension for shell in variables (works with GNU, {Net,Free,Open}BSD) -- cgit v1.3.1-23-gd82d From a33acf084bca33816f9869bf6dfa00fdd4c7b5cb Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 4 Jul 2020 01:32:07 +0200 Subject: README.md: Add IRC+Matrix --- README.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 29e6b04..97b27ef 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ You need to have gettext installed. If you want a GUI, poedit exists and Weblate - Syncing PO file with the POT file: ``make po/de.po`` - Initialising a new PO file (example for German, `de_DE`): ``msginit -l de_DE -i po/messages.pot -o po/de.po`` +## Contacts / Discussions +- IRC: `#badwolf-browser` on FreeNode +- Matrix (bridge): + ## Repositories ### git - Main: , -- cgit v1.3.1-23-gd82d From 17b9802a08bac9a12eaa7f2e5d63b8d1e97108bd Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 5 Jul 2020 05:23:28 +0200 Subject: README.md: Inkscape is used instead of rsvg --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 97b27ef..6804aea 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Dependencies are: Compilation is done with `make`, install with `make install` (`DESTDIR` and `PREFIX` environment variables are supported, amongs other common ones). An example AppArmor profile is provided at `usr.bin.badwolf`, please do some long runtime checks before shipping it or a modified version, help can be provided but with no support. -You'll also need `rsvg-convert(1)` (from librsvg) and scour if you want to regenerate the icons, for example after modifying them or adding a new size. These aren't needed for normal installation as it is bundled. +You'll also need inkscape (command line only) if you want to regenerate the icons, for example after modifying them or adding a new size. These aren't needed for normal installation as it is bundled. ## Notes Most of the privacy/security stuff will be done with patches against WebKit as quite a lot isn’t into [WebKitSettings](https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html) and with generic WebKit extensions that should be resuseable. -- cgit v1.3.1-23-gd82d From a7ba36264f3a62013d393075bd992ac252d3e51a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 3 Nov 2019 21:34:46 +0100 Subject: Add support for XBEL Bookmarks --- KnowledgeBase.md | 17 ++++++++++ Makefile | 2 +- README.md | 1 + badwolf.1 | 10 ++++-- badwolf.c | 1 + bookmarks.c | 99 ++++++++++++++++++++++++++++++++++++++++---------------- 6 files changed, 100 insertions(+), 30 deletions(-) (limited to 'README.md') diff --git a/KnowledgeBase.md b/KnowledgeBase.md index f5f9f9a..af59415 100644 --- a/KnowledgeBase.md +++ b/KnowledgeBase.md @@ -2,3 +2,20 @@ - WebKit2 Extensions Tutorial: https://blogs.igalia.com/carlosgc/2013/09/10/webkit2gtk-web-process-extensions/ - https://trac.torproject.org/projects/tor/wiki/doc/ImportantGoogleChromeBugs / https://trac.torproject.org/projects/tor/ticket/1925 - https://webkit.org/blog/3476/content-blockers-first-look/ + +# Bookmark formats +The different plain-text formats used by web browsers found in the wild, done +in Augmented Backus–Naur Form (ABNF). + +url = *CHAR +title = *CHAR + +## uzbl +bookmark = URL TAB title [TAB tags] +tags = *(*CHAR SP) + +Documenter comment: How does it manages when the separator (TAB here) is +present in the title? + +## qutebrowser +bookmark = URL SP title diff --git a/Makefile b/Makefile index 8ba3003..8ba9b7e 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ INKSCAPE ?= inkscape # for i in 24 32 48 64 128 256; do echo icons/hicolor/${i}x${i}/apps/badwolf.png; done | tr '\n' ' ' ICON_SIZES = icons/hicolor/24x24/apps/badwolf.png icons/hicolor/32x32/apps/badwolf.png icons/hicolor/48x48/apps/badwolf.png icons/hicolor/64x64/apps/badwolf.png icons/hicolor/128x128/apps/badwolf.png icons/hicolor/256x256/apps/badwolf.png -DEPS = gtk+-3.0 webkit2gtk-4.0 libsoup-2.4 +DEPS = gtk+-3.0 webkit2gtk-4.0 libsoup-2.4 libxml-2.0 SRCS = bookmarks.c uri.c uri_test.c keybindings.c downloads.c badwolf.c OBJS = bookmarks.o uri.o keybindings.o downloads.o badwolf.o OBJS_test = uri_test.o diff --git a/README.md b/README.md index 6804aea..b83d134 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Dependencies are: - C11 Compiler (such as clang or gcc) - [WebKitGTK](https://webkitgtk.org/), only the latest stable is supported +- [libxml-2.0](http://www.xmlsoft.org/), no known version limitation - POSIX make with extension for shell in variables (works with GNU, {Net,Free,Open}BSD) - A pkg-config implementation (pkgconf is recommended) - (optionnal) gettext implementation (such as GNU Gettext) diff --git a/badwolf.1 b/badwolf.1 index 96a20d3..6bbe2b2 100644 --- a/badwolf.1 +++ b/badwolf.1 @@ -75,8 +75,14 @@ A more generic variable name is also intended to be used in the future. .El .Sh FILES .Bl -tag -width Ds -compact -.It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/URLs.txt -File containing a URL on each line. [UNSTABLE] +.It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/bookmarks.xbel +XBEL (XML Bookmark Exchange Language) file, known to be currently supported by: +.Xr elinks 1 , +.Xr konqueror 1 , +.Xr kbookmarkeditor 1 . Doing a symbolic link from their path works fine. +.Pp +For more information about this format see: +.Lk http://pyxml.sourceforge.net/topics/xbel/ .It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/webkit-web-extensions/ Directory containing the .Lk https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebExtension.html WebKitWebExtensions diff --git a/badwolf.c b/badwolf.c index bf4916b..f284378 100644 --- a/badwolf.c +++ b/badwolf.c @@ -7,6 +7,7 @@ #include "config.h" #include "downloads.h" #include "bookmarks.h" +#include "config.h" #include "keybindings.h" #include "uri.h" diff --git a/bookmarks.c b/bookmarks.c index f43ed46..23cb558 100644 --- a/bookmarks.c +++ b/bookmarks.c @@ -1,45 +1,90 @@ -#include "badwolf.h" #include "bookmarks.h" -#include +#include "badwolf.h" + #include /* g_fprintf() */ +#include +#include void -location_completion_init() +location_completion_setup(GtkListStore *list_store) { - GtkTreeIter iter; - GtkListStore *list_store; - GIOChannel *file_channel; - GError *file_err = NULL; - gchar *file_line; + gtk_entry_completion_set_model(location_completion, GTK_TREE_MODEL(list_store)); + gtk_entry_completion_set_text_column(location_completion, 0); +} - location_completion = gtk_entry_completion_new(); +void +location_completion_cleanup(xmlXPathObjectPtr xpathObj, xmlXPathContextPtr xpathCtx, xmlDocPtr doc) +{ + if(xpathObj != NULL) xmlXPathFreeObject(xpathObj); + if(xpathCtx != NULL) xmlXPathFreeContext(xpathCtx); + if(doc != NULL) xmlFreeDoc(doc); +} - list_store = gtk_list_store_new(1, G_TYPE_STRING); +GtkTreeIter +load_xpath_results(GtkListStore *list_store, xmlNodeSetPtr nodes) +{ + GtkTreeIter iter; + int size; - gchar *filename = g_build_filename(g_get_user_data_dir(), "badwolf", "URLs.txt", NULL); - g_fprintf(stderr, "URL Completion: loading at %s\n", filename); - file_channel = g_io_channel_new_file(filename, "r", &file_err); + size = (nodes) ? nodes->nodeNr : 0; - if(file_channel != NULL) - { - while(G_IO_STATUS_NORMAL == - g_io_channel_read_line(file_channel, &file_line, NULL, NULL, &file_err)) + g_fprintf(stderr, "Bookmarks: Found %d bookmarks.\n", size); + for(int i = 0; i < size; i++) + if(nodes->nodeTab[i]) { gtk_list_store_append(list_store, &iter); - gtk_list_store_set(list_store, &iter, 0, g_strchomp(file_line), -1); + gtk_list_store_set( + list_store, &iter, 0, (char *)xmlXPathCastNodeToString(nodes->nodeTab[i]), -1); } - g_free(file_line); - g_io_channel_unref(file_channel); - //g_io_channel_shutdown(file_channel, FALSE, &file_err); - g_fprintf(stderr, "URL Completion: Done.\n"); - } - else - g_fprintf(stderr, "URL Completion: Failed to load file.\n"); + return iter; +} + +void +location_completion_init() +{ + const xmlChar *xpathExpr = "//bookmark/@href"; + char *filename = g_build_filename(g_get_user_data_dir(), "badwolf", "bookmarks.xbel", NULL); + xmlDocPtr doc = NULL; + xmlXPathContextPtr xpathCtx = NULL; + xmlXPathObjectPtr xpathObj = NULL; + GtkTreeIter iter; + GtkListStore *list_store = gtk_list_store_new(1, G_TYPE_STRING); + + location_completion = gtk_entry_completion_new(); gtk_list_store_append(list_store, &iter); gtk_list_store_set(list_store, &iter, 0, homepage, -1); - gtk_entry_completion_set_model(location_completion, GTK_TREE_MODEL(list_store)); - gtk_entry_completion_set_text_column(location_completion, 0); + g_fprintf(stderr, "Bookmarks: loading at %s\n", filename); + doc = xmlParseFile(filename); + if(doc == NULL) + { + g_fprintf(stderr, "Bookmarks: unable to parse file \"%s\"\n", filename); + location_completion_cleanup(xpathObj, xpathCtx, doc); + return; + } + + xpathCtx = xmlXPathNewContext(doc); + if(xpathCtx == NULL) + { + g_fprintf(stderr, "Bookmarks: unable to create new XPath context\n"); + location_completion_cleanup(xpathObj, xpathCtx, doc); + return; + } + + xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx); + if(xpathObj == NULL) + { + g_fprintf(stderr, "Bookmarks: unable to evaluate xpath expression \"%s\"\n", xpathExpr); + location_completion_cleanup(xpathObj, xpathCtx, doc); + return; + } + + iter = load_xpath_results(list_store, xpathObj->nodesetval); + + location_completion_cleanup(xpathObj, xpathCtx, doc); + location_completion_setup(list_store); + + g_fprintf(stderr, "Bookmarks: Done.\n"); } -- cgit v1.3.1-23-gd82d From 325e55ec58ea51543e2ece3133f2e8d429a5d6ae Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 9 Apr 2021 07:40:50 +0200 Subject: README: Fix signify link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index b83d134..8dd6cf2 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ You need to have gettext installed. If you want a GUI, poedit exists and Weblate - `*.tar.*` files are tarballs archives to be extracted with a program like `tar(1)`, GNU tar and LibArchive bsdtar are known to work. - `*.sig` files are OpenPGP signatures done with my [key](https://hacktivis.me/key.asc)(`DDC9 237C 14CF 6F4D D847 F6B3 90D9 3ACC FEFF 61AE`). -- `*.sign` files are minisign (OpenBSD `signify(1)` compatible) signatures, they key used for it can be found at as well as other places (feel free to ping me to get it) +- `*.sign` files are minisign (OpenBSD `signify(1)` compatible) signatures, they key used for it can be found at as well as other places (feel free to ping me to get it) ## Manual Installation Dependencies are: -- cgit v1.3.1-23-gd82d From 46ce59c9d63a8ab20117b5eb85afb52c0d6390a1 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 9 Apr 2021 07:44:41 +0200 Subject: Update copyright year --- COPYING | 2 +- README.md | 2 +- badwolf.c | 2 +- keybindings.c | 4 ++-- uri.c | 2 +- uri_test.c | 2 +- usr.bin.badwolf | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'README.md') diff --git a/COPYING b/COPYING index 6ba3f5f..ff830e0 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2019-2020, Badwolf Authors +Copyright (c) 2019-2021, Badwolf Authors All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 8dd6cf2..d2f194b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Minimalist and privacy-oriented WebKitGTK+ browser. Homepage: ``` -Copyright © 2019-2020 Badwolf Authors +Copyright © 2019-2021 Badwolf Authors SPDX-License-Identifier: BSD-3-Clause ``` diff --git a/badwolf.c b/badwolf.c index bad849d..bf5d183 100644 --- a/badwolf.c +++ b/badwolf.c @@ -1,5 +1,5 @@ // BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -// Copyright © 2019-2020 Badwolf Authors +// Copyright © 2019-2021 Badwolf Authors // SPDX-License-Identifier: BSD-3-Clause #include "badwolf.h" diff --git a/keybindings.c b/keybindings.c index 13f2a48..bfc8f7a 100644 --- a/keybindings.c +++ b/keybindings.c @@ -1,5 +1,5 @@ // BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -// Copyright © 2019-2020 Badwolf Authors +// Copyright © 2019-2021 Badwolf Authors // SPDX-License-Identifier: BSD-3-Clause #include "keybindings.h" @@ -42,7 +42,7 @@ badwolf_about_dialog(GtkWindow *main_window, gpointer user_data) "SPDX-License-Identifier: BSD-3-Clause"); gtk_about_dialog_set_copyright( GTK_ABOUT_DIALOG(about_dialog), - "2019-2020 Badwolf Authors "); + "2019-2021 Badwolf Authors "); gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about_dialog), homepage); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about_dialog), comments); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about_dialog), version); diff --git a/uri.c b/uri.c index 912bf86..3cbc1d6 100644 --- a/uri.c +++ b/uri.c @@ -1,5 +1,5 @@ // BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -// Copyright © 2019-2020 Badwolf Authors +// Copyright © 2019-2021 Badwolf Authors // SPDX-License-Identifier: BSD-3-Clause #include "uri.h" diff --git a/uri_test.c b/uri_test.c index a153817..28bdde9 100644 --- a/uri_test.c +++ b/uri_test.c @@ -1,5 +1,5 @@ // BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -// Copyright © 2019-2020 Badwolf Authors +// Copyright © 2019-2021 Badwolf Authors // SPDX-License-Identifier: BSD-3-Clause #include "uri.h" diff --git a/usr.bin.badwolf b/usr.bin.badwolf index 0ebce5d..861ee9f 100644 --- a/usr.bin.badwolf +++ b/usr.bin.badwolf @@ -1,5 +1,5 @@ # BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -# Copyright © 2019-2020 Badwolf Authors +# Copyright © 2019-2021 Badwolf Authors # SPDX-License-Identifier: BSD-3-Clause # # Made on Gentoo Linux with PREFIX=/usr -- cgit v1.3.1-23-gd82d