Compare commits
23 Commits
2.0
...
surf-webkit1
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c640fe0f5 | |||
| 9ba143baba | |||
| 58634c74b3 | |||
| ab16fa5e7c | |||
| dcabd0239e | |||
| 6c8da4c851 | |||
| 31ec0fb93d | |||
| 1308872b8b | |||
| f5e8baad06 | |||
| 842103322c | |||
| 7895fb9c5d | |||
| fd6e80a279 | |||
| 743fa9f3d1 | |||
| 0ac6bf5a97 | |||
| 3d81a0f0b7 | |||
| 018a67986d | |||
| 3393ded725 | |||
| cd7f831776 | |||
| 86efaf8093 | |||
| 9fa4ffef72 | |||
| 002e82d188 | |||
| bae5a785b3 | |||
| b7a359a84f |
@@ -0,0 +1,85 @@
|
|||||||
|
Code of Conduct
|
||||||
|
===============
|
||||||
|
|
||||||
|
> ==Phrack Inc.==
|
||||||
|
> Volume One, Issue 7, Phile 3 of 10
|
||||||
|
>
|
||||||
|
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
|
>
|
||||||
|
> The following was written shortly after my arrest...
|
||||||
|
>
|
||||||
|
> \/\The Conscience of a Hacker/\/
|
||||||
|
>
|
||||||
|
> by
|
||||||
|
>
|
||||||
|
> +++The Mentor+++
|
||||||
|
>
|
||||||
|
> Written on January 8, 1986
|
||||||
|
>
|
||||||
|
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
|
>
|
||||||
|
> Another one got caught today, it's all over the papers. "Teenager
|
||||||
|
> Arrested in Computer Crime Scandal", "Hacker Arrested after Bank Tampering"...
|
||||||
|
> Damn kids. They're all alike.
|
||||||
|
>
|
||||||
|
> But did you, in your three-piece psychology and 1950's technobrain,
|
||||||
|
> ever take a look behind the eyes of the hacker? Did you ever wonder what
|
||||||
|
> made him tick, what forces shaped him, what may have molded him?
|
||||||
|
> I am a hacker, enter my world...
|
||||||
|
> Mine is a world that begins with school... I'm smarter than most of
|
||||||
|
> the other kids, this crap they teach us bores me...
|
||||||
|
> Damn underachiever. They're all alike.
|
||||||
|
>
|
||||||
|
> I'm in junior high or high school. I've listened to teachers explain
|
||||||
|
> for the fifteenth time how to reduce a fraction. I understand it. "No, Ms.
|
||||||
|
> Smith, I didn't show my work. I did it in my head..."
|
||||||
|
> Damn kid. Probably copied it. They're all alike.
|
||||||
|
>
|
||||||
|
> I made a discovery today. I found a computer. Wait a second, this is
|
||||||
|
> cool. It does what I want it to. If it makes a mistake, it's because I
|
||||||
|
> screwed it up. Not because it doesn't like me...
|
||||||
|
> Or feels threatened by me...
|
||||||
|
> Or thinks I'm a smart ass...
|
||||||
|
> Or doesn't like teaching and shouldn't be here...
|
||||||
|
> Damn kid. All he does is play games. They're all alike.
|
||||||
|
>
|
||||||
|
> And then it happened... a door opened to a world... rushing through
|
||||||
|
> the phone line like heroin through an addict's veins, an electronic pulse is
|
||||||
|
> sent out, a refuge from the day-to-day incompetencies is sought... a board is
|
||||||
|
> found.
|
||||||
|
> "This is it... this is where I belong..."
|
||||||
|
> I know everyone here... even if I've never met them, never talked to
|
||||||
|
> them, may never hear from them again... I know you all...
|
||||||
|
> Damn kid. Tying up the phone line again. They're all alike...
|
||||||
|
>
|
||||||
|
> You bet your ass we're all alike... we've been spoon-fed baby food at
|
||||||
|
> school when we hungered for steak... the bits of meat that you did let slip
|
||||||
|
> through were pre-chewed and tasteless. We've been dominated by sadists, or
|
||||||
|
> ignored by the apathetic. The few that had something to teach found us will-
|
||||||
|
> ing pupils, but those few are like drops of water in the desert.
|
||||||
|
>
|
||||||
|
> This is our world now... the world of the electron and the switch, the
|
||||||
|
> beauty of the baud. We make use of a service already existing without paying
|
||||||
|
> for what could be dirt-cheap if it wasn't run by profiteering gluttons, and
|
||||||
|
> you call us criminals. We explore... and you call us criminals. We seek
|
||||||
|
> after knowledge... and you call us criminals. We exist without skin color,
|
||||||
|
> without nationality, without religious bias... and you call us criminals.
|
||||||
|
> You build atomic bombs, you wage wars, you murder, cheat, and lie to us
|
||||||
|
> and try to make us believe it's for our own good, yet we're the criminals.
|
||||||
|
>
|
||||||
|
> Yes, I am a criminal. My crime is that of curiosity. My crime is
|
||||||
|
> that of judging people by what they say and think, not what they look like.
|
||||||
|
> My crime is that of outsmarting you, something that you will never forgive me
|
||||||
|
> for.
|
||||||
|
>
|
||||||
|
> I am a hacker, and this is my manifesto. You may stop this individual,
|
||||||
|
> but you can't stop us all... after all, we're all alike.
|
||||||
|
|
||||||
|
Keep to your sanity, question the world, even this manifest.
|
||||||
|
|
||||||
|
Don't follow morals, nothing is right or wrong.
|
||||||
|
|
||||||
|
Have fun.
|
||||||
|
|
||||||
|
Yours project maintainer on 2016-01-27.
|
||||||
|
|
||||||
@@ -1,8 +1,32 @@
|
|||||||
MIT/X Consortium License
|
MIT/X Consortium License
|
||||||
|
|
||||||
© 2011-2012 Troels Henriksen <athas@sigkill.at>
|
© 2009-2010 Enno Boland <tox@s01.de>
|
||||||
© 2009-2011 Enno Boland <g s01 de>
|
© 2009 Thomas Menari <spaceinvader@chaotika.org>
|
||||||
© 2012 Christoph Lohmann <20h@r-36.net>
|
© 2009 Simon Rozet <simon@rozet.name>
|
||||||
|
© 2009 Andrew Antle <andrew.antle@gmail.com>
|
||||||
|
© 2010-2011 pancake <nopcode.org>
|
||||||
|
© 2011-2013 Anselm R Garbe <anselm@garbe.us>
|
||||||
|
© 2011-2012 Troels Henriksen <athas@sigkill.dk>
|
||||||
|
© 2011 Connor Lane Smith <cls@lubutu.com>
|
||||||
|
© 2012-2017 Christoph Lohmann <20h@r-36.net>
|
||||||
|
© 2013 Shayan Pooya <shayan@liveve.org>
|
||||||
|
© 2013 Jens Nyberg <jens.nyberg@gmail.com>
|
||||||
|
© 2013 Carlos J. Torres <vlaadbrain@gmail.com>
|
||||||
|
© 2013 Alexander Sedov <alex0player@gmail.com>
|
||||||
|
© 2013 Nick White <git@njw.me.uk>
|
||||||
|
© 2013 David Dufberg <david@dufberg.se>
|
||||||
|
© 2014-2017 Quentin Rameau <quinq@fifth.space>
|
||||||
|
© 2014-2016 Markus Teich <markus.teich@stusta.mhn.de>
|
||||||
|
© 2015 Jakukyo Friel <weakish@gmail.com>
|
||||||
|
© 2015 Ben Woolley <tautolog@gmail.com>
|
||||||
|
© 2015 Greg Reagle <greg.reagle@umbc.edu>
|
||||||
|
© 2015 GhostAV <ghostav@riseup.net>
|
||||||
|
© 2015 Ivan Tham <pickfire@riseup.net>
|
||||||
|
© 2015 Alexander Huemer <alexander.huemer@xx.vu>
|
||||||
|
© 2015 Michael Stevens <mstevens@etla.org>
|
||||||
|
© 2015 Felix Janda <felix.janda@posteo.de>
|
||||||
|
© 2016 Charles Lehner <cel@celehner.com>
|
||||||
|
© 2016 Dmitry Bogatov <KAction@gnu.org>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
|||||||
@@ -3,39 +3,46 @@
|
|||||||
* by 20h
|
* by 20h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ARG_H__
|
#ifndef ARG_H__
|
||||||
#define __ARG_H__
|
#define ARG_H__
|
||||||
|
|
||||||
extern char *argv0;
|
extern char *argv0;
|
||||||
|
|
||||||
#define USED(x) ((void)(x))
|
/* use main(int argc, char *argv[]) */
|
||||||
|
|
||||||
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
|
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
|
||||||
argv[0] && argv[0][1]\
|
argv[0] && argv[0][0] == '-'\
|
||||||
&& argv[0][0] == '-';\
|
&& argv[0][1];\
|
||||||
argc--, argv++) {\
|
argc--, argv++) {\
|
||||||
char _argc;\
|
char argc_;\
|
||||||
char **_argv;\
|
char **argv_;\
|
||||||
|
int brk_;\
|
||||||
if (argv[0][1] == '-' && argv[0][2] == '\0') {\
|
if (argv[0][1] == '-' && argv[0][2] == '\0') {\
|
||||||
argv++;\
|
argv++;\
|
||||||
argc--;\
|
argc--;\
|
||||||
break;\
|
break;\
|
||||||
}\
|
}\
|
||||||
for (argv[0]++, _argv = argv; argv[0][0];\
|
for (brk_ = 0, argv[0]++, argv_ = argv;\
|
||||||
|
argv[0][0] && !brk_;\
|
||||||
argv[0]++) {\
|
argv[0]++) {\
|
||||||
if (_argv != argv)\
|
if (argv_ != argv)\
|
||||||
break;\
|
break;\
|
||||||
_argc = argv[0][0];\
|
argc_ = argv[0][0];\
|
||||||
switch (_argc)
|
switch (argc_)
|
||||||
|
|
||||||
#define ARGEND }\
|
#define ARGEND }\
|
||||||
USED(_argc);\
|
}
|
||||||
}\
|
|
||||||
USED(argv);\
|
|
||||||
USED(argc);
|
|
||||||
|
|
||||||
#define EARGF(x) ((argv[1] == NULL)? ((x), abort(), (char *)0) :\
|
#define ARGC() argc_
|
||||||
(argc--, argv++, argv[0]))
|
|
||||||
|
#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\
|
||||||
|
((x), abort(), (char *)0) :\
|
||||||
|
(brk_ = 1, (argv[0][1] != '\0')?\
|
||||||
|
(&argv[0][1]) :\
|
||||||
|
(argc--, argv++, argv[0])))
|
||||||
|
|
||||||
|
#define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\
|
||||||
|
(char *)0 :\
|
||||||
|
(brk_ = 1, (argv[0][1] != '\0')?\
|
||||||
|
(&argv[0][1]) :\
|
||||||
|
(argc--, argv++, argv[0])))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -17,7 +17,7 @@ static gfloat zoomlevel = 1.0; /* Default zoom level */
|
|||||||
/* Soup default features */
|
/* Soup default features */
|
||||||
static char *cookiefile = "~/.surf/cookies.txt";
|
static char *cookiefile = "~/.surf/cookies.txt";
|
||||||
static char *cookiepolicies = "Aa@"; /* A: accept all; a: accept nothing,
|
static char *cookiepolicies = "Aa@"; /* A: accept all; a: accept nothing,
|
||||||
* @: accept no third party */
|
* @: accept all except third party */
|
||||||
static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
|
static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
|
||||||
static Bool strictssl = FALSE; /* Refuse untrusted SSL connections */
|
static Bool strictssl = FALSE; /* Refuse untrusted SSL connections */
|
||||||
static time_t sessiontime = 3600;
|
static time_t sessiontime = 3600;
|
||||||
@@ -48,7 +48,7 @@ static Bool allowgeolocation = TRUE;
|
|||||||
/* DOWNLOAD(URI, referer) */
|
/* DOWNLOAD(URI, referer) */
|
||||||
#define DOWNLOAD(d, r) { \
|
#define DOWNLOAD(d, r) { \
|
||||||
.v = (char *[]){ "/bin/sh", "-c", \
|
.v = (char *[]){ "/bin/sh", "-c", \
|
||||||
"st -e /bin/sh -c \"curl -L -J -O --user-agent '$1'" \
|
"st -e /bin/sh -c \"curl -g -L -J -O --user-agent '$1'" \
|
||||||
" --referer '$2' -b $3 -c $3 '$0';" \
|
" --referer '$2' -b $3 -c $3 '$0';" \
|
||||||
" sleep 5;\"", \
|
" sleep 5;\"", \
|
||||||
d, useragent, r, cookiefile, NULL \
|
d, useragent, r, cookiefile, NULL \
|
||||||
@@ -127,6 +127,7 @@ static Key keys[] = {
|
|||||||
{ MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
|
{ MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
|
||||||
{ MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } },
|
{ MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } },
|
||||||
{ MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } },
|
{ MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } },
|
||||||
|
{ MODKEY|GDK_SHIFT_MASK,GDK_y, toggleproxy, { 0 } },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* button definitions */
|
/* button definitions */
|
||||||
@@ -139,3 +140,4 @@ static Button buttons[] = {
|
|||||||
{ ClkAny, 0, 8, navigate, { .i = -1 } },
|
{ ClkAny, 0, 8, navigate, { .i = -1 } },
|
||||||
{ ClkAny, 0, 9, navigate, { .i = +1 } },
|
{ ClkAny, 0, 9, navigate, { .i = +1 } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# surf version
|
# surf version
|
||||||
VERSION = 0.6
|
VERSION = 1.8
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
|||||||
@@ -221,11 +221,14 @@ Toggle script execution. This will reload the page.
|
|||||||
Toggle the enabling of plugins on that surf instance. This will reload the
|
Toggle the enabling of plugins on that surf instance. This will reload the
|
||||||
page.
|
page.
|
||||||
.TP
|
.TP
|
||||||
|
.B Ctrl\-Shift\-y
|
||||||
|
Toggle if a proxy should be used (if one is set in the environment).
|
||||||
|
.TP
|
||||||
.B F11
|
.B F11
|
||||||
Toggle fullscreen mode.
|
Toggle fullscreen mode.
|
||||||
.SH INDICATORS OF OPERATION
|
.SH INDICATORS OF OPERATION
|
||||||
Surf is showing indicators of operation in front of the site title.
|
Surf is showing indicators of operation in front of the site title.
|
||||||
For all indicators, unless otherwsie specified, a lower case letter means disabled and an upper case letter means enabled.
|
For all indicators, unless otherwise specified, a lower case letter means disabled and an upper case letter means enabled.
|
||||||
.TP
|
.TP
|
||||||
.B A
|
.B A
|
||||||
all cookies accepted
|
all cookies accepted
|
||||||
@@ -283,6 +286,13 @@ string
|
|||||||
.TP
|
.TP
|
||||||
.B http_proxy
|
.B http_proxy
|
||||||
If this variable is set and not empty upon startup, surf will use it as the http proxy
|
If this variable is set and not empty upon startup, surf will use it as the http proxy
|
||||||
|
.TP
|
||||||
|
.B no_proxy
|
||||||
|
If both http_proxy is set and no_proxy contain a
|
||||||
|
.BR comma-separated
|
||||||
|
list of domain extensions and both is not empty upon startup, proxy will
|
||||||
|
.BR not
|
||||||
|
be used for each of the elements in no_proxy.
|
||||||
.SH PLUGINS
|
.SH PLUGINS
|
||||||
For using plugins in surf, first determine your running architecture. Then get
|
For using plugins in surf, first determine your running architecture. Then get
|
||||||
the appropriate plugin for that architecture and copy it to
|
the appropriate plugin for that architecture and copy it to
|
||||||
|
|||||||
@@ -12,19 +12,20 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <webkit/webkit.h>
|
#include <webkit/webkit.h>
|
||||||
#include <glib/gstdio.h>
|
|
||||||
#include <JavaScriptCore/JavaScript.h>
|
#include <JavaScriptCore/JavaScript.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <string.h>
|
#include <glib.h>
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include "arg.h"
|
#include "arg.h"
|
||||||
|
|
||||||
@@ -114,6 +115,8 @@ static void addaccelgroup(Client *c);
|
|||||||
static void beforerequest(WebKitWebView *w, WebKitWebFrame *f,
|
static void beforerequest(WebKitWebView *w, WebKitWebFrame *f,
|
||||||
WebKitWebResource *r, WebKitNetworkRequest *req,
|
WebKitWebResource *r, WebKitNetworkRequest *req,
|
||||||
WebKitNetworkResponse *resp, Client *c);
|
WebKitNetworkResponse *resp, Client *c);
|
||||||
|
static const char *getuserhomedir(const char *user);
|
||||||
|
static const char *getcurrentuserhomedir(void);
|
||||||
static char *buildfile(const char *path);
|
static char *buildfile(const char *path);
|
||||||
static char *buildpath(const char *path);
|
static char *buildpath(const char *path);
|
||||||
static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, Client *c);
|
static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, Client *c);
|
||||||
@@ -196,6 +199,7 @@ static void scroll(GtkAdjustment *a, const Arg *arg);
|
|||||||
static void setatom(Client *c, int a, const char *v);
|
static void setatom(Client *c, int a, const char *v);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
static void sigchld(int unused);
|
static void sigchld(int unused);
|
||||||
|
static void sighup(int unused);
|
||||||
static void source(Client *c, const Arg *arg);
|
static void source(Client *c, const Arg *arg);
|
||||||
static void spawn(Client *c, const Arg *arg);
|
static void spawn(Client *c, const Arg *arg);
|
||||||
static void stop(Client *c, const Arg *arg);
|
static void stop(Client *c, const Arg *arg);
|
||||||
@@ -204,6 +208,7 @@ static void titlechangeleave(void *a, void *b, Client *c);
|
|||||||
static void toggle(Client *c, const Arg *arg);
|
static void toggle(Client *c, const Arg *arg);
|
||||||
static void togglecookiepolicy(Client *c, const Arg *arg);
|
static void togglecookiepolicy(Client *c, const Arg *arg);
|
||||||
static void togglegeolocation(Client *c, const Arg *arg);
|
static void togglegeolocation(Client *c, const Arg *arg);
|
||||||
|
static void toggleproxy(Client *c, const Arg *arg);
|
||||||
static void togglescrollbars(Client *c, const Arg *arg);
|
static void togglescrollbars(Client *c, const Arg *arg);
|
||||||
static void togglestyle(Client *c, const Arg *arg);
|
static void togglestyle(Client *c, const Arg *arg);
|
||||||
static void updatetitle(Client *c);
|
static void updatetitle(Client *c);
|
||||||
@@ -285,29 +290,60 @@ buildfile(const char *path)
|
|||||||
return fpath;
|
return fpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char*
|
||||||
|
getuserhomedir(const char *user)
|
||||||
|
{
|
||||||
|
struct passwd *pw = getpwnam(user);
|
||||||
|
|
||||||
|
if (!pw)
|
||||||
|
die("Can't get user %s login information.\n", user);
|
||||||
|
|
||||||
|
return pw->pw_dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char*
|
||||||
|
getcurrentuserhomedir(void)
|
||||||
|
{
|
||||||
|
const char *homedir;
|
||||||
|
const char *user;
|
||||||
|
struct passwd *pw;
|
||||||
|
|
||||||
|
homedir = getenv("HOME");
|
||||||
|
if (homedir)
|
||||||
|
return homedir;
|
||||||
|
|
||||||
|
user = getenv("USER");
|
||||||
|
if (user)
|
||||||
|
return getuserhomedir(user);
|
||||||
|
|
||||||
|
pw = getpwuid(getuid());
|
||||||
|
if (!pw)
|
||||||
|
die("Can't get current user home directory\n");
|
||||||
|
|
||||||
|
return pw->pw_dir;
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
buildpath(const char *path)
|
buildpath(const char *path)
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
|
||||||
char *apath, *name, *p, *fpath;
|
char *apath, *name, *p, *fpath;
|
||||||
|
const char *homedir;
|
||||||
|
|
||||||
if (path[0] == '~') {
|
if (path[0] == '~') {
|
||||||
if (path[1] == '/' || path[1] == '\0') {
|
if (path[1] == '/' || path[1] == '\0') {
|
||||||
p = (char *)&path[1];
|
p = (char *)&path[1];
|
||||||
pw = getpwuid(getuid());
|
homedir = getcurrentuserhomedir();
|
||||||
} else {
|
} else {
|
||||||
if ((p = strchr(path, '/')))
|
if ((p = strchr(path, '/'))) {
|
||||||
name = g_strndup(&path[1], --p - path);
|
name = g_strndup(&path[1], --p - path);
|
||||||
else
|
} else {
|
||||||
name = g_strdup(&path[1]);
|
name = g_strdup(&path[1]);
|
||||||
|
|
||||||
if (!(pw = getpwnam(name))) {
|
|
||||||
die("Can't get user %s home directory: %s.\n",
|
|
||||||
name, path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
homedir = getuserhomedir(name);
|
||||||
g_free(name);
|
g_free(name);
|
||||||
}
|
}
|
||||||
apath = g_build_filename(pw->pw_dir, p, NULL);
|
apath = g_build_filename(homedir, p, NULL);
|
||||||
} else {
|
} else {
|
||||||
apath = g_strdup(path);
|
apath = g_strdup(path);
|
||||||
}
|
}
|
||||||
@@ -803,6 +839,7 @@ loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c)
|
|||||||
& SOUP_MESSAGE_CERTIFICATE_TRUSTED);
|
& SOUP_MESSAGE_CERTIFICATE_TRUSTED);
|
||||||
}
|
}
|
||||||
setatom(c, AtomUri, uri);
|
setatom(c, AtomUri, uri);
|
||||||
|
c->title = copystr(&c->title, uri);
|
||||||
|
|
||||||
if (enablestyle)
|
if (enablestyle)
|
||||||
setstyle(c, getstyle(uri));
|
setstyle(c, getstyle(uri));
|
||||||
@@ -837,7 +874,7 @@ loaduri(Client *c, const Arg *arg)
|
|||||||
u = g_strdup_printf("file://%s", rp);
|
u = g_strdup_printf("file://%s", rp);
|
||||||
free(rp);
|
free(rp);
|
||||||
} else {
|
} else {
|
||||||
u = g_strrstr(uri, "://") ? g_strdup(uri)
|
u = g_strrstr(uri, "://") || g_str_has_prefix(uri, "about:") ? g_strdup(uri)
|
||||||
: g_strdup_printf("http://%s", uri);
|
: g_strdup_printf("http://%s", uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1072,10 +1109,9 @@ newclient(void)
|
|||||||
printf("%u\n",
|
printf("%u\n",
|
||||||
(guint)GDK_WINDOW_XID(GTK_WIDGET(c->win)->window));
|
(guint)GDK_WINDOW_XID(GTK_WIDGET(c->win)->window));
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
if (fclose(stdout) != 0) {
|
if (fclose(stdout) != 0)
|
||||||
die("Error closing stdout");
|
die("Error closing stdout");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@@ -1198,12 +1234,10 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d)
|
|||||||
if (ev->atom == atoms[AtomFind]) {
|
if (ev->atom == atoms[AtomFind]) {
|
||||||
arg.b = TRUE;
|
arg.b = TRUE;
|
||||||
find(c, &arg);
|
find(c, &arg);
|
||||||
|
|
||||||
return GDK_FILTER_REMOVE;
|
return GDK_FILTER_REMOVE;
|
||||||
} else if (ev->atom == atoms[AtomGo]) {
|
} else if (ev->atom == atoms[AtomGo]) {
|
||||||
arg.v = getatom(c, AtomGo);
|
arg.v = getatom(c, AtomGo);
|
||||||
loaduri(c, &arg);
|
loaduri(c, &arg);
|
||||||
|
|
||||||
return GDK_FILTER_REMOVE;
|
return GDK_FILTER_REMOVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1290,14 +1324,14 @@ void
|
|||||||
setup(void)
|
setup(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *proxy, *new_proxy;
|
|
||||||
char *styledirfile, *stylepath;
|
char *styledirfile, *stylepath;
|
||||||
SoupURI *puri;
|
|
||||||
SoupSession *s;
|
SoupSession *s;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
/* clean up any zombies immediately */
|
/* clean up any zombies immediately */
|
||||||
sigchld(0);
|
sigchld(0);
|
||||||
|
if (signal(SIGHUP, sighup) == SIG_ERR)
|
||||||
|
die("Can't install SIGHUP handler");
|
||||||
gtk_init(NULL, NULL);
|
gtk_init(NULL, NULL);
|
||||||
|
|
||||||
dpy = GDK_DISPLAY();
|
dpy = GDK_DISPLAY();
|
||||||
@@ -1364,20 +1398,7 @@ setup(void)
|
|||||||
g_object_set(G_OBJECT(s), "tls-database", tlsdb, NULL);
|
g_object_set(G_OBJECT(s), "tls-database", tlsdb, NULL);
|
||||||
g_object_set(G_OBJECT(s), "ssl-strict", strictssl, NULL);
|
g_object_set(G_OBJECT(s), "ssl-strict", strictssl, NULL);
|
||||||
|
|
||||||
/* proxy */
|
toggleproxy(NULL, NULL);
|
||||||
if ((proxy = getenv("http_proxy")) && strcmp(proxy, "")) {
|
|
||||||
new_proxy = g_strrstr(proxy, "http://")
|
|
||||||
|| g_strrstr(proxy, "socks://")
|
|
||||||
|| g_strrstr(proxy, "socks4://")
|
|
||||||
|| g_strrstr(proxy, "socks5://")
|
|
||||||
? g_strdup(proxy)
|
|
||||||
: g_strdup_printf("http://%s", proxy);
|
|
||||||
puri = soup_uri_new(new_proxy);
|
|
||||||
g_object_set(G_OBJECT(s), "proxy-uri", puri, NULL);
|
|
||||||
soup_uri_free(puri);
|
|
||||||
g_free(new_proxy);
|
|
||||||
usingproxy = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1388,6 +1409,16 @@ sigchld(int unused)
|
|||||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sighup(int unused)
|
||||||
|
{
|
||||||
|
Arg a = { .b = FALSE };
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for (c = clients; c; c = c->next)
|
||||||
|
reload(c, &a);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
source(Client *c, const Arg *arg)
|
source(Client *c, const Arg *arg)
|
||||||
{
|
{
|
||||||
@@ -1431,6 +1462,7 @@ void
|
|||||||
titlechange(WebKitWebView *view, GParamSpec *pspec, Client *c)
|
titlechange(WebKitWebView *view, GParamSpec *pspec, Client *c)
|
||||||
{
|
{
|
||||||
const gchar *t = webkit_web_view_get_title(view);
|
const gchar *t = webkit_web_view_get_title(view);
|
||||||
|
|
||||||
if (t) {
|
if (t) {
|
||||||
c->title = copystr(&c->title, t);
|
c->title = copystr(&c->title, t);
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
@@ -1508,6 +1540,42 @@ twitch(Client *c, const Arg *arg)
|
|||||||
gtk_adjustment_set_value(a, v);
|
gtk_adjustment_set_value(a, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
toggleproxy(Client *c, const Arg *arg)
|
||||||
|
{
|
||||||
|
char *proxy, *new_proxy, *no_proxy, **new_no_proxy;
|
||||||
|
GProxyResolver *pr;
|
||||||
|
SoupSession *s;
|
||||||
|
|
||||||
|
/* request handler */
|
||||||
|
s = webkit_get_default_session();
|
||||||
|
|
||||||
|
if (usingproxy) {
|
||||||
|
g_object_set(G_OBJECT(s), "proxy-resolver", NULL, NULL);
|
||||||
|
usingproxy = 0;
|
||||||
|
} else if ((proxy = getenv("http_proxy")) && strcmp(proxy, "")) {
|
||||||
|
new_proxy = g_strrstr(proxy, "http://")
|
||||||
|
|| g_strrstr(proxy, "https://")
|
||||||
|
|| g_strrstr(proxy, "socks://")
|
||||||
|
|| g_strrstr(proxy, "socks4://")
|
||||||
|
|| g_strrstr(proxy, "socks4a://")
|
||||||
|
|| g_strrstr(proxy, "socks5://")
|
||||||
|
? g_strdup(proxy)
|
||||||
|
: g_strdup_printf("http://%s", proxy);
|
||||||
|
new_no_proxy = ((no_proxy = getenv("no_proxy")) && strcmp(no_proxy, ""))
|
||||||
|
? g_strsplit(no_proxy, ",", -1) : NULL;
|
||||||
|
pr = g_simple_proxy_resolver_new(new_proxy, new_no_proxy);
|
||||||
|
g_object_set(G_OBJECT(s), "proxy-resolver", pr, NULL);
|
||||||
|
g_free(new_proxy);
|
||||||
|
g_strfreev(new_no_proxy);
|
||||||
|
usingproxy = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c)
|
||||||
|
updatetitle(c);
|
||||||
|
/* Do not reload. */
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
togglescrollbars(Client *c, const Arg *arg)
|
togglescrollbars(Client *c, const Arg *arg)
|
||||||
{
|
{
|
||||||
@@ -1537,7 +1605,6 @@ togglestyle(Client *c, const Arg *arg)
|
|||||||
{
|
{
|
||||||
enablestyle = !enablestyle;
|
enablestyle = !enablestyle;
|
||||||
setstyle(c, enablestyle ? getstyle(geturi(c)) : "");
|
setstyle(c, enablestyle ? getstyle(geturi(c)) : "");
|
||||||
|
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1743,7 +1810,7 @@ main(int argc, char *argv[])
|
|||||||
useragent = EARGF(usage());
|
useragent = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
die("surf-"VERSION", ©2009-2015 surf engineers, "
|
die("surf-"VERSION", ©2009-2017 surf engineers, "
|
||||||
"see LICENSE for details\n");
|
"see LICENSE for details\n");
|
||||||
case 'x':
|
case 'x':
|
||||||
showxid = TRUE;
|
showxid = TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user