2018-03-03 22:15:50 +00:00
|
|
|
import { observers } from './observers/observers'
|
|
|
|
import { computations } from './computations/computations'
|
|
|
|
import { mixins } from './mixins/mixins'
|
2018-01-28 21:09:39 +00:00
|
|
|
import { LocalStorageStore } from './LocalStorageStore'
|
|
|
|
|
|
|
|
const KEYS_TO_STORE_IN_LOCAL_STORAGE = new Set([
|
2018-02-09 06:29:29 +00:00
|
|
|
'currentInstance',
|
|
|
|
'currentRegisteredInstance',
|
|
|
|
'currentRegisteredInstanceName',
|
|
|
|
'instanceNameInSearch',
|
|
|
|
'instanceThemes',
|
|
|
|
'loggedInInstances',
|
|
|
|
'loggedInInstancesInOrder',
|
|
|
|
'autoplayGifs',
|
|
|
|
'markMediaAsSensitive',
|
2018-02-26 00:26:43 +00:00
|
|
|
'pinnedPages',
|
2018-03-03 22:15:50 +00:00
|
|
|
'composeData'
|
2018-01-28 21:09:39 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
class PinaforeStore extends LocalStorageStore {
|
2018-02-09 06:29:29 +00:00
|
|
|
constructor (state) {
|
2018-01-28 21:09:39 +00:00
|
|
|
super(state, KEYS_TO_STORE_IN_LOCAL_STORAGE)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-20 04:15:24 +00:00
|
|
|
export const store = new PinaforeStore({
|
2018-01-28 21:09:39 +00:00
|
|
|
instanceNameInSearch: '',
|
2018-02-07 04:54:49 +00:00
|
|
|
queryInSearch: '',
|
2018-01-28 21:09:39 +00:00
|
|
|
currentInstance: null,
|
|
|
|
loggedInInstances: {},
|
|
|
|
loggedInInstancesInOrder: [],
|
2018-02-01 02:20:30 +00:00
|
|
|
instanceThemes: {},
|
2018-02-04 20:27:28 +00:00
|
|
|
spoilersShown: {},
|
|
|
|
sensitivesShown: {},
|
|
|
|
autoplayGifs: false,
|
2018-02-08 06:49:50 +00:00
|
|
|
markMediaAsSensitive: false,
|
2018-02-08 17:15:25 +00:00
|
|
|
pinnedPages: {},
|
2018-02-11 18:35:25 +00:00
|
|
|
instanceLists: {},
|
2018-02-11 21:46:57 +00:00
|
|
|
pinnedStatuses: {},
|
2018-02-24 02:23:36 +00:00
|
|
|
instanceInfos: {},
|
2018-02-26 00:26:43 +00:00
|
|
|
statusModifications: {},
|
2018-02-28 07:18:07 +00:00
|
|
|
rawComposeText: '',
|
2018-03-03 18:11:32 +00:00
|
|
|
customEmoji: {},
|
2018-03-03 22:15:50 +00:00
|
|
|
composeData: {},
|
2018-03-03 21:23:26 +00:00
|
|
|
verifyCredentials: {}
|
2018-01-28 21:09:39 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
mixins(PinaforeStore)
|
|
|
|
computations(store)
|
2018-02-21 05:29:59 +00:00
|
|
|
observers(store)
|
2018-01-28 21:09:39 +00:00
|
|
|
|
2018-02-20 04:15:24 +00:00
|
|
|
if (process.browser && process.env.NODE_ENV !== 'production') {
|
|
|
|
window.store = store // for debugging
|
2018-02-20 04:28:31 +00:00
|
|
|
}
|