aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/config.js7
-rw-r--r--src/modules/instance.js63
-rw-r--r--src/modules/interface.js36
3 files changed, 99 insertions, 7 deletions
diff --git a/src/modules/config.js b/src/modules/config.js
index 60a34bc1..375d0167 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -4,7 +4,6 @@ import StyleSetter from '../services/style_setter/style_setter.js'
const browserLocale = (window.navigator.language || 'en').split('-')[0]
const defaultState = {
- name: 'Pleroma FE',
colors: {},
collapseMessageWithSubject: false,
hideAttachments: false,
@@ -45,18 +44,12 @@ const config = {
}
},
actions: {
- setPageTitle ({state}, option = '') {
- document.title = `${option} ${state.name}`
- },
setHighlight ({ commit, dispatch }, { user, color, type }) {
commit('setHighlight', {user, color, type})
},
setOption ({ commit, dispatch }, { name, value }) {
commit('setOption', {name, value})
switch (name) {
- case 'name':
- dispatch('setPageTitle')
- break
case 'theme':
StyleSetter.setPreset(value, commit)
break
diff --git a/src/modules/instance.js b/src/modules/instance.js
new file mode 100644
index 00000000..cb724821
--- /dev/null
+++ b/src/modules/instance.js
@@ -0,0 +1,63 @@
+import { set } from 'vue'
+import StyleSetter from '../services/style_setter/style_setter.js'
+
+const defaultState = {
+ // Stuff from static/config.json and apiConfig
+ name: 'Pleroma FE',
+ registrationOpen: true,
+ textlimit: 5000,
+ server: 'http://localhost:4040/',
+ theme: 'pleroma-dark',
+ background: '/static/aurora_borealis.jpg',
+ logo: '/static/logo.png',
+ logoMask: true,
+ logoMargin: '.2em',
+ redirectRootNoLogin: '/main/all',
+ redirectRootLogin: '/main/friends',
+ showInstanceSpecificPanel: false,
+ scopeOptionsEnabled: true,
+ formattingOptionsEnabled: false,
+ collapseMessageWithSubject: false,
+ disableChat: false,
+
+ // Nasty stuff
+ pleromaBackend: true,
+ emoji: [],
+ customEmoji: [],
+
+ // Feature-set, apparently, not everything here is reported...
+ mediaProxyAvailable: false,
+ chatAvailable: false,
+ gopherAvailable: false,
+ suggestionsEnabled: false,
+ suggestionsWeb: '',
+
+ // Html stuff
+ instanceSpecificPanelContent: '',
+ tos: ''
+}
+
+const instance = {
+ state: defaultState,
+ mutations: {
+ setInstanceOption (state, { name, value }) {
+ if (typeof value !== 'undefined') {
+ set(state, name, value)
+ }
+ }
+ },
+ actions: {
+ setInstanceOption ({ commit, dispatch }, { name, value }) {
+ commit('setInstanceOption', {name, value})
+ switch (name) {
+ case 'name':
+ dispatch('setPageTitle')
+ break
+ case 'theme':
+ StyleSetter.setPreset(value, commit)
+ }
+ }
+ }
+}
+
+export default instance
diff --git a/src/modules/interface.js b/src/modules/interface.js
new file mode 100644
index 00000000..07489685
--- /dev/null
+++ b/src/modules/interface.js
@@ -0,0 +1,36 @@
+import { set, delete as del } from 'vue'
+
+const defaultState = {
+ settings: {
+ currentSaveStateNotice: null,
+ noticeClearTimeout: null
+ }
+}
+
+const interfaceMod = {
+ state: defaultState,
+ mutations: {
+ settingsSaved (state, { success, error }) {
+ if (success) {
+ if (state.noticeClearTimeout) {
+ clearTimeout(state.noticeClearTimeout)
+ }
+ set(state.settings, 'currentSaveStateNotice', { error: false, data: success })
+ set(state.settings, 'noticeClearTimeout',
+ setTimeout(() => del(state.settings, 'currentSaveStateNotice'), 2000))
+ } else {
+ set(state.settings, 'currentSaveStateNotice', { error: true, errorData: error })
+ }
+ }
+ },
+ actions: {
+ setPageTitle ({ rootState }, option = '') {
+ document.title = `${option} ${rootState.instance.name}`
+ },
+ settingsSaved ({ commit, dispatch }, { success, error }) {
+ commit('settingsSaved', { success, error })
+ }
+ }
+}
+
+export default interfaceMod