2 * Copyright (c) 2011 Conformal Systems LLC <info@conformal.com>
3 * Copyright (c) 2011 Marco Peereboom <marco@peereboom.us>
4 * Copyright (c) 2010, 2011, 2012 Edd Barrett <vext01@gmail.com>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
34 #include <sys/types.h>
35 #if defined(__linux__)
36 #include "linux/util.h"
37 #include "linux/tree.h"
38 #include <bsd/stdlib.h>
41 # if !defined(sane_libbsd_headers)
42 void arc4random_buf(void *, size_t);
43 u_int32_t
arc4random_uniform(u_int32_t
);
45 #elif defined(__FreeBSD__)
47 #include "freebsd/util.h"
51 #include <sys/param.h>
52 #define LOGIN_NAME_MAX MAXLOGNAME
53 #elif defined(__DragonFly__)
54 #include <sys/param.h>
57 #include "dragonfly/util.h"
60 #define LOGIN_NAME_MAX MAXLOGNAME
61 #elif defined(__NetBSD__)
62 #include <sys/param.h>
64 #include "netbsd/util.h"
67 #define LOGIN_NAME_MAX_MAXLOGNAME
68 #elif defined(__OpenBSD__)
75 void arc4random_buf(void *, size_t);
76 uint32_t arc4random_uniform(uint32_t);
79 #include <sys/queue.h>
80 #include <sys/socket.h>
86 #include <gdk/gdkkeysyms.h>
88 #if GTK_CHECK_VERSION(3,0,0)
89 /* we still use GDK_* instead of GDK_KEY_* */
90 #include <gdk/gdkkeysyms-compat.h>
93 #include <webkit/webkit.h>
94 #include <libsoup/soup.h>
95 #include <JavaScriptCore/JavaScript.h>
96 #include <gnutls/gnutls.h>
97 #include <gnutls/x509.h>
99 /* comment if you don't want to use threads */
103 /* http://seclists.org/wireshark/2011/Jul/209 */
104 #define _GCRYPT_IN_LIBGCRYPT 1
108 /* #define USE_FLUSH */
110 #define GDK_FLUSH() do { gdk_flush(); } while (0)
113 #endif /* USE_FLUSH */
117 /* set if you don't want to use resource limits */
118 #ifndef XT_RESOURCE_LIMITS_DISABLE
119 #include <sys/resource.h>
122 #include "javascript.h"
124 javascript.h borrowed from vimprobable2 under the following license:
126 Copyright (c) 2009 Leon Winter
127 Copyright (c) 2009-2011 Hannes Schueller
128 Copyright (c) 2009-2010 Matto Fransen
129 Copyright (c) 2010-2011 Hans-Peter Deifel
130 Copyright (c) 2010-2011 Thomas Adam
131 Copyright (c) 2011 Albert Kim
132 Copyright (c) 2011 Daniel Carl
134 Permission is hereby granted, free of charge, to any person obtaining a copy
135 of this software and associated documentation files (the "Software"), to deal
136 in the Software without restriction, including without limitation the rights
137 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
138 copies of the Software, and to permit persons to whom the Software is
139 furnished to do so, subject to the following conditions:
141 The above copyright notice and this permission notice shall be included in
142 all copies or substantial portions of the Software.
144 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
145 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
146 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
147 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
148 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
149 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
155 #define DPRINTF(x...) do { if (swm_debug) fprintf(stderr, x); } while (0)
156 #define DNPRINTF(n,x...) do { if (swm_debug & n) fprintf(stderr, x); } while (0)
157 #define XT_D_MOVE 0x0001
158 #define XT_D_KEY 0x0002
159 #define XT_D_TAB 0x0004
160 #define XT_D_URL 0x0008
161 #define XT_D_CMD 0x0010
162 #define XT_D_NAV 0x0020
163 #define XT_D_DOWNLOAD 0x0040
164 #define XT_D_CONFIG 0x0080
165 #define XT_D_JS 0x0100
166 #define XT_D_FAVORITE 0x0200
167 #define XT_D_PRINTING 0x0400
168 #define XT_D_COOKIE 0x0800
169 #define XT_D_KEYBINDING 0x1000
170 #define XT_D_CLIP 0x2000
171 #define XT_D_BUFFERCMD 0x4000
172 #define XT_D_INSPECTOR 0x8000
173 #define XT_D_VISITED 0x10000
174 #define XT_D_HISTORY 0x20000
175 #define XT_D_MISC 0x40000
176 #define XT_D_CUSTOM_URI 0x80000
177 #define XT_D_CMD_ALIAS 0x100000
178 #define XT_D_SEARCH 0x200000
179 #define XT_D_MTX 0x400000
180 extern uint32_t swm_debug
;
182 #define DPRINTF(x...)
183 #define DNPRINTF(n,x...)
186 #define LENGTH(x) (sizeof x / sizeof x[0])
187 #define CLEAN(mask) (mask & ~(GDK_MOD2_MASK) & \
188 ~(GDK_BUTTON1_MASK) & \
189 ~(GDK_BUTTON2_MASK) & \
190 ~(GDK_BUTTON3_MASK) & \
191 ~(GDK_BUTTON4_MASK) & \
194 #define XT_MARKS "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'"
195 #define XT_NOMARKS (sizeof(XT_MARKS) - 1)
196 #define XT_QMARKS "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
197 #define XT_NOQMARKS (sizeof(XT_QMARKS) - 1)
206 TAILQ_ENTRY(tab
) entry
;
208 GtkWidget
*tab_content
;
217 GtkWidget
*uri_entry
;
218 #if !GTK_CHECK_VERSION(3, 0, 0)
219 GtkStyle
*default_style
;
221 GtkWidget
*search_entry
;
223 GtkWidget
*browser_win
;
224 GtkWidget
*statusbar
;
226 GtkWidget
*ebox
; /* non window-less widget for colors */
228 GtkWidget
*buffercmd
;
241 GtkWidget
*js_toggle
;
242 GtkWidget
*proxy_toggle
;
243 GtkEntryCompletion
*completion
;
247 WebKitWebBackForwardList
*bfl
;
248 WebKitWebHistoryItem
*item
;
251 WebKitNetworkRequest
*icon_request
;
252 WebKitDownload
*icon_download
;
253 gchar
*icon_dest_uri
;
255 /* adjustments for browser */
256 GtkAdjustment
*adjust_h
;
257 GtkAdjustment
*adjust_v
;
261 #define XT_MODE_COMMAND (0)
262 #define XT_MODE_INSERT (1)
263 #define XT_MODE_HINT (2)
264 #define XT_MODE_PASSTHROUGH (3)
265 int (*mode_cb
)(struct tab
*, GdkEventKey
*, gpointer
);
266 gpointer mode_cb_data
;
270 int xtp_meaning
; /* identifies dls/favorites */
274 int popup
; /* 1 if cmd_entry has popup visible */
275 int download_requested
;
277 /* https thread stuff */
284 /* custom stylesheet */
294 WebKitWebSettings
*settings
;
297 gboolean load_images
;
300 double mark
[XT_NOMARKS
];
303 WebKitWebInspector
*inspector
;
304 GtkWidget
*inspector_window
;
305 GtkWidget
*inspector_view
;
307 /* focused text entry */
308 #if WEBKIT_CHECK_VERSION(1, 5, 0)
309 WebKitDOMElement
*active
;
314 gulong progress_handle
;
316 TAILQ_HEAD(tab_list
, tab
);
326 RB_ENTRY(download
) entry
;
328 WebKitDownload
*download
;
331 RB_HEAD(download_list
, download
);
332 RB_PROTOTYPE(download_list
, download
, entry
, download_rb_cmp
);
335 RB_ENTRY(history
) entry
;
338 time_t time
; /* When the item was added. */
340 RB_HEAD(history_list
, history
);
341 RB_PROTOTYPE(history_list
, history
, entry
, history_rb_cmp
);
343 #define XT_STS_FLAGS_INCLUDE_SUBDOMAINS (1)
344 #define XT_STS_FLAGS_EXPAND (2)
345 #define XT_STS_FILE ("strict-transport")
347 struct strict_transport
{
348 RB_ENTRY(strict_transport
) entry
;
353 RB_HEAD(strict_transport_tree
, strict_transport
);
354 RB_PROTOTYPE(strict_transport_tree
, strict_transport
, entry
, strict_transport_rb_cmp
);
356 struct secviolation
{
357 RB_ENTRY(secviolation
) entry
;
362 RB_HEAD(secviolation_list
, secviolation
);
363 RB_PROTOTYPE(secviolation_list
, secviolation
, entry
, secviolation_rb_cmp
);
366 RB_ENTRY(user_agent
) entry
;
370 RB_HEAD(user_agent_list
, user_agent
);
371 RB_PROTOTYPE(user_agent_list
, user_agent
, entry
, user_agent_rb_cmp
);
374 RB_ENTRY(http_accept
) entry
;
378 RB_HEAD(http_accept_list
, http_accept
);
379 RB_PROTOTYPE(http_accept_list
, http_accept
, entry
, http_accept_rb_cmp
);
382 RB_ENTRY(domain_id
) entry
;
383 int ua_id
; /* user agent id key */
384 int ha_id
; /* http accept header id key */
387 RB_HEAD(domain_id_list
, domain_id
);
388 RB_PROTOTYPE(domain_id_list
, domain_id
, entry
, domain_id_rb_cmp
);
391 #define XT_NAME ("xombrero")
392 #define XT_DIR (".xombrero")
393 #define XT_CB_HANDLED (TRUE)
394 #define XT_CB_PASSTHROUGH (FALSE)
395 #define XT_CONF_FILE ("xombrero.conf")
396 #define XT_CSS_FILE ("xombrero.css")
397 #define XT_FAVS_FILE ("favorites")
398 #define XT_SOD_FILE ("startofday")
399 #define XT_HSTS_PRELOAD_FILE ("hsts-preload")
400 #define XT_USER_AGENT_FILE ("user-agent-headers")
401 #define XT_HTTP_ACCEPT_FILE ("http-accept-headers")
402 #define XT_RESERVED_CHARS "$&+,/:;=?@ \"<>#%%{}|^~[]`"
404 int run_script(struct tab
*, char *);
405 void js_autorun(struct tab
*);
406 void xt_icon_from_file(struct tab
*, char *);
407 GtkWidget
*create_window(const gchar
*);
408 void show_oops(struct tab
*, const char *, ...);
409 gchar
*get_html_page(gchar
*, gchar
*, gchar
*, bool);
410 const gchar
*get_uri(struct tab
*);
411 const gchar
*get_title(struct tab
*, bool);
412 void load_uri(struct tab
*t
, gchar
*uri
);
413 gboolean
match_uri(const gchar
*uri
, const gchar
*key
);
414 int valid_url_type(char *);
415 void expand_tilde(char *, size_t, const char *);
416 char *html_escape(const char *val
);
417 void set_status(struct tab
*t
, gchar
*fmt
, ...);
419 void load_webkit_string(struct tab
*, const char *, gchar
*, int);
420 void button_set_stockid(GtkWidget
*, char *);
421 void button_set_file(GtkWidget
*, char *);
422 void webview_progress_changed_cb(WebKitWebView
*, GParamSpec
*, struct tab
*);
425 int remove_cookie(int);
426 int remove_cookie_domain(int);
427 int remove_cookie_all(void);
428 void print_cookie(char *msg
, SoupCookie
*);
429 void setup_cookies(void);
432 int insert_history_item(const gchar
*uri
, const gchar
*title
, time_t time
);
433 int save_global_history_to_disk(struct tab
*t
);
434 int restore_global_history(void);
435 char *color_visited_helper(void);
436 int color_visited(struct tab
*t
, char *visited
);
439 void completion_add(struct tab
*);
440 void completion_add_uri(const gchar
*uri
);
442 /* external editor */
443 #define XT_EE_BUFSZ (64 * 1024)
444 int edit_src(struct tab
*t
, struct karg
*args
);
445 int edit_element(struct tab
*t
, struct karg
*a
);
448 #define XT_PRXY_SHOW (1<<0)
449 #define XT_PRXY_TOGGLE (1<<1)
452 #define XT_INS_SHOW (1<<0)
453 #define XT_INS_HIDE (1<<1)
454 #define XT_INS_CLOSE (1<<2)
456 WebKitWebView
* inspector_inspect_web_view_cb(WebKitWebInspector
*,
457 WebKitWebView
*, struct tab
*);
458 void setup_inspector(struct tab
*);
459 int inspector_cmd(struct tab
*, struct karg
*);
461 /* tld public suffix */
462 void tld_tree_init();
463 char *tld_get_suffix(const char *);
466 #define XT_XTP_STR "xxxt://"
467 #define XT_XTP_SCHEME "xxxt"
468 #define XT_URI_ABOUT ("about:")
469 #define XT_URI_ABOUT_LEN (strlen(XT_URI_ABOUT))
470 #define XT_URI_ABOUT_ABOUT ("about")
471 #define XT_URI_ABOUT_ALLTHETHINGS ("allthethings")
472 #define XT_URI_ABOUT_BLANK ("blank")
473 #define XT_URI_ABOUT_CERTS ("certs")
474 #define XT_URI_ABOUT_COOKIEWL ("cookiewl")
475 #define XT_URI_ABOUT_COOKIEJAR ("cookiejar")
476 #define XT_URI_ABOUT_DOWNLOADS ("downloads")
477 #define XT_URI_ABOUT_FAVORITES ("favorites")
478 #define XT_URI_ABOUT_HELP ("help")
479 #define XT_URI_ABOUT_HISTORY ("history")
480 #define XT_URI_ABOUT_JSWL ("jswl")
481 #define XT_URI_ABOUT_PLUGINWL ("plwl")
482 #define XT_URI_ABOUT_HTTPS ("https")
483 #define XT_URI_ABOUT_SET ("set")
484 #define XT_URI_ABOUT_STATS ("stats")
485 #define XT_URI_ABOUT_MARCO ("marco")
486 #define XT_URI_ABOUT_STARTPAGE ("startpage")
487 #define XT_URI_ABOUT_WEBKIT ("webkit")
488 #define XT_URI_ABOUT_SEARCH ("search")
489 #define XT_URI_ABOUT_SECVIOLATION ("secviolation")
490 #define XT_URI_ABOUT_RUNTIME ("runtime")
494 int (*func
)(struct tab
*, struct karg
*);
499 TAILQ_ENTRY(sp
) entry
;
501 TAILQ_HEAD(sp_list
, sp
);
503 int blank(struct tab
*, struct karg
*);
504 int help(struct tab
*, struct karg
*);
505 int stats(struct tab
*, struct karg
*);
506 void show_certs(struct tab
*, gnutls_x509_crt_t
*,
508 int ca_cmd(struct tab
*, struct karg
*);
509 int cookie_show_wl(struct tab
*, struct karg
*);
510 int xtp_page_ab(struct tab
*, struct karg
*);
511 int xtp_page_cl(struct tab
*, struct karg
*);
512 int xtp_page_dl(struct tab
*, struct karg
*);
513 int xtp_page_fl(struct tab
*, struct karg
*);
514 int xtp_page_hl(struct tab
*, struct karg
*);
515 int xtp_page_sl(struct tab
*, struct karg
*);
516 int xtp_page_sv(struct tab
*, struct karg
*);
517 int parse_xtp_url(struct tab
*, const char *);
518 int add_favorite(struct tab
*, struct karg
*);
519 void update_favorite_tabs(struct tab
*);
520 void update_history_tabs(struct tab
*);
521 void update_download_tabs(struct tab
*);
522 size_t about_list_size(void);
523 int cookie_cmd(struct tab
*, struct karg
*);
524 int js_cmd(struct tab
*, struct karg
*);
525 int pl_cmd(struct tab
*, struct karg
*);
526 int https_cmd(struct tab
*, struct karg
*);
527 void startpage_add(const char *, ...);
531 * identifies which tabs have xtp pages in (corresponding to about_list indices)
533 #define XT_XTP_TAB_MEANING_NORMAL (-1) /* normal url */
534 #define XT_XTP_TAB_MEANING_AB (0) /* any other about page */
535 #define XT_XTP_TAB_MEANING_BL (2) /* about:blank in this tab */
536 #define XT_XTP_TAB_MEANING_CL (5) /* cookie manager in this tab */
537 #define XT_XTP_TAB_MEANING_DL (6) /* download manager in this tab */
538 #define XT_XTP_TAB_MEANING_FL (7) /* favorite manager in this tab */
539 #define XT_XTP_TAB_MEANING_HL (9) /* history manager in this tab */
540 #define XT_XTP_TAB_MEANING_SET (11) /* settings manager/viewer */
541 #define XT_XTP_TAB_MEANING_SL (18) /* search engine chooser */
542 #define XT_XTP_TAB_MEANING_RT (19) /* about:runtime in this tab */
543 #define XT_XTP_TAB_MEANING_SV (20) /* about:secviolation in tab */
546 #define XT_WL_TOGGLE (1<<0)
547 #define XT_WL_ENABLE (1<<1)
548 #define XT_WL_DISABLE (1<<2)
549 #define XT_WL_FQDN (1<<3) /* default */
550 #define XT_WL_TOPLEVEL (1<<4)
551 #define XT_WL_PERSISTENT (1<<5)
552 #define XT_WL_SESSION (1<<6)
553 #define XT_WL_RELOAD (1<<7)
554 #define XT_SHOW (1<<8)
555 #define XT_DELETE (1<<9)
556 #define XT_SAVE (1<<10)
557 #define XT_OPEN (1<<11)
558 #define XT_CACHE (1<<12)
559 #define XT_WL_REGEX (1<<13)
561 #define XT_WL_INVALID (0)
562 #define XT_WL_JAVASCRIPT (1)
563 #define XT_WL_COOKIE (2)
564 #define XT_WL_PLUGIN (3)
565 #define XT_WL_HTTPS (4)
570 int handy
; /* app use */
571 TAILQ_ENTRY(wl_entry
) entry
;
573 TAILQ_HEAD(wl_list
, wl_entry
);
575 int wl_show(struct tab
*, struct karg
*, char *,
582 TAILQ_ENTRY(alias
) entry
;
584 TAILQ_HEAD(alias_list
, alias
);
592 TAILQ_ENTRY(mime_type
) entry
;
594 TAILQ_HEAD(mime_type_list
, mime_type
);
596 struct wl_entry
* wl_find(const gchar
*, struct wl_list
*);
597 int wl_save(struct tab
*, struct karg
*, int);
598 int toggle_cwl(struct tab
*, struct karg
*);
599 int toggle_js(struct tab
*, struct karg
*);
600 int toggle_pl(struct tab
*, struct karg
*);
601 int toggle_force_https(struct tab
*, struct karg
*);
603 /* input autofocus */
604 void input_autofocus(struct tab
*);
605 void *input_check_mode(struct tab
*);
606 int command_mode(struct tab
*, struct karg
*);
609 #define XT_BM_NORMAL (0)
610 #define XT_BM_WHITELIST (1)
611 #define XT_BM_KIOSK (2)
613 #define XT_GM_CLASSIC (0)
614 #define XT_GM_MINIMAL (1)
616 #define XT_TABS_NORMAL (0)
617 #define XT_TABS_COMPACT (1)
619 #define XT_STATUSBAR_URL (0)
620 #define XT_STATUSBAR_TITLE (1)
622 #define XT_EM_HYBRID (0)
625 #define XT_DM_START (0)
626 #define XT_DM_ASK (1)
627 #define XT_DM_ADD (2)
629 #define XT_REFERER_ALWAYS (0)
630 #define XT_REFERER_NEVER (1)
631 #define XT_REFERER_SAME_DOMAIN (2)
632 #define XT_REFERER_CUSTOM (3)
633 #define XT_REFERER_SAME_FQDN (4)
635 #define CTRL GDK_CONTROL_MASK
636 #define MOD1 GDK_MOD1_MASK
637 #define SHFT GDK_SHIFT_MASK
639 /* runtime default settings */
640 #define XT_DS_SHOW_TABS (1)
641 #define XT_DS_TAB_STYLE XT_TABS_NORMAL
642 #define XT_DS_STATUSBAR_STYLE XT_STATUSBAR_URL
643 #define XT_DS_SHOW_URL (1)
644 #define XT_DS_SHOW_SCROLLBARS (1)
645 #define XT_DS_SHOW_STATUSBAR (0)
646 #define XT_DS_CTRL_CLICK_FOCUS (0)
647 #define XT_DS_COOKIES_ENABLED (1)
648 #define XT_DS_READ_ONLY_COOKIES (0)
649 #define XT_DS_ENABLE_SCRIPTS (1)
650 #define XT_DS_ENABLE_PLUGINS (1)
651 #define XT_DS_DEFAULT_ZOOM_LEVEL (1.0)
652 #define XT_DS_DEFAULT_SCRIPT ("")
653 #define XT_DS_REFRESH_INTERVAL (10)
654 #define XT_DS_ENABLE_PLUGIN_WHITELIST (0)
655 #define XT_DS_ENABLE_COOKIE_WHITELIST (0)
656 #define XT_DS_ENABLE_JS_WHITELIST (0)
657 #define XT_DS_ENABLE_LOCALSTORAGE (1)
658 #define XT_DS_SESSION_TIMEOUT (3600)
659 #define XT_DS_COOKIE_POLICY SOUP_COOKIE_JAR_ACCEPT_ALWAYS
660 #define XT_DS_SSL_STRICT_CERTS FALSE
661 #define XT_DS_SSL_CA_FILE ("")
662 #define XT_DS_ENABLE_STRICT_TRANSPORT TRUE
663 #define XT_DS_APPEND_NEXT (1)
664 #define XT_DS_HOME ("https://www.cyphertite.com/")
665 #define XT_DS_SEARCH_STRING ("about:search")
666 #define XT_DS_COLOR_VISITED_URIS (1)
667 #define XT_DS_SESSION_AUTOSAVE (0)
668 #define XT_DS_GUESS_SEARCH (0)
669 #define XT_DS_ENABLE_SPELL_CHECKING (0)
670 #define XT_DS_SPELL_CHECK_LANGUAGES ("en_US")
671 #define XT_DS_URL_REGEX ("^[[:blank:]]*[^[:blank:]]*([[:alnum:]-]+\\.)+[[:alnum:]-][^[:blank:]]*[[:blank:]]*$")
672 #define XT_DS_ENCODING ("UTF-8")
673 #define XT_DS_AUTOFOCUS_ONLOAD (0)
674 #define XT_DS_ENABLE_JS_AUTORUN (1)
675 #define XT_DS_USERSTYLE_GLOBAL (0)
676 #define XT_DS_AUTO_LOAD_IMAGES (1)
677 #define XT_DS_ENABLE_AUTOSCROLL (0)
678 #define XT_DS_ENABLE_FAVICON_ENTRY (1)
679 #define XT_DS_ENABLE_FAVICON_TABS (0)
680 #define XT_DS_EXTERNAL_EDITOR (NULL)
681 #define XT_DS_REFERER_MODE XT_REFERER_ALWAYS
682 #define XT_DS_REFERER_CUSTOM ("always")
683 #define XT_DS_DOWNLOAD_NOTIFICATIONS (0)
684 #define XT_DS_CMD_FONT_NAME ("monospace normal 9")
685 #define XT_DS_OOPS_FONT_NAME ("monospace normal 9")
686 #define XT_DS_STATUSBAR_FONT_NAME ("monospace normal 9")
687 #define XT_DS_TABBAR_FONT_NAME ("monospace normal 9")
688 #define XT_DS_ALLOW_INSECURE_CONTENT (TRUE)
689 #define XT_DS_ALLOW_INSECURE_SCRIPTS (TRUE)
690 #define XT_DS_WARN_CERT_CHANGES (0)
691 #define XT_DS_RESOURCE_DIR ("/usr/local/share/xombrero")
692 #define XT_DS_DO_NOT_TRACK (0)
693 #define XT_DS_PRELOAD_STRICT_TRANSPORT (1)
694 #define XT_DS_GNUTLS_PRIORITY_STRING (NULL)
698 #define XT_STYLE_CURRENT_TAB (0)
699 #define XT_STYLE_GLOBAL (1)
701 #define XT_TAB_LAST (-4)
702 #define XT_TAB_FIRST (-3)
703 #define XT_TAB_PREV (-2)
704 #define XT_TAB_NEXT (-1)
705 #define XT_TAB_INVALID (0)
706 #define XT_TAB_NEW (1)
707 #define XT_TAB_DELETE (2)
708 #define XT_TAB_DELQUIT (3)
709 #define XT_TAB_OPEN (4)
710 #define XT_TAB_UNDO_CLOSE (5)
711 #define XT_TAB_SHOW (6)
712 #define XT_TAB_HIDE (7)
713 #define XT_TAB_NEXTSTYLE (8)
714 #define XT_TAB_LOAD_IMAGES (9)
715 #define XT_TAB_ONLY (10)
717 #define XT_URL_SHOW (1)
718 #define XT_URL_HIDE (2)
720 /* XTP classes (xxxt://<class>) */
721 #define XT_XTP_INVALID (0) /* invalid */
722 #define XT_XTP_DL (1) /* downloads */
723 #define XT_XTP_HL (2) /* history */
724 #define XT_XTP_CL (3) /* cookies */
725 #define XT_XTP_FL (4) /* favorites */
726 #define XT_XTP_SL (5) /* search */
727 #define XT_XTP_AB (6) /* about */
728 #define XT_XTP_SV (7) /* security violation */
729 #define XT_XTP_RT (8) /* set */
731 /* XTP download actions */
732 #define XT_XTP_DL_LIST (1)
733 #define XT_XTP_DL_CANCEL (2)
734 #define XT_XTP_DL_REMOVE (3)
735 #define XT_XTP_DL_UNLINK (4)
736 #define XT_XTP_DL_START (5)
738 /* XTP history actions */
739 #define XT_XTP_HL_LIST (1)
740 #define XT_XTP_HL_REMOVE (2)
741 #define XT_XTP_HL_REMOVE_ALL (3)
743 /* XTP cookie actions */
744 #define XT_XTP_CL_LIST (1)
745 #define XT_XTP_CL_REMOVE (2)
746 #define XT_XTP_CL_REMOVE_DOMAIN (3)
747 #define XT_XTP_CL_REMOVE_ALL (4)
749 /* XTP cookie actions */
750 #define XT_XTP_FL_LIST (1)
751 #define XT_XTP_FL_REMOVE (2)
753 /* XPT search actions */
754 #define XT_XTP_SL_SET (1)
756 /* XPT about actions */
757 #define XT_XTP_AB_EDIT_CONF (1)
759 /* XTP security violation actions */
760 #define XT_XTP_SV_SHOW_NEW_CERT (1)
761 #define XT_XTP_SV_ALLOW_SESSION (2)
762 #define XT_XTP_SV_CACHE (3)
763 #define XT_XTP_SV_SHOW_CACHED_CERT (4)
765 /* XTP set actions */
766 #define XT_XTP_RT_SAVE (1)
768 /* needed for xtp_page_rt in settings.c */
769 void generate_xtp_session_key(char **);
776 TAILQ_ENTRY(key_binding
) entry
; /* in bss so no need to init */
778 TAILQ_HEAD(keybinding_list
, key_binding
);
783 TAILQ_ENTRY(custom_uri
) entry
;
785 TAILQ_HEAD(custom_uri_list
, custom_uri
);
790 TAILQ_ENTRY(cmd_alias
) entry
;
792 TAILQ_HEAD(cmd_alias_list
, cmd_alias
);
797 TAILQ_ENTRY(set_reject
) entry
;
799 TAILQ_HEAD(set_reject_list
, set_reject
);
804 #define XT_S_INVALID (0)
807 #define XT_S_FLOAT (3)
808 #define XT_S_BOOL (4)
810 #define XT_SF_RESTART (1<<0)
811 #define XT_SF_RUNTIME (1<<1)
812 #define XT_SF_INVISIBLE (1<<2)
817 int (*activate
)(char *);
818 int (*ismodified
)(char **);
823 int (*set
)(struct settings
*, char *);
824 char *(*get
)(struct settings
*);
825 void (*walk
)(struct settings
*,
826 void (*cb
)(struct settings
*, char *, void *),
828 char *valid_options
[];
831 int set(struct tab
*, struct karg
*);
832 int xtp_page_rt(struct tab
*, struct karg
*);
833 size_t get_settings_size(void);
834 int settings_add(char *, char *);
835 void setup_proxy(char *);
836 int set_browser_mode(struct settings
*, char *);
837 int set_encoding(struct tab
*, struct karg
*);
838 int set_gui_mode(struct settings
*, char *);
839 int set_cookie_policy(struct settings
*, char *);
840 int set_search_string(char *);
841 int set_ssl_ca_file(struct settings
*, char *);
842 char *get_browser_mode(struct settings
*);
843 char *get_gui_mode(struct settings
*);
844 char *get_cookie_policy(struct settings
*);
845 void init_keybindings(void);
846 void config_parse(char *, int);
847 char *get_setting_name(int);
848 void statusbar_set_visibility(void);
849 int tabaction(struct tab
*, struct karg
*);
850 int urlaction(struct tab
*, struct karg
*);
851 int userstyle_cmd(struct tab
*, struct karg
*);
852 struct tab
*get_current_tab(void);
853 int resizetab(struct tab
*, struct karg
*);
854 int cert_cmd(struct tab
*, struct karg
*);
855 void focus_webview(struct tab
*);
856 int is_g_object_setting(GObject
*, char *);
857 int set_scrollbar_visibility(struct tab
*, int);
858 int save_runtime_setting(const char *, const char *);
859 void wl_add(const char *, struct wl_list
*, int);
861 #define XT_DL_START (0)
862 #define XT_DL_RESTART (1)
863 int download_start(struct tab
*, struct download
*, int flag
);
866 extern int enable_socket
;
867 extern int single_instance
;
868 extern int fancy_bar
;
869 extern int browser_mode
;
870 extern int enable_localstorage
;
871 extern char *statusbar_elems
;
872 extern SoupURI
*proxy_uri
;
874 extern int show_tabs
;
875 extern int tab_style
;
876 extern int statusbar_style
;
878 extern int show_scrollbars
;
879 extern int show_statusbar
;
880 extern int ctrl_click_focus
;
881 extern int cookies_enabled
;
882 extern int read_only_cookies
;
883 extern int enable_scripts
;
884 extern int enable_plugins
;
885 extern gfloat default_zoom_level
;
886 extern char default_script
[PATH_MAX
];
887 extern int window_height
;
888 extern int window_width
;
889 extern int window_maximize
;
890 extern int icon_size
;
891 extern int refresh_interval
;
892 extern int enable_plugin_whitelist
;
893 extern int enable_cookie_whitelist
;
894 extern int enable_js_whitelist
;
895 extern int session_timeout
;
896 extern int cookie_policy
;
897 extern char ssl_ca_file
[PATH_MAX
];
898 extern char *resource_dir
;
899 extern gboolean ssl_strict_certs
;
900 extern gboolean enable_strict_transport
;
901 extern int append_next
;
903 extern char *search_string
;
904 extern char *http_proxy
;
905 extern int http_proxy_starts_enabled
;
906 extern char *external_editor
;
907 extern char download_dir
[PATH_MAX
];
908 extern int download_mode
;
909 extern char runtime_settings
[PATH_MAX
];
910 extern int allow_volatile_cookies
;
911 extern int color_visited_uris
;
912 extern int save_global_history
;
913 extern int save_rejected_cookies
;
914 extern int session_autosave
;
915 extern int guess_search
;
916 extern gint max_connections
;
917 extern gint max_host_connections
;
918 extern gint enable_spell_checking
;
919 extern char *spell_check_languages
;
920 extern char *url_regex
;
921 extern int history_autosave
;
922 extern char search_file
[PATH_MAX
];
923 extern char command_file
[PATH_MAX
];
924 extern char *encoding
;
925 extern int autofocus_onload
;
926 extern int enable_js_autorun
;
927 extern char *cmd_font_name
;
928 extern char *oops_font_name
;
929 extern char *statusbar_font_name
;
930 extern char *tabbar_font_name
;
931 extern int edit_mode
;
932 extern char *userstyle
;
933 extern char *stylesheet
;
934 extern int userstyle_global
;
935 extern int auto_load_images
;
936 extern int enable_autoscroll
;
937 extern int enable_favicon_entry
;
938 extern int enable_favicon_tabs
;
939 extern int referer_mode
;
940 extern char *referer_custom
;
941 extern int download_notifications
;
942 extern int warn_cert_changes
;
943 extern regex_t url_re
;
944 extern int allow_insecure_content
;
945 extern int allow_insecure_scripts
;
946 extern int do_not_track
;
947 extern int preload_strict_transport
;
948 extern char *gnutls_priority_string
;
949 extern int anonymize_headers
;
952 extern void (*os_init
)(void);
953 extern char *version
;
954 extern char *icons
[];
955 extern char rc_fname
[PATH_MAX
];
956 extern char work_dir
[PATH_MAX
];
957 extern char temp_dir
[PATH_MAX
];
958 extern struct passwd
*pwd
;
959 extern SoupCookieJar
*s_cookiejar
;
960 extern SoupCookieJar
*p_cookiejar
;
961 extern SoupSession
*session
;
962 extern GtkNotebook
*notebook
;
963 extern GtkListStore
*completion_model
;
964 extern uint64_t blocked_cookies
;
965 extern SoupSession
*session
;
967 extern void (*_soup_cookie_jar_add_cookie
)(SoupCookieJar
*, SoupCookie
*);
969 extern struct history_list hl
;
970 extern int hl_purge_count
;
971 extern struct download_list downloads
;
972 extern struct tab_list tabs
;
973 extern struct about_type about_list
[];
974 extern struct wl_list c_wl
;
975 extern struct wl_list js_wl
;
976 extern struct wl_list pl_wl
;
977 extern struct wl_list force_https
;
978 extern struct wl_list svil
;
979 extern struct strict_transport_tree st_tree
;
980 extern struct alias_list aliases
;
981 extern struct mime_type_list mtl
;
982 extern struct keybinding_list kbl
;
983 extern struct sp_list spl
;
984 extern struct user_agent_list ua_list
;
985 extern struct http_accept_list ha_list
;
986 extern struct cmd_alias_list cal
;
987 extern struct custom_uri_list cul
;
988 extern struct secviolation_list svl
;
989 extern struct set_reject_list srl
;
990 extern struct settings rs
[];
992 extern PangoFontDescription
*cmd_font
;
993 extern PangoFontDescription
*oops_font
;
994 extern PangoFontDescription
*statusbar_font
;
995 extern PangoFontDescription
*tabbar_font
;