diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-13 13:08:33 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-13 13:08:33 +0100 |
commit | 672ab553c4a2b10a703ea40e049eda52db149a93 (patch) | |
tree | 10c581ab40702e113bffe6605c58a640ac5095ee /src/display | |
parent | f3e2cb7bfa4517155a2c6675e6310f17d8ca4d89 (diff) | |
download | chawan-672ab553c4a2b10a703ea40e049eda52db149a93.tar.gz |
Add more cookie options
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/client.nim | 4 | ||||
-rw-r--r-- | src/display/pager.nim | 13 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/display/client.nim b/src/display/client.nim index 90945968..9ca2ac68 100644 --- a/src/display/client.nim +++ b/src/display/client.nim @@ -403,11 +403,11 @@ proc launchClient*(client: Client, pages: seq[string], ctype: Option[string], du var tty: File var dump = dump if not dump: - if stdin.isatty(): + if not stdin.isatty(): tty = stdin elif stdout.isatty(): discard open(tty, "/dev/tty", fmRead) - else: + if tty == nil: dump = true client.ssock = initServerSocket(false) client.selector = newSelector[Container]() diff --git a/src/display/pager.nim b/src/display/pager.nim index d1eca1d7..3825f088 100644 --- a/src/display/pager.nim +++ b/src/display/pager.nim @@ -470,7 +470,7 @@ proc windowChange*(pager: Pager, attrs: WindowAttributes) = proc applySiteconf(pager: Pager, request: Request) = let url = $request.url - let host = $request.url.host + let host = request.url.host for sc in pager.siteconf: if sc.url.isSome and not sc.url.get.exec(url).success: continue @@ -480,8 +480,11 @@ proc applySiteconf(pager: Pager, request: Request) = let s = sc.subst(request.url) if s.isSome and s.get != nil: request.url = s.get - if sc.cookie and request.url.host notin pager.cookiejars: - pager.cookiejars[request.url.host] = newCookieJar(request.url) + if sc.cookie: + # host/url might have changed by now + let jarid = sc.sharecookiejar.get(request.url.host) + if jarid notin pager.cookiejars: + pager.cookiejars[jarid] = newCookieJar(request.url, sc.thirdpartycookie) # Load request in a new buffer. proc gotoURL*(pager: Pager, request: Request, prevurl = none(URL), @@ -749,10 +752,6 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo if pager.container == container: pager.alert(event.msg) pager.refreshStatusMsg() - of SET_COOKIE: - let host = container.source.location.host - if host in pager.cookiejars: - pager.cookiejars[host].cookies.add(event.cookies) of NO_EVENT: discard return true |