refs #2500 Skip cache
This commit is contained in:
parent
654f4af1ec
commit
8feee0c4c7
|
@ -17,7 +17,6 @@ import {
|
||||||
IpcMainInvokeEvent
|
IpcMainInvokeEvent
|
||||||
} from 'electron'
|
} from 'electron'
|
||||||
|
|
||||||
import Datastore from 'nedb'
|
|
||||||
import crypto from 'crypto'
|
import crypto from 'crypto'
|
||||||
import log from 'electron-log'
|
import log from 'electron-log'
|
||||||
import windowStateKeeper from 'electron-window-state'
|
import windowStateKeeper from 'electron-window-state'
|
||||||
|
@ -42,9 +41,6 @@ import { LocalAccount } from '~/src/types/localAccount'
|
||||||
import { LocalTag } from '~/src/types/localTag'
|
import { LocalTag } from '~/src/types/localTag'
|
||||||
import { Notify } from '~/src/types/notify'
|
import { Notify } from '~/src/types/notify'
|
||||||
// import { StreamingError } from '~/src/errors/streamingError'
|
// import { StreamingError } from '~/src/errors/streamingError'
|
||||||
import HashtagCache from './cache/hashtag'
|
|
||||||
import AccountCache from './cache/account'
|
|
||||||
import { InsertAccountCache } from '~/src/types/insertAccountCache'
|
|
||||||
import { Proxy } from '~/src/types/proxy'
|
import { Proxy } from '~/src/types/proxy'
|
||||||
import ProxyConfiguration from './proxy'
|
import ProxyConfiguration from './proxy'
|
||||||
import { Menu as MenuPreferences } from '~/src/types/preference'
|
import { Menu as MenuPreferences } from '~/src/types/preference'
|
||||||
|
@ -128,15 +124,6 @@ const preferencesDBPath = process.env.NODE_ENV === 'production' ? userData + './
|
||||||
|
|
||||||
const settingsDBPath = process.env.NODE_ENV === 'production' ? userData + './db/settings.json' : 'settings.json'
|
const settingsDBPath = process.env.NODE_ENV === 'production' ? userData + './db/settings.json' : 'settings.json'
|
||||||
|
|
||||||
/**
|
|
||||||
* Cache path
|
|
||||||
*/
|
|
||||||
const hashtagCachePath = process.env.NODE_ENV === 'production' ? userData + '/cache/hashtag.db' : 'cache/hashtag.db'
|
|
||||||
const hashtagCache = new HashtagCache(hashtagCachePath)
|
|
||||||
|
|
||||||
const accountCachePath = process.env.NODE_ENV === 'production' ? userData + '/cache/account.db' : 'cache/account.db'
|
|
||||||
const accountCache = new AccountCache(accountCachePath)
|
|
||||||
|
|
||||||
const soundBasePath =
|
const soundBasePath =
|
||||||
process.env.NODE_ENV === 'development' ? path.join(__dirname, '../../build/sounds/') : path.join(process.resourcesPath!, 'build/sounds/')
|
process.env.NODE_ENV === 'development' ? path.join(__dirname, '../../build/sounds/') : path.join(process.resourcesPath!, 'build/sounds/')
|
||||||
const iconBasePath =
|
const iconBasePath =
|
||||||
|
@ -1170,30 +1157,20 @@ ipcMain.handle(
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
ipcMain.handle('get-cache-hashtags', async (_: IpcMainInvokeEvent) => {
|
ipcMain.handle('get-cache-hashtags', async (_: IpcMainInvokeEvent) => {
|
||||||
const tags = await hashtagCache.listTags()
|
// TODO:
|
||||||
return tags
|
return []
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('insert-cache-hashtags', async (_: IpcMainInvokeEvent, tags: Array<string>) => {
|
ipcMain.handle('insert-cache-hashtags', async (_: IpcMainInvokeEvent) => {
|
||||||
await Promise.all(
|
return null
|
||||||
tags.map(async name => {
|
|
||||||
await hashtagCache.insertHashtag(name).catch(err => console.error(err))
|
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('get-cache-accounts', async (_: IpcMainInvokeEvent, ownerID: string) => {
|
ipcMain.handle('get-cache-accounts', async (_: IpcMainInvokeEvent) => {
|
||||||
const accounts = await accountCache.listAccounts(ownerID)
|
return []
|
||||||
return accounts
|
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('insert-cache-accounts', async (_: IpcMainInvokeEvent, obj: InsertAccountCache) => {
|
ipcMain.handle('insert-cache-accounts', async (_: IpcMainInvokeEvent) => {
|
||||||
const { ownerID, accts } = obj
|
return []
|
||||||
Promise.all(
|
|
||||||
accts.map(async acct => {
|
|
||||||
await accountCache.insertAccount(ownerID, acct).catch(err => console.error(err))
|
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Application control
|
// Application control
|
||||||
|
|
Loading…
Reference in New Issue