From e4c54beaf8017095f18545b82863bfc98f6fae30 Mon Sep 17 00:00:00 2001 From: StevenNMeza Date: Fri, 21 May 2021 18:43:19 +0200 Subject: [PATCH 001/300] Keep sort on user page --- views/user.pug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/user.pug b/views/user.pug index 520f8260..94678d38 100644 --- a/views/user.pug +++ b/views/user.pug @@ -144,7 +144,7 @@ html if data.before || data.after p view more: if data.before && !data.user_front - a(href="/u/" + data.username + data.post_type + "?before=" + data.before + "") ‹ prev + a(href="/u/" + data.username + data.post_type + (sortby === "new" ? "?" : "?sort=" + sortby + "&") + (!past ? "" : "t=" + past + "&") + "before=" + data.before + "") ‹ prev if data.after - a(href="/u/" + data.username + data.post_type + "?after=" + data.after + "") next › + a(href="/u/" + data.username + data.post_type + (sortby === "new" ? "?" : "?sort=" + sortby + "&") + (!past ? "" : "t=" + past + "&") + "after=" + data.after + "") next › include includes/footer.pug From ca6d213bdc34721982981eca533de891069aae30 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 23 May 2021 19:10:50 +0200 Subject: [PATCH 002/300] update redis package, fixes security vuln in it (doesn't affect teddit) --- package-lock.json | 22 +++++++++++----------- package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index a1cf006f..79892018 100644 --- a/package-lock.json +++ b/package-lock.json @@ -283,9 +283,9 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "denque": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz", - "integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ==" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", + "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==" }, "depd": { "version": "1.1.2", @@ -918,20 +918,20 @@ } }, "redis": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/redis/-/redis-3.0.2.tgz", - "integrity": "sha512-PNhLCrjU6vKVuMOyFu7oSP296mwBkcE6lrAjruBYG5LgdSqtRBoVQIylrMyVZD/lkF24RSNNatzvYag6HRBHjQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/redis/-/redis-3.1.2.tgz", + "integrity": "sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==", "requires": { - "denque": "^1.4.1", - "redis-commands": "^1.5.0", + "denque": "^1.5.0", + "redis-commands": "^1.7.0", "redis-errors": "^1.2.0", "redis-parser": "^3.0.0" } }, "redis-commands": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.6.0.tgz", - "integrity": "sha512-2jnZ0IkjZxvguITjFTrGiLyzQZcTvaw8DAaCXxZq/dsHXz7KfMQ3OUJy7Tz9vnRtZRVz6VRCPDvruvU8Ts44wQ==" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", + "integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==" }, "redis-errors": { "version": "1.2.0", diff --git a/package.json b/package.json index c56547f3..fcd69cf3 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "node-fetch": "^2.6.1", "postman-request": "^2.88.1-postman.27", "pug": "^3.0.2", - "redis": "^3.0.2" + "redis": "^3.1.2" }, "devDependencies": {} } From ac14a7b094018a547d61775cffbe76634f5a630a Mon Sep 17 00:00:00 2001 From: StevenNMeza Date: Mon, 24 May 2021 20:39:28 +0200 Subject: [PATCH 003/300] Add link component --- inc/processJsonUser.js | 1 + static/css/styles.css | 85 ++++++++++++++++++------------------ views/components/link.pug | 90 ++++++++++++++++++++++++++++++++++++++ views/index.pug | 86 +----------------------------------- views/subreddit.pug | 91 +-------------------------------------- views/user.pug | 60 ++++++++++++++------------ 6 files changed, 169 insertions(+), 244 deletions(-) create mode 100644 views/components/link.pug diff --git a/inc/processJsonUser.js b/inc/processJsonUser.js index 2313ed1d..4a0ec760 100644 --- a/inc/processJsonUser.js +++ b/inc/processJsonUser.js @@ -65,6 +65,7 @@ module.exports = function() { created: post.created_utc, ups: post.ups, url: replaceDomains(url, user_preferences), + domain: post.domain, thumbnail: await downloadAndSave(post.thumbnail), duration: duration, edited: post.edited, diff --git a/static/css/styles.css b/static/css/styles.css index 7a732aab..87e91e3a 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -566,6 +566,9 @@ footer a { overflow: hidden; background: var(--whitebg); } +.commententry .comment { + padding-left: 0; +} .comment details summary { float: left; font-size: 0.833rem; @@ -924,14 +927,14 @@ footer a { width: 80%; min-height: 100vh; } -#user .entries .entry { +#user .entries .commententry { padding-left: 5px; padding-top: 10px; padding-bottom: 15px; float: left; width: 100%; } -#user .entries .entry:first-child { +#user .entries .commententry:first-child { padding-top: 0; } #user .info { @@ -947,70 +950,70 @@ footer a { font-size: 1.1rem; overflow-wrap: anywhere; } -#user .entries .entry .meta { +#user .entries .commententry .meta { float: left; } -#user .entries .entry .meta .title, -#user .entries .entry .meta .author, -#user .entries .entry .meta .subreddit, -#user .entries .entry .meta .flair { +#user .entries .commententry .meta .title, +#user .entries .commententry .meta .author, +#user .entries .commententry .meta .subreddit, +#user .entries .commententry .meta .flair { float: left; } -#user .entries .entry .meta a { +#user .entries .commententry .meta a { margin-right: 5px; margin-left: 5px; } -#user .entries .entry .title a { +#user .entries .commententry .title a { margin-left: 0; font-size: 0.86rem; } -#user .entries .entry .meta .author,#user .entries .entry .meta .subreddit { +#user .entries .commententry .meta .author,#user .entries .commententry .meta .subreddit { font-size: 11px; margin-top: 3px; } -#user .entries .entry .meta .author a { +#user .entries .commententry .meta .author a { font-weight: bold; } -#user .comment details { +#user .commententry details { padding-top: 2px; } -#user .comment details a.context, -#user .comment details a.comments { +#user .commententry details a.context, +#user .commententry details a.comments { float: left; } -#user .comment .meta p.ups,#user .comment .meta p.created { +#user .commententry .meta p.ups,#user .commententry .meta p.created { font-size: var(--sm-font); padding-right: 5px; } -#user .entries .entry .meta .created a { +#user .entries .commententry .meta .created a { color: var(--graytext); } -#user .entries .entry.t3 .title .meta { +#user .entries .commententry.t3 .title .meta { float: left; width: 100%; } -#user .entries .entry.t3 .title a { +#user .entries .commententry.t3 .title a { margin-bottom: 3px; } -#user .entries .entry.t3 .upvotes { +#user .entries .commententry.t3 .upvotes { float: left; width: 60px; } -#user .entries .entry.t3 .image { +#user .entries .commententry.t3 .image { float: left; width: 80px; } -#user .entries .entry.t3 .title { +#user .entries .commententry.t3 .title { width: calc(100% - 200px); float: left; } -#user .entries .entry .comment .meta .author { +#user .entries .commententry .commententry .meta .author { margin-top: 0; } -#user .comment .meta p { +#user .commententry .meta p { padding-right: 0; } -#user .comment .body { +#user .commententry .body { padding-top: 4px; padding-bottom: 0; } @@ -1018,25 +1021,25 @@ footer a { font-weight: bold; font-size: 1.1rem; } -#user .comment details summary { +#user .commententry details summary { font-size: var(--sm-font); } -#user .comment details summary p { +#user .commententry details summary p { margin-right: 5px; margin-left: 5px; } -#user .comment details summary a { +#user .commententry details summary a { margin-left: 5px; } -#user .entries .entry .image,#user .entries .entry .upvotes,#user .entries .entry .title,#user .entries .entry .meta { +#user .entries .commententry .image,#user .entries .commententry .upvotes,#user .entries .commententry .title,#user .entries .commententry .meta { float: left; } -#user .entries .entry .image { +#user .entries .commententry .image { margin-left: 0; margin-right: 8px; position: relative; } -#user .entries .entry .image a span { +#user .entries .commententry .image a span { position: absolute; bottom: 0; background: #0000005e; @@ -1047,29 +1050,29 @@ footer a { font-size: var(--sm-font); margin-bottom: 4px; } -#user .entries .entry .image img { +#user .entries .commententry .image img { max-width: 80px; } -#user .entries .entry .title a { +#user .entries .commententry .title a { float: left; } -#user .entries .entry .title .meta { +#user .entries .commententry .title .meta { width: 100%; } -#user .entries .entry .title .meta a { +#user .entries .commententry .title .meta a { float: initial; font-weight: bold; font-size: var(--sm-font); margin-left: 5px; } -#user .entries .entry .title .meta a.subreddit { +#user .entries .commententry .title .meta a.subreddit { font-weight: unset; } -#user .entries .entry .title .meta .submitted { +#user .entries .commententry .title .meta .submitted { font-size: var(--sm-font); color: var(--graytext); } -#user .entries .entry .meta .title { +#user .entries .commententry .meta .title { margin-left: 20px; } #user #links { @@ -1085,18 +1088,18 @@ footer a { #user #links details ul { margin-left: 20px; } -#user .entries .entry a.comments, #user .entries .entry a.context { +#user .entries .commententry a.comments, #user .entries .commententry a.context { color: gray; font-size: var(--sm-font); font-weight: bold; } -#user .entries .entry .title .meta a.comments { +#user .entries .commententry .title .meta a.comments { margin-left: 0; } -#user .entries .entry a.comments.t1,#user .entries .entry a.context { +#user .entries .commententry a.comments.t1,#user .entries .commententry a.context { margin-top: 0; } -#user .entries .entry a.context { +#user .entries .commententry a.context { margin-right: 10px; } /* FLAIR */ diff --git a/views/components/link.pug b/views/components/link.pug new file mode 100644 index 00000000..e61fdf1c --- /dev/null +++ b/views/components/link.pug @@ -0,0 +1,90 @@ +.link + .upvotes + .arrow + span #{kFormatter(link.ups)} + .arrow.down + .image + if link.images + if link.is_self_link + a(href="" + link.permalink + "") + img(src="" + link.images.thumb + "", alt="") + else + a(href=""+ link.url +"", rel="noopener noreferrer") + img(src="" + link.images.thumb + "", alt="") + else + a(href="" + link.permalink + "") + .no-image no image + .entry + .title + if link.is_self_link + a(href="" + link.permalink + "") + h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)} + != link.link_flair + span (#{link.domain}) + else + a(href="" + link.url + "", rel="noopener noreferrer") + h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)} + != link.link_flair + span (#{link.domain}) + .meta + p.submitted submitted + span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by + if link.author === '[deleted]' + span(class="deleted") [deleted] + else + a(href="/u/" + link.author + "") + | #{link.author} + != link.user_flair + p.to to + a(href="/r/" + link.subreddit + "") + | #{link.subreddit} + if link.stickied + span(class="green") stickied + .links + if link.over_18 + span.tag.nsfw NSFW + if link.selftext_html + details + summary + .line + .line + .line + .selftext + != unescape(link.selftext_html, user_preferences) + if (link.images && link.images.preview) + style. + details.preview-container img { + width: 100% !important; + height: auto !important; + max-width: none !important; + max-height: none !important; + opacity: 0; + } + details.preview-container[open][data-url="#{link.images.preview}"] .preview { + width: 100%; + height: auto; + background-image: url('#{link.images.preview}'); + background-repeat: no-repeat; + background-size: contain; + } + details.preview-container(data-url="" + link.images.preview + "") + summary + span ▶ + .preview + img(src=""+ link.images.thumb +"", alt="") + a(href="" + link.permalink + "", class="comments") #{link.num_comments} comments + - + let back_url = "/r/" + subreddit + "/" + sortby + "§2t="+ (past ? past : '') +"" + if(before && !subreddit_front) + back_url = "/r/" + subreddit + "/" + sortby + "§2t="+ (past ? past : '') +"§1before=" + before + "" + if(after) + back_url = "/r/" + subreddit + "/" + sortby + "§2t=" + (past ? past : '') + "§1after=" + after + "" + - let saved_post = false + if user_preferences.saved + each post_id in user_preferences.saved + if post_id === link.id + - saved_post = true + if saved_post + a(href="/unsave/" + link.id + "/?rk=" + redis_key + "&b=" + back_url + "") unsave + else + a(href="/save/" + link.id + "/?rk=" + redis_key + "&b=" + back_url + "") save diff --git a/views/index.pug b/views/index.pug index 32b30e3e..8f707b49 100644 --- a/views/index.pug +++ b/views/index.pug @@ -68,91 +68,7 @@ html li(class=past === 'all' ? 'active' : '') a(href="?t=all") all time each link in json.links - .link - .upvotes - .arrow - span #{kFormatter(link.ups)} - .arrow.down - .image - if(link.images) - if link.is_self_link - a(href="" + link.permalink + "") - img(src=""+ link.images.thumb +"", alt="") - else - a(href="" + link.url + "", rel="noopener noreferrer") - img(src=""+ link.images.thumb +"", alt="") - else - a(href="" + link.permalink + "") - .no-image no image - .entry - .title - if link.is_self_link - a(href="" + link.permalink + "") - h2 #{cleanTitle(link.title)} - span (#{link.domain}) - else - a(href="" + link.url + "", rel="noopener noreferrer") - h2 #{cleanTitle(link.title)} - span (#{link.domain}) - .meta - p.submitted submitted - span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by - if link.author === '[deleted]' - span(class="deleted") [deleted] - else - a(href="/u/" + link.author + "") - | #{link.author} - span(class="to") to - a(href="/r/" + link.subreddit + "") - | #{link.subreddit} - .links - if link.over_18 - span.tag.nsfw NSFW - if link.selftext_html - details - summary - .line - .line - .line - .selftext - != unescape(link.selftext_html, user_preferences) - if (link.images && link.images.preview) - style. - details.preview-container img { - width: 100% !important; - height: auto !important; - max-width: none !important; - max-height: none !important; - opacity: 0; - } - details.preview-container[open][data-url="#{link.images.preview}"] .preview { - width: 100%; - height: auto; - background-image: url('#{link.images.preview}'); - background-repeat: no-repeat; - background-size: contain; - } - details.preview-container(data-url="" + link.images.preview + "") - summary - span ▶ - .preview - img(src=""+ link.images.thumb +"", alt="") - a(href="" + link.permalink + "", class="comments") #{link.num_comments} comments - - - let back_url = "/" + sortby + "§2t="+ (past ? past : '') +"" - if(before && !subreddit_front) - back_url = "/" + sortby + "§2t="+ (past ? past : '') +"§1before=" + before + "" - if(after) - back_url = "/" + sortby + "§2t=" + (past ? past : '') + "§1after=" + after + "" - - let saved_post = false - if user_preferences.saved - each post_id in user_preferences.saved - if post_id === link.id - - saved_post = true - if saved_post - a(href="/unsave/" + link.id + "/?rk=" + redis_key + "&b=" + back_url + "") unsave - else - a(href="/save/" + link.id + "/?rk=" + redis_key + "&b=" + back_url + "") save + include components/link.pug if json.info.before || json.info.after .view-more-links - var subreddit = 'all' diff --git a/views/subreddit.pug b/views/subreddit.pug index bfdbfe61..7d9e7650 100644 --- a/views/subreddit.pug +++ b/views/subreddit.pug @@ -84,96 +84,7 @@ html p This subreddit either doesn't exist, or any posts weren't found. else each link in json.links - .link - .upvotes - .arrow - span #{kFormatter(link.ups)} - .arrow.down - .image - if link.images - if link.is_self_link - a(href="" + link.permalink + "") - img(src="" + link.images.thumb + "", alt="") - else - a(href=""+ link.url +"", rel="noopener noreferrer") - img(src="" + link.images.thumb + "", alt="") - else - a(href="" + link.permalink + "") - .no-image no image - .entry - .title - if link.is_self_link - a(href="" + link.permalink + "") - h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)} - != link.link_flair - span (#{link.domain}) - else - a(href="" + link.url + "", rel="noopener noreferrer") - h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)} - != link.link_flair - span (#{link.domain}) - .meta - p.submitted submitted - span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by - if link.author === '[deleted]' - span(class="deleted") [deleted] - else - a(href="/u/" + link.author + "") - | #{link.author} - != link.user_flair - p.to to - a(href="/r/" + link.subreddit + "") - | #{link.subreddit} - if link.stickied - span(class="green") stickied - .links - if link.over_18 - span.tag.nsfw NSFW - if link.selftext_html - details - summary - .line - .line - .line - .selftext - != unescape(link.selftext_html, user_preferences) - if (link.images && link.images.preview) - style. - details.preview-container img { - width: 100% !important; - height: auto !important; - max-width: none !important; - max-height: none !important; - opacity: 0; - } - details.preview-container[open][data-url="#{link.images.preview}"] .preview { - width: 100%; - height: auto; - background-image: url('#{link.images.preview}'); - background-repeat: no-repeat; - background-size: contain; - } - details.preview-container(data-url="" + link.images.preview + "") - summary - span ▶ - .preview - img(src=""+ link.images.thumb +"", alt="") - a(href="" + link.permalink + "", class="comments") #{link.num_comments} comments - - - let back_url = "/r/" + subreddit + "/" + sortby + "§2t="+ (past ? past : '') +"" - if(before && !subreddit_front) - back_url = "/r/" + subreddit + "/" + sortby + "§2t="+ (past ? past : '') +"§1before=" + before + "" - if(after) - back_url = "/r/" + subreddit + "/" + sortby + "§2t=" + (past ? past : '') + "§1after=" + after + "" - - let saved_post = false - if user_preferences.saved - each post_id in user_preferences.saved - if post_id === link.id - - saved_post = true - if saved_post - a(href="/unsave/" + link.id + "/?rk=" + redis_key + "&b=" + back_url + "") unsave - else - a(href="/save/" + link.id + "/?rk=" + redis_key + "&b=" + back_url + "") save + include components/link.pug if json.info.before || json.info.after .view-more-links if json.info.before && !subreddit_front diff --git a/views/user.pug b/views/user.pug index 94678d38..c5aae74c 100644 --- a/views/user.pug +++ b/views/user.pug @@ -77,39 +77,43 @@ html br p(title="" + toUTCString(data.created) + "") account created: #{toDateString(data.created)} p verified: #{(data.verified) ? "yes" : "no" } - .entries + #links.entries if !data.posts || data.posts.length <= 0 h3 no posts/comments each post in data.posts if post.type === 't3' - .entry.t3 - .upvotes - .arrow - span #{kFormatter(post.ups)} - .arrow.down - .image - if post.thumbnail !== 'self' - a(href="" + post.permalink + "", rel="noopener noreferrer") - img(src="" + post.thumbnail + "", alt="") - if post.duration - span #{secondsToMMSS(post.duration)} - else - a(href="" + post.permalink + "", rel="noopener noreferrer") - .no-image no image - .title - a(href="" + post.permalink + "", rel="noopener noreferrer") #{cleanTitle(post.title)} - .meta - p.submitted(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} - | by - a(href="/u/" + data.username + "") #{data.username} - | to - != post.user_flair - a(href="/r/" + post.subreddit + "", class="subreddit") #{post.subreddit} - if post.over_18 - span.tag.nsfw NSFW - a.comments(href="" + post.permalink + "") #{post.num_comments} comments + - + var link = post; + link.author = data.username; + include components/link.pug + //-.entry.t3 + //- .upvotes + //- .arrow + //- span #{kFormatter(post.ups)} + //- .arrow.down + //- .image + //- if post.thumbnail !== 'self' + //- a(href="" + post.permalink + "", rel="noopener noreferrer") + //- img(src="" + post.thumbnail + "", alt="") + //- if post.duration + //- span #{secondsToMMSS(post.duration)} + //- else + //- a(href="" + post.permalink + "", rel="noopener noreferrer") + //- .no-image no image + //- .title + //- a(href="" + post.permalink + "", rel="noopener noreferrer") #{cleanTitle(post.title)} + //- .meta + //- p.submitted(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} + //- | by + //- a(href="/u/" + data.username + "") #{data.username} + //- | to + //- != post.user_flair + //- a(href="/r/" + post.subreddit + "", class="subreddit") #{post.subreddit} + //- if post.over_18 + //- span.tag.nsfw NSFW + //- a.comments(href="" + post.permalink + "") #{post.num_comments} comments if post.type === 't1' - .entry + .commententry .meta .title a(href="" + post.url + "", rel="noopener noreferrer") #{cleanTitle(post.link_title)} From 533519df65e9d6628ce50ea9825579339459654b Mon Sep 17 00:00:00 2001 From: StevenNMeza Date: Mon, 24 May 2021 21:18:50 +0200 Subject: [PATCH 004/300] Implement a central link object --- inc/components/link.js | 83 +++++++++++++++++++++++++++++++++++++ inc/processJsonSubreddit.js | 41 ++++-------------- inc/processJsonUser.js | 29 ++----------- inc/processSearchResults.js | 52 +---------------------- static/css/styles.css | 5 +-- views/search.pug | 48 +-------------------- views/user.pug | 1 - 7 files changed, 99 insertions(+), 160 deletions(-) create mode 100644 inc/components/link.js diff --git a/inc/components/link.js b/inc/components/link.js new file mode 100644 index 00000000..66863d55 --- /dev/null +++ b/inc/components/link.js @@ -0,0 +1,83 @@ +/* + * Corresponds to `components/link.pug` + */ + +const config = require('../../config') +let valid_reddit_self_domains = ['reddit.com'] + +class Link { + // Parses a link from a response returned by reddit. + static async fromJson(data, user_preferences, subreddit_front) { + + // Meta + this.id = data.id + this.permalink = data.permalink + this.created = data.created_utc + this.author = data.author + this.title = data.title + this.over_18 = data.over_18 + this.score = data.score + this.ups = data.ups + this.upvote_ratio = data.upvote_ratio + this.num_comments = data.num_comments + + // Content + this.is_self_link = false + this.selftext_html = data.selftext_html + this.url = replaceDomains(data.url, user_preferences) + this.domain = data.domain + this.is_video = data.is_video + this.media = data.media + this.duration = data.is_video ? data.media.reddit_video ? data.media.reddit_video.duration : void 0 : void 0 + this.images = null + + // Moderation attributes + this.locked = data.locked + this.stickied = data.stickied + + // Subreddit + this.subreddit_front = subreddit_front + this.subreddit = data.subreddit + + // Flair + this.link_flair = (user_preferences.flairs != 'false' ? await formatLinkFlair(data) : '') + this.user_flair = (user_preferences.flairs != 'false' ? await formatUserFlair(data) : '') + this.link_flair_text = data.link_flair_text + + if(data.domain) { + let tld = data.domain.split('self.') + if(tld.length > 1) { + if(!tld[1].includes('.')) { + this.is_self_link = true + } + } + if(config.valid_media_domains.includes(data.domain) || valid_reddit_self_domains.includes(data.domain)) { + this.is_self_link = true + } + } + + if(data.preview && data.thumbnail !== 'self') { + if(!data.url.startsWith('/r/') && isGif(data.url)) { + this.images = { + thumb: await downloadAndSave(data.thumbnail, 'thumb_') + } + } else { + if(data.preview.images[0].resolutions[0]) { + let preview = null + if(!isGif(data.url) && !data.post_hint.includes(':video')) + preview = await downloadAndSave(data.preview.images[0].source.url) + this.images = { + thumb: await downloadAndSave(data.preview.images[0].resolutions[0].url, 'thumb_'), + preview: preview + } + } + } + } + + // Use black magic in order to return a normal object + return Object.fromEntries(Object.entries(this)) + } + +} + +module.exports = Link; diff --git a/inc/processJsonSubreddit.js b/inc/processJsonSubreddit.js index 597033e6..cb9f0584 100644 --- a/inc/processJsonSubreddit.js +++ b/inc/processJsonSubreddit.js @@ -1,5 +1,6 @@ module.exports = function() { const config = require('../config'); + const link = require('./components/link') this.processJsonSubreddit = (json, from, subreddit_front, user_preferences, saved) => { return new Promise(resolve => { (async () => { @@ -35,43 +36,14 @@ module.exports = function() { for(var i = 0; i < children_len; i++) { let data = json.data.children[i].data - let images = null - let is_self_link = false - let valid_reddit_self_domains = ['reddit.com'] if(data.over_18) if((config.nsfw_enabled === false && user_preferences.nsfw_enabled != 'true') || user_preferences.nsfw_enabled === 'false') continue - if(data.domain) { - let tld = data.domain.split('self.') - if(tld.length > 1) { - if(!tld[1].includes('.')) { - is_self_link = true - } - } - if(config.valid_media_domains.includes(data.domain) || valid_reddit_self_domains.includes(data.domain)) { - is_self_link = true - } - } - - if(data.preview && data.thumbnail !== 'self') { - if(!data.url.startsWith('/r/') && isGif(data.url)) { - images = { - thumb: await downloadAndSave(data.thumbnail, 'thumb_') - } - } else { - if(data.preview.images[0].resolutions[0]) { - let preview = null - if(!isGif(data.url) && !data.post_hint.includes(':video')) - preview = await downloadAndSave(data.preview.images[0].source.url) - images = { - thumb: await downloadAndSave(data.preview.images[0].resolutions[0].url, 'thumb_'), - preview: preview - } - } - } - } + /* + // Todo: Remove this once the link component is done + // but keep it for now in case we need it later let obj = { author: data.author, created: data.created_utc, @@ -97,7 +69,10 @@ module.exports = function() { subreddit_front: subreddit_front, link_flair: (user_preferences.flairs != 'false' ? await formatLinkFlair(data) : ''), user_flair: (user_preferences.flairs != 'false' ? await formatUserFlair(data) : '') - } + } */ + + let obj = await link.fromJson(data, user_preferences, subreddit_front) + ret.links.push(obj) } resolve(ret) diff --git a/inc/processJsonUser.js b/inc/processJsonUser.js index 4a0ec760..83c8fce5 100644 --- a/inc/processJsonUser.js +++ b/inc/processJsonUser.js @@ -1,5 +1,6 @@ module.exports = function() { const config = require('../config'); + const link = require('./components/link') this.processJsonUser = function(json, parsed, after, before, user_preferences, kind, post_type) { return new Promise(resolve => { (async () => { @@ -49,32 +50,8 @@ module.exports = function() { continue if(type === 't3') { - let duration = null - if(post.media) { - if(post.is_video) { - if(post.media.reddit_video) { - duration = post.media.reddit_video.duration - } - } - } - - obj = { - type: type, - subreddit: post.subreddit, - title: post.title, - created: post.created_utc, - ups: post.ups, - url: replaceDomains(url, user_preferences), - domain: post.domain, - thumbnail: await downloadAndSave(post.thumbnail), - duration: duration, - edited: post.edited, - selftext_html: unescape(post.selftext_html), - num_comments: post.num_comments, - over_18: post.over_18, - permalink: post.permalink, - user_flair: (user_preferences.flairs != 'false' ? await formatUserFlair(post) : '') - } + obj = await link.fromJson(post, user_preferences) + obj.type = 't3' } if(type === 't1') { obj = { diff --git a/inc/processSearchResults.js b/inc/processSearchResults.js index bb71ef23..aa97b9d5 100644 --- a/inc/processSearchResults.js +++ b/inc/processSearchResults.js @@ -1,5 +1,6 @@ module.exports = function() { const config = require('../config'); + const link = require('./components/link') this.processSearchResults = (json, parsed, after, before, user_preferences) => { return new Promise(resolve => { (async () => { @@ -36,61 +37,12 @@ module.exports = function() { for(var i = 0; i < posts_limit; i++) { let post = json.data.children[i].data - let images = null - let is_self_link = false - let valid_reddit_self_domains = ['reddit.com'] if(post.over_18) if((config.nsfw_enabled === false && user_preferences.nsfw_enabled != 'true') || user_preferences.nsfw_enabled === 'false') continue - if(post.domain) { - let tld = post.domain.split('self.') - if(tld.length > 1) { - if(!tld[1].includes('.')) { - is_self_link = true - } - } - if(config.valid_media_domains.includes(post.domain) || valid_reddit_self_domains.includes(post.domain)) { - is_self_link = true - } - } - - if(post.preview && post.thumbnail !== 'self') { - if(!post.url.startsWith('/r/') && isGif(post.url)) { - images = { - thumb: await downloadAndSave(post.thumbnail, 'thumb_') - } - } else { - if(post.preview.images[0].resolutions[0]) { - images = { - thumb: await downloadAndSave(post.preview.images[0].resolutions[0].url, 'thumb_') - } - } - } - } - - let obj = { - subreddit: post.subreddit, - title: post.title, - created: post.created_utc, - domain: post.domain, - subreddit_name_prefixed: post.subreddit_name_prefixed, - link_flair_text: post.link_flair_text, - ups: post.ups, - images: images, - url: replaceDomains(post.url, user_preferences), - edited: post.edited, - selftext_html: unescape(post.body_html), - num_comments: post.num_comments, - over_18: post.over_18, - permalink: post.permalink, - is_self_link: is_self_link, - author: post.author, - link_title: post.link_title, - link_flair: (user_preferences.flairs != 'false' ? await formatLinkFlair(post) : ''), - user_flair: (user_preferences.flairs != 'false' ? await formatUserFlair(post) : '') - } + let obj = await link.fromJson(post, user_preferences) posts.push(obj) } } diff --git a/static/css/styles.css b/static/css/styles.css index 87e91e3a..5e88733e 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -1039,8 +1039,7 @@ footer a { margin-right: 8px; position: relative; } -#user .entries .commententry .image a span { - position: absolute; +#user .entries .link .image a span { bottom: 0; background: #0000005e; left: 0; @@ -1050,7 +1049,7 @@ footer a { font-size: var(--sm-font); margin-bottom: 4px; } -#user .entries .commententry .image img { +#user .entries .link .image img { max-width: 80px; } #user .entries .commententry .title a { diff --git a/views/search.pug b/views/search.pug index a3a07c8e..666658f4 100644 --- a/views/search.pug +++ b/views/search.pug @@ -137,53 +137,7 @@ html span.tag.nsfw NSFW a(href="/subreddits/search?q="+ q +"", class="btn") show more similar subreddits each link in json.posts - .link - .upvotes - .arrow - span #{kFormatter(link.ups)} - .arrow.down - .image - if link.images - if link.is_self_link - a(href="" + link.permalink + "") - img(src="" + link.images.thumb + "", alt="") - else - a(href=""+ link.url +"", rel="noopener noreferrer") - img(src="" + link.images.thumb + "", alt="") - else - a(href="" + link.permalink + "") - .no-image no image - .entry - .title - if link.is_self_link - a(href="" + link.permalink + "") - h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)} - != link.link_flair - span (#{link.domain}) - else - a(href="" + link.url + "", rel="noopener noreferrer") - h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)} - != link.link_flair - span (#{link.domain}) - .meta - p.submitted submitted - span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by - if link.author === '[deleted]' - span(class="deleted") [deleted] - else - a(href="/u/" + link.author + "") - | #{link.author} - != link.user_flair - p.to to - a(href="/r/" + link.subreddit + "") - | #{link.subreddit} - if link.stickied - span(class="green") stickied - .links - if link.over_18 - span.tag.nsfw NSFW - a(href="" + link.permalink + "", class="comments") - | #{link.num_comments} comments + include components/link.pug if json.before || json.after .view-more-links if json.before && !subreddit_front diff --git a/views/user.pug b/views/user.pug index c5aae74c..dfdf973a 100644 --- a/views/user.pug +++ b/views/user.pug @@ -84,7 +84,6 @@ html if post.type === 't3' - var link = post; - link.author = data.username; include components/link.pug //-.entry.t3 //- .upvotes From 6e682b6bc1eec8a538573cae971f8ed34654527f Mon Sep 17 00:00:00 2001 From: StevenNMeza Date: Mon, 24 May 2021 21:51:02 +0200 Subject: [PATCH 005/300] Add duration label --- views/components/link.pug | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/views/components/link.pug b/views/components/link.pug index e61fdf1c..7772ceef 100644 --- a/views/components/link.pug +++ b/views/components/link.pug @@ -8,9 +8,13 @@ if link.is_self_link a(href="" + link.permalink + "") img(src="" + link.images.thumb + "", alt="") + if link.duration + span #{secondsToMMSS(link.duration)} else a(href=""+ link.url +"", rel="noopener noreferrer") img(src="" + link.images.thumb + "", alt="") + if link.duration + span #{secondsToMMSS(link.duration)} else a(href="" + link.permalink + "") .no-image no image From 5ed29ea1a1e915836ad77dbd408f06652f9330eb Mon Sep 17 00:00:00 2001 From: StevenNMeza Date: Mon, 24 May 2021 21:51:15 +0200 Subject: [PATCH 006/300] Remove leftover code --- views/user.pug | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/views/user.pug b/views/user.pug index dfdf973a..fe67d8e1 100644 --- a/views/user.pug +++ b/views/user.pug @@ -85,32 +85,6 @@ html - var link = post; include components/link.pug - //-.entry.t3 - //- .upvotes - //- .arrow - //- span #{kFormatter(post.ups)} - //- .arrow.down - //- .image - //- if post.thumbnail !== 'self' - //- a(href="" + post.permalink + "", rel="noopener noreferrer") - //- img(src="" + post.thumbnail + "", alt="") - //- if post.duration - //- span #{secondsToMMSS(post.duration)} - //- else - //- a(href="" + post.permalink + "", rel="noopener noreferrer") - //- .no-image no image - //- .title - //- a(href="" + post.permalink + "", rel="noopener noreferrer") #{cleanTitle(post.title)} - //- .meta - //- p.submitted(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} - //- | by - //- a(href="/u/" + data.username + "") #{data.username} - //- | to - //- != post.user_flair - //- a(href="/r/" + post.subreddit + "", class="subreddit") #{post.subreddit} - //- if post.over_18 - //- span.tag.nsfw NSFW - //- a.comments(href="" + post.permalink + "") #{post.num_comments} comments if post.type === 't1' .commententry .meta From a8974f709d0a3eb359386ed280bd08b91039a8ee Mon Sep 17 00:00:00 2001 From: StevenNMeza Date: Wed, 26 May 2021 18:21:05 +0200 Subject: [PATCH 007/300] Use a standalone function --- inc/components/link.js | 127 ++++++++++++++++++++--------------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/inc/components/link.js b/inc/components/link.js index 66863d55..e39ec898 100644 --- a/inc/components/link.js +++ b/inc/components/link.js @@ -5,79 +5,78 @@ const config = require('../../config') let valid_reddit_self_domains = ['reddit.com'] -class Link { - // Parses a link from a response returned by reddit. - static async fromJson(data, user_preferences, subreddit_front) { +// Parses a link from a response returned by reddit. +async function fromJson(data, user_preferences, subreddit_front) { + let result = {} - // Meta - this.id = data.id - this.permalink = data.permalink - this.created = data.created_utc - this.author = data.author - this.title = data.title - this.over_18 = data.over_18 - this.score = data.score - this.ups = data.ups - this.upvote_ratio = data.upvote_ratio - this.num_comments = data.num_comments + // Meta + result.id = data.id + result.permalink = data.permalink + result.created = data.created_utc + result.author = data.author + result.title = data.title + result.over_18 = data.over_18 + result.score = data.score + result.ups = data.ups + result.upvote_ratio = data.upvote_ratio + result.num_comments = data.num_comments - // Content - this.is_self_link = false - this.selftext_html = data.selftext_html - this.url = replaceDomains(data.url, user_preferences) - this.domain = data.domain - this.is_video = data.is_video - this.media = data.media - this.duration = data.is_video ? data.media.reddit_video ? data.media.reddit_video.duration : void 0 : void 0 - this.images = null + // Content + result.is_self_link = false + result.selftext_html = data.selftext_html + result.url = replaceDomains(data.url, user_preferences) + result.domain = data.domain + result.is_video = data.is_video + result.media = data.media + result.duration = data.is_video ? data.media.reddit_video ? data.media.reddit_video.duration : void 0 : void 0 + result.images = null - // Moderation attributes - this.locked = data.locked - this.stickied = data.stickied + // Moderation attributes + result.locked = data.locked + result.stickied = data.stickied - // Subreddit - this.subreddit_front = subreddit_front - this.subreddit = data.subreddit + // Subreddit + result.subreddit_front = subreddit_front + result.subreddit = data.subreddit - // Flair - this.link_flair = (user_preferences.flairs != 'false' ? await formatLinkFlair(data) : '') - this.user_flair = (user_preferences.flairs != 'false' ? await formatUserFlair(data) : '') - this.link_flair_text = data.link_flair_text + // Flair + result.link_flair = (user_preferences.flairs != 'false' ? await formatLinkFlair(data) : '') + result.user_flair = (user_preferences.flairs != 'false' ? await formatUserFlair(data) : '') + result.link_flair_text = data.link_flair_text - if(data.domain) { - let tld = data.domain.split('self.') - if(tld.length > 1) { - if(!tld[1].includes('.')) { - this.is_self_link = true - } - } - if(config.valid_media_domains.includes(data.domain) || valid_reddit_self_domains.includes(data.domain)) { - this.is_self_link = true - } - } + if(data.domain) { + let tld = data.domain.split('self.') + if(tld.length > 1) { + if(!tld[1].includes('.')) { + result.is_self_link = true + } + } + if(config.valid_media_domains.includes(data.domain) || valid_reddit_self_domains.includes(data.domain)) { + result.is_self_link = true + } + } - if(data.preview && data.thumbnail !== 'self') { - if(!data.url.startsWith('/r/') && isGif(data.url)) { - this.images = { - thumb: await downloadAndSave(data.thumbnail, 'thumb_') - } - } else { - if(data.preview.images[0].resolutions[0]) { - let preview = null - if(!isGif(data.url) && !data.post_hint.includes(':video')) - preview = await downloadAndSave(data.preview.images[0].source.url) - this.images = { - thumb: await downloadAndSave(data.preview.images[0].resolutions[0].url, 'thumb_'), - preview: preview - } - } - } + if(data.preview && data.thumbnail !== 'self') { + if(!data.url.startsWith('/r/') && isGif(data.url)) { + result.images = { + thumb: await downloadAndSave(data.thumbnail, 'thumb_') + } + } else { + if(data.preview.images[0].resolutions[0]) { + let preview = null + if(!isGif(data.url) && !data.post_hint.includes(':video')) + preview = await downloadAndSave(data.preview.images[0].source.url) + result.images = { + thumb: await downloadAndSave(data.preview.images[0].resolutions[0].url, 'thumb_'), + preview: preview } - - // Use black magic in order to return a normal object - return Object.fromEntries(Object.entries(this)) + } } + } + return result } -module.exports = Link; +module.exports = { + fromJson, +} From 224db4ff6ab1503314672f986a7fcb5ffcba64ba Mon Sep 17 00:00:00 2001 From: teddit Date: Wed, 26 May 2021 20:38:52 +0200 Subject: [PATCH 008/300] bump version --- package-lock.json | 2 +- package.json | 2 +- views/about.pug | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 79892018..7d27aab2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "teddit", - "version": "0.3.1", + "version": "0.3.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fcd69cf3..bee2417e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "teddit", - "version": "0.3.1", + "version": "0.3.8", "description": "A free and open source alternative Reddit front-end focused on privacy.", "homepage": "https://teddit.net", "bugs": { diff --git a/views/about.pug b/views/about.pug index eba33b14..5cb4c158 100644 --- a/views/about.pug +++ b/views/about.pug @@ -21,5 +21,5 @@ html .bottom a(href="https://en.wikipedia.org/wiki/Piratbyr%C3%A5n#Kopimi", target="_blank") img(src="kopimi.gif") - p.version v.0.3.1 + p.version v.0.3.8 include includes/footer.pug From 9da48f92c5518bb9d3a95da6561dc4a0ff25efd3 Mon Sep 17 00:00:00 2001 From: teddit Date: Tue, 1 Jun 2021 23:17:06 +0200 Subject: [PATCH 009/300] mute videos automatically #201 --- config.js.template | 1 + routes.js | 31 ++++++++++++++++++++++--------- views/post.pug | 12 ++++++++++-- views/preferences.pug | 15 +++++++++++++++ 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/config.js.template b/config.js.template index 139f23e4..5232c395 100644 --- a/config.js.template +++ b/config.js.template @@ -25,6 +25,7 @@ const config = { trust_proxy: process.env.TRUST_PROXY === 'true' || false, // Enable trust_proxy if you are using reverse proxy like nginx trust_proxy_address: process.env.TRUST_PROXY_ADDRESS || '127.0.0.1', nsfw_enabled: process.env.NSFW_ENABLED !== 'true' || true, // Enable NSFW (over 18) content. If false, a warning is shown to the user before opening any NSFW post. When the NFSW content is disabled, NSFW posts are hidden from subreddits and from user page feeds. Note: Users can set this to true or false from their preferences. + videos_muted: process.env.VIDEOS_MUTED !== 'true' || true, // Automatically mute all videos in posts post_comments_sort: process.env.POST_COMMENTS_SORT || 'confidence', // "confidence" is the default sorting in Reddit. Must be one of: confidence, top, new, controversial, old, random, qa, live. reddit_app_id: process.env.REDDIT_APP_ID || 'ABfYqdDc9qPh1w', // If "use_reddit_oauth" config key is set to true, you have to obtain your Reddit app ID. For testing purposes it's okay to use this project's default app ID. Create your Reddit app here: https://old.reddit.com/prefs/apps/. Make sure to create an "installed app" type of app. domain_replacements: process.env.DOMAIN_REPLACEMENTS diff --git a/routes.js b/routes.js index db6ae36c..ef102788 100644 --- a/routes.js +++ b/routes.js @@ -82,6 +82,16 @@ module.exports = (app, redis, fetch, RedditAPI) => { res.cookie('domain_instagram', domainInstagram, { maxAge: 31536000, httpOnly: true }) } + let videosMuted = req.query.videos_muted + if(videosMuted) { + req.cookies.videos_muted = videosMuted + res.cookie('videos_muted', videosMuted, { maxAge: 31536000, httpOnly: true }) + } + + if(!config.rate_limiting) { + return next() + } + const valid_reddit_starts = ['/https://old.reddit.com', '/https://reddit.com', '/https://www.reddit.com', '/old.reddit.com', '/reddit.com', '/www.reddit.com'] for(var i = 0; i < valid_reddit_starts.length; i++) { if(req.url.startsWith(valid_reddit_starts[i])) { @@ -98,10 +108,6 @@ module.exports = (app, redis, fetch, RedditAPI) => { } } - if(!config.rate_limiting) { - return next() - } - if(config.rate_limiting.enabled) { /** * This route enforces request limits based on an IP address if @@ -153,11 +159,7 @@ module.exports = (app, redis, fetch, RedditAPI) => { }) app.get('/resetprefs', (req, res, next) => { - res.clearCookie('theme') - res.clearCookie('flairs') - res.clearCookie('nsfw_enabled') - res.clearCookie('highlight_controversial') - res.clearCookie('subbed_subreddits') + resetPreferences(res) return res.redirect('/preferences') }) @@ -1347,6 +1349,7 @@ module.exports = (app, redis, fetch, RedditAPI) => { sortby: sortby, user_preferences: req.cookies, instance_nsfw_enabled: config.nsfw_enabled, + instance_videos_muted: config.videos_muted, post_media_max_heights: config.post_media_max_heights, redis_key: comments_key }) @@ -1393,6 +1396,7 @@ module.exports = (app, redis, fetch, RedditAPI) => { sortby: sortby, user_preferences: req.cookies, instance_nsfw_enabled: config.nsfw_enabled, + instance_videos_muted: config.videos_muted, post_media_max_heights: config.post_media_max_heights, redis_key: comments_key }) @@ -1773,6 +1777,7 @@ module.exports = (app, redis, fetch, RedditAPI) => { let domain_twitter = req.body.domain_twitter let domain_youtube = req.body.domain_youtube let domain_instagram = req.body.domain_instagram + let videos_muted = req.body.videos_muted res.cookie('theme', theme, { maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: true }) @@ -1809,6 +1814,12 @@ module.exports = (app, redis, fetch, RedditAPI) => { show_upvoted_percentage = 'false' res.cookie('show_upvoted_percentage', show_upvoted_percentage, { maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: true }) + if(videos_muted === 'on') + videos_muted = 'true' + else + videos_muted = 'false' + res.cookie('videos_muted', videos_muted, { maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: true }) + res.cookie('domain_twitter', domain_twitter, { maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: true }) res.cookie('domain_youtube', domain_youtube, { maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: true }) res.cookie('domain_instagram', domain_instagram, { maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: true }) @@ -1897,6 +1908,8 @@ module.exports = (app, redis, fetch, RedditAPI) => { res.clearCookie('domain_twitter') res.clearCookie('domain_youtube') res.clearCookie('domain_instagram') + res.clearCookie('videos_muted') } } + diff --git a/views/post.pug b/views/post.pug index 09055d54..fe80f5b7 100644 --- a/views/post.pug +++ b/views/post.pug @@ -37,6 +37,14 @@ html max-height: #{user_preferences.post_media_max_height}px; max-width: 100%; } + - + let video_muted = false + if(instance_videos_muted === true || user_preferences.videos_muted === 'true') { + video_muted = true + } + if(user_preferences.videos_muted === 'false') { + video_muted = false + } .info .score div.arrow @@ -113,7 +121,7 @@ html p #{post.media.embed_src} else .video - video(controls="controls", autoplay="autoplay", loop="loop") + video(controls="controls", autoplay="autoplay", loop="loop", muted=(video_muted ? true : false)) source(src="" + post.media.source + "", type="video/mp4") | Your browser does not support the video element. a(href="" + post.media.source + "") [media] @@ -168,7 +176,7 @@ html p #{post.media.embed_src} else .video - video(controls="controls", autoplay="autoplay", loop="loop") + video(controls="controls", autoplay="autoplay", loop="loop", muted=(video_muted ? true : false)) source(src="" + post.media.source + "", type="video/mp4") | Your browser does not support the video element. a(href="" + post.media.source + "") [media] diff --git a/views/preferences.pug b/views/preferences.pug index 6325086e..f0bb5ce2 100644 --- a/views/preferences.pug +++ b/views/preferences.pug @@ -96,6 +96,21 @@ html input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage", checked="checked") else input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage") + legend Media + .setting + label(for="videos_muted") Mute videos by default: + - + let videos_muted = false + if(instance_config.videos_muted === true || user_preferences.videos_muted === 'true') { + videos_muted = true + } + if(user_preferences.videos_muted === 'false') { + videos_muted = false + } + if(videos_muted) + input(type="checkbox", name="videos_muted", id="videos_muted", checked="checked") + else + input(type="checkbox", name="videos_muted", id="videos_muted") small(class="notice") Preferences are stored client-side using cookies without any personal information. br input(type="submit", value="Save preferences") From d98bb997e6e9009563467b2bfe0c8de4be97e474 Mon Sep 17 00:00:00 2001 From: teddit Date: Tue, 1 Jun 2021 23:23:33 +0200 Subject: [PATCH 010/300] add mention of not working instance #202 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 48b51069..88d5af02 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Community instances: * [https://teddit.nautolan.racing](https://teddit.nautolan.racing) * [https://teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) * [https://teddit.domain.glass](https://teddit.domain.glass) -* [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) +* [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) (not working since 06/2021) * [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) ## Changelog From cf9348a148eb5f244f3923aacbea9f2333f1d7b4 Mon Sep 17 00:00:00 2001 From: teddit Date: Fri, 4 Jun 2021 16:33:44 +0200 Subject: [PATCH 011/300] update packages --- package-lock.json | 62 +++++++++++++++++++++++------------------------ package.json | 4 +-- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7d27aab2..7341510e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,16 @@ "to-fast-properties": "^2.0.0" } }, + "@postman/form-data": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@postman/form-data/-/form-data-3.1.1.tgz", + "integrity": "sha512-vjh8Q2a8S6UCm/KKs31XFJqEEgmbjBmpPNVV2eVav6905wyFAwaUOBGA1NPBI4ERH9MMZc6w0umFgM6WbEPMdg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "@postman/tunnel-agent": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/@postman/tunnel-agent/-/tunnel-agent-0.6.3.tgz", @@ -47,9 +57,9 @@ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" }, "ajv": { - "version": "6.12.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", - "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -96,9 +106,9 @@ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz", - "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==" + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, "babel-walk": { "version": "3.0.0-canary-5", @@ -109,9 +119,9 @@ } }, "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "bcrypt-pbkdf": { "version": "1.0.2", @@ -468,9 +478,9 @@ "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" }, "helmet": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/helmet/-/helmet-4.2.0.tgz", - "integrity": "sha512-aoiSxXMd0ks1ojYpSCFoCRzgv4rY/uB9jKStaw8PkXwsdLYa/Gq+Nc5l0soH0cwBIsLAlujPnx4HLQs+LaXCrQ==" + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-4.6.0.tgz", + "integrity": "sha512-HVqALKZlR95ROkrnesdhbbZJFi/rIVSoNq6f3jA/9u6MIbTsPh3xZwihjeI5+DO/2sOV6HMHooXcEOuwskHpTg==" }, "http-errors": { "version": "1.7.2", @@ -485,9 +495,9 @@ } }, "http-signature": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.4.tgz", - "integrity": "sha512-CbG3io8gUSIxNNSgq+XMjgpTMzAeVRipxVXjuGrDhH5M1a2kZ03w20s8FCLR1NjnnJj10KbvabvckmtQcYNb9g==", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.5.tgz", + "integrity": "sha512-NwoTQYSJoFt34jSBbwzDHDofoA61NGXzu6wXh95o1Ry62EnmKjXb/nR/RknLeZ3G/uGwrlKNY2z7uPt+Cdl7Tw==", "requires": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -712,9 +722,9 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "postman-request": { - "version": "2.88.1-postman.27", - "resolved": "https://registry.npmjs.org/postman-request/-/postman-request-2.88.1-postman.27.tgz", - "integrity": "sha512-4Qc7p3/cbp5S4Q6LcOzJ+K5N7loWDKjW0S9hj8M2AMJDUVcFUbdgvQb6ZfTERz2+34xP9ByCy7VhdnNCATe/bA==", + "version": "2.88.1-postman.30", + "resolved": "https://registry.npmjs.org/postman-request/-/postman-request-2.88.1-postman.30.tgz", + "integrity": "sha512-zsGvs8OgNeno1Q44zTgGP2IL7kCqUy4DAtl8/ms0AQpqkIoysrxzR/Zg4kM1Kz8/duBvwxt8NN717wB7SMNm6w==", "requires": { "@postman/form-data": "~3.1.1", "@postman/tunnel-agent": "^0.6.3", @@ -740,16 +750,6 @@ "uuid": "^3.3.2" }, "dependencies": { - "@postman/form-data": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@postman/form-data/-/form-data-3.1.1.tgz", - "integrity": "sha512-vjh8Q2a8S6UCm/KKs31XFJqEEgmbjBmpPNVV2eVav6905wyFAwaUOBGA1NPBI4ERH9MMZc6w0umFgM6WbEPMdg==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", @@ -1081,9 +1081,9 @@ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "requires": { "punycode": "^2.1.0" } diff --git a/package.json b/package.json index bee2417e..45d87eb1 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,10 @@ "compression": "^1.7.4", "cookie-parser": "^1.4.5", "express": "^4.17.1", - "helmet": "^4.2.0", + "helmet": "^4.6.0", "minizlib": "^2.1.2", "node-fetch": "^2.6.1", - "postman-request": "^2.88.1-postman.27", + "postman-request": "^2.88.1-postman.30", "pug": "^3.0.2", "redis": "^3.1.2" }, From 386e5fad78785d0973ccdb369073fa9d2615c005 Mon Sep 17 00:00:00 2001 From: josiah Date: Sun, 13 Jun 2021 21:52:25 -0500 Subject: [PATCH 012/300] added my instance to README and fixed expresss not binding to config.listen_address --- README.md | 1 + app.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88d5af02..731a50b7 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Community instances: * [https://teddit.nautolan.racing](https://teddit.nautolan.racing) * [https://teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) * [https://teddit.domain.glass](https://teddit.domain.glass) +* [https://snoo.ioens.is](https://snoo.ioens.is) * [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) (not working since 06/2021) * [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) diff --git a/app.js b/app.js index e718983d..07b81d9f 100644 --- a/app.js +++ b/app.js @@ -140,6 +140,6 @@ redis.on('error', (error) => { }) if(config.https_enabled) { - https.listen(config.ssl_port, '::', () => console.log(`Teddit running on https://${config.domain}:${config.ssl_port}`)) + https.listen(config.ssl_port, config.listen_address, () => console.log(`Teddit running on https://${config.domain}:${config.ssl_port}`)) } -http.listen(config.nonssl_port, '::', () => console.log(`Teddit running on http://${config.domain}:${config.nonssl_port}`)) +http.listen(config.nonssl_port, config.listen_address, () => console.log(`Teddit running on http://${config.domain}:${config.nonssl_port}`)) From 791014b661b0b7bc06cc6b7fc28aaef9dd6ef747 Mon Sep 17 00:00:00 2001 From: teddit Date: Wed, 16 Jun 2021 19:50:27 +0200 Subject: [PATCH 013/300] add explanation for listen_address --- config.js.template | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.js.template b/config.js.template index 5232c395..0c45c2cc 100644 --- a/config.js.template +++ b/config.js.template @@ -14,7 +14,7 @@ const config = { redis_port: process.env.REDIS_PORT || 6379, ssl_port: process.env.SSL_PORT || 8088, nonssl_port: process.env.NONSSL_PORT || 8080, - listen_address: process.env.LISTEN_ADDRESS || '0.0.0.0', + listen_address: process.env.LISTEN_ADDRESS || '0.0.0.0', // '0.0.0.0' will accept connections only from IPv4 addresses. If you want to also accept IPv6 addresses use '::'. https_enabled: process.env.HTTPS_ENABLED === 'true' || false, redirect_http_to_https: process.env.REDIRECT_HTTP_TO_HTTPS === 'true' || false, redirect_www: process.env.REDIRECT_WWW === 'true' || false, @@ -72,3 +72,4 @@ const config = { }; module.exports = config; + From 95f7ebb4bef8def54842628fe301264581be903f Mon Sep 17 00:00:00 2001 From: teddit Date: Fri, 18 Jun 2021 22:44:31 +0200 Subject: [PATCH 014/300] comment out the moderators fetching --- inc/processSubredditAbout.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/inc/processSubredditAbout.js b/inc/processSubredditAbout.js index aeadf110..af136040 100644 --- a/inc/processSubredditAbout.js +++ b/inc/processSubredditAbout.js @@ -47,6 +47,16 @@ module.exports = function() { if(config.use_reddit_oauth) { moderators_url = `https://oauth.reddit.com/r/${subreddit}/about/moderators` } + resolve(returnRelevantKeys(json)) + /* + * The following code is commented out because Reddit doesn't + * anymore support fetching moderators for subreddits + * when not logged in. + * This might change in the future though. + * https://codeberg.org/teddit/teddit/issues/207 + */ + + /* fetch(encodeURI(moderators_url), redditApiGETHeaders()) .then(mod_result => { if(mod_result.status === 200) { @@ -72,6 +82,7 @@ module.exports = function() { console.error('Error fetching moderators.', error) resolve(returnRelevantKeys(json)) }) + */ } }) }) From caf399c0f39d3ea844fa0461c3dda9028d5c6b04 Mon Sep 17 00:00:00 2001 From: tetralemma Date: Sun, 20 Jun 2021 06:50:47 +0200 Subject: [PATCH 015/300] Update 'README.md' added instance --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 731a50b7..3bd0f940 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Community instances: * [https://teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) * [https://teddit.domain.glass](https://teddit.domain.glass) * [https://snoo.ioens.is](https://snoo.ioens.is) +* [https://teddit.httpjames.space](https://teddit.httpjames.space) * [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) (not working since 06/2021) * [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) From fedf2fd94de8c784add997c76c53182d51becba8 Mon Sep 17 00:00:00 2001 From: arche_dev Date: Tue, 29 Jun 2021 06:01:55 +0200 Subject: [PATCH 016/300] Replaced bullet list with a table --- README.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3bd0f940..79bbef4f 100644 --- a/README.md +++ b/README.md @@ -22,17 +22,19 @@ XMR: 832ogRwuoSs2JGYg7wJTqshidK7dErgNdfpenQ9dzMghNXQTJRby1xGbqC3gW3GAifRM9E84J91 Community instances: -* [https://teddit.ggc-project.de](https://teddit.ggc-project.de) -* [https://teddit.kavin.rocks](https://teddit.kavin.rocks) -* [https://teddit.zaggy.nl](https://teddit.zaggy.nl) -* [https://teddit.namazso.eu](https://teddit.namazso.eu) -* [https://teddit.nautolan.racing](https://teddit.nautolan.racing) -* [https://teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) -* [https://teddit.domain.glass](https://teddit.domain.glass) -* [https://snoo.ioens.is](https://snoo.ioens.is) -* [https://teddit.httpjames.space](https://teddit.httpjames.space) -* [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) (not working since 06/2021) -* [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) +| Instance | Notes | +|-------------------------------------------------------------------------------------------------------|---------------------------| +| [teddit.ggc-project.de](https://teddit.ggc-project.de) | | +| [teddit.kavin.rocks](https://teddit.kavin.rocks) | | +| [teddit.zaggy.nl](https://teddit.zaggy.nl) | | +| [teddit.namazso.eu](https://teddit.namazso.eu) | | +| [teddit.nautolan.racing](https://teddit.nautolan.racing) | | +| [teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) | | +| [teddit.domain.glass](https://teddit.domain.glass) | | +| [snoo.ioens.is](https://snoo.ioens.is) | | +| [teddit.httpjames.space](https://teddit.httpjames.space) | | +| [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | Not working since 06/2021 | +| [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) | | ## Changelog From 321b6de8e343aeb763b9bc2060f0e5f455d94554 Mon Sep 17 00:00:00 2001 From: Ming Di Leom Date: Sat, 3 Jul 2021 02:48:55 +0000 Subject: [PATCH 017/300] docs: ibara...onion is back online --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 79bbef4f..9f7aea5d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Community instances: | [teddit.domain.glass](https://teddit.domain.glass) | | | [snoo.ioens.is](https://snoo.ioens.is) | | | [teddit.httpjames.space](https://teddit.httpjames.space) | | -| [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | Not working since 06/2021 | +| [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | | | [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) | | ## Changelog From 777efee088bdf4574b9d32974a0ee8b84a23592d Mon Sep 17 00:00:00 2001 From: teddit Date: Wed, 7 Jul 2021 17:29:53 +0200 Subject: [PATCH 018/300] update instances table (fixes PR#214) --- README.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9f7aea5d..f6ec0c7a 100644 --- a/README.md +++ b/README.md @@ -20,21 +20,25 @@ XMR: 832ogRwuoSs2JGYg7wJTqshidK7dErgNdfpenQ9dzMghNXQTJRby1xGbqC3gW3GAifRM9E84J91 [https://teddit.net](https://teddit.net) - Official instance + + + + Community instances: -| Instance | Notes | -|-------------------------------------------------------------------------------------------------------|---------------------------| -| [teddit.ggc-project.de](https://teddit.ggc-project.de) | | -| [teddit.kavin.rocks](https://teddit.kavin.rocks) | | -| [teddit.zaggy.nl](https://teddit.zaggy.nl) | | -| [teddit.namazso.eu](https://teddit.namazso.eu) | | -| [teddit.nautolan.racing](https://teddit.nautolan.racing) | | -| [teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) | | -| [teddit.domain.glass](https://teddit.domain.glass) | | -| [snoo.ioens.is](https://snoo.ioens.is) | | -| [teddit.httpjames.space](https://teddit.httpjames.space) | | -| [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | | -| [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) | | +| Instance | Onion Link | Notes | +|-|-|-| +| [teddit.ggc-project.de](https://teddit.ggc-project.de) | | | +| [teddit.kavin.rocks](https://teddit.kavin.rocks) | [teddit4w6cmzmj5kimhfc...onion](http://teddit4w6cmzmj5kimhfcavs7yo5s7alszvsi2khqutqtlaanpcftfyd.onion/) | | +| [teddit.zaggy.nl](https://teddit.zaggy.nl) | | | +| [teddit.namazso.eu](https://teddit.namazso.eu) | | | +| [teddit.nautolan.racing](https://teddit.nautolan.racing) | | | +| [teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) | | | +| [teddit.domain.glass](https://teddit.domain.glass) | | | +| [snoo.ioens.is](https://snoo.ioens.is) | [snoo.ioensistjs7wd746...onion](http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion/) | | +| [teddit.httpjames.space](https://teddit.httpjames.space) | | | +| [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | | | +| [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) | | | ## Changelog From fcb2f329ee5d934035bf79e0ae61afdcaa61aa7e Mon Sep 17 00:00:00 2001 From: teddit Date: Wed, 7 Jul 2021 17:32:13 +0200 Subject: [PATCH 019/300] remove unnecessary lines --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index f6ec0c7a..71d15227 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,6 @@ XMR: 832ogRwuoSs2JGYg7wJTqshidK7dErgNdfpenQ9dzMghNXQTJRby1xGbqC3gW3GAifRM9E84J91 [https://teddit.net](https://teddit.net) - Official instance - - - - Community instances: | Instance | Onion Link | Notes | From 199e9712aacbfd6e46c13a81296a0e346e40a078 Mon Sep 17 00:00:00 2001 From: tetsuyaaoi Date: Tue, 20 Jul 2021 14:17:05 -0300 Subject: [PATCH 020/300] fix theme drop-down's duplicated options problem --- views/preferences.pug | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/views/preferences.pug b/views/preferences.pug index f0bb5ce2..32388b61 100644 --- a/views/preferences.pug +++ b/views/preferences.pug @@ -34,22 +34,22 @@ html select(id="theme", name="theme") if(!user_preferences.theme || user_preferences.theme === 'auto') option(value="auto", selected="selected") Auto - option(value="") White + option(value="white") White option(value="dark") Dark option(value="sepia") Sepia - if(user_preferences.theme == '') + if(user_preferences.theme == 'white') option(value="auto") Auto - option(value="", selected="selected") White + option(value="white", selected="selected") White option(value="dark") Dark option(value="sepia") Sepia if(user_preferences.theme === 'dark') option(value="auto") Auto - option(value="") White + option(value="white") White option(value="dark", selected="selected") Dark option(value="sepia") Sepia if(user_preferences.theme === 'sepia') option(value="auto") Auto - option(value="") White + option(value="white") White option(value="dark") Dark option(value="sepia", selected="selected") Sepia .setting From d60753ac7dce9eb9ccbe8ecef045223fff9754f5 Mon Sep 17 00:00:00 2001 From: btdmaster Date: Sat, 24 Jul 2021 11:48:05 +0200 Subject: [PATCH 021/300] fix docker-compose installation instructions Prevent docker from complaining about a missing Dockerfile. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 71d15227..00258b14 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ See ```CHANGELOG.md``` ### Docker-compose method ```console -wget https://codeberg.org/teddit/teddit/raw/branch/main/docker-compose.yml +git clone https://codeberg.org/teddit/teddit +cd teddit docker-compose build docker-compose up ``` From 795aa70aa1b5f9fd11363643ab0ef53220a698b0 Mon Sep 17 00:00:00 2001 From: teddit Date: Wed, 28 Jul 2021 22:05:42 +0200 Subject: [PATCH 022/300] add raw JSON parameter for teddit api (#220) --- routes.js | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/routes.js b/routes.js index ef102788..0bd943c5 100644 --- a/routes.js +++ b/routes.js @@ -696,15 +696,17 @@ module.exports = (app, redis, fetch, RedditAPI) => { api_req = true else api_req = false - - let key = `/after:${after}:before:${before}:sort:${sortby}:past:${past}` + + let raw_json = (api_req && req.query.raw_json == '1' ? 1 : 0) + + let key = `/after:${after}:before:${before}:sort:${sortby}:past:${past}:raw_json:${raw_json}` let subbed_subreddits = req.cookies.subbed_subreddits let get_subbed_subreddits = false if(subbed_subreddits && Array.isArray(subbed_subreddits)) { get_subbed_subreddits = true subbed_subreddits = subbed_subreddits.join('+') - key = `${subbed_subreddits.toLowerCase()}:${after}:${before}:sort:${sortby}:past:${past}` + key = `${subbed_subreddits.toLowerCase()}:${after}:${before}:sort:${sortby}:past:${past}:raw_json:${raw_json}` } redis.get(key, (error, json) => { @@ -732,14 +734,14 @@ module.exports = (app, redis, fetch, RedditAPI) => { let url = '' if(config.use_reddit_oauth) { if(get_subbed_subreddits) - url = `https://oauth.reddit.com/r/${subbed_subreddits}/${sortby}?api_type=json&count=25&g=GLOBAL&t=${past}${d}` + url = `https://oauth.reddit.com/r/${subbed_subreddits}/${sortby}?api_type=json&count=25&g=GLOBAL&t=${past}${d}&raw_json=${raw_json}` else - url = `https://oauth.reddit.com/${sortby}?api_type=json&g=GLOBAL&t=${past}${d}` + url = `https://oauth.reddit.com/${sortby}?api_type=json&g=GLOBAL&t=${past}${d}&raw_json=${raw_json}` } else { if(get_subbed_subreddits) - url = `https://reddit.com/r/${subbed_subreddits}/${sortby}.json?api_type=json&count=25&g=GLOBAL&t=${past}${d}` + url = `https://reddit.com/r/${subbed_subreddits}/${sortby}.json?api_type=json&count=25&g=GLOBAL&t=${past}${d}&raw_json=${raw_json}` else - url = `https://reddit.com/${sortby}.json?g=GLOBAL&t=${past}${d}` + url = `https://reddit.com/${sortby}.json?g=GLOBAL&t=${past}${d}&raw_json=${raw_json}` } fetch(encodeURI(url), redditApiGETHeaders()) .then(result => { @@ -1158,6 +1160,8 @@ module.exports = (app, redis, fetch, RedditAPI) => { api_req = true else api_req = false + + let raw_json = (api_req && req.query.raw_json == '1' ? 1 : 0) let d = `&after=${after}` if(before) { @@ -1188,7 +1192,7 @@ module.exports = (app, redis, fetch, RedditAPI) => { } } - let key = `${subreddit.toLowerCase()}:${after}:${before}:sort:${sortby}:past:${past}` + let key = `${subreddit.toLowerCase()}:${after}:${before}:sort:${sortby}:past:${past}:raw_json:${raw_json}` redis.get(key, (error, json) => { if(error) { console.error(`Error getting the ${subreddit} key from redis.`, error) @@ -1229,9 +1233,9 @@ module.exports = (app, redis, fetch, RedditAPI) => { } else { let url = '' if(config.use_reddit_oauth) - url = `https://oauth.reddit.com/r/${subreddit}/${sortby}?api_type=json&count=25&g=GLOBAL&t=${past}${d}` + url = `https://oauth.reddit.com/r/${subreddit}/${sortby}?api_type=json&count=25&g=GLOBAL&t=${past}${d}&raw_json=${raw_json}` else - url = `https://reddit.com/r/${subreddit}/${sortby}.json?api_type=json&count=25&g=GLOBAL&t=${past}${d}` + url = `https://reddit.com/r/${subreddit}/${sortby}.json?api_type=json&count=25&g=GLOBAL&t=${past}${d}&raw_json=${raw_json}` fetch(encodeURI(url), redditApiGETHeaders()) .then(result => { if(result.status === 200) { @@ -1454,6 +1458,8 @@ module.exports = (app, redis, fetch, RedditAPI) => { else api_req = false + let raw_json = (api_req && req.query.raw_json == '1' ? 1 : 0) + if(!after) { after = '' } @@ -1507,7 +1513,7 @@ module.exports = (app, redis, fetch, RedditAPI) => { } } - let key = `${user}:${after}:${before}:sort:${sortby}:past:${past}:post_type:${post_type}` + let key = `${user}:${after}:${before}:sort:${sortby}:past:${past}:post_type:${post_type}:raw_json:${raw_json}` redis.get(key, (error, json) => { if(error) { console.error(`Error getting the user ${key} key from redis.`, error) @@ -1531,9 +1537,9 @@ module.exports = (app, redis, fetch, RedditAPI) => { } else { let url = '' if(config.use_reddit_oauth) - url = `https://oauth.reddit.com/user/${user}/about` + url = `https://oauth.reddit.com/user/${user}/about?raw_json=${raw_json}` else - url = `https://reddit.com/user/${user}/about.json` + url = `https://reddit.com/user/${user}/about.json?raw_json=${raw_json}` fetch(encodeURI(url), redditApiGETHeaders()) .then(result => { if(result.status === 200) { @@ -1545,9 +1551,9 @@ module.exports = (app, redis, fetch, RedditAPI) => { let endpoint = '/overview' if(post_type !== '') endpoint = post_type - url = `https://oauth.reddit.com/user/${user}${post_type}?limit=26${d}&sort=${sortby}&t=${past}` + url = `https://oauth.reddit.com/user/${user}${post_type}?limit=26${d}&sort=${sortby}&t=${past}&raw_json=${raw_json}` } else { - url = `https://reddit.com/user/${user}${post_type}.json?limit=26${d}&sort=${sortby}&t=${past}` + url = `https://reddit.com/user/${user}${post_type}.json?limit=26${d}&sort=${sortby}&t=${past}&raw_json=${raw_json}` } fetch(encodeURI(url), redditApiGETHeaders()) .then(result => { From 33489ea23461d6b1e7535b6a55f6e59bd3aac005 Mon Sep 17 00:00:00 2001 From: teddit Date: Tue, 3 Aug 2021 08:12:37 +0200 Subject: [PATCH 023/300] check if json.error_data exists --- views/subreddit.pug | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/views/subreddit.pug b/views/subreddit.pug index 7d9e7650..e0de8661 100644 --- a/views/subreddit.pug +++ b/views/subreddit.pug @@ -19,7 +19,8 @@ html if error if json.error_data.reason === "private" h2 This is a private subreddit. - p Error: #{JSON.stringify(json.error_data)} + if json.error_data + p Error: #{JSON.stringify(json.error_data)} else if show_nsfw_warning === true .nsfw-warning From ec767a4be8d4477d37375725d7f4b40cd0ca8da6 Mon Sep 17 00:00:00 2001 From: Felix Golatofski Date: Tue, 10 Aug 2021 21:43:39 +0200 Subject: [PATCH 024/300] Updated: image versions (docker) --- Dockerfile | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 028b14b2..479a93d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use LTS Node.js base image -FROM node:14.16-alpine +FROM node:14.17-alpine # Video support dependency RUN apk add ffmpeg diff --git a/docker-compose.yml b/docker-compose.yml index 317c21b1..e16f2268 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: redis: - image: redis:6.0.9-alpine3.12 + image: redis:6.2.5-alpine command: redis-server environment: - REDIS_REPLICATION_MODE=master From 0d180c2c5e39d88738fe3a51dbbbfa64c5c755d2 Mon Sep 17 00:00:00 2001 From: teddit Date: Fri, 13 Aug 2021 21:00:31 +0200 Subject: [PATCH 025/300] update packages --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7341510e..795b1bf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -707,9 +707,9 @@ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "path-to-regexp": { "version": "0.1.7", From 73a8391f2e060dc759c795e324ab85fcc3312124 Mon Sep 17 00:00:00 2001 From: 3nprob <3nprob@3nprob> Date: Tue, 17 Aug 2021 03:53:42 +0900 Subject: [PATCH 026/300] Add http(s) proxy support --- README.md | 1 + app.js | 16 +- config.js.template | 1 + package-lock.json | 1512 +++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + 5 files changed, 1529 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 00258b14..7f15ddbe 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ The following variables may be set to customize your deployment at runtime. | use_helmet_hsts | *Boolean* Recommended to be true when using https. Defaults to **false** | | trust_proxy | *Boolean* Enable trust_proxy if you are using a reverse proxy like nginx or traefik. Defaults to **false** | | trust_proxy_address | Location of trust_proxy. Defaults to **127.0.0.1** | +| http_proxy | Set http/https proxy to use for outgoing requests. See [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) for details | | nsfw_enabled | *Boolean* Enable NSFW (over 18) content. If false, a warning is shown to the user before opening any NSFW post. When the NFSW content is disabled, NSFW posts are hidden from subreddits and from user page feeds. Note: Users can set this to true or false from their preferences. Defaults to **true** | | post_comments_sort | Defines default sort preference. Options are *confidence* (default sorting option in Reddit), *top*, *new*, *controversal*, *old*, *random*, *qa*, *live*. Defaults to **confidence** | | reddit_app_id | If "use_reddit_oauth" config key is set to true, you have to obtain your Reddit app ID. For testing purposes it's okay to use this project's default app ID. Create your Reddit app here: https://old.reddit.com/prefs/apps/. Make sure to create an "installed app" type of app. Default is **ABfYqdDc9qPh1w** | diff --git a/app.js b/app.js index 07b81d9f..404288e9 100644 --- a/app.js +++ b/app.js @@ -45,9 +45,23 @@ const redis = (() => { return r.createClient(redisOptions) })() + +const nodeFetch = require('node-fetch') +const fetch = config.http_proxy + ? (() => { + const agent = require('https-proxy-agent')(config.http_proxy) + return (url, options) => { + const instanceOptions = { + agent, + ...options + }; + return nodeFetch(url, instanceOptions); + } + })() + : nodeFetch + const helmet = require('helmet') const bodyParser = require('body-parser') -const fetch = require('node-fetch') const fs = require('fs') const app = express() const request = require('postman-request') diff --git a/config.js.template b/config.js.template index 0c45c2cc..2394cc60 100644 --- a/config.js.template +++ b/config.js.template @@ -24,6 +24,7 @@ const config = { use_helmet_hsts: process.env.USE_HELMET_HSTS === 'true' || false, // Recommended to be true when using https trust_proxy: process.env.TRUST_PROXY === 'true' || false, // Enable trust_proxy if you are using reverse proxy like nginx trust_proxy_address: process.env.TRUST_PROXY_ADDRESS || '127.0.0.1', + http_proxy: process.env.HTTP_PROXY, nsfw_enabled: process.env.NSFW_ENABLED !== 'true' || true, // Enable NSFW (over 18) content. If false, a warning is shown to the user before opening any NSFW post. When the NFSW content is disabled, NSFW posts are hidden from subreddits and from user page feeds. Note: Users can set this to true or false from their preferences. videos_muted: process.env.VIDEOS_MUTED !== 'true' || true, // Automatically mute all videos in posts post_comments_sort: process.env.POST_COMMENTS_SORT || 'confidence', // "confidence" is the default sorting in Reddit. Must be one of: confidence, top, new, controversial, old, random, qa, live. diff --git a/package-lock.json b/package-lock.json index 795b1bf8..e0eb107a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,1471 @@ { "name": "teddit", "version": "0.3.8", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "version": "0.3.8", + "funding": [ + { + "type": "XMR", + "url": "832ogRwuoSs2JGYg7wJTqshidK7dErgNdfpenQ9dzMghNXQTJRby1xGbqC3gW3GAifRM9E84J91VdMZRjoSJ32nkAZnaCEj" + } + ], + "license": "AGPL-3.0", + "dependencies": { + "compression": "^1.7.4", + "cookie-parser": "^1.4.5", + "express": "^4.17.1", + "helmet": "^4.6.0", + "https-proxy-agent": "^5.0.0", + "minizlib": "^2.1.2", + "node-fetch": "^2.6.1", + "postman-request": "^2.88.1-postman.30", + "pug": "^3.0.2", + "redis": "^3.1.2" + }, + "devDependencies": {} + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" + }, + "node_modules/@babel/parser": { + "version": "7.13.11", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.11.tgz", + "integrity": "sha512-PhuoqeHoO9fc4ffMEVk4qb/w/s2iOSWohvbHxLtxui0eBg3Lg5gN1U8wp1V1u61hOWkPQJJyJzGH6Y+grwkq8Q==", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.12.11", + "lodash": "^4.17.19", + "to-fast-properties": "^2.0.0" + } + }, + "node_modules/@postman/form-data": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@postman/form-data/-/form-data-3.1.1.tgz", + "integrity": "sha512-vjh8Q2a8S6UCm/KKs31XFJqEEgmbjBmpPNVV2eVav6905wyFAwaUOBGA1NPBI4ERH9MMZc6w0umFgM6WbEPMdg==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@postman/tunnel-agent": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@postman/tunnel-agent/-/tunnel-agent-0.6.3.tgz", + "integrity": "sha512-k57fzmAZ2PJGxfOA4SGR05ejorHbVAa/84Hxh/2nAztjNXc4ZjOm9NUIk6/Z6LCrBvJZqjRZbN8e/nROVUPVdg==", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "dependencies": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" + }, + "node_modules/asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/assert-never": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/assert-never/-/assert-never-1.2.1.tgz", + "integrity": "sha512-TaTivMB6pYI1kXwrFlEhLeGfOqoDNdTxjCdwRfFFkEA30Eu+k48W34nlok2EYWJfFFzqaEmichdNM7th6M5HNw==" + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" + }, + "node_modules/babel-walk": { + "version": "3.0.0-canary-5", + "resolved": "https://registry.npmjs.org/babel-walk/-/babel-walk-3.0.0-canary-5.tgz", + "integrity": "sha512-GAwkz0AihzY5bkwIY5QDR+LvsRQgB/B+1foMPvi0FZPMl5fjD7ICiznUiBdLYMH1QYe6vqu4gWYytZOccLouFw==", + "dependencies": { + "@babel/types": "^7.9.6" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/bluebird": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", + "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=" + }, + "node_modules/body-parser": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "dependencies": { + "bytes": "3.1.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.7.0", + "raw-body": "2.4.0", + "type-is": "~1.6.17" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/brotli": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.2.tgz", + "integrity": "sha1-UlqcrU/LqWR119OI9q7LE+7VL0Y=", + "dependencies": { + "base64-js": "^1.1.2" + } + }, + "node_modules/bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "node_modules/character-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz", + "integrity": "sha1-x84o821LzZdE5f/CxfzeHHMmH8A=", + "dependencies": { + "is-regex": "^1.0.3" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "dependencies": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/constantinople": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/constantinople/-/constantinople-4.0.1.tgz", + "integrity": "sha512-vCrqcSIq4//Gx74TXXCGnHpulY1dskqLTFGDmhrGxzeXL8lF8kvXv6mpNWlJj1uD4DW23D4ljAqbY4RRaaUZIw==", + "dependencies": { + "@babel/parser": "^7.6.0", + "@babel/types": "^7.6.1" + } + }, + "node_modules/content-disposition": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", + "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-parser": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz", + "integrity": "sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==", + "dependencies": { + "cookie": "0.4.0", + "cookie-signature": "1.0.6" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/denque": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", + "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "node_modules/doctypes": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/doctypes/-/doctypes-1.1.0.tgz", + "integrity": "sha1-6oCxBqh1OHdOijpKWv4pPeSJ4Kk=" + }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "dependencies": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "content-type": "~1.0.4", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.5", + "qs": "6.7.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "engines": [ + "node >=0.6.0" + ] + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "engines": { + "node": "*" + } + }, + "node_modules/forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/helmet": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-4.6.0.tgz", + "integrity": "sha512-HVqALKZlR95ROkrnesdhbbZJFi/rIVSoNq6f3jA/9u6MIbTsPh3xZwihjeI5+DO/2sOV6HMHooXcEOuwskHpTg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/http-errors": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-signature": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.5.tgz", + "integrity": "sha512-NwoTQYSJoFt34jSBbwzDHDofoA61NGXzu6wXh95o1Ry62EnmKjXb/nR/RknLeZ3G/uGwrlKNY2z7uPt+Cdl7Tw==", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.14.1" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/is-expression": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-expression/-/is-expression-4.0.0.tgz", + "integrity": "sha512-zMIXX63sxzG3XrkHkrAPvm/OVZVSCPNkwMHU8oTX7/U3AL78I0QXCEICXUM13BIa8TYGZ68PiTKfQz3yaTNr4A==", + "dependencies": { + "acorn": "^7.1.1", + "object-assign": "^4.1.1" + } + }, + "node_modules/is-promise": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", + "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==" + }, + "node_modules/is-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", + "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==", + "dependencies": { + "call-bind": "^1.0.2", + "has-symbols": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "node_modules/js-stringify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz", + "integrity": "sha1-Fzb939lyTyijaCrcYjCufk6Weds=" + }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "node_modules/json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "node_modules/jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "node_modules/jstransformer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz", + "integrity": "sha1-7Yvwkh4vPx7U1cGkT2hwntJHIsM=", + "dependencies": { + "is-promise": "^2.0.0", + "promise": "^7.0.1" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dependencies": { + "mime-db": "1.44.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minipass": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz", + "integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "engines": { + "node": "*" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "node_modules/postman-request": { + "version": "2.88.1-postman.30", + "resolved": "https://registry.npmjs.org/postman-request/-/postman-request-2.88.1-postman.30.tgz", + "integrity": "sha512-zsGvs8OgNeno1Q44zTgGP2IL7kCqUy4DAtl8/ms0AQpqkIoysrxzR/Zg4kM1Kz8/duBvwxt8NN717wB7SMNm6w==", + "dependencies": { + "@postman/form-data": "~3.1.1", + "@postman/tunnel-agent": "^0.6.3", + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "brotli": "~1.3.2", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "har-validator": "~5.1.3", + "http-signature": "~1.3.1", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "stream-length": "^1.0.2", + "tough-cookie": "~2.5.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/postman-request/node_modules/qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dependencies": { + "asap": "~2.0.3" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", + "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", + "dependencies": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + }, + "node_modules/pug": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pug/-/pug-3.0.2.tgz", + "integrity": "sha512-bp0I/hiK1D1vChHh6EfDxtndHji55XP/ZJKwsRqrz6lRia6ZC2OZbdAymlxdVFwd1L70ebrVJw4/eZ79skrIaw==", + "dependencies": { + "pug-code-gen": "^3.0.2", + "pug-filters": "^4.0.0", + "pug-lexer": "^5.0.1", + "pug-linker": "^4.0.0", + "pug-load": "^3.0.0", + "pug-parser": "^6.0.0", + "pug-runtime": "^3.0.1", + "pug-strip-comments": "^2.0.0" + } + }, + "node_modules/pug-attrs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pug-attrs/-/pug-attrs-3.0.0.tgz", + "integrity": "sha512-azINV9dUtzPMFQktvTXciNAfAuVh/L/JCl0vtPCwvOA21uZrC08K/UnmrL+SXGEVc1FwzjW62+xw5S/uaLj6cA==", + "dependencies": { + "constantinople": "^4.0.1", + "js-stringify": "^1.0.2", + "pug-runtime": "^3.0.0" + } + }, + "node_modules/pug-code-gen": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pug-code-gen/-/pug-code-gen-3.0.2.tgz", + "integrity": "sha512-nJMhW16MbiGRiyR4miDTQMRWDgKplnHyeLvioEJYbk1RsPI3FuA3saEP8uwnTb2nTJEKBU90NFVWJBk4OU5qyg==", + "dependencies": { + "constantinople": "^4.0.1", + "doctypes": "^1.1.0", + "js-stringify": "^1.0.2", + "pug-attrs": "^3.0.0", + "pug-error": "^2.0.0", + "pug-runtime": "^3.0.0", + "void-elements": "^3.1.0", + "with": "^7.0.0" + } + }, + "node_modules/pug-error": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pug-error/-/pug-error-2.0.0.tgz", + "integrity": "sha512-sjiUsi9M4RAGHktC1drQfCr5C5eriu24Lfbt4s+7SykztEOwVZtbFk1RRq0tzLxcMxMYTBR+zMQaG07J/btayQ==" + }, + "node_modules/pug-filters": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pug-filters/-/pug-filters-4.0.0.tgz", + "integrity": "sha512-yeNFtq5Yxmfz0f9z2rMXGw/8/4i1cCFecw/Q7+D0V2DdtII5UvqE12VaZ2AY7ri6o5RNXiweGH79OCq+2RQU4A==", + "dependencies": { + "constantinople": "^4.0.1", + "jstransformer": "1.0.0", + "pug-error": "^2.0.0", + "pug-walk": "^2.0.0", + "resolve": "^1.15.1" + } + }, + "node_modules/pug-lexer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pug-lexer/-/pug-lexer-5.0.1.tgz", + "integrity": "sha512-0I6C62+keXlZPZkOJeVam9aBLVP2EnbeDw3An+k0/QlqdwH6rv8284nko14Na7c0TtqtogfWXcRoFE4O4Ff20w==", + "dependencies": { + "character-parser": "^2.2.0", + "is-expression": "^4.0.0", + "pug-error": "^2.0.0" + } + }, + "node_modules/pug-linker": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pug-linker/-/pug-linker-4.0.0.tgz", + "integrity": "sha512-gjD1yzp0yxbQqnzBAdlhbgoJL5qIFJw78juN1NpTLt/mfPJ5VgC4BvkoD3G23qKzJtIIXBbcCt6FioLSFLOHdw==", + "dependencies": { + "pug-error": "^2.0.0", + "pug-walk": "^2.0.0" + } + }, + "node_modules/pug-load": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pug-load/-/pug-load-3.0.0.tgz", + "integrity": "sha512-OCjTEnhLWZBvS4zni/WUMjH2YSUosnsmjGBB1An7CsKQarYSWQ0GCVyd4eQPMFJqZ8w9xgs01QdiZXKVjk92EQ==", + "dependencies": { + "object-assign": "^4.1.1", + "pug-walk": "^2.0.0" + } + }, + "node_modules/pug-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pug-parser/-/pug-parser-6.0.0.tgz", + "integrity": "sha512-ukiYM/9cH6Cml+AOl5kETtM9NR3WulyVP2y4HOU45DyMim1IeP/OOiyEWRr6qk5I5klpsBnbuHpwKmTx6WURnw==", + "dependencies": { + "pug-error": "^2.0.0", + "token-stream": "1.0.0" + } + }, + "node_modules/pug-runtime": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/pug-runtime/-/pug-runtime-3.0.1.tgz", + "integrity": "sha512-L50zbvrQ35TkpHwv0G6aLSuueDRwc/97XdY8kL3tOT0FmhgG7UypU3VztfV/LATAvmUfYi4wNxSajhSAeNN+Kg==" + }, + "node_modules/pug-strip-comments": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pug-strip-comments/-/pug-strip-comments-2.0.0.tgz", + "integrity": "sha512-zo8DsDpH7eTkPHCXFeAk1xZXJbyoTfdPlNR0bK7rpOMuhBYb0f5qUVCO1xlsitYd3w5FQTK7zpNVKb3rZoUrrQ==", + "dependencies": { + "pug-error": "^2.0.0" + } + }, + "node_modules/pug-walk": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pug-walk/-/pug-walk-2.0.0.tgz", + "integrity": "sha512-yYELe9Q5q9IQhuvqsZNwA5hfPkMJ8u92bQLIMcsMxf/VADjNtEYptU+inlufAFYcWdHlwNfZOEnOOQrZrcyJCQ==" + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "dependencies": { + "bytes": "3.1.0", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/redis": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/redis/-/redis-3.1.2.tgz", + "integrity": "sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==", + "dependencies": { + "denque": "^1.5.0", + "redis-commands": "^1.7.0", + "redis-errors": "^1.2.0", + "redis-parser": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/redis-commands": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", + "integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==" + }, + "node_modules/redis-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", + "integrity": "sha1-62LSrbFeTq9GEMBK/hUpOEJQq60=", + "engines": { + "node": ">=4" + } + }, + "node_modules/redis-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", + "integrity": "sha1-tm2CjNyv5rS4pCin3vTGvKwxyLQ=", + "dependencies": { + "redis-errors": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", + "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "dependencies": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.7.2", + "mime": "1.6.0", + "ms": "2.1.1", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + }, + "node_modules/serve-static": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", + "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + }, + "node_modules/sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/stream-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stream-length/-/stream-length-1.0.2.tgz", + "integrity": "sha1-gnfzy+5JpNqrz9tOL0qbXp8snwA=", + "dependencies": { + "bluebird": "^2.6.2" + } + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "engines": { + "node": ">=4" + } + }, + "node_modules/toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/token-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz", + "integrity": "sha1-zCAOqyYT9BZtJ/+a/HylbUnfbrQ=" + }, + "node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/void-elements": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", + "integrity": "sha1-YU9/v42AHwu18GYfWy9XhXUOTwk=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/with": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/with/-/with-7.0.2.tgz", + "integrity": "sha512-RNGKj82nUPg3g5ygxkQl0R937xLyho1J24ItRCBTr/m1YnZkzJy1hUiHUJrc/VlsDQzsCnInEGSg3bci0Lmd4w==", + "dependencies": { + "@babel/parser": "^7.9.6", + "@babel/types": "^7.9.6", + "assert-never": "^1.2.1", + "babel-walk": "3.0.0-canary-5" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + }, "dependencies": { "@babel/helper-validator-identifier": { "version": "7.12.11", @@ -56,6 +1519,29 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -504,6 +1990,30 @@ "sshpk": "^1.14.1" } }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "requires": { + "agent-base": "6", + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", diff --git a/package.json b/package.json index 45d87eb1..1e710207 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "cookie-parser": "^1.4.5", "express": "^4.17.1", "helmet": "^4.6.0", + "https-proxy-agent": "^5.0.0", "minizlib": "^2.1.2", "node-fetch": "^2.6.1", "postman-request": "^2.88.1-postman.30", From 2cb5a5e45a2fe26e0ab414705d90d714dc99f564 Mon Sep 17 00:00:00 2001 From: teddit Date: Wed, 18 Aug 2021 22:07:29 +0200 Subject: [PATCH 027/300] pass pref_quarantine_optin-cookie to get quarantined subreddits (fixes #224) --- inc/initRedditApi.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inc/initRedditApi.js b/inc/initRedditApi.js index 2824fca5..02d5ef53 100644 --- a/inc/initRedditApi.js +++ b/inc/initRedditApi.js @@ -73,12 +73,15 @@ module.exports = function(fetch) { }) } this.redditApiGETHeaders = function() { + let cookies = '_options=%7B%22pref_quarantine_optin%22%3A%20true%7D' + if(!config.use_reddit_oauth) - return { method: 'GET' } + return { headers: { cookie: cookies }, method: 'GET' } return { headers: { - Authorization: `Bearer ${reddit_access_token}` + Authorization: `Bearer ${reddit_access_token}`, + cookie: cookies }, method: 'GET' } From af5793fd8b82382090e4949a7742c72d9ff3ea0e Mon Sep 17 00:00:00 2001 From: alefvanoon Date: Sun, 22 Aug 2021 14:18:09 +0430 Subject: [PATCH 028/300] add teddit.alefvanoon.xyz --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7f15ddbe..b7581e13 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Community instances: | [teddit.httpjames.space](https://teddit.httpjames.space) | | | | [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | | | | [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) | | | +| [teddit.alefvanoon.xyz](https://teddit.alefvanoon.xyz) | | | + ## Changelog From e0b5cc6e4075c5539164011c68f82611e063777f Mon Sep 17 00:00:00 2001 From: teddit Date: Tue, 24 Aug 2021 17:17:46 +0200 Subject: [PATCH 029/300] introduce a cache control: a way of keeping the cache directory under certain size (should fix #229) --- app.js | 3 +++ cacheControl.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++ config.js.template | 3 +++ 3 files changed, 64 insertions(+) create mode 100644 cacheControl.js diff --git a/app.js b/app.js index 404288e9..504aacd8 100644 --- a/app.js +++ b/app.js @@ -153,6 +153,9 @@ redis.on('error', (error) => { } }) +const cacheControl = require('./cacheControl.js') +cacheControl.removeCacheFiles() + if(config.https_enabled) { https.listen(config.ssl_port, config.listen_address, () => console.log(`Teddit running on https://${config.domain}:${config.ssl_port}`)) } diff --git a/cacheControl.js b/cacheControl.js new file mode 100644 index 00000000..09c928ba --- /dev/null +++ b/cacheControl.js @@ -0,0 +1,58 @@ +module.exports.removeCacheFiles = function() { + const fs = require('fs') + const config = require('./config') + const pics = './static/pics' + const flairs = './static/pics/flairs' + const icons = './static/pics/icons' + const thumbs = './static/pics/thumbs' + const vids = './static/vids' + let util = require('util') + let spawn = require('child_process').spawn + + let usage + const limit = config.cache_max_size + + function getUsage() { + return new Promise((resolve, reject) => { + let size = spawn('du', ['-sBM', './static/']) + size.stdout.on('data', function (data) { + usage = parseInt(data) + resolve(usage) + }) + }) + } + + function deleteFiles() { + return new Promise(async (resolve, reject) => { + usage = await getUsage() + if(usage > limit) { + const { exec } = require('child_process') + exec(`cd ${pics} && ls -1btr -Iflairs -Iicons -Ithumbs -I.gitignore | head -50 | xargs rm -f --`) + exec(`cd ${flairs} && ls -1btr -I.gitignore | head -50 | xargs rm -f --`) + exec(`cd ${icons} && ls -1btr -I.gitignore | head -50 | xargs rm -f --`) + exec(`cd ${thumbs} && ls -1btr -I.gitignore | head -50 | xargs rm -f --`) + exec(`cd ${vids} && ls -1btr -I.gitignore | head -30 | xargs rm -f --`) + } + resolve(1) + }) + } + + async function main() { + usage = await getUsage() + if(usage > limit) { + console.log('Started removeCacheFiles()') + while(usage > limit) { + await deleteFiles() + } + } + } + + if(config.cache_control) { + main() + + const interval_ms = config.cache_control_interval + setInterval(() => { + main() + }, interval_ms) + } +} diff --git a/config.js.template b/config.js.template index 2394cc60..2ab1effb 100644 --- a/config.js.template +++ b/config.js.template @@ -32,6 +32,9 @@ const config = { domain_replacements: process.env.DOMAIN_REPLACEMENTS ? (JSON.parse(process.env.DOMAIN_REPLACEMENTS).map(([p, r]) => [new RegExp(p, 'gm'), r])) : [], // Replacements for domains in outgoing links. Tuples with regular expressions to match, and replacement values. This is in addition to user-level configuration of privacyDomains. + cache_control: process.env.CACHE_CONTROL !== 'true' || true, // If true, teddit will automatically try to keep the size of the cache directory (static) under config.cache_max_size. By default this is set to true. + cache_max_size: process.env.CACHE_MAX_SIZE || 3000, // How much can we cache to the disk? Default is 3000 MB (~3 GB). Note: This is not perfectly exact limit. + cache_control_interval: process.env.CACHE_CONTROL_INTERVAL || 1000 * 60 * 30, // How often the size of the cache directory (static/) is checked. Default is every 30 minutes. post_media_max_heights: { /** * Sets the max-height value for images and videos in posts. From b76c72ef6c311a8fc6d132589626a7e0e4dda3f2 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 29 Aug 2021 19:36:36 +0200 Subject: [PATCH 030/300] make the getUsage() function a bit more reliable, and fine-tune the amount of files to delete from static/ --- cacheControl.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cacheControl.js b/cacheControl.js index 09c928ba..26362bc7 100644 --- a/cacheControl.js +++ b/cacheControl.js @@ -16,7 +16,15 @@ module.exports.removeCacheFiles = function() { return new Promise((resolve, reject) => { let size = spawn('du', ['-sBM', './static/']) size.stdout.on('data', function (data) { - usage = parseInt(data) + data = data.toString() + let lines = data.split('\n') + if(lines) { + for(let i = lines.length; i >= 0; i--) { + if(lines[i] && lines[i].includes('./static/')) { + usage = parseInt(lines[i]) + } + } + } resolve(usage) }) }) @@ -28,10 +36,10 @@ module.exports.removeCacheFiles = function() { if(usage > limit) { const { exec } = require('child_process') exec(`cd ${pics} && ls -1btr -Iflairs -Iicons -Ithumbs -I.gitignore | head -50 | xargs rm -f --`) - exec(`cd ${flairs} && ls -1btr -I.gitignore | head -50 | xargs rm -f --`) - exec(`cd ${icons} && ls -1btr -I.gitignore | head -50 | xargs rm -f --`) - exec(`cd ${thumbs} && ls -1btr -I.gitignore | head -50 | xargs rm -f --`) - exec(`cd ${vids} && ls -1btr -I.gitignore | head -30 | xargs rm -f --`) + exec(`cd ${flairs} && ls -1btr -I.gitignore | head -6 | xargs rm -f --`) + exec(`cd ${icons} && ls -1btr -I.gitignore | head -6 | xargs rm -f --`) + exec(`cd ${thumbs} && ls -1btr -I.gitignore | head -80 | xargs rm -f --`) + exec(`cd ${vids} && ls -1btr -I.gitignore | head -2 | xargs rm -f --`) } resolve(1) }) From 5d091e2fb7981aa0d7613579a3e3fdf5e09d29b8 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 29 Aug 2021 20:29:31 +0200 Subject: [PATCH 031/300] add incogsnoo.com instance --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7581e13..14846b53 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Community instances: | [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | | | | [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) | | | | [teddit.alefvanoon.xyz](https://teddit.alefvanoon.xyz) | | | - +| [incogsnoo.com](https://incogsnoo.com) | [tedditfyn6idalzso5wam....onion](tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion/) | I2P: [http://teddit.i2p](http://teddit.i2p) | ## Changelog From ab19dae2d6b52e516aa0629051694607630aed15 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 29 Aug 2021 20:39:13 +0200 Subject: [PATCH 032/300] update missing env variables --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 14846b53..3142c8c4 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,13 @@ The following variables may be set to customize your deployment at runtime. | trust_proxy_address | Location of trust_proxy. Defaults to **127.0.0.1** | | http_proxy | Set http/https proxy to use for outgoing requests. See [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) for details | | nsfw_enabled | *Boolean* Enable NSFW (over 18) content. If false, a warning is shown to the user before opening any NSFW post. When the NFSW content is disabled, NSFW posts are hidden from subreddits and from user page feeds. Note: Users can set this to true or false from their preferences. Defaults to **true** | +| videos_muted | *Boolean* Automatically mute all videos in posts. Defaults to **true** | | post_comments_sort | Defines default sort preference. Options are *confidence* (default sorting option in Reddit), *top*, *new*, *controversal*, *old*, *random*, *qa*, *live*. Defaults to **confidence** | | reddit_app_id | If "use_reddit_oauth" config key is set to true, you have to obtain your Reddit app ID. For testing purposes it's okay to use this project's default app ID. Create your Reddit app here: https://old.reddit.com/prefs/apps/. Make sure to create an "installed app" type of app. Default is **ABfYqdDc9qPh1w** | +| domain_replacements | Replacements for domains in outgoing links. Tuples with regular expressions to match, and replacement values. This is in addition to user-level configuration of privacyDomains. Defaults to **[]** | +| cache_control | *Boolean* If true, teddit will automatically try to keep the size of the cache directory under ```config.cache_max_size```. Defaults to **true** | +| cache_max_size | In Megabytes (MB), how much can we cache media files to the disk? Default is 3000 MB (~3 GB). Note: This is not perfectly exact limit. Defaults to **3000** | +| cache_control_interval | How often the size of the cache directory is checked. Default is every 30 minutes. Defaults to **1000 * 60 * 30** | ### Manual From 94c1d46abd06f9cdc6902e0596e71889a51c9cd1 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 29 Aug 2021 20:47:40 +0200 Subject: [PATCH 033/300] remove changelog section --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3142c8c4..607fa921 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,13 @@ Community instances: | [teddit.alefvanoon.xyz](https://teddit.alefvanoon.xyz) | | | | [incogsnoo.com](https://incogsnoo.com) | [tedditfyn6idalzso5wam....onion](tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion/) | I2P: [http://teddit.i2p](http://teddit.i2p) | +<-- +Remove the Changelog section, because the CHANGELOG.md is not updated anymore ## Changelog See ```CHANGELOG.md``` +--> + ## Installation ### Docker-compose method From 904914f524d8e4e162c54241ed85245d9b7c7292 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 29 Aug 2021 20:48:41 +0200 Subject: [PATCH 034/300] mention that the changelog is not updated anymore --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c2710e7..f17382f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## Changelog has not been updated since 2021-03-23 + # Changelog ## 2021-03-23 ### Fixed From 202514db8bfdabf5ad511f2d181d7ce25766484c Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 29 Aug 2021 20:49:36 +0200 Subject: [PATCH 035/300] fix comment tag --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 607fa921..c10ffaaa 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Community instances: | [teddit.alefvanoon.xyz](https://teddit.alefvanoon.xyz) | | | | [incogsnoo.com](https://incogsnoo.com) | [tedditfyn6idalzso5wam....onion](tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion/) | I2P: [http://teddit.i2p](http://teddit.i2p) | -<-- + 0.4.1 --- package-lock.json | 2 +- package.json | 2 +- views/about.pug | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f61cabab..1ece3b6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "teddit", - "version": "0.4.0", + "version": "0.4.1", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 2e0888de..70227c7a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "teddit", - "version": "0.4.0", + "version": "0.4.1", "description": "A free and open source alternative Reddit front-end focused on privacy.", "homepage": "https://teddit.net", "bugs": { diff --git a/views/about.pug b/views/about.pug index d6a7a78d..c0f113a2 100644 --- a/views/about.pug +++ b/views/about.pug @@ -21,5 +21,5 @@ html .bottom a(href="https://en.wikipedia.org/wiki/Piratbyr%C3%A5n#Kopimi", target="_blank") img(src="kopimi.gif") - p.version v.0.4.0 + p.version v.0.4.1 include includes/footer.pug From 9e515c4985ef3167ca20c0478b94e61f3b25689f Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 12 Sep 2021 18:03:00 +0200 Subject: [PATCH 075/300] fix setting the duration (fixes #240) --- inc/components/link.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/components/link.js b/inc/components/link.js index e39ec898..99312626 100644 --- a/inc/components/link.js +++ b/inc/components/link.js @@ -28,8 +28,14 @@ async function fromJson(data, user_preferences, subreddit_front) { result.domain = data.domain result.is_video = data.is_video result.media = data.media - result.duration = data.is_video ? data.media.reddit_video ? data.media.reddit_video.duration : void 0 : void 0 + result.duration = null result.images = null + + if(data.is_video && data.media) { + if(data.media.reddit_video) { + result.duration = data.media.reddit_video.duration + } + } // Moderation attributes result.locked = data.locked From 8bb949b2b36417feb71b7fd120055d922c0f13f9 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 19 Sep 2021 20:48:51 +0200 Subject: [PATCH 076/300] redirect http => https before initializing reddit API (fixes #241) --- app.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 2aaefbb4..076a661a 100644 --- a/app.js +++ b/app.js @@ -106,6 +106,13 @@ app.use(express.static(`${__dirname}/static`)); app.set('views', './views'); app.set('view engine', 'pug'); +if (config.redirect_http_to_https) { + app.use((req, res, next) => { + if (req.secure) next(); + else res.redirect(`https://${req.headers.host}${req.url}`); + }); +} + const redditAPI = require('./inc/initRedditApi.js')(fetch); /* @@ -121,13 +128,6 @@ app.use('/', allRoutes); // The old routes //require('./routes')(app, redis, fetch, redditAPI); -if (config.redirect_http_to_https) { - app.use((req, res, next) => { - if (req.secure) next(); - else res.redirect(`https://${req.headers.host}${req.url}`); - }); -} - const cacheControl = require('./cacheControl.js'); cacheControl.removeCacheFiles(); From d2feeac288f70dacb5c6e8c41b82e24f6785f5ec Mon Sep 17 00:00:00 2001 From: arche_dev Date: Mon, 4 Oct 2021 03:30:52 +0200 Subject: [PATCH 077/300] Improve table list Added I2P Section and moved links to there respective columns. --- README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c85c1344..cd47dec6 100644 --- a/README.md +++ b/README.md @@ -22,22 +22,22 @@ XMR: 832ogRwuoSs2JGYg7wJTqshidK7dErgNdfpenQ9dzMghNXQTJRby1xGbqC3gW3GAifRM9E84J91 Community instances: -| Instance | Onion Link | Notes | -|-|-|-| -| [teddit.ggc-project.de](https://teddit.ggc-project.de) | | | -| [teddit.kavin.rocks](https://teddit.kavin.rocks) | [teddit4w6cmzmj5kimhfc...onion](http://teddit4w6cmzmj5kimhfcavs7yo5s7alszvsi2khqutqtlaanpcftfyd.onion/) | | -| [teddit.zaggy.nl](https://teddit.zaggy.nl) | | | -| [teddit.namazso.eu](https://teddit.namazso.eu) | | | -| [teddit.nautolan.racing](https://teddit.nautolan.racing) | | | -| [teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) | | | -| [teddit.domain.glass](https://teddit.domain.glass) | | | -| [snoo.ioens.is](https://snoo.ioens.is) | [snoo.ioensistjs7wd746...onion](http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion/) | | -| [teddit.httpjames.space](https://teddit.httpjames.space) | | | -| [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | | | -| [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) | | | -| [teddit.alefvanoon.xyz](https://teddit.alefvanoon.xyz) | | | -| [incogsnoo.com](https://incogsnoo.com) | [tedditfyn6idalzso5wam....onion](tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion/) | I2P: [http://teddit.i2p](http://teddit.i2p) | -| [teddit.pussthecat.org](https://teddit.pussthecat.org) | | | +| Instance | Onion Link | I2P | Notes | +|-|-|-|-| +| [teddit.ggc-project.de](https://teddit.ggc-project.de) | | | | +| [teddit.kavin.rocks](https://teddit.kavin.rocks) | [teddit4w6cmzmj5kimhfc...onion](http://teddit4w6cmzmj5kimhfcavs7yo5s7alszvsi2khqutqtlaanpcftfyd.onion/) | | | +| [teddit.zaggy.nl](https://teddit.zaggy.nl) | | | | +| [teddit.namazso.eu](https://teddit.namazso.eu) | | | | +| [teddit.nautolan.racing](https://teddit.nautolan.racing) | | | | +| [teddit.tinfoil-hat.net](https://teddit.tinfoil-hat.net) | | | | +| [teddit.domain.glass](https://teddit.domain.glass) | | | | +| [snoo.ioens.is](https://snoo.ioens.is) | [snoo.ioensistjs7wd746...onion](http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion/) | | | +| [teddit.httpjames.space](https://teddit.httpjames.space) | | | | +| | [ibarajztopxnuhabfu7f...onion](http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion) | | | +| | | [xugoqcf2pftm76vbznx4...i2p](http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p) | | +| [teddit.alefvanoon.xyz](https://teddit.alefvanoon.xyz) | | | | +| [incogsnoo.com](https://incogsnoo.com) | [tedditfyn6idalzso5wam....onion](tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion/) | [http://teddit.i2p](http://teddit.i2p) | | +| [teddit.pussthecat.org](https://teddit.pussthecat.org) | | | |