Merge branch 'setttingssync' into shigusegubu-themes3
This commit is contained in:
commit
71c7bb86f9
6 changed files with 12 additions and 19 deletions
|
|
@ -83,7 +83,6 @@ export const vuexPushNotificationsPlugin = (store) => {
|
||||||
mutation.type === 'setCurrentUser' ||
|
mutation.type === 'setCurrentUser' ||
|
||||||
mutation.type === 'clearCurrentUser'
|
mutation.type === 'clearCurrentUser'
|
||||||
) {
|
) {
|
||||||
console.log(!!user, permissionGranted, enabled)
|
|
||||||
if (user && permissionGranted && enabled) {
|
if (user && permissionGranted && enabled) {
|
||||||
return store.dispatch('registerPushNotifications')
|
return store.dispatch('registerPushNotifications')
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,8 @@ export const getJsonOrError = async (response) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createApp = (instance) => {
|
export const createApp = (instance) => {
|
||||||
console.log('NAP', instance)
|
|
||||||
const url = `${instance}/api/v1/apps`
|
const url = `${instance}/api/v1/apps`
|
||||||
const form = new window.FormData()
|
const form = new window.FormData()
|
||||||
console.log(url)
|
|
||||||
|
|
||||||
form.append('client_name', 'PleromaFE')
|
form.append('client_name', 'PleromaFE')
|
||||||
form.append('website', 'https://pleroma.social')
|
form.append('website', 'https://pleroma.social')
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,6 @@ const generateTheme = (inputRuleset, callbacks, debug) => {
|
||||||
export const tryLoadCache = async () => {
|
export const tryLoadCache = async () => {
|
||||||
console.info('Trying to load compiled theme data from cache')
|
console.info('Trying to load compiled theme data from cache')
|
||||||
const cache = await localforage.getItem('pleromafe-theme-cache')
|
const cache = await localforage.getItem('pleromafe-theme-cache')
|
||||||
console.log(cache.checksum)
|
|
||||||
if (!cache) return null
|
if (!cache) return null
|
||||||
try {
|
try {
|
||||||
if (cache.engineChecksum === getEngineChecksum() &&
|
if (cache.engineChecksum === getEngineChecksum() &&
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ export const useOAuthStore = defineStore('oauth', {
|
||||||
},
|
},
|
||||||
async getAppToken() {
|
async getAppToken() {
|
||||||
const instance = useInstanceStore().server
|
const instance = useInstanceStore().server
|
||||||
console.log(this.clientId)
|
|
||||||
const res = await getClientToken({
|
const res = await getClientToken({
|
||||||
clientId: this.clientId,
|
clientId: this.clientId,
|
||||||
clientSecret: this.clientSecret,
|
clientSecret: this.clientSecret,
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ export const _moveItemInArray = (array, value, movement) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const _wrapData = (data, userName) => {
|
const _wrapData = (data, userName) => {
|
||||||
console.log('WRAP')
|
|
||||||
return {
|
return {
|
||||||
...data,
|
...data,
|
||||||
_user: userName,
|
_user: userName,
|
||||||
|
|
@ -414,8 +413,6 @@ export const _resetPrefs = (
|
||||||
}
|
}
|
||||||
|
|
||||||
export const _doMigrations = async (data, setPreference) => {
|
export const _doMigrations = async (data, setPreference) => {
|
||||||
console.log('TEST', data._version)
|
|
||||||
|
|
||||||
if (data._version < VERSION) {
|
if (data._version < VERSION) {
|
||||||
console.debug(
|
console.debug(
|
||||||
'Data has older version, seeing if there any migrations that can be applied',
|
'Data has older version, seeing if there any migrations that can be applied',
|
||||||
|
|
|
||||||
|
|
@ -71,27 +71,27 @@ export const _getRecentData = (cache, live, isTest) => {
|
||||||
if (!liveValid && cacheValid) {
|
if (!liveValid && cacheValid) {
|
||||||
result.needUpload = true
|
result.needUpload = true
|
||||||
console.debug(
|
console.debug(
|
||||||
'Nothing valid stored on server, assuming cache to be source of truth',
|
'[HIGHLIGHT] Nothing valid stored on server, assuming cache to be source of truth',
|
||||||
)
|
)
|
||||||
result.recent = cache
|
result.recent = cache
|
||||||
result.stale = live
|
result.stale = live
|
||||||
} else if (!cacheValid && liveValid) {
|
} else if (!cacheValid && liveValid) {
|
||||||
console.debug(
|
console.debug(
|
||||||
'Valid storage on server found, no local cache found, using live as source of truth',
|
'[HIGHLIGHT] Valid storage on server found, no local cache found, using live as source of truth',
|
||||||
)
|
)
|
||||||
result.recent = live
|
result.recent = live
|
||||||
result.stale = cache
|
result.stale = cache
|
||||||
} else if (cacheValid && liveValid) {
|
} else if (cacheValid && liveValid) {
|
||||||
console.debug('Both sources have valid data, figuring things out...')
|
console.debug('[HIGHLIGHT] Both sources have valid data, figuring things out...')
|
||||||
if (live._timestamp === cache._timestamp) {
|
if (live._timestamp === cache._timestamp) {
|
||||||
console.debug(
|
console.debug(
|
||||||
'Same timestamp on both sources, source of truth irrelevant',
|
'[HIGHLIGHT] Same timestamp on both sources, source of truth irrelevant',
|
||||||
)
|
)
|
||||||
result.recent = cache
|
result.recent = cache
|
||||||
result.stale = live
|
result.stale = live
|
||||||
} else {
|
} else {
|
||||||
console.debug(
|
console.debug(
|
||||||
'Different timestamp, figuring out which one is more recent',
|
'[HIGHLIGHT] Different timestamp, figuring out which one is more recent',
|
||||||
)
|
)
|
||||||
if (live._timestamp < cache._timestamp) {
|
if (live._timestamp < cache._timestamp) {
|
||||||
result.recent = cache
|
result.recent = cache
|
||||||
|
|
@ -102,7 +102,7 @@ export const _getRecentData = (cache, live, isTest) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.debug('Both sources are invalid, start from scratch')
|
console.debug('[HIGHLIGHT] Both sources are invalid, start from scratch')
|
||||||
result.needUpload = true
|
result.needUpload = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -281,16 +281,17 @@ export const useUserHighlightStore = defineStore('user_highlight', {
|
||||||
Object.entries(highlight).forEach(([user, value]) => {
|
Object.entries(highlight).forEach(([user, value]) => {
|
||||||
if ((highlight[user]._migrated || 0) < 1) {
|
if ((highlight[user]._migrated || 0) < 1) {
|
||||||
dirty = true
|
dirty = true
|
||||||
|
needUpload = true
|
||||||
this.set({ user, value: clone(value) })
|
this.set({ user, value: clone(value) })
|
||||||
vuexState.config.highlight[user]._migrated = 1
|
vuexState.config.highlight[user]._migrated = 1
|
||||||
console.debug(`Migrating user ${user}: ${ JSON.stringify(value) }`)
|
console.debug(`[HIGHLIGHT] Migrating user ${user}: ${ JSON.stringify(value) }`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
storage.setItem('vuex-lz', vuexState)
|
storage.setItem('vuex-lz', vuexState)
|
||||||
|
|
||||||
if (recent === null) {
|
if (recent === null) {
|
||||||
console.debug(
|
console.debug(
|
||||||
`Data is empty, initializing for ${userNew ? 'new' : 'existing'} user`,
|
`[HIGHLIGHT] Data is empty, initializing for ${userNew ? 'new' : 'existing'} user`,
|
||||||
)
|
)
|
||||||
recent = _wrapData({
|
recent = _wrapData({
|
||||||
highlight: { ...defaultState.highlight },
|
highlight: { ...defaultState.highlight },
|
||||||
|
|
@ -298,17 +299,17 @@ export const useUserHighlightStore = defineStore('user_highlight', {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!needUpload && recent && stale) {
|
if (!needUpload && recent && stale) {
|
||||||
console.debug('Checking if data needs merging...')
|
console.debug('[HIGHLIGHT] Checking if data needs merging...')
|
||||||
// discarding timestamps
|
// discarding timestamps
|
||||||
const { _timestamp: _0, ...recentData } = recent
|
const { _timestamp: _0, ...recentData } = recent
|
||||||
const { _timestamp: _2, ...staleData } = stale
|
const { _timestamp: _2, ...staleData } = stale
|
||||||
dirty = !isEqual(recentData, staleData)
|
dirty = !isEqual(recentData, staleData)
|
||||||
console.debug(`Data ${dirty ? 'needs' : "doesn't need"} merging`)
|
console.debug(`[HIGHLIGHT] Data ${dirty ? 'needs' : "doesn't need"} merging`)
|
||||||
}
|
}
|
||||||
|
|
||||||
let highlights
|
let highlights
|
||||||
if (dirty) {
|
if (dirty) {
|
||||||
console.debug('Merging the data...')
|
console.debug('[HIGHLIGHT] Merging the data...')
|
||||||
_verifyHighlights(recent)
|
_verifyHighlights(recent)
|
||||||
_verifyHighlights(stale)
|
_verifyHighlights(stale)
|
||||||
highlights = _mergeHighlights(recent.highlight, stale.highlight)
|
highlights = _mergeHighlights(recent.highlight, stale.highlight)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue