From 90ea409d1ddebebde92beade6ea1197b99c1bdbd Mon Sep 17 00:00:00 2001 From: Fabien Date: Mon, 16 Jul 2018 13:51:28 +0200 Subject: [PATCH 01/13] Add post into DMCA list (#2069) --- src/common/constants/dmca.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/constants/dmca.json b/src/common/constants/dmca.json index 543e958c3b..30bf1f5cbf 100644 --- a/src/common/constants/dmca.json +++ b/src/common/constants/dmca.json @@ -13,6 +13,7 @@ "harshvasistha/instant-cryptocurrency-exchange-in-depth-review-shapeshift-vs-changelly", "harshvasistha/10-best-bitcoin-faucets-to-get-free-bitcoins-2017", "fumegi/allison-parker", - "soldier/how-to-trick-your-mind-chapter-9" + "soldier/how-to-trick-your-mind-chapter-9", + "sonetaber21/soorma-2018-full-hindi-movies-online-watch-free-hd-download-700mb-dvdrip" ] } From e52dcc5c56673e56eb33ec0054fd1f4db7c37022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Mon, 16 Jul 2018 15:16:31 +0200 Subject: [PATCH 02/13] allow mixed line endings locally (#2071) --- .eslintrc.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 9fbec8b7d3..e1df21fd4c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -32,5 +32,7 @@ module.exports = { ], 'no-console': OFF, 'global-require': OFF, + // Allow mixed linebreaks locally, but commit only LF. + 'linebreak-style': process.env.CI ? ['error', 'unix'] : OFF, }, }; From b73030d3e41253913e982c35a6f4b314740cbdf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Mon, 16 Jul 2018 16:38:52 +0200 Subject: [PATCH 03/13] feat: display vote indicator if there is more than one of any vote (#2072) --- src/client/components/StoryFooter/Buttons.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/components/StoryFooter/Buttons.js b/src/client/components/StoryFooter/Buttons.js index a6681ebbc7..39fb15e5f1 100644 --- a/src/client/components/StoryFooter/Buttons.js +++ b/src/client/components/StoryFooter/Buttons.js @@ -309,7 +309,7 @@ export default class Buttons extends React.Component { )} - {upVotes.length > 0 && ( + {post.active_votes.length > 0 && ( - {upVotesPreview} + {upVotes.length > 0 ? ( + upVotesPreview + ) : ( + + )} {upVotesMore} } From 7d0a8b964ffb9af5d4b06e4644e3f7e642230708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Tue, 17 Jul 2018 10:27:15 +0200 Subject: [PATCH 04/13] always use 3 decimal points for transfer amount (#2074) --- src/client/wallet/Transfer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/wallet/Transfer.js b/src/client/wallet/Transfer.js index 486a87af0e..c1ca0c05f8 100644 --- a/src/client/wallet/Transfer.js +++ b/src/client/wallet/Transfer.js @@ -146,7 +146,7 @@ export default class Transfer extends React.Component { if (!errors) { const transferQuery = { to: values.to, - amount: `${values.amount} ${values.currency}`, + amount: `${parseFloat(values.amount).toFixed(3)} ${values.currency}`, }; if (values.memo) transferQuery.memo = values.memo; From 01410b7a612c858654544035f5c827545536282b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Tue, 17 Jul 2018 10:29:45 +0200 Subject: [PATCH 05/13] fix: don't display no comments message before comments loaded (#2073) * fix: don't display no comments message before comments loaded * call getComments for side effects --- src/client/comments/Comments.js | 7 ++----- src/client/comments/commentsReducer.js | 14 ++++++++++++++ src/client/components/Comments/Comments.js | 18 ++++++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/client/comments/Comments.js b/src/client/comments/Comments.js index 7461cc3bd2..8b3e35fad5 100644 --- a/src/client/comments/Comments.js +++ b/src/client/comments/Comments.js @@ -98,11 +98,7 @@ export default class Comments extends React.Component { componentWillReceiveProps(nextProps) { const { post, show } = this.props; - if ( - nextProps.show && - nextProps.post.children !== 0 && - (nextProps.post.id !== post.id || !show) - ) { + if (nextProps.show && (nextProps.post.id !== post.id || !show)) { this.props.getComments(nextProps.post.id); } } @@ -184,6 +180,7 @@ export default class Comments extends React.Component { username={this.props.username} pendingVotes={pendingVotes} loading={comments.isFetching} + loaded={comments.isLoaded} show={show} notify={this.props.notify} rewardFund={rewardFund} diff --git a/src/client/comments/commentsReducer.js b/src/client/comments/commentsReducer.js index 30dc020947..ecb80d2c14 100644 --- a/src/client/comments/commentsReducer.js +++ b/src/client/comments/commentsReducer.js @@ -5,6 +5,7 @@ const initialState = { comments: {}, pendingVotes: [], isFetching: false, + isLoaded: false, }; const childrenById = (state = {}, action) => { @@ -64,6 +65,18 @@ const isFetching = (state = initialState.isFetching, action) => { } }; +const isLoaded = (state = initialState.isLoaded, action) => { + switch (action.type) { + case commentsTypes.GET_COMMENTS_START: + return false; + case commentsTypes.GET_COMMENTS_SUCCESS: + case commentsTypes.GET_COMMENTS_ERROR: + return true; + default: + return state; + } +}; + const comments = (state = initialState, action) => { switch (action.type) { case commentsTypes.GET_COMMENTS_START: @@ -74,6 +87,7 @@ const comments = (state = initialState, action) => { comments: commentsData(state.comments, action), childrenById: childrenById(state.childrenById, action), isFetching: isFetching(state.isFetching, action), + isLoaded: isLoaded(state.isLoaded, action), }; case commentsTypes.LIKE_COMMENT_START: return { diff --git a/src/client/components/Comments/Comments.js b/src/client/components/Comments/Comments.js index 19b96a025d..d193698e81 100644 --- a/src/client/components/Comments/Comments.js +++ b/src/client/components/Comments/Comments.js @@ -18,6 +18,8 @@ class Comments extends React.Component { intl: PropTypes.shape().isRequired, user: PropTypes.shape().isRequired, authenticated: PropTypes.bool.isRequired, + loading: PropTypes.bool.isRequired, + loaded: PropTypes.bool.isRequired, username: PropTypes.string, parentPost: PropTypes.shape(), comments: PropTypes.shape(), @@ -33,7 +35,6 @@ class Comments extends React.Component { defaultVotePercent: PropTypes.number.isRequired, rewriteLinks: PropTypes.bool, sliderMode: PropTypes.oneOf(['on', 'off', 'auto']), - loading: PropTypes.bool, show: PropTypes.bool, notify: PropTypes.func, onLikeClick: PropTypes.func, @@ -50,7 +51,6 @@ class Comments extends React.Component { pendingVotes: [], rewriteLinks: false, sliderMode: 'auto', - loading: false, show: false, notify: () => {}, onLikeClick: () => {}, @@ -195,6 +195,7 @@ class Comments extends React.Component { rootLevelComments, commentsChildren, loading, + loaded, show, pendingVotes, onLikeClick, @@ -248,12 +249,13 @@ class Comments extends React.Component { /> )} {loading && } - {commentsToRender.length === 0 && ( -
- -
- )} - {!loading && + {loaded && + commentsToRender.length === 0 && ( +
+ +
+ )} + {loaded && show && comments && commentsToRender.map(comment => ( From 5e1f0f809f4128b03a9a2efc746bd8381a033de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Tue, 17 Jul 2018 11:03:46 +0200 Subject: [PATCH 06/13] New translations default.json (Bengali) (#2075) --- src/client/locales/bn-BD.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/client/locales/bn-BD.json b/src/client/locales/bn-BD.json index eb2e867e2d..d964c3691a 100644 --- a/src/client/locales/bn-BD.json +++ b/src/client/locales/bn-BD.json @@ -116,8 +116,8 @@ "by": "{username} দ্বারা", "memo": "মেমো", "memo_placeholder": "Additional message to include in this payment (optional)", - "power_up": "Power up", - "power_down": "Power down", + "power_up": "পাওয়ার আপ", + "power_down": "পাওয়ার ডাউন", "message": "বার্তা", "edit_profile": "প্রোফাইল সম্পাদনা করুন", "profile_name": "নাম", @@ -159,16 +159,16 @@ "see_all_comments": "সবগুলো মন্তব্য দেখুন", "see_all_recommendations": "সবগুলো সুপারিশ দেখুন", "reputation_score_value": "Reputation score: {value}", - "original_poster": "Original poster", - "no_likes": "No likes yet", - "no_dislikes": "No dislikes", - "sort_by": "Sort by", - "sort_trending": "Trending", - "sort_created": "New", - "sort_active": "Active", + "original_poster": "মূল লেখক", + "no_likes": "এখনো কোন লাইক নেই", + "no_dislikes": "কোন ডিজলাইক নেই", + "sort_by": "সাজানোর ক্রম", + "sort_trending": "আলোচিত বিষয়", + "sort_created": "নতুন", + "sort_active": "সক্রিয়", "sort_hot": "Hot", - "sort_promoted": "Promoted", - "sort_best": "Best", + "sort_promoted": "প্রচারিত", + "sort_best": "সেরা", "sort_newest": "নতুন", "sort_oldest": "পুরাতন", "sort_author_reputation": "Reputation", @@ -202,8 +202,8 @@ "preview": "Preview", "reward": "Reward", "rewards": "Rewards", - "reward_option_100": "100% Steem Power", - "reward_option_50": "50% SBD and 50% SP", + "reward_option_100": "১০০% স্টিম পাওয়ার", + "reward_option_50": "৫০% SBD এবং ৫০% SP", "reward_option_0": "Declined", "recommended_posts": "Recommended Posts", "like_post": "Like this post", From df182b68f66e627d902ead8b20ee2eafc13d1d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Tue, 17 Jul 2018 14:00:43 +0200 Subject: [PATCH 07/13] Feature/encrypted memo (#2077) * add memo encryption validation * trim memo --- src/client/locales/default.json | 2 ++ src/client/wallet/Transfer.js | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/client/locales/default.json b/src/client/locales/default.json index c46a6cf2aa..d101e7f5e6 100644 --- a/src/client/locales/default.json +++ b/src/client/locales/default.json @@ -116,6 +116,8 @@ "by": "By {username}", "memo": "Memo", "memo_placeholder": "Additional message to include in this payment (optional)", + "memo_exchange_error": "Memo is required when sending to an exchange.", + "memo_encryption_error": "Encrypted memos are not supported.", "power_up": "Power up", "power_down": "Power down", "message": "Message", diff --git a/src/client/wallet/Transfer.js b/src/client/wallet/Transfer.js index c1ca0c05f8..d8aa7621e2 100644 --- a/src/client/wallet/Transfer.js +++ b/src/client/wallet/Transfer.js @@ -175,18 +175,28 @@ export default class Transfer extends React.Component { validateMemo = (rule, value, callback) => { const { intl } = this.props; const recipientIsExchange = Transfer.exchangeRegex.test(this.props.form.getFieldValue('to')); + if (recipientIsExchange && (!value || value === '')) { - callback([ + return callback([ new Error( intl.formatMessage({ - id: 'memo_error_exchange', + id: 'memo_exchange_error', defaultMessage: 'Memo is required when sending to an exchange.', }), ), ]); - } else { - callback(); + } else if (value && value.trim()[0] === '#') { + return callback([ + new Error( + intl.formatMessage({ + id: 'memo_encryption_error', + defaultMessage: 'Encrypted memos are not supported.', + }), + ), + ]); } + + return callback(); }; validateUsername = (rule, value, callback) => { From f343b75a3ccbee6b6d0ae598c92564db6b07d83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Tue, 17 Jul 2018 14:18:39 +0200 Subject: [PATCH 08/13] Release v2.5.3 (#2078) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6fd26712f1..757b285157 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "busy", - "version": "2.5.2", + "version": "2.5.3", "engines": { "node": ">=7.10.1", "npm": "=5.3.0" From d0afd66e5f3604ec4ad7a51cf7b6ea6bacfb83c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Mon, 23 Jul 2018 15:13:48 +0200 Subject: [PATCH 09/13] Merge master back to develop (#2086) * Release v2.5.3 (#2080) * Add post into DMCA list (#2069) * allow mixed line endings locally (#2071) * feat: display vote indicator if there is more than one of any vote (#2072) * always use 3 decimal points for transfer amount (#2074) * fix: don't display no comments message before comments loaded (#2073) * fix: don't display no comments message before comments loaded * call getComments for side effects * New translations default.json (Bengali) (#2075) * Feature/encrypted memo (#2077) * add memo encryption validation * trim memo * Release v2.5.3 (#2078) * Update dmca.json (#2083) --- src/common/constants/dmca.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/constants/dmca.json b/src/common/constants/dmca.json index 095dc38531..2469da954c 100644 --- a/src/common/constants/dmca.json +++ b/src/common/constants/dmca.json @@ -18,6 +18,7 @@ "doujinblog/180630rj228205-btzqrc0qdu", "doujinblog/180630rj226466-booljr1545", "doujinblog/180630rj220960-7brgs7iru2", - "arabebtc/big-butt-wiggling" + "arabebtc/big-butt-wiggling", + "doujinblog/180701rj228604-9arcnnx5cr" ] } From de965060a83392a63e3c59db136ec8c18454b310 Mon Sep 17 00:00:00 2001 From: mkt Date: Mon, 30 Jul 2018 10:50:41 +0200 Subject: [PATCH 10/13] Nightmode Preparations (#2090) * added nightmode setting * added css class to ant-layout for nightmode * fixed settingsReducer test * first nightmode css * removed unnecessary css --- src/client/Wrapper.js | 11 +++++- .../components/Navigation/Topnav-dark.less | 37 +++++++++++++++++++ src/client/components/Navigation/Topnav.less | 2 + src/client/locales/de-DE.json | 3 ++ src/client/locales/default.json | 3 ++ src/client/reducers.js | 1 + src/client/settings/Settings.js | 35 ++++++++++++++++++ .../settings/__tests__/settingsReducer.js | 5 ++- src/client/settings/settingsReducer.js | 5 +++ 9 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 src/client/components/Navigation/Topnav-dark.less diff --git a/src/client/Wrapper.js b/src/client/Wrapper.js index 33686c91c1..c424a40f64 100644 --- a/src/client/Wrapper.js +++ b/src/client/Wrapper.js @@ -17,6 +17,7 @@ import { getUsedLocale, getTranslations, getUseBeta, + getNightmode, } from './reducers'; import { login, logout, busyLogin } from './auth/authActions'; import { getFollowing, getNotifications } from './user/userActions'; @@ -44,6 +45,7 @@ import BBackTop from './components/BBackTop'; usedLocale: getUsedLocale(state), translations: getTranslations(state), locale: getLocale(state), + nightmode: getNightmode(state), }), { login, @@ -77,6 +79,7 @@ export default class Wrapper extends React.PureComponent { getNotifications: PropTypes.func, setUsedLocale: PropTypes.func, busyLogin: PropTypes.func, + nightmode: PropTypes.bool, }; static defaultProps = { @@ -93,6 +96,7 @@ export default class Wrapper extends React.PureComponent { getNotifications: () => {}, setUsedLocale: () => {}, busyLogin: () => {}, + nightmode: false, }; static async fetchData({ store, req, res }) { @@ -201,14 +205,17 @@ export default class Wrapper extends React.PureComponent { } render() { - const { user, usedLocale, translations } = this.props; + const { user, usedLocale, translations, nightmode } = this.props; const language = findLanguage(usedLocale); return ( - + diff --git a/src/client/components/Navigation/Topnav-dark.less b/src/client/components/Navigation/Topnav-dark.less new file mode 100644 index 0000000000..10e68f5ba3 --- /dev/null +++ b/src/client/components/Navigation/Topnav-dark.less @@ -0,0 +1,37 @@ +@import (reference) '../../styles/modules/variables.less'; +@import (reference) '../../styles/custom.less'; + +@base-spacing: 0; + +.dark { + .Topnav { + background-color: @grey-nero; + border-bottom: @normal-grey; + + &__input-container { + input { + color: @white-smoke; + border: @border-width-base @border-style-base @normal-grey; + + &:hover, + &:focus { + border: @border-width-base @border-style-base @normal-grey !important; + } + } + } + + &__menu-container { + &__menu { + & > li.ant-menu-item { + & > a { + color: @tertiary-color !important; + + &:hover { + color: @white-smoke !important; + } + } + } + } + } + } +} diff --git a/src/client/components/Navigation/Topnav.less b/src/client/components/Navigation/Topnav.less index 6af210c59a..817fd36d07 100644 --- a/src/client/components/Navigation/Topnav.less +++ b/src/client/components/Navigation/Topnav.less @@ -286,3 +286,5 @@ div[data-dir='rtl'] .Topnav { width: 16px !important; justify-content: flex-end !important; } + +@import 'Topnav-dark'; diff --git a/src/client/locales/de-DE.json b/src/client/locales/de-DE.json index 5a2f3ce0b6..f450e26e99 100644 --- a/src/client/locales/de-DE.json +++ b/src/client/locales/de-DE.json @@ -314,6 +314,9 @@ "nsfw_posts": "NSFW Beiträge", "display_nsfw_posts_details": "Sie können alle Beiträge mit dem Stichwort NSFW standardmäßig anzeigen lassen.", "display_nsfw_posts": "NSFW Beiträge anzeigen", + "nightmode": "Nachtmodus", + "nightmode_details": "Aktiviere diese Option, für eine augenschonendere Oberfläche bei Nacht.", + "use_nightmode": "Nachtmodus aktivieren", "rewrite_links": "Erneuern sie ihre Links", "rewrite_links_details": "Sie können diese Option aktivieren, um Steemit.com Links mit Busy.org Links zu ersetzen.", "use_beta": "Verwenden sie die Busy-Betaversion", diff --git a/src/client/locales/default.json b/src/client/locales/default.json index d101e7f5e6..6a27b126f6 100644 --- a/src/client/locales/default.json +++ b/src/client/locales/default.json @@ -316,6 +316,9 @@ "nsfw_posts": "NSFW Posts", "display_nsfw_posts_details": "You can enable all posts tagged with NSFW to be shown as default.", "display_nsfw_posts": "Display NSFW Posts", + "nightmode": "Nightmode", + "nightmode_details": "You can enable this option for a more eye-friendly experience at night.", + "use_nightmode": "Use Nightmode", "rewrite_links": "Rewrite links", "rewrite_links_details": "You can enable this option to replace Steemit.com links with Busy.org links.", "use_beta": "Use Busy beta", diff --git a/src/client/reducers.js b/src/client/reducers.js index 97d16ac8da..8df34b7b91 100644 --- a/src/client/reducers.js +++ b/src/client/reducers.js @@ -122,6 +122,7 @@ export const getLocale = state => fromSettings.getLocale(state.settings); export const getVotingPower = state => fromSettings.getVotingPower(state.settings); export const getVotePercent = state => fromSettings.getVotePercent(state.settings); export const getShowNSFWPosts = state => fromSettings.getShowNSFWPosts(state.settings); +export const getNightmode = state => fromSettings.getNightmode(state.settings); export const getRewriteLinks = state => fromSettings.getRewriteLinks(state.settings); export const getUpvoteSetting = state => fromSettings.getUpvoteSetting(state.settings); export const getExitPageSetting = state => fromSettings.getExitPageSetting(state.settings); diff --git a/src/client/settings/Settings.js b/src/client/settings/Settings.js index 8cf31c6ef6..8a11cabf71 100644 --- a/src/client/settings/Settings.js +++ b/src/client/settings/Settings.js @@ -11,6 +11,7 @@ import { getIsSettingsLoading, getVotePercent, getShowNSFWPosts, + getNightmode, getRewriteLinks, getUseBeta, getUpvoteSetting, @@ -39,6 +40,7 @@ import packageJson from '../../../package.json'; votingPower: getVotingPower(state), votePercent: getVotePercent(state), showNSFWPosts: getShowNSFWPosts(state), + nightmode: getNightmode(state), rewriteLinks: getRewriteLinks(state), useBeta: getUseBeta(state), loading: getIsSettingsLoading(state), @@ -56,6 +58,7 @@ export default class Settings extends React.Component { votePercent: PropTypes.number, loading: PropTypes.bool, showNSFWPosts: PropTypes.bool, + nightmode: PropTypes.bool, rewriteLinks: PropTypes.bool, useBeta: PropTypes.bool, reload: PropTypes.func, @@ -72,6 +75,7 @@ export default class Settings extends React.Component { votePercent: 10000, loading: false, showNSFWPosts: false, + nightmode: false, rewriteLinks: false, useBeta: false, upvoteSetting: true, @@ -91,6 +95,7 @@ export default class Settings extends React.Component { votingPower: 'auto', votePercent: 10000, showNSFWPosts: false, + nightmode: false, rewriteLinks: false, exitPageSetting: true, }; @@ -101,6 +106,7 @@ export default class Settings extends React.Component { votingPower: this.props.votingPower, votePercent: this.props.votePercent / 100, showNSFWPosts: this.props.showNSFWPosts, + nightmode: this.props.nightmode, rewriteLinks: this.props.rewriteLinks, useBeta: this.props.useBeta, upvoteSetting: this.props.upvoteSetting, @@ -129,6 +135,10 @@ export default class Settings extends React.Component { this.setState({ showNSFWPosts: nextProps.showNSFWPosts }); } + if (nextProps.nightmode !== this.props.nightmode) { + this.setState({ nightmode: nextProps.nightmode }); + } + if (nextProps.rewriteLinks !== this.props.rewriteLinks) { this.setState({ rewriteLinks: nextProps.rewriteLinks }); } @@ -153,6 +163,7 @@ export default class Settings extends React.Component { votingPower: this.state.votingPower, votePercent: this.state.votePercent * 100, showNSFWPosts: this.state.showNSFWPosts, + nightmode: this.state.nightmode, rewriteLinks: this.state.rewriteLinks, useBeta: this.state.useBeta, upvoteSetting: this.state.upvoteSetting, @@ -170,6 +181,7 @@ export default class Settings extends React.Component { handleVotingPowerChange = event => this.setState({ votingPower: event.target.value }); handleVotePercentChange = value => this.setState({ votePercent: value }); handleShowNSFWPosts = event => this.setState({ showNSFWPosts: event.target.checked }); + handleNightmode = event => this.setState({ nightmode: event.target.checked }); handleRewriteLinksChange = event => this.setState({ rewriteLinks: event.target.checked }); handleUseBetaChange = event => this.setState({ useBeta: event.target.checked }); handleExitPageSettingChange = event => this.setState({ exitPageSetting: event.target.checked }); @@ -185,12 +197,14 @@ export default class Settings extends React.Component { locale: initialLocale, votingPower: initialVotingPower, showNSFWPosts: initialShowNSFWPosts, + nightmode: initialNightmode, loading, } = this.props; const { votingPower, locale, showNSFWPosts, + nightmode, rewriteLinks, useBeta, upvoteSetting, @@ -317,6 +331,27 @@ export default class Settings extends React.Component { +
+

+ +

+

+ +

+
+ + + +
+

diff --git a/src/client/settings/__tests__/settingsReducer.js b/src/client/settings/__tests__/settingsReducer.js index 20d158e039..81bdc42eb2 100644 --- a/src/client/settings/__tests__/settingsReducer.js +++ b/src/client/settings/__tests__/settingsReducer.js @@ -11,6 +11,7 @@ describe('settingsReducer', () => { votePercent: 10000, loading: false, showNSFWPosts: false, + nightmode: false, rewriteLinks: false, upvoteSetting: true, exitPageSetting: true, @@ -63,7 +64,7 @@ describe('settingsReducer', () => { expect(settingsReducer(stateBefore, action)).to.eql(stateAfter); }); - it('should set locale, voting power, vote percent, loading, showNSFWPosts, and rewriteLinks after saving succeeded', () => { + it('should set locale, voting power, vote percent, loading, showNSFWPosts, nightmode and rewriteLinks after saving succeeded', () => { const stateBefore = { ...initialState, loading: true, @@ -75,6 +76,7 @@ describe('settingsReducer', () => { votePercent: 10000, votingPower: 'on', showNSFWPosts: true, + nightmode: true, rewriteLinks: true, }; const action = { @@ -84,6 +86,7 @@ describe('settingsReducer', () => { votingPower: 'on', votePercent: 10000, showNSFWPosts: true, + nightmode: true, rewriteLinks: true, upvoteSetting: true, exitPageSetting: true, diff --git a/src/client/settings/settingsReducer.js b/src/client/settings/settingsReducer.js index 6c2b68a70e..9c355a0c39 100644 --- a/src/client/settings/settingsReducer.js +++ b/src/client/settings/settingsReducer.js @@ -7,6 +7,7 @@ const initialState = { votingPower: 'auto', votePercent: 10000, showNSFWPosts: false, + nightmode: false, rewriteLinks: false, loading: false, upvoteSetting: true, @@ -26,6 +27,7 @@ const settings = (state = initialState, action) => { votingPower, votePercent, showNSFWPosts, + nightmode, rewriteLinks, upvoteSetting, exitPageSetting, @@ -38,6 +40,7 @@ const settings = (state = initialState, action) => { votingPower: votingPower || initialState.votingPower, votePercent: votePercent || initialState.votePercent, showNSFWPosts: showNSFWPosts || initialState.showNSFWPosts, + nightmode: nightmode || initialState.nightmode, rewriteLinks: typeof rewriteLinks === 'boolean' ? rewriteLinks : initialState.rewriteLinks, upvoteSetting: @@ -62,6 +65,7 @@ const settings = (state = initialState, action) => { votingPower: action.payload.votingPower, votePercent: action.payload.votePercent, showNSFWPosts: action.payload.showNSFWPosts, + nightmode: action.payload.nightmode, rewriteLinks: action.payload.rewriteLinks, upvoteSetting: action.payload.upvoteSetting, exitPageSetting: action.payload.exitPageSetting, @@ -90,6 +94,7 @@ export const getLocale = state => state.locale; export const getVotingPower = state => state.votingPower; export const getVotePercent = state => state.votePercent; export const getShowNSFWPosts = state => state.showNSFWPosts; +export const getNightmode = state => state.nightmode; export const getRewriteLinks = state => !!state.rewriteLinks; export const getUpvoteSetting = state => state.upvoteSetting; export const getExitPageSetting = state => state.exitPageSetting; From 15bcc94093d1c1283c85ed903a95ffbac5284a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Mon, 30 Jul 2018 14:16:14 +0200 Subject: [PATCH 11/13] update rewriteRegex to support dots and dashes in permlinks (#2091) --- src/client/helpers/regexHelpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/helpers/regexHelpers.js b/src/client/helpers/regexHelpers.js index ae42f8df59..0d89e13fe9 100644 --- a/src/client/helpers/regexHelpers.js +++ b/src/client/helpers/regexHelpers.js @@ -6,7 +6,7 @@ export const usernameURLRegex = /@([^/]+)/; export const categoryRegex = /\/([^/]+)/; -export const rewriteRegex = /"https?:\/\/(?:www)?steemit\.com((\/)(((\w+\/)?@\w+\/\w+)|(@\w+(\/(comments|followers|followed|reblogs|transfers|activity))?)|((trending|created|active|hot|promoted)(\/\w+)?))?)?"/g; +export const rewriteRegex = /"https?:\/\/(?:www)?steemit\.com(\/((([\w-]+\/)?@[\w.-]+\/[\w-]+)|(@[\w.-]+(\/(comments|followers|followed|reblogs|transfers|activity))?)|((trending|created|active|hot|promoted)(\/[\w-]+)?))?)?"/g; export const ownUrl = /^(localhost|busy\.org|staging\.busy\.org|busy-master-pr-\d+\.herokuapp.com)$/; From a09049a4cb18103363fb578ebaec57b35c7d15e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Mon, 30 Jul 2018 14:34:22 +0200 Subject: [PATCH 12/13] Allowed protocols (#2092) * don't add HTTPS to URIs with scheme * whitelist byteball and bitcoin schemes * mark uncommon protocols as external --- src/client/vendor/SanitizeConfig.js | 4 +++- src/client/vendor/steemitHtmlReady.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/vendor/SanitizeConfig.js b/src/client/vendor/SanitizeConfig.js index 16d822437f..6a5d10758c 100644 --- a/src/client/vendor/SanitizeConfig.js +++ b/src/client/vendor/SanitizeConfig.js @@ -1,3 +1,4 @@ +import sanitizeHtml from 'sanitize-html'; import URL from 'url-parse'; import { ownUrl } from '../helpers/regexHelpers'; import { knownDomains } from '../helpers/constants'; @@ -87,6 +88,7 @@ export default ({ large = true, noImage = false, sanitizeErrors = [], secureLink img: ['src', 'alt'], a: ['href', 'rel', 'target'], }, + allowedSchemes: sanitizeHtml.defaults.allowedSchemes.concat(['byteball', 'bitcoin']), transformTags: { iframe: (tagName, attribs) => { const srcAtty = decodeURIComponent(attribs.src); @@ -168,7 +170,7 @@ export default ({ large = true, noImage = false, sanitizeErrors = [], secureLink const url = new URL(href); const hostname = url.hostname || 'localhost'; - if (!hostname.match(ownUrl)) { + if (['https', 'http'].indexOf(url.protocol) || !hostname.match(ownUrl)) { attys.target = '_blank'; } diff --git a/src/client/vendor/steemitHtmlReady.js b/src/client/vendor/steemitHtmlReady.js index 43bf386766..f4c7ac3850 100644 --- a/src/client/vendor/steemitHtmlReady.js +++ b/src/client/vendor/steemitHtmlReady.js @@ -122,7 +122,7 @@ function link(state, child) { state.links.add(url); if (state.mutate) { // If this link is not relative, http, or https -- add https. - if (!/^\/(?!\/)|(https?:)?\/\//.test(url)) { + if (!/^[\w.-]+:(\/\/)?/.test(url)) { child.setAttribute('href', `https://${url}`); } } From eef178a4a17869137ff1acdf08d1b226f3368f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Tkaczy=C5=84ski?= Date: Mon, 30 Jul 2018 15:14:24 +0200 Subject: [PATCH 13/13] Release v2.5.4 (#2093) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 757b285157..80d27645a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "busy", - "version": "2.5.3", + "version": "2.5.4", "engines": { "node": ">=7.10.1", "npm": "=5.3.0"