diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 0f9cc9d..4eae050 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -119,6 +119,9 @@ "opt_desc_openTabListNoTab": { "message": "Open the tab list when store all tabs" }, + "opt_desc_listsPerPage": { + "message": "Number of lists per page" + }, "opt_label_popup": { "message": "Popup simple list" }, diff --git a/src/_locales/zh_CN/messages.json b/src/_locales/zh_CN/messages.json index 850927a..5dff83a 100644 --- a/src/_locales/zh_CN/messages.json +++ b/src/_locales/zh_CN/messages.json @@ -119,6 +119,9 @@ "opt_desc_openTabListNoTab": { "message": "当储存所有标签时打开标签列表" }, + "opt_desc_listsPerPage": { + "message": "每页的列表数量" + }, "opt_label_popup": { "message": "弹出简单列表" }, diff --git a/src/background.js b/src/background.js index 8198cf4..acafe26 100644 --- a/src/background.js +++ b/src/background.js @@ -5,6 +5,7 @@ import storage from './common/storage' import options from './common/options' import migrate from './common/migrate' import boss from './common/service/boss' +import listManger from './common/listManager' import browser from 'webextension-polyfill' @@ -212,6 +213,7 @@ const commandHandler = async command => { } const init = async () => { + await listManger.init() const opts = window.opts = await storage.getOptions() || {} _.defaults(opts, options.getDefaultOptions()) await storage.setOptions(opts) diff --git a/src/common/listManager.js b/src/common/listManager.js index 8331f03..179b0fb 100644 --- a/src/common/listManager.js +++ b/src/common/listManager.js @@ -19,7 +19,6 @@ const compressOps = ops => { const removed = [] const updated = {} const finalOps = [] - console.log(ops) for (let i = ops.length - 1; i > -1; i -= 1) { const op = ops[i] // ignore all actions for the list if that list will be removed finally diff --git a/src/common/service/boss.js b/src/common/service/boss.js index 334712c..b8744cf 100644 --- a/src/common/service/boss.js +++ b/src/common/service/boss.js @@ -5,7 +5,7 @@ import { import {isBackground} from '../utils' import browser from 'webextension-polyfill' - const apiUrl = 'http://127.0.0.1:3000' +const apiUrl = 'http://127.0.0.1:3000' // TODO: use online address const hasToken = async () => TOKEN_KEY in await browser.storage.local.get(TOKEN_KEY) @@ -107,15 +107,15 @@ const uploadOperations = async () => { const applyRemoteLists = async () => { const lists = await getLists() - const {listsUpdatedAt} = browser.storage.local.set({lists}) - return Date.parse(listsUpdatedAt) + await browser.storage.local.set({lists}) + return getInfo() } const uploadOpts = async () => { const {opts} = await browser.storage.local.get('opts') - const optsUpdatedAt = await setOpts(opts) - await browser.storage.local.set({optsUpdatedAt}) - return Date.parse(optsUpdatedAt) + const result = await setOpts(opts) + result.optsUpdatedAt = Date.parse(result.optsUpdatedAt) + return result } const applyRemoteOpts = async () => { @@ -141,12 +141,12 @@ const refresh = async () => { } // apply remote lists if remote lists update time later than local if (remoteInfo.listsUpdatedAt > localInfo.listsUpdatedAt) { - const listsUpdatedAt = await applyRemoteLists() + const {listsUpdatedAt} = await applyRemoteLists() await browser.storage.local.set({listsUpdatedAt}) } if (localInfo.optsUpdatedAt > remoteInfo.optsUpdatedAt) { - const optsUpdatedAt = await uploadOpts() + const {optsUpdatedAt} = await uploadOpts() await browser.storage.local.set({optsUpdatedAt}) } else if (localInfo.optsUpdatedAt < remoteInfo.optsUpdatedAt) { await applyRemoteOpts() diff --git a/src/common/utils.js b/src/common/utils.js index 6585eff..faeb76d 100644 --- a/src/common/utils.js +++ b/src/common/utils.js @@ -40,6 +40,6 @@ export const genObjectId = () => { return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, () => (Math.random() * 16 | 0).toString(16)).toLowerCase() } export const isBackground = async () => { - if (window._isBackground != null) window._isBackground = window === await browser.runtime.getBackgroundPage() + if (window._isBackground == null) window._isBackground = window === await browser.runtime.getBackgroundPage() return window._isBackground } diff --git a/src/component/main/Toolbar.vue b/src/component/main/Toolbar.vue index ef9c980..c660332 100644 --- a/src/component/main/Toolbar.vue +++ b/src/component/main/Toolbar.vue @@ -9,8 +9,7 @@ - cloud_done - {{ syncIcon }} + {{ syncIcon }} {{ tooltip }} @@ -24,7 +23,6 @@