From 621ac0bdc76ef1f38b227ede9200a947bbbc8073 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 9 Nov 2019 19:49:50 -0600 Subject: [PATCH 01/51] docs: document FE interaction with the BE private setting --- docs/CONFIGURATION.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 3536353725..f7397a55fc 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -96,3 +96,6 @@ Setting this will change the warning text that is displayed for direct messages. ATTENTION: If you actually want the behavior to change. You will need to set the appropriate option at the backend. See the backend documentation for information about that. DO NOT activate this without checking the backend configuration first! + +### Private Mode +If the `private` instance setting is enabled in the backend, features that are not accessible without authentication, such as the timelines and search will be disabled for unauthenticated users. From 99fd096ddd1cc657a86c41e7e96344b8bb1dc4de Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 9 Nov 2019 19:53:03 -0600 Subject: [PATCH 02/51] boot: track whether private mode is enabled or not --- src/boot/after_store.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 226b67d8ac..cbe0c33083 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -218,6 +218,9 @@ const getNodeInfo = async ({ store }) => { store.dispatch('setInstanceOption', { name: 'backendVersion', value: software.version }) store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: software.name === 'pleroma' }) + const priv = metadata.private + store.dispatch('setInstanceOption', { name: 'private', value: priv }) + const frontendVersion = window.___pleromafe_commit_hash store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') }) From 21f1637e437398ec56b6078cf28b58bd4a0299ba Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 11 Nov 2019 14:14:44 -0600 Subject: [PATCH 03/51] nav panel: refactor to use vuex mapState --- src/components/nav_panel/nav_panel.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index aa3f760533..bfcab62e4e 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -1,4 +1,5 @@ import followRequestFetcher from '../../services/follow_request_fetcher/follow_request_fetcher.service' +import { mapState } from 'vuex' const NavPanel = { created () { @@ -9,17 +10,11 @@ const NavPanel = { followRequestFetcher.startFetching({ store, credentials }) } }, - computed: { - currentUser () { - return this.$store.state.users.currentUser - }, - chat () { - return this.$store.state.chat.channel - }, - followRequestCount () { - return this.$store.state.api.followRequests.length - } - } + computed: mapState({ + currentUser: state => state.users.currentUser, + chat: state => state.chat.channel, + followRequestCount: state => state.api.followRequests.length + }) } export default NavPanel From 1f9674350cdf7455fe5540d377eb327edf1336ce Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 11 Nov 2019 14:18:36 -0600 Subject: [PATCH 04/51] nav panel: disable TWKN if federation disabled, disable Public and TWKN if privateMode is enabled --- src/components/nav_panel/nav_panel.js | 4 +++- src/components/nav_panel/nav_panel.vue | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index bfcab62e4e..a6426d13a8 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -13,7 +13,9 @@ const NavPanel = { computed: mapState({ currentUser: state => state.users.currentUser, chat: state => state.chat.channel, - followRequestCount: state => state.api.followRequests.length + followRequestCount: state => state.api.followRequests.length, + privateMode: state => state.instance.private, + federating: state => state.instance.federationPolicy.federating || true }) } diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index 28589bb14a..d85c28bd62 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -28,12 +28,12 @@ -
  • +
  • {{ $t("nav.public_tl") }}
  • -
  • +
  • {{ $t("nav.twkn") }} From cb5f73148a2dc9341d16326ed606d74e818fb61d Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 11 Nov 2019 14:25:38 -0600 Subject: [PATCH 05/51] app: search API is not available in private mode so disable it --- src/App.js | 3 ++- src/App.vue | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index 04a40e304a..e2b0e6db69 100644 --- a/src/App.js +++ b/src/App.js @@ -97,7 +97,8 @@ export default { this.$store.state.instance.instanceSpecificPanelContent }, showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, - isMobileLayout () { return this.$store.state.interface.mobileLayout } + isMobileLayout () { return this.$store.state.interface.mobileLayout }, + privateMode () { return this.$store.state.instance.private } }, methods: { scrollToTop () { diff --git a/src/App.vue b/src/App.vue index dbe842ec4f..1f244b5606 100644 --- a/src/App.vue +++ b/src/App.vue @@ -43,6 +43,7 @@ class="nav-icon mobile-hidden" @toggled="onSearchBarToggled" @click.stop.native + v-if="currentUser || !privateMode" /> Date: Mon, 11 Nov 2019 14:37:14 -0600 Subject: [PATCH 06/51] side drawer: same treatment --- src/components/side_drawer/side_drawer.js | 6 ++++++ src/components/side_drawer/side_drawer.vue | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js index 567d2e5e65..2725d43a49 100644 --- a/src/components/side_drawer/side_drawer.js +++ b/src/components/side_drawer/side_drawer.js @@ -34,6 +34,12 @@ const SideDrawer = { }, followRequestCount () { return this.$store.state.api.followRequests.length + }, + privateMode () { + return this.$store.state.instance.private + }, + federating () { + return this.$store.state.instance.federationPolicy.federating || true } }, methods: { diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue index 214b8e0c9c..be18a5d7a9 100644 --- a/src/components/side_drawer/side_drawer.vue +++ b/src/components/side_drawer/side_drawer.vue @@ -79,12 +79,12 @@
  • -
  • +
  • {{ $t("nav.public_tl") }}
  • -
  • +
  • {{ $t("nav.twkn") }} @@ -99,7 +99,7 @@
    • -
    • +
    • {{ $t("nav.search") }} From 13fc2612ae388dec682829ae2b6211bb3cb8ccb3 Mon Sep 17 00:00:00 2001 From: Wyatt Benno Date: Thu, 5 Dec 2019 11:48:37 +0900 Subject: [PATCH 07/51] Change 403 messaging --- src/components/timeline/timeline.js | 7 ++++++- src/components/timeline/timeline.vue | 19 ++++++++++++++++--- src/i18n/en.json | 2 ++ src/modules/statuses.js | 7 +++++++ src/services/api/api.service.js | 10 ++++++++-- .../timeline_fetcher.service.js | 6 ++++++ 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 27a9a55ed4..6086336c54 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -36,7 +36,12 @@ const Timeline = { } }, computed: { - timelineError () { return this.$store.state.statuses.error }, + timelineError () { + return this.$store.state.statuses.error + }, + error403 () { + return this.$store.state.statuses.error403 + }, newStatusCount () { return this.timeline.newStatusCount }, diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index 93f6f5706b..1c45d0f6fb 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -11,15 +11,22 @@ > {{ $t('timeline.error_fetching') }} +
      + {{ $t('timeline.error_403') }} +
      @@ -67,12 +74,18 @@ {{ $t('timeline.no_more_statuses') }}
      + + +
        diff --git a/src/modules/instance.js b/src/modules/instance.js index 96f14ed5da..625323b973 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -27,6 +27,7 @@ const defaultState = { scopeCopy: true, subjectLineBehavior: 'email', postContentType: 'text/plain', + hideSitename: false, nsfwCensorImage: undefined, vapidPublicKey: undefined, noAttachmentLinks: false, From fee3226705beb4b6eddb8e64f8c53b2651ca89fa Mon Sep 17 00:00:00 2001 From: taehoon Date: Mon, 9 Dec 2019 15:21:33 -0500 Subject: [PATCH 27/51] add documentation for new instance option --- docs/CONFIGURATION.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 3536353725..3a21828bb4 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -77,6 +77,9 @@ Use custom image for NSFW'd images ### `showFeaturesPanel` Show panel showcasing instance features/settings to logged-out visitors +### `hideSitename` +Hide instance name in header + ## Indirect configuration Some features are configured depending on how backend is configured. In general the approach is "if backend allows it there's no need to hide it, if backend doesn't allow it there's no need to show it. From d7bc1aff1d4c52c038457fe7650ffb793dfc4618 Mon Sep 17 00:00:00 2001 From: seven Date: Thu, 12 Dec 2019 06:35:48 +0500 Subject: [PATCH 28/51] fix babelrc plugin config --- .babelrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.babelrc b/.babelrc index 3019976fca..3c732dd1bc 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,5 @@ { "presets": ["@babel/preset-env"], - "plugins": ["@babel/plugin-transform-runtime", "lodash", "transform-vue-jsx"], + "plugins": ["@babel/plugin-transform-runtime", "lodash", "@vue/babel-plugin-transform-vue-jsx"], "comments": false } From 386719b0d03475fb5cab667ce28a5aff354fbc4d Mon Sep 17 00:00:00 2001 From: seven Date: Thu, 12 Dec 2019 08:33:40 +0500 Subject: [PATCH 29/51] fix css runtime loading issue --- src/App.scss | 13 +++++++++++++ src/components/timeline/timeline.vue | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/App.scss b/src/App.scss index 925913f2d5..754ca62e6b 100644 --- a/src/App.scss +++ b/src/App.scss @@ -870,3 +870,16 @@ nav { transform: rotate(359deg); } } + +.new-status-notification { + position:relative; + margin-top: -1px; + font-size: 1.1em; + border-width: 1px 0 0 0; + border-style: solid; + border-color: var(--border, $fallback--border); + padding: 10px; + z-index: 1; + background-color: $fallback--fg; + background-color: var(--panel, $fallback--fg); +} diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index 93f6f5706b..a6fba4527c 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -93,17 +93,4 @@ opacity: 1; } } - -.new-status-notification { - position:relative; - margin-top: -1px; - font-size: 1.1em; - border-width: 1px 0 0 0; - border-style: solid; - border-color: var(--border, $fallback--border); - padding: 10px; - z-index: 1; - background-color: $fallback--fg; - background-color: var(--panel, $fallback--fg); -} From f70fe28f644c037326a1d2c1fdffbf6d365e0a02 Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Thu, 12 Dec 2019 08:42:21 +0300 Subject: [PATCH 30/51] mfa: fix login and recovery form --- src/components/mfa_form/recovery_form.js | 11 ++++++++--- src/components/mfa_form/totp_form.js | 10 ++++++++-- src/services/new_api/mfa.js | 12 ++++++------ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/components/mfa_form/recovery_form.js b/src/components/mfa_form/recovery_form.js index 7a3cc22d51..b25c65dd3b 100644 --- a/src/components/mfa_form/recovery_form.js +++ b/src/components/mfa_form/recovery_form.js @@ -8,18 +8,23 @@ export default { }), computed: { ...mapGetters({ - authApp: 'authFlow/app', authSettings: 'authFlow/settings' }), - ...mapState({ instance: 'instance' }) + ...mapState({ + instance: 'instance', + oauth: 'oauth' + }) }, methods: { ...mapMutations('authFlow', ['requireTOTP', 'abortMFA']), ...mapActions({ login: 'authFlow/login' }), clearError () { this.error = false }, submit () { + const { clientId, clientSecret } = this.oauth + const data = { - app: this.authApp, + clientId, + clientSecret, instance: this.instance.server, mfaToken: this.authSettings.mfa_token, code: this.code diff --git a/src/components/mfa_form/totp_form.js b/src/components/mfa_form/totp_form.js index 778bf8dce1..1ec7576b21 100644 --- a/src/components/mfa_form/totp_form.js +++ b/src/components/mfa_form/totp_form.js @@ -10,15 +10,21 @@ export default { authApp: 'authFlow/app', authSettings: 'authFlow/settings' }), - ...mapState({ instance: 'instance' }) + ...mapState({ + instance: 'instance', + oauth: 'oauth' + }) }, methods: { ...mapMutations('authFlow', ['requireRecovery', 'abortMFA']), ...mapActions({ login: 'authFlow/login' }), clearError () { this.error = false }, submit () { + const { clientId, clientSecret } = this.oauth + const data = { - app: this.authApp, + clientId, + clientSecret, instance: this.instance.server, mfaToken: this.authSettings.mfa_token, code: this.code diff --git a/src/services/new_api/mfa.js b/src/services/new_api/mfa.js index cbba06d54c..c944667c0d 100644 --- a/src/services/new_api/mfa.js +++ b/src/services/new_api/mfa.js @@ -1,9 +1,9 @@ -const verifyOTPCode = ({ app, instance, mfaToken, code }) => { +const verifyOTPCode = ({ clientId, clientSecret, instance, mfaToken, code }) => { const url = `${instance}/oauth/mfa/challenge` const form = new window.FormData() - form.append('client_id', app.client_id) - form.append('client_secret', app.client_secret) + form.append('client_id', clientId) + form.append('client_secret', clientSecret) form.append('mfa_token', mfaToken) form.append('code', code) form.append('challenge_type', 'totp') @@ -14,12 +14,12 @@ const verifyOTPCode = ({ app, instance, mfaToken, code }) => { }).then((data) => data.json()) } -const verifyRecoveryCode = ({ app, instance, mfaToken, code }) => { +const verifyRecoveryCode = ({ clientId, clientSecret, instance, mfaToken, code }) => { const url = `${instance}/oauth/mfa/challenge` const form = new window.FormData() - form.append('client_id', app.client_id) - form.append('client_secret', app.client_secret) + form.append('client_id', clientId) + form.append('client_secret', clientSecret) form.append('mfa_token', mfaToken) form.append('code', code) form.append('challenge_type', 'recovery') From b973ee5915ca9a2c79d9523286f42aee4b1a7db7 Mon Sep 17 00:00:00 2001 From: seven Date: Thu, 12 Dec 2019 12:13:31 +0500 Subject: [PATCH 31/51] must use h in higher babel-plugin-transform-vue-jsx --- src/hocs/with_load_more/with_load_more.js | 4 ++-- src/hocs/with_subscription/with_subscription.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hocs/with_load_more/with_load_more.js b/src/hocs/with_load_more/with_load_more.js index 1e1b2a747b..6142f5138f 100644 --- a/src/hocs/with_load_more/with_load_more.js +++ b/src/hocs/with_load_more/with_load_more.js @@ -65,7 +65,7 @@ const withLoadMore = ({ } } }, - render (createElement) { + render (h) { const props = { props: { ...this.$props, @@ -74,7 +74,7 @@ const withLoadMore = ({ on: this.$listeners, scopedSlots: this.$scopedSlots } - const children = Object.entries(this.$slots).map(([key, value]) => createElement('template', { slot: key }, value)) + const children = Object.entries(this.$slots).map(([key, value]) => h('template', { slot: key }, value)) return (
        diff --git a/src/hocs/with_subscription/with_subscription.js b/src/hocs/with_subscription/with_subscription.js index 91fc4ccaad..1775adcb43 100644 --- a/src/hocs/with_subscription/with_subscription.js +++ b/src/hocs/with_subscription/with_subscription.js @@ -49,7 +49,7 @@ const withSubscription = ({ } } }, - render (createElement) { + render (h) { if (!this.error && !this.loading) { const props = { props: { @@ -59,7 +59,7 @@ const withSubscription = ({ on: this.$listeners, scopedSlots: this.$scopedSlots } - const children = Object.entries(this.$slots).map(([key, value]) => createElement('template', { slot: key }, value)) + const children = Object.entries(this.$slots).map(([key, value]) => h('template', { slot: key }, value)) return (
        From b3992358487d5afa7499759a90d6447a2b0bfe20 Mon Sep 17 00:00:00 2001 From: lain Date: Thu, 12 Dec 2019 09:38:24 +0000 Subject: [PATCH 32/51] Revert "Merge branch 'oauth-extra-scopes' into 'develop'" This reverts merge request !1024 --- src/services/new_api/oauth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/new_api/oauth.js b/src/services/new_api/oauth.js index 3c8e64bd9a..d0d18c036e 100644 --- a/src/services/new_api/oauth.js +++ b/src/services/new_api/oauth.js @@ -12,7 +12,7 @@ export const getOrCreateApp = ({ clientId, clientSecret, instance, commit }) => form.append('client_name', `PleromaFE_${window.___pleromafe_commit_hash}_${(new Date()).toISOString()}`) form.append('redirect_uris', REDIRECT_URI) - form.append('scopes', 'read write follow push admin') + form.append('scopes', 'read write follow') return window.fetch(url, { method: 'POST', @@ -28,7 +28,7 @@ const login = ({ instance, clientId }) => { response_type: 'code', client_id: clientId, redirect_uri: REDIRECT_URI, - scope: 'read write follow push admin' + scope: 'read write follow' } const dataString = reduce(data, (acc, v, k) => { From ed3144eb1168ece5fcd3eed2867c653f785039d8 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Thu, 12 Dec 2019 18:19:46 +0700 Subject: [PATCH 33/51] Support "native" captcha --- src/components/registration/registration.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue index 5bb06a4fed..222b67a87d 100644 --- a/src/components/registration/registration.vue +++ b/src/components/registration/registration.vue @@ -172,7 +172,7 @@ for="captcha-label" >{{ $t('captcha') }} -