From 455cd0d0289c7633aca22ad6e8737d449e361fce Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 25 Sep 2018 14:47:02 +0300 Subject: settings for scope/subject --- src/modules/instance.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/modules/instance.js') diff --git a/src/modules/instance.js b/src/modules/instance.js index cb724821..0e67e4d1 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -19,6 +19,8 @@ const defaultState = { formattingOptionsEnabled: false, collapseMessageWithSubject: false, disableChat: false, + scopeCopy: false, + subjectLineBehavior: 'email', // Nasty stuff pleromaBackend: true, -- cgit v1.2.3-70-g09d2 From ef968d8e1e4f3194a0856fd93bc03d8030112b12 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 25 Sep 2018 15:16:26 +0300 Subject: now it actually works --- src/components/post_status_form/post_status_form.js | 10 ++++++++-- src/components/settings/settings.vue | 6 +++--- src/components/status/status.js | 10 ++++++++-- src/components/status/status.vue | 2 +- src/modules/instance.js | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src/modules/instance.js') diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index a84e764c..804c4bc2 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -24,7 +24,7 @@ const PostStatusForm = { 'replyTo', 'repliedUser', 'attentions', - 'messageScope', + 'copyMessageScope', 'subject' ], components: { @@ -46,6 +46,12 @@ const PostStatusForm = { statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser) } + console.log(this.copyMessageScope) + const scope = (this.copyMessageScope && this.$store.state.config.copyScope || this.copyMessageScope === 'direct') + ? this.copyMessageScope + : this.$store.state.users.currentUser.default_scope + + console.log(this) return { dropFiles: [], submitDisabled: false, @@ -58,7 +64,7 @@ const PostStatusForm = { contentType: 'text/plain', nsfw: false, files: [], - visibility: this.messageScope || this.$store.state.users.currentUser.default_scope + visibility: scope }, caret: 0 } diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index f9e7d711..5a5b2fb4 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -70,15 +70,15 @@ diff --git a/src/components/status/status.js b/src/components/status/status.js index 45f5ccac..38cfc5ae 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -174,10 +174,16 @@ const Status = { return true }, replySubject () { - if (this.status.summary && !this.status.summary.match(/^re[: ]/i)) { + if (!this.status.summary) return ''; + const behavior = this.$store.state.config.subjectLineBehavior + const startsWithRe = this.status.summary.match(/^re[: ]/i) + if (behavior !== 'noop' && startsWithRe || behavior === 'masto') { + return this.status.summary + } else if (behavior === 'email') { return 're: '.concat(this.status.summary) + } else if (behavior === 'noop') { + return '' } - return this.status.summary }, attachmentSize () { if ((this.$store.state.config.hideAttachments && !this.inConversation) || diff --git a/src/components/status/status.vue b/src/components/status/status.vue index eb521280..8087d392 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -106,7 +106,7 @@
- +
diff --git a/src/modules/instance.js b/src/modules/instance.js index 0e67e4d1..58913060 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -19,7 +19,7 @@ const defaultState = { formattingOptionsEnabled: false, collapseMessageWithSubject: false, disableChat: false, - scopeCopy: false, + scopeCopy: true, subjectLineBehavior: 'email', // Nasty stuff -- cgit v1.2.3-70-g09d2 From 50264410f541c8f9f3416bd0027fc199cb96e424 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 7 Nov 2018 16:56:12 +0100 Subject: Add login form back in. --- README.md | 6 ++++++ src/boot/after_store.js | 2 ++ src/components/login_form/login_form.js | 26 ++++++++++++++++++-------- src/components/login_form/login_form.vue | 19 ++++++++++++++++++- src/modules/instance.js | 1 + static/config.json | 3 ++- 6 files changed, 47 insertions(+), 10 deletions(-) (limited to 'src/modules/instance.js') diff --git a/README.md b/README.md index 5a3e2a4b..b6e5a586 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,9 @@ npm run unit # Configuration Edit config.json for configuration. scopeOptionsEnabled gives you input fields for CWs and the scope settings. + +## Options + +### Login methods + +```loginMethod``` can be set to either ```password``` (the default) or ```token```, which will use the full oauth redirection flow, which is useful for SSO situations. diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 65d1ea02..6b8aef7f 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -53,6 +53,7 @@ const afterStoreSetup = ({store, i18n}) => { var scopeOptionsEnabled = (config.scopeOptionsEnabled) var formattingOptionsEnabled = (config.formattingOptionsEnabled) var collapseMessageWithSubject = (config.collapseMessageWithSubject) + var loginMethod = (config.loginMethod) store.dispatch('setInstanceOption', { name: 'theme', value: theme }) store.dispatch('setInstanceOption', { name: 'background', value: background }) @@ -67,6 +68,7 @@ const afterStoreSetup = ({store, i18n}) => { store.dispatch('setInstanceOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled }) store.dispatch('setInstanceOption', { name: 'formattingOptionsEnabled', value: formattingOptionsEnabled }) store.dispatch('setInstanceOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject }) + store.dispatch('setInstanceOption', { name: 'loginMethod', value: loginMethod }) if (chatDisabled) { store.dispatch('disableChat') } diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index ffdd5504..49868aed 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -5,6 +5,7 @@ const LoginForm = { authError: false }), computed: { + loginMethod () { return this.$store.state.instance.loginMethod }, loggingIn () { return this.$store.state.users.loggingIn }, registrationOpen () { return this.$store.state.instance.registrationOpen } }, @@ -17,14 +18,23 @@ const LoginForm = { }) }, submit () { - this.$store.dispatch('loginUser', this.user).then( - () => {}, - (error) => { - this.authError = error - this.user.username = '' - this.user.password = '' - } - ) + const data = { + oauth: this.$store.state.oauth, + instance: this.$store.state.instance.server + } + oauthApi.getOrCreateApp(data).then((app) => { + oauthApi.getTokenWithCredentials( + { + app, + instance: data.instance, + username: this.user.username, + password: this.user.password}) + .then((result) => { + this.$store.commit('setToken', result.access_token) + this.$store.dispatch('loginUser', result.access_token) + this.$router.push('/main/friends') + }) + }) } } } diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue index db389716..8a5174d7 100644 --- a/src/components/login_form/login_form.vue +++ b/src/components/login_form/login_form.vue @@ -5,7 +5,24 @@ {{$t('login.login')}}
- + +