From c6f4bfa875af3c11928176e6de05c3668db3e0c2 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Mon, 28 Aug 2023 13:39:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ncurc.js | 5 +- package-lock.json | 503 ++++++++++-------- package.json | 26 +- publish/changeLog.md | 2 +- src/common/constants.ts | 21 - .../constants.ts => common/constants_sync.ts} | 6 +- src/common/types/list.d.ts | 14 - src/common/types/list_sync.d.ts | 34 ++ src/common/types/sync.d.ts | 55 +- src/common/types/sync_common.d.ts | 17 - src/main/modules/sync/client/auth.ts | 2 +- src/main/modules/sync/client/client.ts | 34 +- src/main/modules/sync/client/data.ts | 2 +- src/main/modules/sync/client/index.ts | 2 +- src/main/modules/sync/client/modules/index.ts | 4 + .../sync/client/modules/list/handler.ts | 20 +- .../sync/client/modules/list/localEvent.ts | 5 +- src/main/modules/sync/client/sync/handler.ts | 22 + src/main/modules/sync/client/sync/index.ts | 8 + src/main/modules/sync/migrate.ts | 2 +- src/main/modules/sync/server/modules/index.ts | 4 + .../sync/server/modules/list/manage.ts | 2 +- .../server/modules/list/snapshotDataManage.ts | 6 +- .../sync/server/modules/list/sync/handler.ts | 12 +- .../sync/server/modules/list/sync/index.ts | 2 +- .../server/modules/list/sync/localEvent.ts | 7 +- .../sync/server/modules/list/sync/sync.ts | 64 ++- src/main/modules/sync/server/server/auth.ts | 2 +- src/main/modules/sync/server/server/server.ts | 63 +-- .../modules/sync/server/server/sync/event.ts | 14 + .../sync/server/server/sync/handler.ts | 23 + .../modules/sync/server/server/sync/index.ts | 10 + .../modules/sync/server/server/sync/sync.ts | 22 + src/main/modules/sync/server/user/data.ts | 4 +- src/main/modules/sync/utils.ts | 10 +- .../modules/winMain/rendererEvent/sync.ts | 4 +- src/main/types/common.d.ts | 2 +- src/main/types/sync.d.ts | 15 +- src/main/types/sync_common.d.ts | 25 + src/renderer-lyric/tsconfig.json | 1 - src/renderer/core/useApp/useSync.ts | 2 +- src/renderer/tsconfig.json | 3 - src/renderer/types/common.d.ts | 1 + .../views/Setting/components/SettingSync.vue | 2 +- tsconfig.json | 2 +- 45 files changed, 604 insertions(+), 482 deletions(-) rename src/{main/modules/sync/constants.ts => common/constants_sync.ts} (91%) create mode 100644 src/common/types/list_sync.d.ts delete mode 100644 src/common/types/sync_common.d.ts create mode 100644 src/main/modules/sync/client/sync/handler.ts create mode 100644 src/main/modules/sync/client/sync/index.ts create mode 100644 src/main/modules/sync/server/server/sync/event.ts create mode 100644 src/main/modules/sync/server/server/sync/handler.ts create mode 100644 src/main/modules/sync/server/server/sync/index.ts create mode 100644 src/main/modules/sync/server/server/sync/sync.ts create mode 100644 src/main/types/sync_common.d.ts diff --git a/.ncurc.js b/.ncurc.js index 267a7453..8e080481 100644 --- a/.ncurc.js +++ b/.ncurc.js @@ -8,6 +8,7 @@ module.exports = { 'vue', '@types/ws', // 'eslint-config-standard-with-typescript', + 'typescript', // https://github.com/microsoft/TypeScript/pull/54567 ], // target: 'newest', @@ -24,10 +25,6 @@ module.exports = { // target: 'minor', // filter: [ - // 'eslint-plugin-n', // 'electron', - // 'eslint-config-standard-with-typescript', - // '@typescript-eslint/eslint-plugin', - // '@typescript-eslint/parser', // ], } diff --git a/package-lock.json b/package-lock.json index a2cdc6f3..9bb5bcc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,29 +1,29 @@ { "name": "lx-music-desktop", - "version": "2.4.0-beta.9", + "version": "2.4.0-beta.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "lx-music-desktop", - "version": "2.4.0-beta.9", + "version": "2.4.0-beta.10", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@simonwep/pickr": "^1.8.2", - "better-sqlite3": "^8.5.1", + "better-sqlite3": "^8.5.2", "bufferutil": "^4.0.7", "comlink": "~4.3.1", "crypto-js": "^4.1.1", "electron-font-manager": "github:lyswhut/electron-font-manager#6d2f5ecf850c4fe34812b9394913680462ee0dae", - "electron-log": "^5.0.0-beta.25", + "electron-log": "^5.0.0-beta.28", "electron-store": "^8.1.0", - "font-list": "^1.5.0", + "font-list": "^1.5.1", "iconv-lite": "^0.6.3", "image-size": "^1.0.2", "jschardet": "^3.0.0", "long": "^5.2.3", - "message2call": "^0.1.0", + "message2call": "^0.1.2", "music-metadata": "^8.1.4", "needle": "github:lyswhut/needle#93299ac841b7e9a9f82ca7279b88aaaeda404060", "node-id3": "^0.2.6", @@ -35,14 +35,14 @@ "ws": "^8.13.0" }, "devDependencies": { - "@babel/core": "^7.22.10", - "@babel/eslint-parser": "^7.22.10", + "@babel/core": "^7.22.11", + "@babel/eslint-parser": "^7.22.11", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-modules-umd": "^7.22.5", "@babel/plugin-transform-runtime": "^7.22.10", "@babel/preset-env": "^7.22.10", - "@babel/preset-typescript": "^7.22.5", + "@babel/preset-typescript": "^7.22.11", "@tsconfig/recommended": "^1.0.2", "@types/better-sqlite3": "^7.6.4", "@types/needle": "^3.2.0", @@ -60,15 +60,15 @@ "css-loader": "^6.8.1", "css-minimizer-webpack-plugin": "^5.0.1", "del": "^6.1.1", - "electron": "^22.3.21", - "electron-builder": "^24.6.3", + "electron": "^22.3.22", + "electron-builder": "^24.6.4", "electron-debug": "^3.2.0", "electron-devtools-installer": "^3.2.0", - "electron-to-chromium": "^1.4.496", + "electron-to-chromium": "^1.4.503", "electron-updater": "^6.1.4", - "eslint": "^8.47.0", + "eslint": "^8.48.0", "eslint-config-standard": "^17.1.0", - "eslint-config-standard-with-typescript": "^38.1.0", + "eslint-config-standard-with-typescript": "^39.0.0", "eslint-formatter-friendly": "github:lyswhut/eslint-friendly-formatter#2170d1320e2fad13615a9dcf229669f0bb473a53", "eslint-plugin-html": "^7.1.0", "eslint-plugin-vue": "^9.17.0", @@ -223,9 +223,9 @@ } }, "node_modules/@babel/core": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.10.tgz", - "integrity": "sha512-fTmqbbUBAwCcre6zPzNngvsI0aNrPZe77AeqvDxWM9Nm+04RrJ3CAmGHA9f7lJQY6ZMhRztNemy4uslDxTX4Qw==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.11.tgz", + "integrity": "sha512-lh7RJrtPdhibbxndr6/xx0w8+CVlY5FJZiaSz908Fpy+G0xkBFTvwLcKJFF4PJxVfGhVWNebikpWGnOoC71juQ==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", @@ -233,15 +233,15 @@ "@babel/generator": "^7.22.10", "@babel/helper-compilation-targets": "^7.22.10", "@babel/helper-module-transforms": "^7.22.9", - "@babel/helpers": "^7.22.10", - "@babel/parser": "^7.22.10", + "@babel/helpers": "^7.22.11", + "@babel/parser": "^7.22.11", "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.10", - "@babel/types": "^7.22.10", + "@babel/traverse": "^7.22.11", + "@babel/types": "^7.22.11", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.2.2", + "json5": "^2.2.3", "semver": "^6.3.1" }, "engines": { @@ -253,9 +253,9 @@ } }, "node_modules/@babel/eslint-parser": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.10.tgz", - "integrity": "sha512-0J8DNPRXQRLeR9rPaUMM3fA+RbixjnVLe/MRMYCkp3hzgsSuxCHQ8NN8xQG1wIHKJ4a1DTROTvFJdW+B5/eOsg==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.11.tgz", + "integrity": "sha512-YjOYZ3j7TjV8OhLW6NCtyg8G04uStATEUe5eiLuCZaXz2VSDQ3dsAtm2D+TuQyAqNMUK2WacGo0/uma9Pein1w==", "dev": true, "dependencies": { "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", @@ -340,9 +340,9 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.5.tgz", - "integrity": "sha512-xkb58MyOYIslxu3gKmVXmjTtUPvBU4odYzbiIQbWwLKIHCsx6UGZGX6F1IznMFVnDdirseUZopzN+ZRt8Xb33Q==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.11.tgz", + "integrity": "sha512-y1grdYL4WzmUDBRGK0pDbIoFd7UZKoDurDzWEoNMYoj1EL+foGRQNyPWDcC+YyegN5y1DUsFFmzjGijB3nSVAQ==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", @@ -350,10 +350,10 @@ "@babel/helper-function-name": "^7.22.5", "@babel/helper-member-expression-to-functions": "^7.22.5", "@babel/helper-optimise-call-expression": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.9", "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.5", - "semver": "^6.3.0" + "@babel/helper-split-export-declaration": "^7.22.6", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -511,20 +511,20 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.5.tgz", - "integrity": "sha512-aLdNM5I3kdI/V9xGNyKSF3X/gTyMUBohTZ+/3QdQKAA9vxIiy12E+8E2HoOP1/DjeqU+g6as35QHJNMDDYpuCg==", + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.9.tgz", + "integrity": "sha512-LJIKvvpgPOPUThdYqcX6IXRuIcTkcAub0IaDRGCZH0p5GPUp7PhRU9QVgFcDDd51BaPkk77ZjqFwh6DZTAEmGg==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.22.5", "@babel/helper-member-expression-to-functions": "^7.22.5", - "@babel/helper-optimise-call-expression": "^7.22.5", - "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/helper-optimise-call-expression": "^7.22.5" }, "engines": { "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-simple-access": { @@ -605,14 +605,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.10.tgz", - "integrity": "sha512-a41J4NW8HyZa1I1vAndrraTlPZ/eZoga2ZgS7fEr0tZJGVU4xqdE80CEm0CcNjha5EZ8fTBYLKHF0kqDUuAwQw==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.11.tgz", + "integrity": "sha512-vyOXC8PBWaGc5h7GMsNx68OH33cypkEDJCHvYVVgVbbxJDROYVtexSk0gK5iCF1xNjRIN2s8ai7hwkWDq5szWg==", "dev": true, "dependencies": { "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.10", - "@babel/types": "^7.22.10" + "@babel/traverse": "^7.22.11", + "@babel/types": "^7.22.11" }, "engines": { "node": ">=6.9.0" @@ -704,9 +704,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.10.tgz", - "integrity": "sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.11.tgz", + "integrity": "sha512-R5zb8eJIBPJriQtbH/htEQy4k7E2dHWlD2Y2VT07JCzwYZHBxV5ZYtM0UhXSNMT74LyxuM+b1jdL7pSesXbC/g==", "bin": { "parser": "bin/babel-parser.js" }, @@ -1396,12 +1396,12 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.22.5.tgz", - "integrity": "sha512-B4pzOXj+ONRmuaQTg05b3y/4DuFz3WcCNAXPLb2Q0GT0TrGKGxNKV4jwsXts+StaM0LQczZbOpj8o1DLPDJIiA==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.22.11.tgz", + "integrity": "sha512-o2+bg7GDS60cJMgz9jWqRUsWkMzLCxp+jFDeDUT5sjRlAxcJWZ2ylNdI7QQ2+CH5hWu7OnN+Cv3htt7AkSf96g==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.22.5", + "@babel/helper-module-transforms": "^7.22.9", "@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-simple-access": "^7.22.5" }, @@ -1769,13 +1769,13 @@ } }, "node_modules/@babel/plugin-transform-typescript": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.5.tgz", - "integrity": "sha512-SMubA9S7Cb5sGSFFUlqxyClTA9zWJ8qGQrppNUm05LtFuN1ELRFNndkix4zUJrC9F+YivWwa1dHMSyo0e0N9dA==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.11.tgz", + "integrity": "sha512-0E4/L+7gfvHub7wsbTv03oRtD69X31LByy44fGmFzbZScpupFByMcgCJ0VbBTkzyjSJKuRoGN8tcijOWKTmqOA==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-create-class-features-plugin": "^7.22.5", + "@babel/helper-create-class-features-plugin": "^7.22.11", "@babel/helper-plugin-utils": "^7.22.5", "@babel/plugin-syntax-typescript": "^7.22.5" }, @@ -1958,16 +1958,16 @@ } }, "node_modules/@babel/preset-typescript": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.22.5.tgz", - "integrity": "sha512-YbPaal9LxztSGhmndR46FmAbkJ/1fAsw293tSU+I5E5h+cnJ3d4GTwyUgGYmOXJYdGA+uNePle4qbaRzj2NISQ==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.22.11.tgz", + "integrity": "sha512-tWY5wyCZYBGY7IlalfKI1rLiGlIfnwsRHZqlky0HVv8qviwQ1Uo/05M6+s+TcTCVa6Bmoo2uJW5TMFX6Wa4qVg==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-validator-option": "^7.22.5", "@babel/plugin-syntax-jsx": "^7.22.5", - "@babel/plugin-transform-modules-commonjs": "^7.22.5", - "@babel/plugin-transform-typescript": "^7.22.5" + "@babel/plugin-transform-modules-commonjs": "^7.22.11", + "@babel/plugin-transform-typescript": "^7.22.11" }, "engines": { "node": ">=6.9.0" @@ -2009,9 +2009,9 @@ } }, "node_modules/@babel/traverse": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.10.tgz", - "integrity": "sha512-Q/urqV4pRByiNNpb/f5OSv28ZlGJiFiiTh+GAHktbIrkPhPbl90+uW6SmpoLyZqutrg9AEaEf3Q/ZBRHBXgxig==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.11.tgz", + "integrity": "sha512-mzAenteTfomcB7mfPtyi+4oe5BZ6MXxWcn4CX+h4IRJ+OOGXBrWU6jDQavkQI9Vuc5P+donFabBfFCcmWka9lQ==", "dev": true, "dependencies": { "@babel/code-frame": "^7.22.10", @@ -2020,8 +2020,8 @@ "@babel/helper-function-name": "^7.22.5", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.10", - "@babel/types": "^7.22.10", + "@babel/parser": "^7.22.11", + "@babel/types": "^7.22.11", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -2030,9 +2030,9 @@ } }, "node_modules/@babel/types": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.10.tgz", - "integrity": "sha512-obaoigiLrlDZ7TUQln/8m4mSqIW2QFeOrCQc9r+xsaHGNoplVNYlRVpsfE8Vj35GEm2ZH4ZhrNYogs/3fj85kg==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.11.tgz", + "integrity": "sha512-siazHiGuZRz9aB9NpHy9GOs9xiQPKnMzgdr493iI1M67vRXpnEq8ZOOKzezC5q7zwuQ6sDhdSp4SD9ixKSqKZg==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.22.5", @@ -2109,13 +2109,14 @@ } }, "node_modules/@electron/notarize": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.4.tgz", - "integrity": "sha512-W5GQhJEosFNafewnS28d3bpQ37/s91CDWqxVchHfmv2dQSTWpOzNlUVQwYzC1ay5bChRV/A9BTL68yj0Pa+TSg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.1.0.tgz", + "integrity": "sha512-Q02xem1D0sg4v437xHgmBLxI2iz/fc0D4K7fiVWHa/AnW8o7D751xyKNXgziA6HrTOme9ul1JfWN5ark8WH1xA==", "dev": true, "dependencies": { "debug": "^4.1.1", - "fs-extra": "^9.0.1" + "fs-extra": "^9.0.1", + "promise-retry": "^2.0.1" }, "engines": { "node": ">= 10.0.0" @@ -2158,9 +2159,9 @@ } }, "node_modules/@electron/osx-sign": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.0.4.tgz", - "integrity": "sha512-xfhdEcIOfAZg7scZ9RQPya1G1lWo8/zMCwUXAulq0SfY7ONIW+b9qGyKdMyuMctNYwllrIS+vmxfijSfjeh97g==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.0.5.tgz", + "integrity": "sha512-k9ZzUQtamSoweGQDV2jILiRIHUu7lYlJ3c6IEmjv1hC17rclE+eb9U+f6UFlOOETo0JzY1HNlXy4YOlCvl+Lww==", "dev": true, "dependencies": { "compare-version": "^0.1.2", @@ -2226,9 +2227,9 @@ } }, "node_modules/@electron/universal": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.3.4.tgz", - "integrity": "sha512-BdhBgm2ZBnYyYRLRgOjM5VHkyFItsbggJ0MHycOjKWdFGYwK97ZFXH54dTvUWEfha81vfvwr5On6XBjt99uDcg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.4.1.tgz", + "integrity": "sha512-lE/U3UNw1YHuowNbTmKNs9UlS3En3cPgwM5MI+agIgr/B1hSze9NdOP0qn7boZaI9Lph8IDv3/24g9IxnJP7aQ==", "dev": true, "dependencies": { "@electron/asar": "^3.2.1", @@ -2363,9 +2364,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.47.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz", - "integrity": "sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz", + "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4119,15 +4120,15 @@ "dev": true }, "node_modules/app-builder-lib": { - "version": "24.6.3", - "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-24.6.3.tgz", - "integrity": "sha512-++0Zp7vcCHfXMBGVj7luFxpqvMPk5mcWeTuw7OK0xNAaNtYQTTN0d9YfWRsb1MvviTOOhyHeULWz1CaixrdrDg==", + "version": "24.6.4", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-24.6.4.tgz", + "integrity": "sha512-m9931WXb83teb32N0rKg+ulbn6+Hl8NV5SUpVDOVz9MWOXfhV6AQtTdftf51zJJvCQnQugGtSqoLvgw6mdF/Rg==", "dev": true, "dependencies": { "@develar/schema-utils": "~2.6.5", - "@electron/notarize": "^1.2.3", - "@electron/osx-sign": "^1.0.4", - "@electron/universal": "1.3.4", + "@electron/notarize": "2.1.0", + "@electron/osx-sign": "1.0.5", + "@electron/universal": "1.4.1", "@malept/flatpak-bundler": "^0.4.0", "@types/fs-extra": "9.0.13", "7zip-bin": "~5.1.1", @@ -4686,9 +4687,9 @@ "dev": true }, "node_modules/better-sqlite3": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.5.1.tgz", - "integrity": "sha512-aDfC67xfll6bugnOqRJhdUWioQZnkhLkrwZ+oo6yZbNMtyktbwkDO4SfBcCVWbm4BlsCjCNTJchlHaBt+vB4Iw==", + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.5.2.tgz", + "integrity": "sha512-w/EZ/jwuZF+/47mAVC2+rhR2X/gwkZ+fd1pbX7Y90D5NRaRzDQcxrHY10t6ijGiYIonCVsBSF5v1cay07bP5sg==", "hasInstallScript": true, "dependencies": { "bindings": "^1.5.0", @@ -6586,12 +6587,12 @@ } }, "node_modules/dmg-builder": { - "version": "24.6.3", - "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-24.6.3.tgz", - "integrity": "sha512-O7KNT7OKqtV54fMYUpdlyTOCP5DoPuRMLqMTgxxV2PO8Hj/so6zOl5o8GTs8pdDkeAhJzCFOUNB3BDhgXbUbJg==", + "version": "24.6.4", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-24.6.4.tgz", + "integrity": "sha512-BNcHRc9CWEuI9qt0E655bUBU/j/3wUCYBVKGu1kVpbN5lcUdEJJJeiO0NHK3dgKmra6LUUZlo+mWqc+OCbi0zw==", "dev": true, "dependencies": { - "app-builder-lib": "24.6.3", + "app-builder-lib": "24.6.4", "builder-util": "24.5.0", "builder-util-runtime": "9.2.1", "fs-extra": "^10.1.0", @@ -6836,9 +6837,9 @@ } }, "node_modules/electron": { - "version": "22.3.21", - "resolved": "https://registry.npmjs.org/electron/-/electron-22.3.21.tgz", - "integrity": "sha512-9JzWgvehRrqA30M7RvWCwwbyq2EgPUSbCFaqyZGnG0B52m4ayB8H+uFNIKXyWuyFwAEPDpQW5cGwCzXir1HuLA==", + "version": "22.3.22", + "resolved": "https://registry.npmjs.org/electron/-/electron-22.3.22.tgz", + "integrity": "sha512-jSZDXwQXa98QlCzZNWRxKhcJC3ZI6WpsA2Fdvwj5eOtFqhwnbvL5HiO7IzTCcUnGggaYgVcDSfbssloA3hxcvw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -6854,16 +6855,16 @@ } }, "node_modules/electron-builder": { - "version": "24.6.3", - "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-24.6.3.tgz", - "integrity": "sha512-O6PqhRXwfxCNTXI4BlhELSeYYO6/tqlxRuy+4+xKBokQvwDDjDgZMMoSgAmanVSCuzjE7MZldI9XYrKFk+EQDw==", + "version": "24.6.4", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-24.6.4.tgz", + "integrity": "sha512-uNWQoU7pE7qOaIQ6CJHpBi44RJFVG8OHRBIadUxrsDJVwLLo8Nma3K/EEtx5/UyWAQYdcK4nVPYKoRqBb20hbA==", "dev": true, "dependencies": { - "app-builder-lib": "24.6.3", + "app-builder-lib": "24.6.4", "builder-util": "24.5.0", "builder-util-runtime": "9.2.1", "chalk": "^4.1.2", - "dmg-builder": "24.6.3", + "dmg-builder": "24.6.4", "fs-extra": "^10.1.0", "is-ci": "^3.0.0", "lazy-val": "^1.0.5", @@ -6994,9 +6995,9 @@ } }, "node_modules/electron-log": { - "version": "5.0.0-beta.25", - "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-5.0.0-beta.25.tgz", - "integrity": "sha512-ihfT5W3cGx0x8+tTO+51lyxWbu2pXcbFlBcdYRw13Q4PtJh3n38385ZC7gnpfP9Ou6SFgYfyd2qsL2BYRpulXQ==", + "version": "5.0.0-beta.28", + "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-5.0.0-beta.28.tgz", + "integrity": "sha512-gVkQxxYQfV3nmx4zw4lsxWdzdaqJhK+OyBNOU3GGwjhtApbH7KQTWgr8sZcowEk0D6ksj+UbvaHOaU1HTaClzA==", "engines": { "electron": ">= 13", "node": ">= 14" @@ -7065,9 +7066,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.496", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz", - "integrity": "sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g==", + "version": "1.4.503", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.503.tgz", + "integrity": "sha512-LF2IQit4B0VrUHFeQkWhZm97KuJSGF2WJqq1InpY+ECpFRkXd8yTIaTtJxsO0OKDmiBYwWqcrNaXOurn2T2wiA==", "dev": true }, "node_modules/electron-updater": { @@ -7204,6 +7205,12 @@ "node": ">=4" } }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true + }, "node_modules/errno": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", @@ -7363,15 +7370,15 @@ } }, "node_modules/eslint": { - "version": "8.47.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz", - "integrity": "sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz", + "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "^8.47.0", + "@eslint/js": "8.48.0", "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -7446,16 +7453,16 @@ } }, "node_modules/eslint-config-standard-with-typescript": { - "version": "38.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-38.1.0.tgz", - "integrity": "sha512-sdgN8Gf7BMVhVKlY7/mB426yO/MozU1zV7TKnh0z1wIoPq4lD0CHQ+b/UkgqKfiZ4Io0j3xIY1j+lHhVXQck0g==", + "version": "39.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-39.0.0.tgz", + "integrity": "sha512-CiV2LS4NUeeRmDTDf1ocUMpMxitSyW0g+Y/N7ecElwGj188GahbcQgqfBNyVsIXQxHlZVBlOjkbg3oUI0R3KBg==", "dev": true, "dependencies": { - "@typescript-eslint/parser": "^6.1.0", + "@typescript-eslint/parser": "^6.4.0", "eslint-config-standard": "17.1.0" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^6.1.0", + "@typescript-eslint/eslint-plugin": "^6.4.0", "eslint": "^8.0.1", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", @@ -8719,9 +8726,9 @@ } }, "node_modules/font-list": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/font-list/-/font-list-1.5.0.tgz", - "integrity": "sha512-VETXWrbILrlxW2e5lmCwOYc1kKYpL3np777kM33APUtNMBWVftMIzi4cd62/XHDth+0tfAekvr9hAXa6Nxzptg==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/font-list/-/font-list-1.5.1.tgz", + "integrity": "sha512-Hr5V0dsSv91wH3FgirXd7qh1PydqA/vMQyWjFFWn+lUPJtC+3i2tzgVqbLRcvQh87TGdbTGbAR3mEo4VlwC1jw==" }, "node_modules/for-each": { "version": "0.3.3", @@ -10923,9 +10930,9 @@ } }, "node_modules/message2call": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/message2call/-/message2call-0.1.0.tgz", - "integrity": "sha512-10zubfIMTkxevtenynScyYN6GdWUgROrGqi9rU06tg+WY8SJIPwvKaDFuoKF8d2pbaFXD4hlOON2vf0ptCIN/A==" + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/message2call/-/message2call-0.1.2.tgz", + "integrity": "sha512-jUYYyrVwhd5PWKtQXp1qTKKMxllm3lRZ/Vka1pzSZ0zT957YY6c4Vg1mp3YXsU7cukrZkjXXvQJrteJwBzrKsQ==" }, "node_modules/methods": { "version": "1.1.2", @@ -13240,6 +13247,19 @@ "asap": "~2.0.3" } }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -14059,6 +14079,15 @@ "node": ">=0.12" } }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -17712,9 +17741,9 @@ "dev": true }, "@babel/core": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.10.tgz", - "integrity": "sha512-fTmqbbUBAwCcre6zPzNngvsI0aNrPZe77AeqvDxWM9Nm+04RrJ3CAmGHA9f7lJQY6ZMhRztNemy4uslDxTX4Qw==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.11.tgz", + "integrity": "sha512-lh7RJrtPdhibbxndr6/xx0w8+CVlY5FJZiaSz908Fpy+G0xkBFTvwLcKJFF4PJxVfGhVWNebikpWGnOoC71juQ==", "dev": true, "requires": { "@ampproject/remapping": "^2.2.0", @@ -17722,11 +17751,11 @@ "@babel/generator": "^7.22.10", "@babel/helper-compilation-targets": "^7.22.10", "@babel/helper-module-transforms": "^7.22.9", - "@babel/helpers": "^7.22.10", - "@babel/parser": "^7.22.10", + "@babel/helpers": "^7.22.11", + "@babel/parser": "^7.22.11", "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.10", - "@babel/types": "^7.22.10", + "@babel/traverse": "^7.22.11", + "@babel/types": "^7.22.11", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -17735,9 +17764,9 @@ } }, "@babel/eslint-parser": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.10.tgz", - "integrity": "sha512-0J8DNPRXQRLeR9rPaUMM3fA+RbixjnVLe/MRMYCkp3hzgsSuxCHQ8NN8xQG1wIHKJ4a1DTROTvFJdW+B5/eOsg==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.11.tgz", + "integrity": "sha512-YjOYZ3j7TjV8OhLW6NCtyg8G04uStATEUe5eiLuCZaXz2VSDQ3dsAtm2D+TuQyAqNMUK2WacGo0/uma9Pein1w==", "dev": true, "requires": { "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", @@ -17802,9 +17831,9 @@ } }, "@babel/helper-create-class-features-plugin": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.5.tgz", - "integrity": "sha512-xkb58MyOYIslxu3gKmVXmjTtUPvBU4odYzbiIQbWwLKIHCsx6UGZGX6F1IznMFVnDdirseUZopzN+ZRt8Xb33Q==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.11.tgz", + "integrity": "sha512-y1grdYL4WzmUDBRGK0pDbIoFd7UZKoDurDzWEoNMYoj1EL+foGRQNyPWDcC+YyegN5y1DUsFFmzjGijB3nSVAQ==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.22.5", @@ -17812,9 +17841,9 @@ "@babel/helper-function-name": "^7.22.5", "@babel/helper-member-expression-to-functions": "^7.22.5", "@babel/helper-optimise-call-expression": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.9", "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", "semver": "latest" } }, @@ -17925,17 +17954,14 @@ } }, "@babel/helper-replace-supers": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.5.tgz", - "integrity": "sha512-aLdNM5I3kdI/V9xGNyKSF3X/gTyMUBohTZ+/3QdQKAA9vxIiy12E+8E2HoOP1/DjeqU+g6as35QHJNMDDYpuCg==", + "version": "7.22.9", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.9.tgz", + "integrity": "sha512-LJIKvvpgPOPUThdYqcX6IXRuIcTkcAub0IaDRGCZH0p5GPUp7PhRU9QVgFcDDd51BaPkk77ZjqFwh6DZTAEmGg==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.22.5", "@babel/helper-member-expression-to-functions": "^7.22.5", - "@babel/helper-optimise-call-expression": "^7.22.5", - "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/helper-optimise-call-expression": "^7.22.5" } }, "@babel/helper-simple-access": { @@ -17995,14 +18021,14 @@ } }, "@babel/helpers": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.10.tgz", - "integrity": "sha512-a41J4NW8HyZa1I1vAndrraTlPZ/eZoga2ZgS7fEr0tZJGVU4xqdE80CEm0CcNjha5EZ8fTBYLKHF0kqDUuAwQw==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.11.tgz", + "integrity": "sha512-vyOXC8PBWaGc5h7GMsNx68OH33cypkEDJCHvYVVgVbbxJDROYVtexSk0gK5iCF1xNjRIN2s8ai7hwkWDq5szWg==", "dev": true, "requires": { "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.10", - "@babel/types": "^7.22.10" + "@babel/traverse": "^7.22.11", + "@babel/types": "^7.22.11" } }, "@babel/highlight": { @@ -18075,9 +18101,9 @@ } }, "@babel/parser": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.10.tgz", - "integrity": "sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ==" + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.11.tgz", + "integrity": "sha512-R5zb8eJIBPJriQtbH/htEQy4k7E2dHWlD2Y2VT07JCzwYZHBxV5ZYtM0UhXSNMT74LyxuM+b1jdL7pSesXbC/g==" }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { "version": "7.22.5", @@ -18522,12 +18548,12 @@ } }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.22.5.tgz", - "integrity": "sha512-B4pzOXj+ONRmuaQTg05b3y/4DuFz3WcCNAXPLb2Q0GT0TrGKGxNKV4jwsXts+StaM0LQczZbOpj8o1DLPDJIiA==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.22.11.tgz", + "integrity": "sha512-o2+bg7GDS60cJMgz9jWqRUsWkMzLCxp+jFDeDUT5sjRlAxcJWZ2ylNdI7QQ2+CH5hWu7OnN+Cv3htt7AkSf96g==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.22.5", + "@babel/helper-module-transforms": "^7.22.9", "@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-simple-access": "^7.22.5" } @@ -18757,13 +18783,13 @@ } }, "@babel/plugin-transform-typescript": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.5.tgz", - "integrity": "sha512-SMubA9S7Cb5sGSFFUlqxyClTA9zWJ8qGQrppNUm05LtFuN1ELRFNndkix4zUJrC9F+YivWwa1dHMSyo0e0N9dA==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.11.tgz", + "integrity": "sha512-0E4/L+7gfvHub7wsbTv03oRtD69X31LByy44fGmFzbZScpupFByMcgCJ0VbBTkzyjSJKuRoGN8tcijOWKTmqOA==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-create-class-features-plugin": "^7.22.5", + "@babel/helper-create-class-features-plugin": "^7.22.11", "@babel/helper-plugin-utils": "^7.22.5", "@babel/plugin-syntax-typescript": "^7.22.5" } @@ -18907,16 +18933,16 @@ } }, "@babel/preset-typescript": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.22.5.tgz", - "integrity": "sha512-YbPaal9LxztSGhmndR46FmAbkJ/1fAsw293tSU+I5E5h+cnJ3d4GTwyUgGYmOXJYdGA+uNePle4qbaRzj2NISQ==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.22.11.tgz", + "integrity": "sha512-tWY5wyCZYBGY7IlalfKI1rLiGlIfnwsRHZqlky0HVv8qviwQ1Uo/05M6+s+TcTCVa6Bmoo2uJW5TMFX6Wa4qVg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-validator-option": "^7.22.5", "@babel/plugin-syntax-jsx": "^7.22.5", - "@babel/plugin-transform-modules-commonjs": "^7.22.5", - "@babel/plugin-transform-typescript": "^7.22.5" + "@babel/plugin-transform-modules-commonjs": "^7.22.11", + "@babel/plugin-transform-typescript": "^7.22.11" } }, "@babel/regjsgen": { @@ -18946,9 +18972,9 @@ } }, "@babel/traverse": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.10.tgz", - "integrity": "sha512-Q/urqV4pRByiNNpb/f5OSv28ZlGJiFiiTh+GAHktbIrkPhPbl90+uW6SmpoLyZqutrg9AEaEf3Q/ZBRHBXgxig==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.11.tgz", + "integrity": "sha512-mzAenteTfomcB7mfPtyi+4oe5BZ6MXxWcn4CX+h4IRJ+OOGXBrWU6jDQavkQI9Vuc5P+donFabBfFCcmWka9lQ==", "dev": true, "requires": { "@babel/code-frame": "^7.22.10", @@ -18957,16 +18983,16 @@ "@babel/helper-function-name": "^7.22.5", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.10", - "@babel/types": "^7.22.10", + "@babel/parser": "^7.22.11", + "@babel/types": "^7.22.11", "debug": "^4.1.0", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.10.tgz", - "integrity": "sha512-obaoigiLrlDZ7TUQln/8m4mSqIW2QFeOrCQc9r+xsaHGNoplVNYlRVpsfE8Vj35GEm2ZH4ZhrNYogs/3fj85kg==", + "version": "7.22.11", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.11.tgz", + "integrity": "sha512-siazHiGuZRz9aB9NpHy9GOs9xiQPKnMzgdr493iI1M67vRXpnEq8ZOOKzezC5q7zwuQ6sDhdSp4SD9ixKSqKZg==", "dev": true, "requires": { "@babel/helper-string-parser": "^7.22.5", @@ -19019,13 +19045,14 @@ } }, "@electron/notarize": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.4.tgz", - "integrity": "sha512-W5GQhJEosFNafewnS28d3bpQ37/s91CDWqxVchHfmv2dQSTWpOzNlUVQwYzC1ay5bChRV/A9BTL68yj0Pa+TSg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.1.0.tgz", + "integrity": "sha512-Q02xem1D0sg4v437xHgmBLxI2iz/fc0D4K7fiVWHa/AnW8o7D751xyKNXgziA6HrTOme9ul1JfWN5ark8WH1xA==", "dev": true, "requires": { "debug": "^4.1.1", - "fs-extra": "^9.0.1" + "fs-extra": "^9.0.1", + "promise-retry": "^2.0.1" }, "dependencies": { "fs-extra": { @@ -19059,9 +19086,9 @@ } }, "@electron/osx-sign": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.0.4.tgz", - "integrity": "sha512-xfhdEcIOfAZg7scZ9RQPya1G1lWo8/zMCwUXAulq0SfY7ONIW+b9qGyKdMyuMctNYwllrIS+vmxfijSfjeh97g==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.0.5.tgz", + "integrity": "sha512-k9ZzUQtamSoweGQDV2jILiRIHUu7lYlJ3c6IEmjv1hC17rclE+eb9U+f6UFlOOETo0JzY1HNlXy4YOlCvl+Lww==", "dev": true, "requires": { "compare-version": "^0.1.2", @@ -19108,9 +19135,9 @@ } }, "@electron/universal": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.3.4.tgz", - "integrity": "sha512-BdhBgm2ZBnYyYRLRgOjM5VHkyFItsbggJ0MHycOjKWdFGYwK97ZFXH54dTvUWEfha81vfvwr5On6XBjt99uDcg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.4.1.tgz", + "integrity": "sha512-lE/U3UNw1YHuowNbTmKNs9UlS3En3cPgwM5MI+agIgr/B1hSze9NdOP0qn7boZaI9Lph8IDv3/24g9IxnJP7aQ==", "dev": true, "requires": { "@electron/asar": "^3.2.1", @@ -19210,9 +19237,9 @@ } }, "@eslint/js": { - "version": "8.47.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz", - "integrity": "sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz", + "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==", "dev": true }, "@humanwhocodes/config-array": { @@ -20650,15 +20677,15 @@ "dev": true }, "app-builder-lib": { - "version": "24.6.3", - "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-24.6.3.tgz", - "integrity": "sha512-++0Zp7vcCHfXMBGVj7luFxpqvMPk5mcWeTuw7OK0xNAaNtYQTTN0d9YfWRsb1MvviTOOhyHeULWz1CaixrdrDg==", + "version": "24.6.4", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-24.6.4.tgz", + "integrity": "sha512-m9931WXb83teb32N0rKg+ulbn6+Hl8NV5SUpVDOVz9MWOXfhV6AQtTdftf51zJJvCQnQugGtSqoLvgw6mdF/Rg==", "dev": true, "requires": { "@develar/schema-utils": "~2.6.5", - "@electron/notarize": "^1.2.3", - "@electron/osx-sign": "^1.0.4", - "@electron/universal": "1.3.4", + "@electron/notarize": "2.1.0", + "@electron/osx-sign": "1.0.5", + "@electron/universal": "1.4.1", "@malept/flatpak-bundler": "^0.4.0", "@types/fs-extra": "9.0.13", "7zip-bin": "~5.1.1", @@ -21074,9 +21101,9 @@ "dev": true }, "better-sqlite3": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.5.1.tgz", - "integrity": "sha512-aDfC67xfll6bugnOqRJhdUWioQZnkhLkrwZ+oo6yZbNMtyktbwkDO4SfBcCVWbm4BlsCjCNTJchlHaBt+vB4Iw==", + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.5.2.tgz", + "integrity": "sha512-w/EZ/jwuZF+/47mAVC2+rhR2X/gwkZ+fd1pbX7Y90D5NRaRzDQcxrHY10t6ijGiYIonCVsBSF5v1cay07bP5sg==", "requires": { "bindings": "^1.5.0", "prebuild-install": "^7.1.0" @@ -22489,12 +22516,12 @@ } }, "dmg-builder": { - "version": "24.6.3", - "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-24.6.3.tgz", - "integrity": "sha512-O7KNT7OKqtV54fMYUpdlyTOCP5DoPuRMLqMTgxxV2PO8Hj/so6zOl5o8GTs8pdDkeAhJzCFOUNB3BDhgXbUbJg==", + "version": "24.6.4", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-24.6.4.tgz", + "integrity": "sha512-BNcHRc9CWEuI9qt0E655bUBU/j/3wUCYBVKGu1kVpbN5lcUdEJJJeiO0NHK3dgKmra6LUUZlo+mWqc+OCbi0zw==", "dev": true, "requires": { - "app-builder-lib": "24.6.3", + "app-builder-lib": "24.6.4", "builder-util": "24.5.0", "builder-util-runtime": "9.2.1", "dmg-license": "^1.0.11", @@ -22683,9 +22710,9 @@ } }, "electron": { - "version": "22.3.21", - "resolved": "https://registry.npmjs.org/electron/-/electron-22.3.21.tgz", - "integrity": "sha512-9JzWgvehRrqA30M7RvWCwwbyq2EgPUSbCFaqyZGnG0B52m4ayB8H+uFNIKXyWuyFwAEPDpQW5cGwCzXir1HuLA==", + "version": "22.3.22", + "resolved": "https://registry.npmjs.org/electron/-/electron-22.3.22.tgz", + "integrity": "sha512-jSZDXwQXa98QlCzZNWRxKhcJC3ZI6WpsA2Fdvwj5eOtFqhwnbvL5HiO7IzTCcUnGggaYgVcDSfbssloA3hxcvw==", "dev": true, "requires": { "@electron/get": "^2.0.0", @@ -22702,16 +22729,16 @@ } }, "electron-builder": { - "version": "24.6.3", - "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-24.6.3.tgz", - "integrity": "sha512-O6PqhRXwfxCNTXI4BlhELSeYYO6/tqlxRuy+4+xKBokQvwDDjDgZMMoSgAmanVSCuzjE7MZldI9XYrKFk+EQDw==", + "version": "24.6.4", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-24.6.4.tgz", + "integrity": "sha512-uNWQoU7pE7qOaIQ6CJHpBi44RJFVG8OHRBIadUxrsDJVwLLo8Nma3K/EEtx5/UyWAQYdcK4nVPYKoRqBb20hbA==", "dev": true, "requires": { - "app-builder-lib": "24.6.3", + "app-builder-lib": "24.6.4", "builder-util": "24.5.0", "builder-util-runtime": "9.2.1", "chalk": "^4.1.2", - "dmg-builder": "24.6.3", + "dmg-builder": "24.6.4", "fs-extra": "^10.1.0", "is-ci": "^3.0.0", "lazy-val": "^1.0.5", @@ -22822,9 +22849,9 @@ } }, "electron-log": { - "version": "5.0.0-beta.25", - "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-5.0.0-beta.25.tgz", - "integrity": "sha512-ihfT5W3cGx0x8+tTO+51lyxWbu2pXcbFlBcdYRw13Q4PtJh3n38385ZC7gnpfP9Ou6SFgYfyd2qsL2BYRpulXQ==" + "version": "5.0.0-beta.28", + "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-5.0.0-beta.28.tgz", + "integrity": "sha512-gVkQxxYQfV3nmx4zw4lsxWdzdaqJhK+OyBNOU3GGwjhtApbH7KQTWgr8sZcowEk0D6ksj+UbvaHOaU1HTaClzA==" }, "electron-publish": { "version": "24.5.0", @@ -22880,9 +22907,9 @@ } }, "electron-to-chromium": { - "version": "1.4.496", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz", - "integrity": "sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g==", + "version": "1.4.503", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.503.tgz", + "integrity": "sha512-LF2IQit4B0VrUHFeQkWhZm97KuJSGF2WJqq1InpY+ECpFRkXd8yTIaTtJxsO0OKDmiBYwWqcrNaXOurn2T2wiA==", "dev": true }, "electron-updater": { @@ -22983,6 +23010,12 @@ "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", "dev": true }, + "err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true + }, "errno": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", @@ -23115,15 +23148,15 @@ "dev": true }, "eslint": { - "version": "8.47.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz", - "integrity": "sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz", + "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "^8.47.0", + "@eslint/js": "8.48.0", "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -23206,12 +23239,12 @@ "requires": {} }, "eslint-config-standard-with-typescript": { - "version": "38.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-38.1.0.tgz", - "integrity": "sha512-sdgN8Gf7BMVhVKlY7/mB426yO/MozU1zV7TKnh0z1wIoPq4lD0CHQ+b/UkgqKfiZ4Io0j3xIY1j+lHhVXQck0g==", + "version": "39.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-39.0.0.tgz", + "integrity": "sha512-CiV2LS4NUeeRmDTDf1ocUMpMxitSyW0g+Y/N7ecElwGj188GahbcQgqfBNyVsIXQxHlZVBlOjkbg3oUI0R3KBg==", "dev": true, "requires": { - "@typescript-eslint/parser": "^6.1.0", + "@typescript-eslint/parser": "^6.4.0", "eslint-config-standard": "17.1.0" } }, @@ -24126,9 +24159,9 @@ "dev": true }, "font-list": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/font-list/-/font-list-1.5.0.tgz", - "integrity": "sha512-VETXWrbILrlxW2e5lmCwOYc1kKYpL3np777kM33APUtNMBWVftMIzi4cd62/XHDth+0tfAekvr9hAXa6Nxzptg==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/font-list/-/font-list-1.5.1.tgz", + "integrity": "sha512-Hr5V0dsSv91wH3FgirXd7qh1PydqA/vMQyWjFFWn+lUPJtC+3i2tzgVqbLRcvQh87TGdbTGbAR3mEo4VlwC1jw==" }, "for-each": { "version": "0.3.3", @@ -25775,9 +25808,9 @@ "dev": true }, "message2call": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/message2call/-/message2call-0.1.0.tgz", - "integrity": "sha512-10zubfIMTkxevtenynScyYN6GdWUgROrGqi9rU06tg+WY8SJIPwvKaDFuoKF8d2pbaFXD4hlOON2vf0ptCIN/A==" + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/message2call/-/message2call-0.1.2.tgz", + "integrity": "sha512-jUYYyrVwhd5PWKtQXp1qTKKMxllm3lRZ/Vka1pzSZ0zT957YY6c4Vg1mp3YXsU7cukrZkjXXvQJrteJwBzrKsQ==" }, "methods": { "version": "1.1.2", @@ -27492,6 +27525,16 @@ "asap": "~2.0.3" } }, + "promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "requires": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + } + }, "proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -28149,6 +28192,12 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", diff --git a/package.json b/package.json index cd0fe360..f45a1b9d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lx-music-desktop", - "version": "2.4.0-beta.9", + "version": "2.4.0-beta.10", "description": "一个免费的音乐查找助手", "main": "./dist/main.js", "productName": "lx-music-desktop", @@ -205,14 +205,14 @@ }, "homepage": "https://github.com/lyswhut/lx-music-desktop#readme", "devDependencies": { - "@babel/core": "^7.22.10", - "@babel/eslint-parser": "^7.22.10", + "@babel/core": "^7.22.11", + "@babel/eslint-parser": "^7.22.11", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-modules-umd": "^7.22.5", "@babel/plugin-transform-runtime": "^7.22.10", "@babel/preset-env": "^7.22.10", - "@babel/preset-typescript": "^7.22.5", + "@babel/preset-typescript": "^7.22.11", "@tsconfig/recommended": "^1.0.2", "@types/better-sqlite3": "^7.6.4", "@types/needle": "^3.2.0", @@ -230,15 +230,15 @@ "css-loader": "^6.8.1", "css-minimizer-webpack-plugin": "^5.0.1", "del": "^6.1.1", - "electron": "^22.3.21", - "electron-builder": "^24.6.3", + "electron": "^22.3.22", + "electron-builder": "^24.6.4", "electron-debug": "^3.2.0", "electron-devtools-installer": "^3.2.0", - "electron-to-chromium": "^1.4.496", + "electron-to-chromium": "^1.4.503", "electron-updater": "^6.1.4", - "eslint": "^8.47.0", + "eslint": "^8.48.0", "eslint-config-standard": "^17.1.0", - "eslint-config-standard-with-typescript": "^38.1.0", + "eslint-config-standard-with-typescript": "^39.0.0", "eslint-formatter-friendly": "github:lyswhut/eslint-friendly-formatter#2170d1320e2fad13615a9dcf229669f0bb473a53", "eslint-plugin-html": "^7.1.0", "eslint-plugin-vue": "^9.17.0", @@ -274,19 +274,19 @@ }, "dependencies": { "@simonwep/pickr": "^1.8.2", - "better-sqlite3": "^8.5.1", + "better-sqlite3": "^8.5.2", "bufferutil": "^4.0.7", "comlink": "~4.3.1", "crypto-js": "^4.1.1", "electron-font-manager": "github:lyswhut/electron-font-manager#6d2f5ecf850c4fe34812b9394913680462ee0dae", - "electron-log": "^5.0.0-beta.25", + "electron-log": "^5.0.0-beta.28", "electron-store": "^8.1.0", - "font-list": "^1.5.0", + "font-list": "^1.5.1", "iconv-lite": "^0.6.3", "image-size": "^1.0.2", "jschardet": "^3.0.0", "long": "^5.2.3", - "message2call": "^0.1.0", + "message2call": "^0.1.2", "music-metadata": "^8.1.4", "needle": "github:lyswhut/needle#93299ac841b7e9a9f82ca7279b88aaaeda404060", "node-id3": "^0.2.6", diff --git a/publish/changeLog.md b/publish/changeLog.md index bf5ce147..019309fc 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -30,5 +30,5 @@ ### 其他 -- 更新 electron 到 v22.3.21 +- 更新 electron 到 v22.3.22 - 重构同步服务端功能部分代码,使其更易扩展新功能 diff --git a/src/common/constants.ts b/src/common/constants.ts index 3a83f8a2..c16172e1 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -76,24 +76,3 @@ export const DOWNLOAD_STATUS = { } as const export const QUALITYS = ['flac24bit', 'flac', 'wav', 'ape', '320k', '192k', '128k'] as const - -export const SYNC_CODE = { - helloMsg: 'Hello~::^-^::~v4~', - idPrefix: 'OjppZDo6', - authMsg: 'lx-music auth::', - authFailed: 'Auth failed', - missingAuthCode: 'Missing auth code', - getServiceIdFailed: 'Get service id failed', - connectServiceFailed: 'Connect service failed', - connecting: 'Connecting...', - unknownServiceAddress: 'Unknown service address', - msgBlockedIp: 'Blocked IP', - msgConnect: 'lx-music connect', - msgAuthFailed: 'Auth failed', -} as const - -export const SYNC_CLOSE_CODE = { - normal: 1000, - failed: 4100, -} as const - diff --git a/src/main/modules/sync/constants.ts b/src/common/constants_sync.ts similarity index 91% rename from src/main/modules/sync/constants.ts rename to src/common/constants_sync.ts index 3cbee460..17dd5d40 100644 --- a/src/main/modules/sync/constants.ts +++ b/src/common/constants_sync.ts @@ -41,7 +41,7 @@ export const SYNC_CLOSE_CODE = { failed: 4100, } as const -export const TRANS_MODE: Readonly> = { +export const TRANS_MODE: Readonly> = { merge_local_remote: 'merge_remote_local', merge_remote_local: 'merge_local_remote', overwrite_local_remote: 'overwrite_remote_local', @@ -64,3 +64,7 @@ export const File = { syncAuthKeysJSON: 'syncAuthKey.json', } as const + +export const FeaturesList = [ + 'list', +] as const diff --git a/src/common/types/list.d.ts b/src/common/types/list.d.ts index 085c9eb3..98a6fe9c 100644 --- a/src/common/types/list.d.ts +++ b/src/common/types/list.d.ts @@ -139,19 +139,5 @@ declare namespace LX { userList: UserListInfoFull[] tempList: LX.Music.MusicInfo[] } - - type ActionList = SyncAction<'list_data_overwrite', LX.List.ListActionDataOverwrite> - | SyncAction<'list_create', LX.List.ListActionAdd> - | SyncAction<'list_remove', LX.List.ListActionRemove> - | SyncAction<'list_update', LX.List.ListActionUpdate> - | SyncAction<'list_update_position', LX.List.ListActionUpdatePosition> - | SyncAction<'list_music_add', LX.List.ListActionMusicAdd> - | SyncAction<'list_music_move', LX.List.ListActionMusicMove> - | SyncAction<'list_music_remove', LX.List.ListActionMusicRemove> - | SyncAction<'list_music_update', LX.List.ListActionMusicUpdate> - | SyncAction<'list_music_update_position', LX.List.ListActionMusicUpdatePosition> - | SyncAction<'list_music_overwrite', LX.List.ListActionMusicOverwrite> - | SyncAction<'list_music_clear', LX.List.ListActionMusicClear> - } } diff --git a/src/common/types/list_sync.d.ts b/src/common/types/list_sync.d.ts new file mode 100644 index 00000000..36593e47 --- /dev/null +++ b/src/common/types/list_sync.d.ts @@ -0,0 +1,34 @@ +declare namespace LX { + + namespace Sync { + namespace List { + interface ListInfo { + lastSyncDate?: number + snapshotKey: string + } + + type ActionList = LX.Sync.SyncAction<'list_data_overwrite', LX.List.ListActionDataOverwrite> + | SyncAction<'list_create', LX.List.ListActionAdd> + | SyncAction<'list_remove', LX.List.ListActionRemove> + | SyncAction<'list_update', LX.List.ListActionUpdate> + | SyncAction<'list_update_position', LX.List.ListActionUpdatePosition> + | SyncAction<'list_music_add', LX.List.ListActionMusicAdd> + | SyncAction<'list_music_move', LX.List.ListActionMusicMove> + | SyncAction<'list_music_remove', LX.List.ListActionMusicRemove> + | SyncAction<'list_music_update', LX.List.ListActionMusicUpdate> + | SyncAction<'list_music_update_position', LX.List.ListActionMusicUpdatePosition> + | SyncAction<'list_music_overwrite', LX.List.ListActionMusicOverwrite> + | SyncAction<'list_music_clear', LX.List.ListActionMusicClear> + + type ListData = Omit + type SyncMode = 'merge_local_remote' + | 'merge_remote_local' + | 'overwrite_local_remote' + | 'overwrite_remote_local' + | 'overwrite_local_remote_full' + | 'overwrite_remote_local_full' + // | 'none' + | 'cancel' + } + } +} diff --git a/src/common/types/sync.d.ts b/src/common/types/sync.d.ts index 7856b50c..12247f64 100644 --- a/src/common/types/sync.d.ts +++ b/src/common/types/sync.d.ts @@ -24,48 +24,13 @@ declare namespace LX { | SyncAction<'client_status', ClientStatus> | SyncAction<'server_status', ServerStatus> - type SyncServiceActions = SyncAction<'select_mode', ListSyncMode> + type SyncServiceActions = SyncAction<'select_mode', LX.Sync.List.SyncMode> | SyncAction<'get_server_status'> | SyncAction<'get_client_status'> | SyncAction<'generate_code'> | SyncAction<'enable_server', EnableServer> | SyncAction<'enable_client', EnableClient> - type ActionList = SyncAction<'list_data_overwrite', LX.List.ListActionDataOverwrite> - | SyncAction<'list_create', LX.List.ListActionAdd> - | SyncAction<'list_remove', LX.List.ListActionRemove> - | SyncAction<'list_update', LX.List.ListActionUpdate> - | SyncAction<'list_update_position', LX.List.ListActionUpdatePosition> - | SyncAction<'list_music_add', LX.List.ListActionMusicAdd> - | SyncAction<'list_music_move', LX.List.ListActionMusicMove> - | SyncAction<'list_music_remove', LX.List.ListActionMusicRemove> - | SyncAction<'list_music_update', LX.List.ListActionMusicUpdate> - | SyncAction<'list_music_update_position', LX.List.ListActionMusicUpdatePosition> - | SyncAction<'list_music_overwrite', LX.List.ListActionMusicOverwrite> - | SyncAction<'list_music_clear', LX.List.ListActionMusicClear> - - type ActionSync = SyncAction<'list:sync:list_sync_get_md5', string> - | SyncAction<'list:sync:list_sync_get_list_data', ListData> - | SyncAction<'list:sync:list_sync_get_sync_mode', Mode> - | SyncAction<'list:sync:action', ActionList> - // | SyncAction<'finished'> - - type ActionSyncType = Actions - - type ActionSyncSend = SyncAction<'list:sync:list_sync_get_md5'> - | SyncAction<'list:sync:list_sync_get_list_data'> - | SyncAction<'list:sync:list_sync_get_sync_mode'> - | SyncAction<'list:sync:list_sync_set_data', LX.Sync.ListData> - | SyncAction<'list:sync:action', ActionList> - | SyncAction<'list:sync:finished'> - - type ActionSyncSendType = Actions - - interface List { - action: string - data: any - } - interface ServerStatus { status: boolean message: string @@ -94,20 +59,10 @@ declare namespace LX { isMobile: boolean } - interface ListInfo { - lastSyncDate?: number - snapshotKey: string + type ServerType = 'desktop-app' | 'server' + interface EnabledFeatures { + list: boolean } - type ListData = Omit - - type ListSyncMode = 'merge_local_remote' - | 'merge_remote_local' - | 'overwrite_local_remote' - | 'overwrite_remote_local' - | 'overwrite_local_remote_full' - | 'overwrite_remote_local_full' - // | 'none' - | 'cancel' - + type SupportedFeatures = Partial<{ [k in keyof EnabledFeatures]: number }> } } diff --git a/src/common/types/sync_common.d.ts b/src/common/types/sync_common.d.ts deleted file mode 100644 index 8c27c822..00000000 --- a/src/common/types/sync_common.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -declare namespace LX { - namespace Sync { - type ServerActions = WarpPromiseRecord<{ - onListSyncAction: (action: LX.List.ActionList) => void - }> - - type ClientActions = WarpPromiseRecord<{ - onListSyncAction: (action: LX.List.ActionList) => void - list_sync_get_md5: () => string - list_sync_get_sync_mode: () => ListSyncMode - list_sync_get_list_data: () => ListData - list_sync_set_list_data: (data: ListData) => void - list_sync_finished: () => void - }> - } -} - diff --git a/src/main/modules/sync/client/auth.ts b/src/main/modules/sync/client/auth.ts index 6f9afcab..42972144 100644 --- a/src/main/modules/sync/client/auth.ts +++ b/src/main/modules/sync/client/auth.ts @@ -1,9 +1,9 @@ import { request, generateRsaKey } from './utils' import { getSyncAuthKey, setSyncAuthKey } from './data' -import { SYNC_CODE } from '@common/constants' import log from '../log' import { aesDecrypt, aesEncrypt, getComputerName, rsaDecrypt } from '../utils' import { toMD5 } from '@common/utils/nodejs' +import { SYNC_CODE } from '@common/constants_sync' const hello = async(urlInfo: LX.Sync.Client.UrlInfo) => request(`${urlInfo.httpProtocol}//${urlInfo.hostPath}/hello`) diff --git a/src/main/modules/sync/client/client.ts b/src/main/modules/sync/client/client.ts index 72a0548a..67855430 100644 --- a/src/main/modules/sync/client/client.ts +++ b/src/main/modules/sync/client/client.ts @@ -1,15 +1,15 @@ import WebSocket from 'ws' import { encryptMsg, decryptMsg } from './utils' -import { modules, callObj } from './modules' +import { callObj } from './sync' // import { action as commonAction } from '@root/store/modules/common' // import { getStore } from '@root/store' // import registerSyncListHandler from './syncList' import log from '../log' -import { SYNC_CLOSE_CODE, SYNC_CODE } from '@common/constants' import { dateFormat } from '@common/utils/common' import { aesEncrypt, getAddress } from '../utils' import { sendClientStatus } from '@main/modules/winMain' import { createMsg2call } from 'message2call' +import { SYNC_CLOSE_CODE, SYNC_CODE } from '@common/constants_sync' let status: LX.Sync.ClientStatus = { status: false, @@ -31,18 +31,6 @@ export const sendSyncMessage = (message: string) => { sendClientStatus(status) } -const handleConnection = (socket: LX.Sync.Client.Socket) => { - for (const { registerEvent } of Object.values(modules)) { - registerEvent(socket) - } -} - -const handleDisconnection = () => { - for (const { unregisterEvent } of Object.values(modules)) { - unregisterEvent() - } -} - const heartbeatTools = { failedNum: 0, maxTryNum: 100000, @@ -139,14 +127,14 @@ export const connect = (urlInfo: LX.Sync.Client.UrlInfo, keyInfo: LX.Sync.Client heartbeatTools.connect(client) let closeEvents: Array<(err: Error) => (void | Promise)> = [] + let disconnected = true - const message2read = createMsg2call({ + const message2read = createMsg2call({ funcsObj: { ...callObj, - list_sync_finished() { + finished() { log.info('sync list success') client!.isReady = true - handleConnection(client as LX.Sync.Client.Socket) sendSyncStatus({ status: true, message: '', @@ -156,6 +144,7 @@ export const connect = (urlInfo: LX.Sync.Client.UrlInfo, keyInfo: LX.Sync.Client }, timeout: 120 * 1000, sendMessage(data) { + if (disconnected) throw new Error('disconnected') void encryptMsg(keyInfo, JSON.stringify(data)).then((data) => { client?.send(data) }).catch((err) => { @@ -178,13 +167,14 @@ export const connect = (urlInfo: LX.Sync.Client.UrlInfo, keyInfo: LX.Sync.Client }, }) - client.remoteSyncList = message2read.createSyncRemote('list') + client.remote = message2read.remote + client.remoteQueueList = message2read.createQueueRemote('list') client.addEventListener('message', ({ data }) => { if (data == 'ping') return if (typeof data === 'string') { void decryptMsg(keyInfo, data).then((data) => { - let syncData: LX.Sync.ServerActions + let syncData: LX.Sync.ServerSyncActions try { syncData = JSON.parse(data) } catch (err) { @@ -212,6 +202,10 @@ export const connect = (urlInfo: LX.Sync.Client.UrlInfo, keyInfo: LX.Sync.Client // const store = getStore() // global.lx.syncKeyInfo = keyInfo client!.isReady = false + client!.moduleReadys = { + list: false, + } + disconnected = false sendSyncStatus({ status: false, message: initMessage, @@ -225,7 +219,7 @@ export const connect = (urlInfo: LX.Sync.Client.UrlInfo, keyInfo: LX.Sync.Client log.error(err?.message) } closeEvents = [] - handleDisconnection() + disconnected = true message2read.onDestroy() switch (code) { case SYNC_CLOSE_CODE.normal: diff --git a/src/main/modules/sync/client/data.ts b/src/main/modules/sync/client/data.ts index 63916e23..f6ac0b4d 100644 --- a/src/main/modules/sync/client/data.ts +++ b/src/main/modules/sync/client/data.ts @@ -1,6 +1,6 @@ import fs from 'node:fs' import path from 'node:path' -import { File } from '../constants' +import { File } from '../../../../common/constants_sync' let syncAuthKeys: Record diff --git a/src/main/modules/sync/client/index.ts b/src/main/modules/sync/client/index.ts index 6ff494a1..85c34b49 100644 --- a/src/main/modules/sync/client/index.ts +++ b/src/main/modules/sync/client/index.ts @@ -1,10 +1,10 @@ import handleAuth from './auth' import { connect as socketConnect, disconnect as socketDisconnect, sendSyncStatus, sendSyncMessage } from './client' // import { getSyncHost } from '@root/utils/data' -import { SYNC_CODE } from '@common/constants' import log from '../log' import { parseUrl } from './utils' import migrateData from '../migrate' +import { SYNC_CODE } from '@common/constants_sync' let connectId = 0 diff --git a/src/main/modules/sync/client/modules/index.ts b/src/main/modules/sync/client/modules/index.ts index e484eb63..04eece93 100644 --- a/src/main/modules/sync/client/modules/index.ts +++ b/src/main/modules/sync/client/modules/index.ts @@ -8,3 +8,7 @@ export const callObj = Object.assign({}, list.handler) export const modules = { list, } + +export const featureVersion = { + list: 1, +} as const diff --git a/src/main/modules/sync/client/modules/list/handler.ts b/src/main/modules/sync/client/modules/list/handler.ts index f0e52b3f..a0b1881e 100644 --- a/src/main/modules/sync/client/modules/list/handler.ts +++ b/src/main/modules/sync/client/modules/list/handler.ts @@ -1,8 +1,10 @@ +// 这个文件导出的方法将暴露给服务端调用,第一个参数固定为当前 socket 对象 import { handleRemoteListAction } from '@main/modules/sync/utils' import { getLocalListData, setLocalListData } from '../../../utils' import { toMD5 } from '@common/utils/nodejs' import { removeSelectModeListener, sendCloseSelectMode, sendSelectMode } from '@main/modules/winMain' import log from '@main/modules/sync/log' +import { registerEvent, unregisterEvent } from './localEvent' const logInfo = (eventName: string, success = false) => { log.info(`[${eventName}]${eventName.replace('list:sync:list_sync_', '').replaceAll('_', ' ')}${success ? ' success' : ''}`) @@ -11,8 +13,8 @@ const logInfo = (eventName: string, success = false) => { // log.error(`[${eventName}]${eventName.replace('list:sync:list_sync_', '').replaceAll('_', ' ')} error: ${err.message}`) // } -export const onListSyncAction = async(socket: LX.Sync.Client.Socket, action: LX.Sync.ActionList) => { - if (!socket.isReady) return +export const onListSyncAction = async(socket: LX.Sync.Client.Socket, action: LX.Sync.List.ActionList) => { + if (!socket.moduleReadys?.list) return await handleRemoteListAction(action) } @@ -21,7 +23,7 @@ export const list_sync_get_md5 = async(socket: LX.Sync.Client.Socket) => { return toMD5(JSON.stringify(await getLocalListData())) } -const getSyncMode = async(socket: LX.Sync.Client.Socket): Promise => new Promise((resolve, reject) => { +const getSyncMode = async(socket: LX.Sync.Client.Socket): Promise => new Promise((resolve, reject) => { const handleDisconnect = (err: Error) => { sendCloseSelectMode() removeSelectModeListener() @@ -47,7 +49,17 @@ export const list_sync_get_list_data = async(socket: LX.Sync.Client.Socket) => { return getLocalListData() } -export const list_sync_set_list_data = async(socket: LX.Sync.Client.Socket, data: LX.Sync.ListData) => { +export const list_sync_set_list_data = async(socket: LX.Sync.Client.Socket, data: LX.Sync.List.ListData) => { logInfo('list:sync:list_sync_set_list_data') await setLocalListData(data) } + +export const list_sync_finished = async(socket: LX.Sync.Client.Socket) => { + logInfo('list:sync:finished') + socket.moduleReadys.list = true + registerEvent(socket) + socket.onClose(() => { + unregisterEvent() + }) +} + diff --git a/src/main/modules/sync/client/modules/list/localEvent.ts b/src/main/modules/sync/client/modules/list/localEvent.ts index bcc39783..d2b1c535 100644 --- a/src/main/modules/sync/client/modules/list/localEvent.ts +++ b/src/main/modules/sync/client/modules/list/localEvent.ts @@ -8,9 +8,10 @@ export const registerEvent = (socket: LX.Sync.Client.Socket) => { // unregisterLocalListAction?.() // unregisterLocalListAction = null // }) + unregisterEvent() unregisterLocalListAction = registerListActionEvent((action) => { - if (!socket?.isReady) return - void socket.remoteSyncList.onListSyncAction(action) + if (!socket.moduleReadys?.list) return + void socket.remoteQueueList.onListSyncAction(action) }) } diff --git a/src/main/modules/sync/client/sync/handler.ts b/src/main/modules/sync/client/sync/handler.ts new file mode 100644 index 00000000..f1240eeb --- /dev/null +++ b/src/main/modules/sync/client/sync/handler.ts @@ -0,0 +1,22 @@ +// 这个文件导出的方法将暴露给服务端调用,第一个参数固定为当前 socket 对象 + +// import { getUserSpace } from '@/user' +// import { modules } from '../modules' + +import { featureVersion } from '../modules' + + +export const getEnabledFeatures = async(socket: LX.Sync.Client.Socket, serverType: LX.Sync.ServerType, supportedFeatures: LX.Sync.SupportedFeatures): Promise => { + // const userSpace = getUserSpace(socket.userInfo.name) + switch (serverType) { + case 'server': + return { + list: featureVersion.list == supportedFeatures.list, + } + case 'desktop-app': + default: + return { + list: featureVersion.list == supportedFeatures.list, + } + } +} diff --git a/src/main/modules/sync/client/sync/index.ts b/src/main/modules/sync/client/sync/index.ts new file mode 100644 index 00000000..a82a4c98 --- /dev/null +++ b/src/main/modules/sync/client/sync/index.ts @@ -0,0 +1,8 @@ +import * as handler from './handler' +import { callObj as _callObj } from '../modules' +export { modules } from '../modules' + +export const callObj = { + ...handler, + ..._callObj, +} diff --git a/src/main/modules/sync/migrate.ts b/src/main/modules/sync/migrate.ts index a5fa87d2..df7a69ff 100644 --- a/src/main/modules/sync/migrate.ts +++ b/src/main/modules/sync/migrate.ts @@ -1,4 +1,4 @@ -import { File } from './constants' +import { File } from '../../../common/constants_sync' import fs from 'node:fs' import path from 'node:path' diff --git a/src/main/modules/sync/server/modules/index.ts b/src/main/modules/sync/server/modules/index.ts index 6d952960..d24414c8 100644 --- a/src/main/modules/sync/server/modules/index.ts +++ b/src/main/modules/sync/server/modules/index.ts @@ -10,3 +10,7 @@ export const modules = { export { ListManage } from './list' + +export const featureVersion = { + list: 1, +} as const diff --git a/src/main/modules/sync/server/modules/list/manage.ts b/src/main/modules/sync/server/modules/list/manage.ts index c036db78..8f0dd4a0 100644 --- a/src/main/modules/sync/server/modules/list/manage.ts +++ b/src/main/modules/sync/server/modules/list/manage.ts @@ -44,7 +44,7 @@ export class ListManage { await this.snapshotDataManage.updateDeviceSnapshotKey(clientId, key) } - getListData = async(): Promise => { + getListData = async(): Promise => { return getLocalListData() } } diff --git a/src/main/modules/sync/server/modules/list/snapshotDataManage.ts b/src/main/modules/sync/server/modules/list/snapshotDataManage.ts index 978f66df..1240b850 100644 --- a/src/main/modules/sync/server/modules/list/snapshotDataManage.ts +++ b/src/main/modules/sync/server/modules/list/snapshotDataManage.ts @@ -3,7 +3,7 @@ import fs from 'node:fs' import path from 'node:path' import syncLog from '../../../log' import { getUserConfig, type UserDataManage } from '../../user/data' -import { File } from '../../../constants' +import { File } from '../../../../../../common/constants_sync' import { checkAndCreateDirSync } from '../../utils' @@ -11,7 +11,7 @@ interface SnapshotInfo { latest: string | null time: number list: string[] - clients: Record + clients: Record } export class SnapshotDataManage { userDataManage: UserDataManage @@ -70,7 +70,7 @@ export class SnapshotDataManage { getSnapshot = async(name: string) => { const filePath = path.join(this.snapshotDir, `snapshot_${name}`) - let listData: LX.Sync.ListData + let listData: LX.Sync.List.ListData try { listData = JSON.parse((await fs.promises.readFile(filePath)).toString('utf-8')) } catch (err) { diff --git a/src/main/modules/sync/server/modules/list/sync/handler.ts b/src/main/modules/sync/server/modules/list/sync/handler.ts index 8785622d..7c8011cd 100644 --- a/src/main/modules/sync/server/modules/list/sync/handler.ts +++ b/src/main/modules/sync/server/modules/list/sync/handler.ts @@ -1,7 +1,8 @@ +// 这个文件导出的方法将暴露给客户端调用,第一个参数固定为当前 socket 对象 // import { throttle } from '@common/utils/common' // import { sendSyncActionList } from '@main/modules/winMain' // import { SYNC_CLOSE_CODE } from '@/constants' -import { SYNC_CLOSE_CODE } from '@main/modules/sync/constants' +import { SYNC_CLOSE_CODE } from '@common/constants_sync' import { getUserSpace } from '@main/modules/sync/server/user' import { handleRemoteListAction } from '@main/modules/sync/utils' // import { encryptMsg } from '@/utils/tools' @@ -108,7 +109,7 @@ import { handleRemoteListAction } from '@main/modules/sync/utils' // } // } -// export const sendListAction = async(action: LX.Sync.ActionList) => { +// export const sendListAction = async(action: LX.Sync.List.ActionList) => { // console.log('sendListAction', action.action) // // io.sockets // await broadcast('list:sync:action', action) @@ -144,7 +145,8 @@ import { handleRemoteListAction } from '@main/modules/sync/utils' // // } // } -export const onListSyncAction = async(socket: LX.Sync.Server.Socket, action: LX.Sync.ActionList) => { +export const onListSyncAction = async(socket: LX.Sync.Server.Socket, action: LX.Sync.List.ActionList) => { + if (!socket.moduleReadys.list) return const userSpace = getUserSpace(socket.userInfo.name) await handleRemoteListAction(action).then(async updated => { if (!updated) { @@ -156,8 +158,8 @@ export const onListSyncAction = async(socket: LX.Sync.Server.Socket, action: LX. const currentUserName = socket.userInfo.name const currentId = socket.keyInfo.clientId socket.broadcast((client) => { - if (client.keyInfo.clientId == currentId || !client.isReady || client.userInfo.name != currentUserName) return - void client.remoteSyncList.onListSyncAction(action) + if (client.keyInfo.clientId == currentId || !client.moduleReadys?.list || client.userInfo.name != currentUserName) return + void client.remoteQueueList.onListSyncAction(action) }) }) } diff --git a/src/main/modules/sync/server/modules/list/sync/index.ts b/src/main/modules/sync/server/modules/list/sync/index.ts index 2470e4a9..78dd3db7 100644 --- a/src/main/modules/sync/server/modules/list/sync/index.ts +++ b/src/main/modules/sync/server/modules/list/sync/index.ts @@ -1,3 +1,3 @@ export * as handler from './handler' -export { default as sync } from './sync' +export { sync } from './sync' export * from './localEvent' diff --git a/src/main/modules/sync/server/modules/list/sync/localEvent.ts b/src/main/modules/sync/server/modules/list/sync/localEvent.ts index 54464986..14a9e794 100644 --- a/src/main/modules/sync/server/modules/list/sync/localEvent.ts +++ b/src/main/modules/sync/server/modules/list/sync/localEvent.ts @@ -5,13 +5,13 @@ import { getUserSpace } from '../../../user' let unregisterLocalListAction: (() => void) | null -const sendListAction = async(wss: LX.Sync.Server.SocketServer, action: LX.Sync.ActionList) => { +const sendListAction = async(wss: LX.Sync.Server.SocketServer, action: LX.Sync.List.ActionList) => { // console.log('sendListAction', action.action) const userSpace = getUserSpace() const key = await userSpace.listManage.createSnapshot() for (const client of wss.clients) { - if (!client.isReady) return - void client.remoteSyncList.onListSyncAction(action).then(() => { + if (!client.moduleReadys?.list) continue + void client.remoteQueueList.onListSyncAction(action).then(() => { void userSpace.listManage.updateDeviceSnapshotKey(client.keyInfo.clientId, key) }) } @@ -23,6 +23,7 @@ export const registerEvent = (wss: LX.Sync.Server.SocketServer) => { // unregisterLocalListAction?.() // unregisterLocalListAction = null // }) + unregisterEvent() unregisterLocalListAction = registerListActionEvent((action) => { void sendListAction(wss, action) }) diff --git a/src/main/modules/sync/server/modules/list/sync/sync.ts b/src/main/modules/sync/server/modules/list/sync/sync.ts index 23ce4352..80ff5ab8 100644 --- a/src/main/modules/sync/server/modules/list/sync/sync.ts +++ b/src/main/modules/sync/server/modules/list/sync/sync.ts @@ -1,4 +1,4 @@ -import { SYNC_CLOSE_CODE } from '../../../../constants' +// import { SYNC_CLOSE_CODE } from '../../../../constants' import { getUserSpace, getUserConfig } from '../../../user' import { getLocalListData, setLocalListData } from '@main/modules/sync/utils' // import { LIST_IDS } from '@common/constants' @@ -9,7 +9,7 @@ import { getLocalListData, setLocalListData } from '@main/modules/sync/utils' let syncingId: string | null = null const wait = async(time = 1000) => await new Promise((resolve, reject) => setTimeout(resolve, time)) -const patchListData = (listData: Partial): LX.Sync.ListData => { +const patchListData = (listData: Partial): LX.Sync.List.ListData => { return Object.assign({ defaultList: [], loveList: [], @@ -17,39 +17,39 @@ const patchListData = (listData: Partial): LX.Sync.ListData => }, listData) } -const getRemoteListData = async(socket: LX.Sync.Server.Socket): Promise => { +const getRemoteListData = async(socket: LX.Sync.Server.Socket): Promise => { console.log('getRemoteListData') - return patchListData(await socket.remoteSyncList.list_sync_get_list_data()) + return patchListData(await socket.remoteQueueList.list_sync_get_list_data()) } const getRemoteListMD5 = async(socket: LX.Sync.Server.Socket): Promise => { - return socket.remoteSyncList.list_sync_get_md5() + return socket.remoteQueueList.list_sync_get_md5() } -// const getLocalListData = async(socket: LX.Sync.Server.Socket): Promise => { +// const getLocalListData = async(socket: LX.Sync.Server.Socket): Promise => { // return getUserSpace(socket.userInfo.name).listManage.getListData() // } -const getSyncMode = async(socket: LX.Sync.Server.Socket): Promise => { - return socket.remoteSyncList.list_sync_get_sync_mode() +const getSyncMode = async(socket: LX.Sync.Server.Socket): Promise => { + return socket.remoteQueueList.list_sync_get_sync_mode() } const finishedSync = async(socket: LX.Sync.Server.Socket) => { - await socket.remoteSyncList.list_sync_finished() + await socket.remoteQueueList.list_sync_finished() } -const setLocalList = async(socket: LX.Sync.Server.Socket, listData: LX.Sync.ListData) => { +const setLocalList = async(socket: LX.Sync.Server.Socket, listData: LX.Sync.List.ListData) => { await setLocalListData(listData) const userSpace = getUserSpace(socket.userInfo.name) return userSpace.listManage.createSnapshot() } -const overwriteRemoteListData = async(socket: LX.Sync.Server.Socket, listData: LX.Sync.ListData, key: string, excludeIds: string[] = []) => { +const overwriteRemoteListData = async(socket: LX.Sync.Server.Socket, listData: LX.Sync.List.ListData, key: string, excludeIds: string[] = []) => { const action = { action: 'list_data_overwrite', data: listData } as const const tasks: Array> = [] socket.broadcast((client) => { - if (excludeIds.includes(client.keyInfo.clientId) || client.userInfo.name != socket.userInfo.name || !client.isReady) return - tasks.push(client.remoteSyncList.onListSyncAction(action).then(async() => { + if (excludeIds.includes(client.keyInfo.clientId) || client.userInfo.name != socket.userInfo.name || !client.moduleReadys?.list) return + tasks.push(client.remoteQueueList.onListSyncAction(action).then(async() => { const userSpace = getUserSpace(socket.userInfo.name) return userSpace.listManage.updateDeviceSnapshotKey(socket.keyInfo.clientId, key) }).catch(err => { @@ -59,14 +59,14 @@ const overwriteRemoteListData = async(socket: LX.Sync.Server.Socket, listData: L if (!tasks.length) return await Promise.all(tasks) } -const setRemotelList = async(socket: LX.Sync.Server.Socket, listData: LX.Sync.ListData, key: string): Promise => { - await socket.remoteSyncList.list_sync_set_list_data(listData) +const setRemotelList = async(socket: LX.Sync.Server.Socket, listData: LX.Sync.List.ListData, key: string): Promise => { + await socket.remoteQueueList.list_sync_set_list_data(listData) const userSpace = getUserSpace(socket.userInfo.name) await userSpace.listManage.updateDeviceSnapshotKey(socket.keyInfo.clientId, key) } type UserDataObj = Map -const createUserListDataObj = (listData: LX.Sync.ListData): UserDataObj => { +const createUserListDataObj = (listData: LX.Sync.List.ListData): UserDataObj => { const userListDataObj: UserDataObj = new Map() for (const list of listData.userList) userListDataObj.set(list.id, list) return userListDataObj @@ -111,9 +111,9 @@ const handleMergeList = ( } return ids.map(id => map.get(id)) as LX.Music.MusicInfo[] } -const mergeList = (socket: LX.Sync.Server.Socket, sourceListData: LX.Sync.ListData, targetListData: LX.Sync.ListData): LX.Sync.ListData => { +const mergeList = (socket: LX.Sync.Server.Socket, sourceListData: LX.Sync.List.ListData, targetListData: LX.Sync.List.ListData): LX.Sync.List.ListData => { const addMusicLocationType = getUserConfig(socket.userInfo.name)['list.addMusicLocationType'] - const newListData: LX.Sync.ListData = { + const newListData: LX.Sync.List.ListData = { defaultList: [], loveList: [], userList: [], @@ -147,8 +147,8 @@ const mergeList = (socket: LX.Sync.Server.Socket, sourceListData: LX.Sync.ListDa return newListData } -const overwriteList = (sourceListData: LX.Sync.ListData, targetListData: LX.Sync.ListData): LX.Sync.ListData => { - const newListData: LX.Sync.ListData = { +const overwriteList = (sourceListData: LX.Sync.List.ListData, targetListData: LX.Sync.List.ListData): LX.Sync.List.ListData => { + const newListData: LX.Sync.List.ListData = { defaultList: [], loveList: [], userList: [], @@ -171,16 +171,13 @@ const overwriteList = (sourceListData: LX.Sync.ListData, targetListData: LX.Sync return newListData } -const handleMergeListData = async(socket: LX.Sync.Server.Socket): Promise<[LX.Sync.ListData, boolean, boolean]> => { - const mode: LX.Sync.ListSyncMode = await getSyncMode(socket) +const handleMergeListData = async(socket: LX.Sync.Server.Socket): Promise<[LX.Sync.List.ListData, boolean, boolean]> => { + const mode: LX.Sync.List.SyncMode = await getSyncMode(socket) - if (mode == 'cancel') { - socket.close(SYNC_CLOSE_CODE.normal) - throw new Error('cancel') - } + if (mode == 'cancel') throw new Error('cancel') const [remoteListData, localListData] = await Promise.all([getRemoteListData(socket), getLocalListData()]) console.log('handleMergeListData', 'remoteListData, localListData') - let listData: LX.Sync.ListData + let listData: LX.Sync.List.ListData let requiredUpdateLocalListData = true let requiredUpdateRemoteListData = true switch (mode) { @@ -206,9 +203,7 @@ const handleMergeListData = async(socket: LX.Sync.Server.Socket): Promise<[LX.Sy break // case 'none': return null // case 'cancel': - default: - socket.close(SYNC_CLOSE_CODE.normal) - throw new Error('cancel') + default: throw new Error('cancel') } return [listData, requiredUpdateLocalListData, requiredUpdateRemoteListData] } @@ -299,12 +294,12 @@ const checkListLatest = async(socket: LX.Sync.Server.Socket) => { if (latest && userCurrentListInfoKey != currentListInfoKey) await userSpace.listManage.updateDeviceSnapshotKey(socket.keyInfo.clientId, currentListInfoKey) return latest } -const handleMergeListDataFromSnapshot = async(socket: LX.Sync.Server.Socket, snapshot: LX.Sync.ListData) => { +const handleMergeListDataFromSnapshot = async(socket: LX.Sync.Server.Socket, snapshot: LX.Sync.List.ListData) => { if (await checkListLatest(socket)) return const addMusicLocationType = getUserConfig(socket.userInfo.name)['list.addMusicLocationType'] const [remoteListData, localListData] = await Promise.all([getRemoteListData(socket), getLocalListData()]) - const newListData: LX.Sync.ListData = { + const newListData: LX.Sync.List.ListData = { defaultList: [], loveList: [], userList: [], @@ -413,7 +408,7 @@ const syncList = async(socket: LX.Sync.Server.Socket) => { // await fsPromises.unlink(filePath) // } -export default async(socket: LX.Sync.Server.Socket) => { +export const sync = async(socket: LX.Sync.Server.Socket) => { let disconnected = false socket.onClose(() => { disconnected = true @@ -428,7 +423,8 @@ export default async(socket: LX.Sync.Server.Socket) => { syncingId = socket.keyInfo.clientId await syncList(socket).then(async() => { - return finishedSync(socket) + await finishedSync(socket) + socket.moduleReadys.list = true }).finally(() => { syncingId = null }) diff --git a/src/main/modules/sync/server/server/auth.ts b/src/main/modules/sync/server/server/auth.ts index 64274b67..01e4a582 100644 --- a/src/main/modules/sync/server/server/auth.ts +++ b/src/main/modules/sync/server/server/auth.ts @@ -1,5 +1,4 @@ import type http from 'http' -import { SYNC_CODE } from '@common/constants' import { aesEncrypt, aesDecrypt, @@ -10,6 +9,7 @@ import querystring from 'node:querystring' import { getUserSpace, createClientKeyInfo } from '../user' import { toMD5 } from '../utils' import { getComputerName } from '../../utils' +import { SYNC_CODE } from '@common/constants_sync' const requestIps = new Map() diff --git a/src/main/modules/sync/server/server/server.ts b/src/main/modules/sync/server/server/server.ts index 264a32c9..7eda49ad 100644 --- a/src/main/modules/sync/server/server/server.ts +++ b/src/main/modules/sync/server/server/server.ts @@ -1,10 +1,9 @@ import http, { type IncomingMessage } from 'node:http' -import url from 'node:url' import { WebSocketServer } from 'ws' -import { modules, callObj } from '../modules' +import { registerLocalSyncEvent, callObj, sync, unregisterLocalSyncEvent } from './sync' import { authCode, authConnect } from './auth' import { getAddress } from '../../utils' -import { SYNC_CLOSE_CODE, SYNC_CODE } from '../../constants' +import { SYNC_CLOSE_CODE, SYNC_CODE } from '@common/constants_sync' import { getUserSpace, releaseUserSpace, getServerId, initServerInfo } from '../user' import { createMsg2call } from 'message2call' import log from '../../log' @@ -23,6 +22,8 @@ let status: LX.Sync.ServerStatus = { let stopingServer = false +let host = 'http://localhost' + const codeTools: { timeout: NodeJS.Timer | null start: () => void @@ -42,46 +43,25 @@ const codeTools: { }, } -const syncData = async(socket: LX.Sync.Server.Socket) => { - let disconnected = false - socket.onClose(() => { - disconnected = true - }) - for (const module of Object.values(modules)) { - await module.sync(socket) - if (disconnected) throw new Error('disconnected') - } -} - - -const registerLocalSyncEvent = async(wss: LX.Sync.Server.SocketServer) => { - for (const module of Object.values(modules)) { - module.registerEvent(wss) - } -} - -const unregisterLocalSyncEvent = () => { - for (const module of Object.values(modules)) { - module.unregisterEvent() - } -} - - const checkDuplicateClient = (newSocket: LX.Sync.Server.Socket) => { for (const client of [...wss!.clients]) { if (client === newSocket || client.keyInfo.clientId != newSocket.keyInfo.clientId) continue log.info('duplicate client', client.userInfo.name, client.keyInfo.deviceName) client.isReady = false + for (const name of Object.keys(client.moduleReadys) as Array) { + client.moduleReadys[name] = false + } client.close(SYNC_CLOSE_CODE.normal) } } const handleConnection = async(socket: LX.Sync.Server.Socket, request: IncomingMessage) => { - const queryData = url.parse(request.url as string, true).query as Record + const queryData = new URL(request.url as string, host).searchParams + const clientId = queryData.get('i') // // if (typeof socket.handshake.query.i != 'string') return socket.disconnect(true) const userSpace = getUserSpace() - const keyInfo = userSpace.dataManage.getClientKeyInfo(queryData.i) + const keyInfo = userSpace.dataManage.getClientKeyInfo(clientId) if (!keyInfo) { socket.close(SYNC_CLOSE_CODE.failed) return @@ -95,7 +75,7 @@ const handleConnection = async(socket: LX.Sync.Server.Socket, request: IncomingM checkDuplicateClient(socket) try { - await syncData(socket) + await sync(socket) } catch (err) { // console.log(err) log.warn(err) @@ -174,6 +154,12 @@ const handleStartServer = async(port = 9527, ip = '0.0.0.0') => await new Promis wss.on('connection', function(socket, request) { socket.isReady = false + socket.moduleReadys = { + list: false, + } + socket.feature = { + list: false, + } socket.on('pong', () => { socket.isAlive = true }) @@ -182,10 +168,12 @@ const handleStartServer = async(port = 9527, ip = '0.0.0.0') => await new Promis // const events = new Map void>>() // let events: Partial<{ [K in keyof LX.Sync.ActionSyncType]: Array<(data: LX.Sync.ActionSyncType[K]) => void> }> = {} let closeEvents: Array<(err: Error) => (void | Promise)> = [] - const msg2call = createMsg2call({ + let disconnected = false + const msg2call = createMsg2call({ funcsObj: callObj, timeout: 120 * 1000, sendMessage(data) { + if (disconnected) throw new Error('disconnected') void encryptMsg(socket.keyInfo, JSON.stringify(data)).then((data) => { // console.log('sendData', eventName) socket.send(data) @@ -200,13 +188,14 @@ const handleStartServer = async(port = 9527, ip = '0.0.0.0') => await new Promis }, onError(error, path, groupName) { const name = groupName ?? '' - log.error(`sync call ${name} ${path.join('.')} error:`, error) + const deviceName = socket.keyInfo?.deviceName ?? '' + log.error(`sync call ${deviceName} ${name} ${path.join('.')} error:`, error) if (groupName == null) return socket.close(SYNC_CLOSE_CODE.failed) }, }) socket.remote = msg2call.remote - socket.remoteSyncList = msg2call.createSyncRemote('list') + socket.remoteQueueList = msg2call.createQueueRemote('list') socket.addEventListener('message', ({ data }) => { if (typeof data != 'string') return void decryptMsg(socket.keyInfo, data).then((data) => { @@ -233,14 +222,15 @@ const handleStartServer = async(port = 9527, ip = '0.0.0.0') => await new Promis log.error(err?.message) } closeEvents = [] + disconnected = true msg2call.onDestroy() if (socket.isReady) { log.info('deconnection', socket.userInfo.name, socket.keyInfo.deviceName) // events = {} if (!status.devices.length) handleUnconnection() } else { - const queryData = url.parse(request.url as string, true).query as Record - log.info('deconnection', queryData.i) + const queryData = new URL(request.url as string, host).searchParams + log.info('deconnection', queryData.get('i')) } }) socket.onClose = function(handler: typeof closeEvents[number]) { @@ -311,6 +301,7 @@ const handleStartServer = async(port = 9527, ip = '0.0.0.0') => await new Promis void registerLocalSyncEvent(wss as LX.Sync.Server.SocketServer) }) + host = `http://${ip}:${port}` httpServer.listen(port, ip) }) diff --git a/src/main/modules/sync/server/server/sync/event.ts b/src/main/modules/sync/server/server/sync/event.ts new file mode 100644 index 00000000..b8d4cc6c --- /dev/null +++ b/src/main/modules/sync/server/server/sync/event.ts @@ -0,0 +1,14 @@ +import { modules } from '../../modules' + +export const registerLocalSyncEvent = async(wss: LX.Sync.Server.SocketServer) => { + unregisterLocalSyncEvent() + for (const module of Object.values(modules)) { + module.registerEvent(wss) + } +} + +export const unregisterLocalSyncEvent = () => { + for (const module of Object.values(modules)) { + module.unregisterEvent() + } +} diff --git a/src/main/modules/sync/server/server/sync/handler.ts b/src/main/modules/sync/server/server/sync/handler.ts new file mode 100644 index 00000000..05c136d7 --- /dev/null +++ b/src/main/modules/sync/server/server/sync/handler.ts @@ -0,0 +1,23 @@ +// 这个文件导出的方法将暴露给客户端调用,第一个参数固定为当前 socket 对象 +// import { getUserSpace } from '@/user' +import { FeaturesList } from '../../../../../../common/constants_sync' +import { modules } from '../../modules' + + +export const onFeatureChanged = async(socket: LX.Sync.Server.Socket, feature: LX.Sync.EnabledFeatures) => { + // const userSpace = getUserSpace(socket.userInfo.name) + const beforeFeature = socket.feature + + for (const name of FeaturesList) { + if (feature[name] == beforeFeature[name]) continue + if (feature[name]) { + await modules[name].sync(socket).then(() => { + beforeFeature[name] = true + }).catch(_ => _) + } else { + socket.moduleReadys[name] = false + beforeFeature[name] = false + } + } +} + diff --git a/src/main/modules/sync/server/server/sync/index.ts b/src/main/modules/sync/server/server/sync/index.ts new file mode 100644 index 00000000..363dd439 --- /dev/null +++ b/src/main/modules/sync/server/server/sync/index.ts @@ -0,0 +1,10 @@ +import * as handler from './handler' +import { callObj as _callObj } from '../../modules' +export { sync } from './sync' +export { modules } from '../../modules' +export * from './event' + +export const callObj = { + ...handler, + ..._callObj, +} diff --git a/src/main/modules/sync/server/server/sync/sync.ts b/src/main/modules/sync/server/server/sync/sync.ts new file mode 100644 index 00000000..8ad581e7 --- /dev/null +++ b/src/main/modules/sync/server/server/sync/sync.ts @@ -0,0 +1,22 @@ +import { FeaturesList } from '../../../../../../common/constants_sync' +import { featureVersion, modules } from '../../modules' + + +export const sync = async(socket: LX.Sync.Server.Socket) => { + let disconnected = false + socket.onClose(() => { + disconnected = true + }) + const enabledFeatures = await socket.remote.getEnabledFeatures('desktop-app', featureVersion) + + if (disconnected) throw new Error('disconnected') + for (const moduleName of FeaturesList) { + if (enabledFeatures[moduleName]) { + await modules[moduleName].sync(socket).then(() => { + socket.feature[moduleName] = true + }).catch(_ => _) + } + if (disconnected) throw new Error('disconnected') + } + await socket.remote.finished() +} diff --git a/src/main/modules/sync/server/user/data.ts b/src/main/modules/sync/server/user/data.ts index c8b66559..a22351ef 100644 --- a/src/main/modules/sync/server/user/data.ts +++ b/src/main/modules/sync/server/user/data.ts @@ -3,7 +3,7 @@ import path from 'node:path' import { randomBytes } from 'node:crypto' import { throttle } from '@common/utils/common' import { filterFileName, toMD5 } from '../utils' -import { File } from '../../constants' +import { File } from '../../../../../common/constants_sync' interface ServerInfo { @@ -111,7 +111,7 @@ export class UserDataManage { this.saveDevicesInfoThrottle() } - getClientKeyInfo = (clientId?: string): LX.Sync.ServerKeyInfo | null => { + getClientKeyInfo = (clientId?: string | null): LX.Sync.ServerKeyInfo | null => { if (!clientId) return null return this.devicesInfo.clients[clientId] ?? null } diff --git a/src/main/modules/sync/utils.ts b/src/main/modules/sync/utils.ts index b926832b..3bd5d776 100644 --- a/src/main/modules/sync/utils.ts +++ b/src/main/modules/sync/utils.ts @@ -90,8 +90,8 @@ export const rsaDecrypt = (buffer: Buffer, key: string): Buffer => { return privateDecrypt({ key, padding: constants.RSA_PKCS1_OAEP_PADDING }, buffer) } -export const getLocalListData = async(): Promise => { - const lists: LX.Sync.ListData = { +export const getLocalListData = async(): Promise => { + const lists: LX.Sync.List.ListData = { defaultList: await global.lx.worker.dbService.getListMusics(LIST_IDS.DEFAULT), loveList: await global.lx.worker.dbService.getListMusics(LIST_IDS.LOVE), userList: [], @@ -106,12 +106,12 @@ export const getLocalListData = async(): Promise => { return lists } -export const setLocalListData = async(listData: LX.Sync.ListData) => { +export const setLocalListData = async(listData: LX.Sync.List.ListData) => { await global.lx.event_list.list_data_overwrite(listData, true) } -export const registerListActionEvent = (sendListAction: (action: LX.Sync.ActionList) => (void | Promise)) => { +export const registerListActionEvent = (sendListAction: (action: LX.Sync.List.ActionList) => (void | Promise)) => { const list_data_overwrite = async(listData: MakeOptional, isRemote: boolean = false) => { if (isRemote) return await sendListAction({ action: 'list_data_overwrite', data: listData }) @@ -188,7 +188,7 @@ export const registerListActionEvent = (sendListAction: (action: LX.Sync.ActionL } } -export const handleRemoteListAction = async({ action, data }: LX.Sync.ActionList) => { +export const handleRemoteListAction = async({ action, data }: LX.Sync.List.ActionList) => { // console.log('handleRemoteListAction', action) switch (action) { diff --git a/src/main/modules/winMain/rendererEvent/sync.ts b/src/main/modules/winMain/rendererEvent/sync.ts index d4bf68a3..65c4aae1 100644 --- a/src/main/modules/winMain/rendererEvent/sync.ts +++ b/src/main/modules/winMain/rendererEvent/sync.ts @@ -3,7 +3,7 @@ import { WIN_MAIN_RENDERER_EVENT_NAME } from '@common/ipcNames' import { startServer, stopServer, getServerStatus, generateCode, connectServer, disconnectServer, getClientStatus } from '@main/modules/sync' import { sendEvent } from '../main' -let selectModeListenr: ((mode: LX.Sync.ListSyncMode | null) => void) | null = null +let selectModeListenr: ((mode: LX.Sync.List.SyncMode | null) => void) | null = null export default () => { mainHandle(WIN_MAIN_RENDERER_EVENT_NAME.sync_action, async({ params: data }) => { @@ -46,7 +46,7 @@ export const sendServerStatus = (status: LX.Sync.ServerStatus) => { data: status, }) } -export const sendSelectMode = (deviceName: string, listener: (mode: LX.Sync.ListSyncMode | null) => void) => { +export const sendSelectMode = (deviceName: string, listener: (mode: LX.Sync.List.SyncMode | null) => void) => { selectModeListenr = listener sendSyncAction({ action: 'select_mode', data: deviceName }) } diff --git a/src/main/types/common.d.ts b/src/main/types/common.d.ts index 31088826..bf7e8ca8 100644 --- a/src/main/types/common.d.ts +++ b/src/main/types/common.d.ts @@ -3,8 +3,8 @@ import '@common/types/app_setting' import '@common/types/common' import '@common/types/user_api' import '@common/types/sync' -import '@common/types/sync_common' import '@common/types/list' +import '@common/types/list_sync' import '@common/types/download_list' import '@common/types/music' import '@common/types/player' diff --git a/src/main/types/sync.d.ts b/src/main/types/sync.d.ts index 6a9cd6d2..f99f0a4b 100644 --- a/src/main/types/sync.d.ts +++ b/src/main/types/sync.d.ts @@ -13,9 +13,13 @@ declare global { keyInfo: ClientKeyInfo urlInfo: UrlInfo } + moduleReadys: { + list: boolean + } onClose: (handler: (err: Error) => (void | Promise)) => () => void - remoteSyncList: LX.Sync.ServerActions + remote: LX.Sync.ServerSyncActions + remoteQueueList: LX.Sync.ServerSyncListActions } interface UrlInfo { @@ -31,11 +35,16 @@ declare global { isReady: boolean userInfo: { name: 'default' } keyInfo: ServerKeyInfo + feature: LX.Sync.EnabledFeatures + moduleReadys: { + list: boolean + } + onClose: (handler: (err: Error) => (void | Promise)) => () => void broadcast: (handler: (client: Socket) => void) => void - remote: LX.Sync.ClientActions - remoteSyncList: LX.Sync.ClientActions + remote: LX.Sync.ClientSyncActions + remoteQueueList: LX.Sync.ClientSyncListActions } type SocketServer = WS.Server } diff --git a/src/main/types/sync_common.d.ts b/src/main/types/sync_common.d.ts new file mode 100644 index 00000000..560e7690 --- /dev/null +++ b/src/main/types/sync_common.d.ts @@ -0,0 +1,25 @@ +declare namespace LX { + namespace Sync { + type ServerSyncActions = WarpPromiseRecord<{ + onFeatureChanged: (feature: EnabledFeatures) => void + }> + type ServerSyncListActions = WarpPromiseRecord<{ + onListSyncAction: (action: LX.Sync.List.ActionList) => void + }> + + type ClientSyncActions = WarpPromiseRecord<{ + getEnabledFeatures: (serverType: ServerType, supportedFeatures: SupportedFeatures) => EnabledFeatures + finished: () => void + }> + type ClientSyncListActions = WarpPromiseRecord<{ + onListSyncAction: (action: LX.Sync.List.ActionList) => void + list_sync_get_md5: () => string + list_sync_get_sync_mode: () => LX.Sync.List.SyncMode + list_sync_get_list_data: () => LX.Sync.List.ListData + list_sync_set_list_data: (data: LX.Sync.List.ListData) => void + list_sync_finished: () => void + }> + } +} + + diff --git a/src/renderer-lyric/tsconfig.json b/src/renderer-lyric/tsconfig.json index 8ce4c1e4..336fa30b 100644 --- a/src/renderer-lyric/tsconfig.json +++ b/src/renderer-lyric/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "compilerOptions": { "isolatedModules": true, - "moduleResolution": "nodenext", "paths": { /* Specify a set of entries that re-map imports to additional lookup locations. */ "@common/*": ["common/*"], // "@renderer/*": ["renderer/*"], diff --git a/src/renderer/core/useApp/useSync.ts b/src/renderer/core/useApp/useSync.ts index 5d58b5fe..6db1382d 100644 --- a/src/renderer/core/useApp/useSync.ts +++ b/src/renderer/core/useApp/useSync.ts @@ -2,7 +2,7 @@ import { markRaw, onBeforeUnmount } from '@common/utils/vueTools' import { onSyncAction, sendSyncAction } from '@renderer/utils/ipc' import { sync } from '@renderer/store' import { appSetting } from '@renderer/store/setting' -import { SYNC_CODE } from '@common/constants' +import { SYNC_CODE } from '@common/constants_sync' export default () => { const handleSyncList = (event: LX.Sync.SyncMainWindowActions) => { diff --git a/src/renderer/tsconfig.json b/src/renderer/tsconfig.json index bf33ec3a..cdd0e212 100644 --- a/src/renderer/tsconfig.json +++ b/src/renderer/tsconfig.json @@ -2,9 +2,6 @@ "extends": "../../tsconfig.json", "compilerOptions": { "isolatedModules": true, - "module": "ESNext", - "moduleResolution": "nodenext", - "resolveJsonModule": true, "paths": { /* Specify a set of entries that re-map imports to additional lookup locations. */ "@common/*": ["common/*"], "@renderer/*": ["renderer/*"], diff --git a/src/renderer/types/common.d.ts b/src/renderer/types/common.d.ts index b80afb4c..595892de 100644 --- a/src/renderer/types/common.d.ts +++ b/src/renderer/types/common.d.ts @@ -2,6 +2,7 @@ import '@common/types/app_setting' import '@common/types/common' import '@common/types/user_api' import '@common/types/sync' +import '@common/types/list_sync' import '@common/types/music' import '@common/types/list' import '@common/types/download_list' diff --git a/src/renderer/views/Setting/components/SettingSync.vue b/src/renderer/views/Setting/components/SettingSync.vue index 15f44c9c..65c7709a 100644 --- a/src/renderer/views/Setting/components/SettingSync.vue +++ b/src/renderer/views/Setting/components/SettingSync.vue @@ -46,7 +46,7 @@ import { openUrl } from '@common/utils/electron' import { useI18n } from '@renderer/plugins/i18n' import { appSetting, updateSetting } from '@renderer/store/setting' import { debounce } from '@common/utils/common' -import { SYNC_CODE } from '@common/constants' +import { SYNC_CODE } from '@common/constants_sync' export default { name: 'SettingSync', diff --git a/tsconfig.json b/tsconfig.json index 5852d6db..81fb5093 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,8 +5,8 @@ "target": "ESNext", "allowJs": true, "module": "esnext", - "resolveJsonModule": true, "moduleResolution": "nodenext", + "resolveJsonModule": true, "outDir": "./dist", "baseUrl": "./src", /* Specify the base directory to resolve non-relative module names. */ // "paths": { /* Specify a set of entries that re-map imports to additional lookup locations. */