Merge branch 'betterStorage' into shigusegubu
* betterStorage: Fixed "user.id is undefined" or something error more sane by properly handling HTTP errors undo rename because it makes less sense now. proxying nodeinfo made FE work even without either api or static config Removed warning. Added support for working without static/config.json more missing stuff fix some missing stuff translations Added more stuff that's actually being added to instanceConfig, simplified the whitelist. more refactoring some recategorization of options... Initial version
This commit is contained in:
commit
b0af6b572c
5 changed files with 96 additions and 74 deletions
|
@ -27,6 +27,11 @@ module.exports = {
|
|||
changeOrigin: true,
|
||||
cookieDomainRewrite: 'localhost'
|
||||
},
|
||||
'/nodeinfo': {
|
||||
target: 'http://localhost:4000/',
|
||||
changeOrigin: true,
|
||||
cookieDomainRewrite: 'localhost'
|
||||
},
|
||||
'/socket': {
|
||||
target: 'http://localhost:4000/',
|
||||
changeOrigin: true,
|
||||
|
|
|
@ -92,8 +92,6 @@ export default function createPersistedState ({
|
|||
store.dispatch('settingsSaved', { error })
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.warn(`Not saving to localStorage for: ${mutation.type}`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Couldn't persist state:")
|
||||
|
|
17
src/main.js
17
src/main.js
|
@ -90,8 +90,13 @@ window.fetch('/api/statusnet/config.json')
|
|||
|
||||
window.fetch('/static/config.json')
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
var staticConfig = data
|
||||
.catch((err) => {
|
||||
console.warn('Failed to load static/config.json, continuing without it.')
|
||||
console.warn('Error was: ')
|
||||
console.warn(err)
|
||||
return {}
|
||||
})
|
||||
.then((staticConfig) => {
|
||||
// This takes static config and overrides properties that are present in apiConfig
|
||||
var config = Object.assign({}, staticConfig, apiConfig)
|
||||
|
||||
|
@ -106,7 +111,7 @@ window.fetch('/api/statusnet/config.json')
|
|||
var showInstanceSpecificPanel = (config.showInstanceSpecificPanel)
|
||||
var scopeOptionsEnabled = (config.scopeOptionsEnabled)
|
||||
var formattingOptionsEnabled = (config.formattingOptionsEnabled)
|
||||
var defaultCollapseMessageWithSubject = (config.collapseMessageWithSubject)
|
||||
var collapseMessageWithSubject = (config.collapseMessageWithSubject)
|
||||
|
||||
store.dispatch('setInstanceOption', { name: 'theme', value: theme })
|
||||
store.dispatch('setInstanceOption', { name: 'background', value: background })
|
||||
|
@ -118,7 +123,7 @@ window.fetch('/api/statusnet/config.json')
|
|||
store.dispatch('setInstanceOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
|
||||
store.dispatch('setInstanceOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled })
|
||||
store.dispatch('setInstanceOption', { name: 'formattingOptionsEnabled', value: formattingOptionsEnabled })
|
||||
store.dispatch('setInstanceOption', { name: 'collapseMessageWithSubject', value: defaultCollapseMessageWithSubject })
|
||||
store.dispatch('setInstanceOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject })
|
||||
if (chatDisabled) {
|
||||
store.dispatch('disableChat')
|
||||
}
|
||||
|
@ -127,7 +132,9 @@ window.fetch('/api/statusnet/config.json')
|
|||
{ name: 'root',
|
||||
path: '/',
|
||||
redirect: to => {
|
||||
return (store.state.users.currentUser ? redirectRootLogin : redirectRootNoLogin) || '/main/all'
|
||||
return (store.state.users.currentUser
|
||||
? store.state.instance.redirectRootLogin
|
||||
: store.state.instance.redirectRootNoLogin) || '/main/all'
|
||||
}},
|
||||
{ path: '/main/all', component: PublicAndExternalTimeline },
|
||||
{ path: '/main/public', component: PublicTimeline },
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { set } from 'vue'
|
||||
import StyleSetter from '../services/style_setter/style_setter.js'
|
||||
|
||||
const defaultState = {
|
||||
// Stuff from static/config.json and apiConfig
|
||||
|
@ -7,7 +8,7 @@ const defaultState = {
|
|||
textlimit: 5000,
|
||||
server: 'http://localhost:4040/',
|
||||
theme: 'pleroma-dark',
|
||||
background: 'img.png',
|
||||
background: '/static/aurora_borealis.jpg',
|
||||
logo: '/static/logo.png',
|
||||
logoMask: true,
|
||||
logoMargin: '.2em',
|
||||
|
@ -40,8 +41,10 @@ const instance = {
|
|||
state: defaultState,
|
||||
mutations: {
|
||||
setInstanceOption (state, { name, value }) {
|
||||
if (typeof value !== 'undefined') {
|
||||
set(state, name, value)
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setInstanceOption ({ commit, dispatch }, { name, value }) {
|
||||
|
@ -50,6 +53,8 @@ const instance = {
|
|||
case 'name':
|
||||
dispatch('setPageTitle')
|
||||
break
|
||||
case 'theme':
|
||||
StyleSetter.setPreset(value, commit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -335,7 +335,14 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
|
|||
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
|
||||
url += `?${queryString}`
|
||||
|
||||
return fetch(url, { headers: authHeaders(credentials) }).then((data) => data.json())
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
.then((data) => {
|
||||
if (data.ok) {
|
||||
return data
|
||||
}
|
||||
throw new Error('Error fetching timeline')
|
||||
})
|
||||
.then((data) => data.json())
|
||||
}
|
||||
|
||||
const verifyCredentials = (user) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue