From c318f5830ca062900a31cf3f042d84f44da6c117 Mon Sep 17 00:00:00 2001 From: Benny Jacobs Date: Tue, 15 Aug 2017 01:11:24 +0200 Subject: [PATCH 1/3] Added chrome executable detection for ubuntu --- packchrome.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packchrome.sh b/packchrome.sh index 2dd168f..46577bf 100755 --- a/packchrome.sh +++ b/packchrome.sh @@ -1,6 +1,6 @@ #!/bin/bash -CHROME=`command -v chrome || command -v chromium || command -v "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"` +CHROME=`command -v chrome || command -v chromium || command -v chromium-browser || command -v "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"` rm -f extension.crx From b747a6364fa88b26ebe8b66771f00f362d8dbfd7 Mon Sep 17 00:00:00 2001 From: Benny Jacobs Date: Tue, 15 Aug 2017 01:11:50 +0200 Subject: [PATCH 2/3] Changed view_mature from a querystring to a header. querystring no longer worked --- src/FimFic2Epub.js | 2 +- src/fetch.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/FimFic2Epub.js b/src/FimFic2Epub.js index 46a0c00..394646f 100644 --- a/src/FimFic2Epub.js +++ b/src/FimFic2Epub.js @@ -544,7 +544,7 @@ class FimFic2Epub extends Emitter { fetchTitlePage () { let url = this.storyInfo.url.replace('http://www.fimfiction.net', '') - return fetch(url + '?view_mature=true').then(this.extractTitlePageInfo.bind(this)) + return fetch(url).then(this.extractTitlePageInfo.bind(this)) } extractTitlePageInfo (html) { diff --git a/src/fetch.js b/src/fetch.js index 769da3a..836944e 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -11,7 +11,8 @@ function fetchNode (url, responseType) { url: url, encoding: responseType ? null : 'utf8', headers: { - referer: 'http://www.fimfiction.net/' + referer: 'http://www.fimfiction.net/', + Cookie: 'view_mature=true', } }, (error, response, body) => { if (error) { From efcf5ee550c80348b2ec55cfe6a2684dca334461 Mon Sep 17 00:00:00 2001 From: Benny Jacobs Date: Wed, 16 Aug 2017 00:57:09 +0200 Subject: [PATCH 3/3] Add mature headers to fetch request --- src/fetch.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fetch.js b/src/fetch.js index 836944e..9a46173 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -38,11 +38,14 @@ export default function fetch (url, responseType) { } return new Promise((resolve, reject) => { if (typeof window.fetch === 'function') { + const headers = new Headers() + headers.append("Cookie", "view_mature=true"); window.fetch(url, { method: 'GET', mode: 'cors', credentials: 'include', cache: 'default', + headers: headers, redirect: 'follow' }).then((response) => { if (responseType === 'blob') { @@ -62,7 +65,6 @@ export default function fetch (url, responseType) { x.responseType = responseType } x.onload = function () { - // x.getResponseHeader('content-type') resolve(x.response) } x.onerror = function () {