Add a flag for custom certificates

I don't think a keybinding would be useful here because we can't
remove a custom certificate which is alread set anyway.
I'll add it if somebody convince me of it's usefulness.
This commit is contained in:
Quentin Rameau 2017-04-29 17:21:12 +02:00
parent 7823ab6fc0
commit d66904675d
2 changed files with 21 additions and 4 deletions

9
surf.1
View File

@ -126,6 +126,12 @@ Prints xid to standard output. This can be used to script the browser in for
example example
.BR xdotool(1). .BR xdotool(1).
.TP .TP
.B -x
Disable custom certificates.
.TP
.B -X
Enable custom certificates.
.TP
.B \-z zoomlevel .B \-z zoomlevel
Specify the Specify the
.I zoomlevel .I zoomlevel
@ -268,6 +274,9 @@ plugins
.TP .TP
.B m M .B m M
styles styles
.TP
.B x X
custom certificates
.SH INDICATORS OF WEB PAGE .SH INDICATORS OF WEB PAGE
The second part of the indicators specifies modes of the web page itself. The second part of the indicators specifies modes of the web page itself.
.SS First character: encryption .SS First character: encryption

16
surf.c
View File

@ -236,7 +236,7 @@ static void clicknewwindow(Client *c, const Arg *a, WebKitHitTestResult *h);
static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h); static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h);
static char winid[64]; static char winid[64];
static char togglestats[11]; static char togglestats[12];
static char pagestats[2]; static char pagestats[2];
static Atom atoms[AtomLast]; static Atom atoms[AtomLast];
static Window embed; static Window embed;
@ -590,8 +590,9 @@ gettogglestats(Client *c)
togglestats[6] = curconfig[Plugins].val.b ? 'V' : 'v'; togglestats[6] = curconfig[Plugins].val.b ? 'V' : 'v';
togglestats[7] = curconfig[Style].val.b ? 'M' : 'm'; togglestats[7] = curconfig[Style].val.b ? 'M' : 'm';
togglestats[8] = curconfig[FrameFlattening].val.b ? 'F' : 'f'; togglestats[8] = curconfig[FrameFlattening].val.b ? 'F' : 'f';
togglestats[9] = curconfig[StrictTLS].val.b ? 'T' : 't'; togglestats[9] = curconfig[Certificate].val.b ? 'X' : 'x';
togglestats[10] = '\0'; togglestats[10] = curconfig[StrictTLS].val.b ? 'T' : 't';
togglestats[11] = '\0';
} }
void void
@ -881,7 +882,7 @@ newwindow(Client *c, const Arg *a, int noembed)
{ {
int i = 0; int i = 0;
char tmp[64]; char tmp[64];
const char *cmd[28], *uri; const char *cmd[29], *uri;
const Arg arg = { .v = cmd }; const Arg arg = { .v = cmd };
cmd[i++] = argv0; cmd[i++] = argv0;
@ -921,6 +922,7 @@ newwindow(Client *c, const Arg *a, int noembed)
} }
if (showxid) if (showxid)
cmd[i++] = "-w"; cmd[i++] = "-w";
cmd[i++] = curconfig[Certificate].val.b ? "-X" : "-x" ;
/* do not keep zoom level */ /* do not keep zoom level */
cmd[i++] = "--"; cmd[i++] = "--";
if ((uri = a->v)) if ((uri = a->v))
@ -1902,6 +1904,12 @@ main(int argc, char *argv[])
case 'w': case 'w':
showxid = 1; showxid = 1;
break; break;
case 'x':
defconfig CSETB(Certificate, 0);
break;
case 'X':
defconfig CSETB(Certificate, 1);
break;
case 'z': case 'z':
defconfig CSETF(ZoomLevel, strtof(EARGF(usage()), NULL)); defconfig CSETF(ZoomLevel, strtof(EARGF(usage()), NULL));
break; break;