]> git.armaanb.net Git - chorizo.git/commitdiff
Log running user script to console
authorArmaan Bhojwani <me@armaanb.net>
Sat, 5 Jun 2021 22:29:24 +0000 (18:29 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 6 Jun 2021 13:48:59 +0000 (09:48 -0400)
browser.c

index 66fc699453bc9b055aa8fdb1a6218e8395036ca1..2b526423ae8c2ddace239e4722ff4c99094939b4 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -1202,10 +1202,14 @@ run_user_scripts(WebKitWebView *web_view)
        if (scriptdir != NULL) {
                while ((entry = g_dir_read_name(scriptdir)) != NULL) {
                        path = g_build_filename(base, entry, NULL);
        if (scriptdir != NULL) {
                while ((entry = g_dir_read_name(scriptdir)) != NULL) {
                        path = g_build_filename(base, entry, NULL);
+                       char *jscmd = malloc(strlen(path) + 36);
+                       sprintf(jscmd, "console.log(\"Running userscript %s\");", path);
                        if (g_str_has_suffix(path, ".js")) {
                                if (g_file_get_contents(path, &contents, NULL, NULL)) {
                        if (g_str_has_suffix(path, ".js")) {
                                if (g_file_get_contents(path, &contents, NULL, NULL)) {
+                                       webkit_web_view_run_javascript(web_view, jscmd, NULL, NULL, NULL);
                                        webkit_web_view_run_javascript(web_view, contents, NULL, NULL, NULL);
                                        g_free(contents);
                                        webkit_web_view_run_javascript(web_view, contents, NULL, NULL, NULL);
                                        g_free(contents);
+                                       g_free(jscmd);
                                }
                        }
                        g_free(path);
                                }
                        }
                        g_free(path);