diff --git a/README.md b/README.md index 59b1178..65068ce 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,6 @@ add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; ``` -In the same file you also want to change `gzip on` to `gzip off` (read more [here](https://github.com/h5bp/server-configs-nginx/issues/72)). - ## Nginx server config Copy the ssl config and create a soft link. Create folder for logs and also remove the default config ``` diff --git a/src/js/api/pushshift/index.js b/src/js/api/pushshift/index.js index 4019408..6138606 100644 --- a/src/js/api/pushshift/index.js +++ b/src/js/api/pushshift/index.js @@ -1,4 +1,4 @@ -import { json, toBase10, toBase36, chunk, flatten } from 'utils' +import { json, toBase10, toBase36 } from 'utils' const baseURL = 'https://elastic.pushshift.io' const postURL = `${baseURL}/rs/submissions/_search?source=` @@ -24,52 +24,48 @@ export const getPost = threadID => { ) } -export const getComments = threadID => ( - fetch(`https://api.pushshift.io/reddit/comment/search?link_id=${threadID}&limit=10000`) - .then(json) - .then(data => data.data) - .then(comments => { - comments.forEach(comment => { - comment.link_id = comment.link_id.split('_')[1] - comment.parent_id = comment.parent_id.split('_')[1] - }) - return comments - }) -) +// export const getComments = threadID => ( +// fetch(`https://api.pushshift.io/reddit/comment/search?link_id=${threadID}&limit=10000`) +// .then(json) +// .then(data => data.data) +// .then(comments => { +// comments.forEach(comment => { +// comment.link_id = comment.link_id.split('_')[1] +// comment.parent_id = comment.parent_id.split('_')[1] +// }) +// return comments +// }) +// ) -// export const getComments = threadID => { -// const elasticQuery = { -// query: { -// match: { -// link_id: toBase10(threadID), -// }, -// }, -// size: 10000, -// // _source: [ -// // 'author', 'body', 'created_utc', 'parent_id', 'score', 'subreddit', 'link_id', -// // ], -// } +export const getComments = threadID => { + const elasticQuery = { + query: { + match: { + link_id: toBase10(threadID), + }, + }, + size: 10000, + _source: [ + 'author', 'body', 'created_utc', 'parent_id', 'score', 'subreddit', 'link_id', + ], + } -// return ( -// fetch(commentURL + JSON.stringify(elasticQuery)) -// .then(json) -// .then(jsonData => jsonData.hits.hits) -// .then(comments => comments.map(comment => { -// comment._source.id = toBase36(comment._id) -// comment._source.link_id = toBase36(comment._source.link_id) + return ( + fetch(commentURL + JSON.stringify(elasticQuery)) + .then(json) + .then(jsonData => jsonData.hits.hits) + .then(comments => comments.map(comment => { + comment._source.id = toBase36(comment._id) + comment._source.link_id = toBase36(comment._source.link_id) -// // Missing parent id === direct reply to thread -// if (!comment._source.parent_id) { -// comment._source.parent_id = threadID -// } else { -// comment._source.parent_id = toBase36(comment._source.parent_id) -// } + // Missing parent id === direct reply to thread + if (!comment._source.parent_id) { + comment._source.parent_id = threadID + } else { + comment._source.parent_id = toBase36(comment._source.parent_id) + } -// if (comment._source.id === 'dmrxgic') { -// console.log(JSON.stringify(comment._source)) -// } - -// return comment._source -// })) -// ) -// } + return comment._source + })) + ) +} diff --git a/src/js/api/removeddit/index.js b/src/js/api/removeddit/index.js index fcecb72..94d5ffc 100644 --- a/src/js/api/removeddit/index.js +++ b/src/js/api/removeddit/index.js @@ -1,6 +1,6 @@ import { json } from 'utils' -const baseURL = 'http://localhost:9000/api' +const baseURL = 'https://removeddit.com/api' export const getRemovedThreadIDs = (subreddit = '', page = 1) => ( fetch(`${baseURL}/threads?subreddit=${subreddit}&page=${page - 1}`)