diff --git a/package-lock.json b/package-lock.json index 7508945..a066260 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2150,14 +2150,12 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "optional": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2172,20 +2170,17 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "optional": true + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "optional": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "optional": true + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "core-util-is": { "version": "1.0.2", @@ -2302,8 +2297,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "optional": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", @@ -2315,7 +2309,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -2330,7 +2323,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2338,14 +2330,12 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "optional": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minipass": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz", "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -2364,7 +2354,6 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "optional": true, "requires": { "minimist": "0.0.8" } @@ -2445,8 +2434,7 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "optional": true + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "object-assign": { "version": "4.1.1", @@ -2458,7 +2446,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "optional": true, "requires": { "wrappy": "1" } @@ -2580,7 +2567,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -11271,14 +11257,6 @@ "errno": "~0.1.7" } }, - "workerize-loader": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/workerize-loader/-/workerize-loader-1.0.4.tgz", - "integrity": "sha512-HMTr/zpuZhm8dbhcK52cMYmn57uf7IJeMZJil+5lL/vC5+AO9wzxZ0FISkGVj78No7HcpaINwAWHGCYx3dnsTw==", - "requires": { - "loader-utils": "^1.1.0" - } - }, "wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", diff --git a/package.json b/package.json index cd0fe95..5ff92e6 100644 --- a/package.json +++ b/package.json @@ -98,8 +98,7 @@ "tiny-queue": "^0.2.1", "web-animations-js": "^2.3.1", "webpack": "^4.20.2", - "webpack-bundle-analyzer": "^3.0.2", - "workerize-loader": "^1.0.4" + "webpack-bundle-analyzer": "^3.0.2" }, "devDependencies": { "eslint-plugin-html": "^4.0.6", diff --git a/routes/_actions/instances.js b/routes/_actions/instances.js index 57a4050..e77f9a5 100644 --- a/routes/_actions/instances.js +++ b/routes/_actions/instances.js @@ -56,7 +56,7 @@ export async function logOutOfInstance (instanceName) { store.save() toast.say(`Logged out of ${instanceName}`) switchToTheme(instanceThemes[newInstance] || 'default') - await database.clearDatabaseForInstance(instanceName) + /* no await */ database.clearDatabaseForInstance(instanceName) goto('/settings/instances') } diff --git a/routes/_components/settings/instance/InstanceActions.html b/routes/_components/settings/instance/InstanceActions.html index 18aa8fb..41d4441 100644 --- a/routes/_components/settings/instance/InstanceActions.html +++ b/routes/_components/settings/instance/InstanceActions.html @@ -40,7 +40,7 @@ showConfirmationDialog({ text: `Log out of ${instanceName}?`, onPositive () { - logOutOfInstance(instanceName) + /* no await */ logOutOfInstance(instanceName) } }) } diff --git a/routes/_database/database.js b/routes/_database/database.js index e1689f8..8c71c09 100644 --- a/routes/_database/database.js +++ b/routes/_database/database.js @@ -1,3 +1,3 @@ -// dev version to play nice with IDEs -import * as database from './databaseWorker' +// this used to be workerized, hence the API looks like this +import * as database from './databaseApis' export { database } diff --git a/routes/_database/database.workerize.js b/routes/_database/database.workerize.js deleted file mode 100644 index 756320b..0000000 --- a/routes/_database/database.workerize.js +++ /dev/null @@ -1,3 +0,0 @@ -// workerize version, used in production -const database = process.browser && require('./databaseWorker.js')() -export { database } diff --git a/routes/_database/databaseApis.js b/routes/_database/databaseApis.js new file mode 100644 index 0000000..e3ab4b8 --- /dev/null +++ b/routes/_database/databaseApis.js @@ -0,0 +1,11 @@ +export * from './accounts' +export * from './clear' +export * from './timelines/lookup' +export * from './timelines/pinnedStatuses' +export * from './timelines/pagination' +export * from './timelines/getStatusOrNotification' +export * from './timelines/updateStatus' +export * from './timelines/deletion' +export * from './timelines/insertion' +export * from './meta' +export * from './relationships' diff --git a/routes/_database/databaseLifecycle.js b/routes/_database/databaseLifecycle.js index 3d7d23b..c353c10 100644 --- a/routes/_database/databaseLifecycle.js +++ b/routes/_database/databaseLifecycle.js @@ -126,5 +126,6 @@ export function deleteDatabase (instanceName) { let req = indexedDB.deleteDatabase(instanceName) req.onsuccess = () => resolve() req.onerror = () => reject(req.error) + req.onblocked = () => console.error(`database ${instanceName} blocked`) }).then(() => deleteKnownInstance(instanceName)) } diff --git a/routes/_database/databaseWorker.js b/routes/_database/databaseWorker.js deleted file mode 100644 index 46ea7df..0000000 --- a/routes/_database/databaseWorker.js +++ /dev/null @@ -1,157 +0,0 @@ -import { - getAccount as _getAccount, - searchAccountsByUsername as _searchAccountsByUsername, - setAccount as _setAccount -} from './accounts' -import { - clearDatabaseForInstance as _clearDatabaseForInstance -} from './clear' -import { - getNotificationIdsForStatuses as _getNotificationIdsForStatuses, - getReblogsForStatus as _getReblogsForStatus -} from './timelines/lookup' -import { - getPinnedStatuses as _getPinnedStatuses, - insertPinnedStatuses as _insertPinnedStatuses -} from './timelines/pinnedStatuses' -import { - getTimeline as _getTimeline -} from './timelines/pagination' -import { - getNotification as _getNotification, - getStatus as _getStatus -} from './timelines/getStatusOrNotification' -import { - setStatusFavorited as _setStatusFavorited, - setStatusMuted as _setStatusMuted, - setStatusPinned as _setStatusPinned, - setStatusReblogged as _setStatusReblogged -} from './timelines/updateStatus' -import { - deleteStatusesAndNotifications as _deleteStatusesAndNotifications -} from './timelines/deletion' -import { - insertTimelineItems as _insertTimelineItems -} from './timelines/insertion' -import { - getCustomEmoji as _getCustomEmoji, - getInstanceInfo as _getInstanceInfo, - getInstanceVerifyCredentials as _getInstanceVerifyCredentials, - getLists as _getLists, - setCustomEmoji as _setCustomEmoji, - setInstanceInfo as _setInstanceInfo, - setInstanceVerifyCredentials as _setInstanceVerifyCredentials, - setLists as _setLists -} from './meta' -import { - getRelationship as _getRelationship, - setRelationship as _setRelationship -} from './relationships' - -export async function getAccount (instanceName, accountId) { - return _getAccount(instanceName, accountId) -} - -export async function setAccount (instanceName, account) { - return _setAccount(instanceName, account) -} - -export async function searchAccountsByUsername (instanceName, usernamePrefix, limit) { - return _searchAccountsByUsername(instanceName, usernamePrefix, limit) -} - -export async function clearDatabaseForInstance (instanceName) { - return _clearDatabaseForInstance(instanceName) -} - -export async function getReblogsForStatus (instanceName, id) { - return _getReblogsForStatus(instanceName, id) -} - -export async function getNotificationIdsForStatuses (instanceName, statusIds) { - return _getNotificationIdsForStatuses(instanceName, statusIds) -} - -export async function insertPinnedStatuses (instanceName, accountId, statuses) { - return _insertPinnedStatuses(instanceName, accountId, statuses) -} - -export async function getPinnedStatuses (instanceName, accountId) { - return _getPinnedStatuses(instanceName, accountId) -} - -export async function getTimeline (instanceName, timeline, maxId, limit) { - return _getTimeline(instanceName, timeline, maxId, limit) -} - -export async function getStatus (instanceName, id) { - return _getStatus(instanceName, id) -} - -export async function getNotification (instanceName, id) { - return _getNotification(instanceName, id) -} - -export async function setStatusFavorited (instanceName, statusId, favorited) { - return _setStatusFavorited(instanceName, statusId, favorited) -} - -export async function setStatusReblogged (instanceName, statusId, reblogged) { - return _setStatusReblogged(instanceName, statusId, reblogged) -} - -export async function setStatusPinned (instanceName, statusId, pinned) { - return _setStatusPinned(instanceName, statusId, pinned) -} - -export async function setStatusMuted (instanceName, statusId, muted) { - return _setStatusMuted(instanceName, statusId, muted) -} - -export async function deleteStatusesAndNotifications (instanceName, statusIds, notificationIds) { - return _deleteStatusesAndNotifications(instanceName, statusIds, notificationIds) -} - -export async function insertTimelineItems (instanceName, timeline, timelineItems) { - return _insertTimelineItems(instanceName, timeline, timelineItems) -} - -export async function getInstanceVerifyCredentials (instanceName) { - return _getInstanceVerifyCredentials(instanceName) -} - -export async function setInstanceVerifyCredentials (instanceName, value) { - return _setInstanceVerifyCredentials(instanceName, value) -} - -export async function getInstanceInfo (instanceName) { - return _getInstanceInfo(instanceName) -} - -export async function setInstanceInfo (instanceName, value) { - return _setInstanceInfo(instanceName, value) -} - -export async function getLists (instanceName) { - return _getLists(instanceName) -} - -export async function setLists (instanceName, value) { - return _setLists(instanceName, value) -} - -export async function getCustomEmoji (instanceName) { - return _getCustomEmoji(instanceName) -} - -export async function setCustomEmoji (instanceName, value) { - return _setCustomEmoji(instanceName, value) -} - -export async function getRelationship (instanceName, accountId) { - return _getRelationship(instanceName, accountId) -} - -export async function setRelationship (instanceName, relationship) { - return _setRelationship(instanceName, relationship) -} diff --git a/webpack.client.config.js b/webpack.client.config.js index 308d06b..d0d1883 100644 --- a/webpack.client.config.js +++ b/webpack.client.config.js @@ -45,12 +45,6 @@ module.exports = { MiniCssExtractPlugin.loader, 'css-loader' ] - }, - { - test: /\/_database\/databaseWorker\.js$/, - use: [ - 'workerize-loader' - ] } ].filter(Boolean) }, @@ -85,11 +79,7 @@ module.exports = { plugins: [ new LodashModuleReplacementPlugin({ paths: true - }), - new webpack.NormalModuleReplacementPlugin( - /\/_database\/database\.js$/, - './database.workerize.js' - ) + }) ].concat(isDev ? [ new webpack.HotModuleReplacementPlugin({ requestTimeout: 120000