From 4ccc54247852ba399498c4777842f8a928ce439d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:58:32 +0000 Subject: [PATCH 01/13] chore(deps): update dependency vercel to v32.7.2 --- pnpm-lock.yaml | 120 ++++++++++++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 46 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index efc30b45..48d37bef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -126,7 +126,7 @@ devDependencies: version: 0.18.5 vercel: specifier: ^32.6.1 - version: 32.6.1 + version: 32.7.2 vite: specifier: ^5.1.4 version: 5.1.4(@types/node@20.11.22)(sass@1.71.1) @@ -579,11 +579,11 @@ packages: detect-libc: 2.0.2 https-proxy-agent: 5.0.1 make-dir: 3.1.0 - node-fetch: 2.6.9 + node-fetch: 2.7.0 nopt: 5.0.0 npmlog: 5.0.1 rimraf: 3.0.2 - semver: 7.5.4 + semver: 7.6.0 tar: 6.2.0 transitivePeerDependencies: - encoding @@ -844,8 +844,8 @@ packages: resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} dev: true - /@vercel/build-utils@7.2.5: - resolution: {integrity: sha512-rlXL7Kjwfl8c8CQ9fYpP/+AunFZbaXXf89OT+7G8E/CGRM+hAYrGF+N3Kz1X8TfwfNlSCqPs7VQriOKKajUS0g==} + /@vercel/build-utils@7.3.0: + resolution: {integrity: sha512-RJwqrGYSk75auHZqWmlSL+a5JsWv+4SF1AxNQJ+KpF3XWZ/8yThkN/jHBfNxMmW6VvNczSVtMaXI0/2Sess6Eg==} dev: true /@vercel/build-utils@7.7.0: @@ -891,11 +891,11 @@ packages: web-vitals: 0.2.4 dev: true - /@vercel/gatsby-plugin-vercel-builder@2.0.11: - resolution: {integrity: sha512-2G83Rj1gxL6X1/Cc0di+10xQ/ZYaaI1Mhi7kC8rUVApWY4cNJfFPsogB+DQ/fC6m+YAh3qajcbF6pnmVZk5K3Q==} + /@vercel/gatsby-plugin-vercel-builder@2.0.12: + resolution: {integrity: sha512-S1RkywrUItewqg06T3L4cgYfiwi2BFngHIIerhOYhVuD9A+yfMgxnH5dkbu6nujmV1SEws+Q92wSiPfLPmO0eA==} dependencies: '@sinclair/typebox': 0.25.24 - '@vercel/build-utils': 7.2.5 + '@vercel/build-utils': 7.3.0 '@vercel/routing-utils': 3.1.0 esbuild: 0.14.47 etag: 1.8.1 @@ -929,14 +929,14 @@ packages: dependencies: '@mapbox/node-pre-gyp': 1.0.11 '@rollup/pluginutils': 4.2.1 - acorn: 8.11.2 + acorn: 8.11.3 async-sema: 3.1.1 bindings: 1.5.0 estree-walker: 2.0.2 glob: 7.2.3 graceful-fs: 4.2.11 micromatch: 4.0.5 - node-gyp-build: 4.7.1 + node-gyp-build: 4.8.0 resolve-from: 5.0.0 transitivePeerDependencies: - encoding @@ -950,29 +950,29 @@ packages: dependencies: '@mapbox/node-pre-gyp': 1.0.11 '@rollup/pluginutils': 4.2.1 - acorn: 8.11.2 - acorn-import-attributes: 1.9.2(acorn@8.11.2) + acorn: 8.11.3 + acorn-import-attributes: 1.9.2(acorn@8.11.3) async-sema: 3.1.1 bindings: 1.5.0 estree-walker: 2.0.2 glob: 7.2.3 graceful-fs: 4.2.11 micromatch: 4.0.5 - node-gyp-build: 4.7.1 + node-gyp-build: 4.8.0 resolve-from: 5.0.0 transitivePeerDependencies: - encoding - supports-color dev: true - /@vercel/node@3.0.11: - resolution: {integrity: sha512-J6ETfnfHNCnomEaEVTdbr/J1t1+SDYTx7nawCRux+Gn2JDrQ6y1K0YIi61FLLd7uIhShqJ4DzfImih7zKxxeeg==} + /@vercel/node@3.0.12: + resolution: {integrity: sha512-OiNHiUe1LX/CfDrQ07ntPsoYhJiC38mEeErYeqA6YNVAz3QGdX3pthiaIig2KPqeeYkEx5bSkVIqQtQOTJBuLQ==} dependencies: '@edge-runtime/node-utils': 2.2.1 '@edge-runtime/primitives': 4.0.5 '@edge-runtime/vm': 3.1.7 '@types/node': 14.18.33 - '@vercel/build-utils': 7.2.5 + '@vercel/build-utils': 7.3.0 '@vercel/error-utils': 2.0.2 '@vercel/nft': 0.24.2 '@vercel/static-config': 3.0.0 @@ -1039,8 +1039,8 @@ packages: - supports-color dev: true - /@vercel/remix-builder@2.0.12: - resolution: {integrity: sha512-tm0dIJJcVm5CuJmWYJMqqz9h2gI2rysOTmbPdzEjZmFFzwcrI+745crFMbCXN++LJCLhyhXaMuktdWqQ4laimg==} + /@vercel/remix-builder@2.0.14: + resolution: {integrity: sha512-c+ILERSRq404sf6kt0qWhYhuxWkkoTEm2FdLoUnVs21K6kzGtJMJbUExEHoPZvN9a0tq86ZU86jVvRZV6WL0cQ==} dependencies: '@vercel/nft': 0.24.2 '@vercel/static-config': 3.0.0 @@ -1058,15 +1058,15 @@ packages: ajv: 6.12.6 dev: true - /@vercel/ruby@2.0.3: - resolution: {integrity: sha512-INZjBvBxQlANvj7LvHeXtfjpU+ZtwGL45vyys5+hI594MokpkrKdzUaTuK4kUX+KsEJUR7Xule5JiS89fW77BA==} + /@vercel/ruby@2.0.4: + resolution: {integrity: sha512-EpZyfF6wFGzFDmubFIh/EZtYpKindmXx/69xSfKEBTVU0afgljyOOICbyZePe5tvigfOEBLSLgrt/2nN+MlLtA==} dev: true - /@vercel/static-build@2.0.13: - resolution: {integrity: sha512-2+8v7QsRBVF31St8+OVZpJQHwOroXgP4ZoGX8/ppZhBh/Y7qfQds0mlECEnjdLHEdMIFwXCfuvUvcD5LfmjjAA==} + /@vercel/static-build@2.0.14: + resolution: {integrity: sha512-l5eQtJbk5Pc+P8XARDnpcbX4LnK3bGy7uf6S1aFOD4h6F8iBdg0agWTufZnq5BI91pcPVICPazM5BYhigIEznQ==} dependencies: '@vercel/gatsby-plugin-vercel-analytics': 1.0.11 - '@vercel/gatsby-plugin-vercel-builder': 2.0.11 + '@vercel/gatsby-plugin-vercel-builder': 2.0.12 '@vercel/static-config': 3.0.0 ts-morph: 12.0.0 dev: true @@ -1228,12 +1228,12 @@ packages: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} dev: true - /acorn-import-attributes@1.9.2(acorn@8.11.2): + /acorn-import-attributes@1.9.2(acorn@8.11.3): resolution: {integrity: sha512-O+nfJwNolEA771IYJaiLWK1UAwjNsQmZbTRqqwBYxCgVQTmpFEMvBw6LOIQV0Me339L5UMVYFyRohGnGlQDdIQ==} peerDependencies: acorn: ^8 dependencies: - acorn: 8.11.2 + acorn: 8.11.3 dev: true /acorn-walk@8.3.0: @@ -1516,6 +1516,21 @@ packages: fsevents: 2.3.3 dev: true + /chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} requiresBuild: true @@ -1675,7 +1690,7 @@ packages: handlebars: 4.7.8 json-stringify-safe: 5.0.1 meow: 12.1.1 - semver: 7.5.4 + semver: 7.6.0 split2: 4.2.0 dev: true @@ -2468,7 +2483,7 @@ packages: hasBin: true dependencies: meow: 12.1.1 - semver: 7.5.4 + semver: 7.6.0 dev: true /glob-parent@5.1.2: @@ -2560,7 +2575,7 @@ packages: resolution: {integrity: sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==} engines: {node: ^16.14.0 || >=18.0.0} dependencies: - lru-cache: 10.1.0 + lru-cache: 10.2.0 dev: true /htmlparser2@8.0.2: @@ -2842,8 +2857,8 @@ packages: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} dev: false - /lru-cache@10.1.0: - resolution: {integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==} + /lru-cache@10.2.0: + resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} engines: {node: 14 || >=16.14} dev: true @@ -3094,8 +3109,20 @@ packages: whatwg-url: 5.0.0 dev: true - /node-gyp-build@4.7.1: - resolution: {integrity: sha512-wTSrZ+8lsRRa3I3H8Xr65dLWSgCvY2l4AOnaeKdPA9TB/WYMPaTcrzf3rXvFoVvjKNVnu0CcWSx54qq9GKRUYg==} + /node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: true + + /node-gyp-build@4.8.0: + resolution: {integrity: sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==} hasBin: true dev: true @@ -3113,7 +3140,7 @@ packages: dependencies: hosted-git-info: 7.0.1 is-core-module: 2.13.1 - semver: 7.5.4 + semver: 7.6.0 validate-npm-package-license: 3.0.4 dev: true @@ -3490,6 +3517,7 @@ packages: /punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} + requiresBuild: true dev: true /queue-microtask@1.2.3: @@ -3649,8 +3677,8 @@ packages: lru-cache: 6.0.0 dev: true - /semver@7.5.4: - resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} engines: {node: '>=10'} hasBin: true dependencies: @@ -3795,7 +3823,7 @@ packages: /strip-literal@1.3.0: resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} dependencies: - acorn: 8.11.2 + acorn: 8.11.3 dev: true /supports-color@5.5.0: @@ -3923,7 +3951,7 @@ packages: '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 '@types/node': 14.18.33 - acorn: 8.11.2 + acorn: 8.11.3 acorn-walk: 8.3.0 arg: 4.1.3 create-require: 1.1.1 @@ -3994,7 +4022,7 @@ packages: resolution: {integrity: sha512-V9HpXYfsZye5bPPYUgs0Otn3ODS1mDUciaBlXljI4C2fTwfFpvFZRywmlOu943puN9sncxROMZhsZCjNXEpzEQ==} dependencies: '@rollup/pluginutils': 5.1.0 - acorn: 8.11.2 + acorn: 8.11.3 escape-string-regexp: 5.0.0 estree-walker: 3.0.3 fast-glob: 3.3.2 @@ -4085,7 +4113,7 @@ packages: resolution: {integrity: sha512-JqzORDAPxxs8ErLV4x+LL7bk5pk3YlcWqpSNsIkAZj972KzFZLClc/ekppahKkOczGkwIG6ElFgdOgOlK4tXZw==} dependencies: acorn: 8.11.3 - chokidar: 3.5.3 + chokidar: 3.6.0 webpack-sources: 3.2.3 webpack-virtual-modules: 0.6.1 dev: true @@ -4126,22 +4154,22 @@ packages: vue: 3.4.21(typescript@5.3.3) dev: false - /vercel@32.6.1: - resolution: {integrity: sha512-isEjDN1/rZEEHV2HVe2lGHkxuzvmih2luBAB42fDhhecIYs2gGKRLy+vIkJweRWRTlFMHjOHGPTYo7VfzQ10Ug==} + /vercel@32.7.2: + resolution: {integrity: sha512-esyeo67OZ/f7usKFCrx6NSjsvpo/BP/C8Mfron2uiCb4vXVcjkwOM7TwliHx6b0DbXjpzomdGVUHKRs34VNn2Q==} engines: {node: '>= 16'} hasBin: true dependencies: - '@vercel/build-utils': 7.2.5 + '@vercel/build-utils': 7.3.0 '@vercel/fun': 1.1.0 '@vercel/go': 3.0.4 '@vercel/hydrogen': 1.0.1 '@vercel/next': 4.0.15 - '@vercel/node': 3.0.11 + '@vercel/node': 3.0.12 '@vercel/python': 4.1.0 '@vercel/redwood': 2.0.5 - '@vercel/remix-builder': 2.0.12 - '@vercel/ruby': 2.0.3 - '@vercel/static-build': 2.0.13 + '@vercel/remix-builder': 2.0.14 + '@vercel/ruby': 2.0.4 + '@vercel/static-build': 2.0.14 chokidar: 3.3.1 transitivePeerDependencies: - '@swc/core' From 5a9d4412c880ff04b3e6b09300db7cc994743fba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:00:58 +0000 Subject: [PATCH 02/13] chore(deps): update dependency @types/node to v20.11.23 --- pnpm-lock.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 48d37bef..0bbfe3ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,7 +72,7 @@ devDependencies: version: 4.1.9 '@types/node': specifier: ^20.11.22 - version: 20.11.22 + version: 20.11.23 '@types/nprogress': specifier: ^0.2.3 version: 0.2.3 @@ -129,7 +129,7 @@ devDependencies: version: 32.7.2 vite: specifier: ^5.1.4 - version: 5.1.4(@types/node@20.11.22)(sass@1.71.1) + version: 5.1.4(@types/node@20.11.23)(sass@1.71.1) packages: @@ -826,8 +826,8 @@ packages: resolution: {integrity: sha512-qelS/Ra6sacc4loe/3MSjXNL1dNQ/GjxNHVzuChwMfmk7HuycRLVQN2qNY3XahK+fZc5E2szqQSKUyAF0E+2bg==} dev: true - /@types/node@20.11.22: - resolution: {integrity: sha512-/G+IxWxma6V3E+pqK1tSl2Fo1kl41pK1yeCyDsgkF9WlVAme4j5ISYM2zR11bgLFJGLN5sVK40T4RJNuiZbEjA==} + /@types/node@20.11.23: + resolution: {integrity: sha512-ZUarKKfQuRILSNYt32FuPL20HS7XwNT7/uRwSV8tiHWfyyVwDLYZNF6DZKc2bove++pgfsXn9sUwII/OsQ82cQ==} dependencies: undici-types: 5.26.5 dev: true @@ -1086,7 +1086,7 @@ packages: vite: ^5.0.0 vue: ^3.2.25 dependencies: - vite: 5.1.4(@types/node@20.11.22)(sass@1.71.1) + vite: 5.1.4(@types/node@20.11.23)(sass@1.71.1) vue: 3.4.21(typescript@5.3.3) dev: true @@ -4178,7 +4178,7 @@ packages: - supports-color dev: true - /vite@5.1.4(@types/node@20.11.22)(sass@1.71.1): + /vite@5.1.4(@types/node@20.11.23)(sass@1.71.1): resolution: {integrity: sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -4206,7 +4206,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.11.22 + '@types/node': 20.11.23 esbuild: 0.19.8 postcss: 8.4.35 rollup: 4.6.1 From 952d3e18840bbc6a7f42056abfa90c3f24b10b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=BA=E6=99=BA=E7=9A=84=E5=B0=8F=E9=B1=BC=E5=90=9B?= <44761872+dragon-fish@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:31:33 +0000 Subject: [PATCH 03/13] feat: + hidden bookmarks --- src/view/users.vue | 148 +++++++++++++++++++++++++++++++++------------ 1 file changed, 109 insertions(+), 39 deletions(-) diff --git a/src/view/users.vue b/src/view/users.vue index 7ed0ef77..5d52337e 100644 --- a/src/view/users.vue +++ b/src/view/users.vue @@ -1,7 +1,7 @@ @@ -169,15 +197,31 @@ import { import { setTitle } from '@/utils/setTitle' import { effect } from 'vue' -const loading = ref(true) +const loadingUser = ref(true) const user = ref() -const bookmarks = ref([]) -const loadingBookmarks = ref(false) -const totalBookmarks = ref(0) -const hasMoreBookmarks = computed( - () => bookmarks.value.length && bookmarks.value.length < totalBookmarks.value +const isSelfUserPage = computed(() => user.value?.userId === userStore.userId) + +const publicBookmarks = ref([]) +const loadingPublicBookmarks = ref(false) +const totalPublicBookmarks = ref(0) +const hasMorePublicBookmarks = computed( + () => + publicBookmarks.value.length && + publicBookmarks.value.length < totalPublicBookmarks.value +) + +const hiddenBookmarks = ref([]) +const loadingHiddenBookmarks = ref(false) +const totalHiddenBookmarks = ref(0) +const hasMoreHiddenBookmarks = computed( + () => + hiddenBookmarks.value.length && + hiddenBookmarks.value.length < totalHiddenBookmarks.value +) + +const tab = ref<'illust' | 'manga' | 'public-bookmarks' | 'hidden-bookmarks'>( + 'illust' ) -const tab = ref<'illust' | 'manga' | 'bookmarks'>('illust') const error = ref('') const showUserMore = ref(false) const route = useRoute() @@ -205,19 +249,19 @@ async function init(id: string | number): Promise { user.value = undefined tab.value = 'illust' error.value = '' - bookmarks.value = [] - totalBookmarks.value = 0 + publicBookmarks.value = [] + hiddenBookmarks.value = [] + totalPublicBookmarks.value = 0 + totalHiddenBookmarks.value = 0 const cache = getCache(`users.${id}`) if (cache) { - loading.value = false + loadingUser.value = false user.value = cache - // Extra - await getBookmarks() return } try { - loading.value = true + loadingUser.value = true const [{ data }, { data: profileData }] = await Promise.all([ ajax.get(`/ajax/user/${id}?full=1`), ajax.get<{ @@ -241,8 +285,7 @@ async function init(id: string | number): Promise { error.value = '未知错误' } } finally { - loading.value = false - getBookmarks() + loadingUser.value = false } } @@ -267,33 +310,60 @@ function userMore(): void { showUserMore.value = true } -async function getBookmarks(): Promise { - const target = user.value - if (!target) return - if (loadingBookmarks.value) return +async function getBookmarks(hidden?: boolean): Promise { + const curUser = user.value + if (!curUser) return + + const curLoading = hidden ? loadingHiddenBookmarks : loadingPublicBookmarks + const curList = hidden ? hiddenBookmarks : publicBookmarks + const curTotal = hidden ? totalHiddenBookmarks : totalPublicBookmarks + + if (curLoading.value) return try { - loadingBookmarks.value = true + curLoading.value = true const { data } = await ajax.get<{ works: ArtworkInfo; total: number }>( - `/ajax/user/${target.userId}/illusts/bookmarks`, + `/ajax/user/${curUser.userId}/illusts/bookmarks`, { params: new URLSearchParams({ tag: '', - offset: `${bookmarks.value.length}`, + offset: `${curList.value.length}`, limit: '48', - rest: 'show', + rest: hidden ? 'hide' : 'show', }), } ) - totalBookmarks.value = data.total - bookmarks.value = bookmarks.value.concat(data.works) + curTotal.value = data.total + curList.value = curList.value.concat(data.works) } catch (err) { console.warn('failed to fetch bookmarks', err) } finally { - loadingBookmarks.value = false + curLoading.value = false } } +const stopBookmarksFirstInit = watch(tab, (newTab) => { + const isPublicBookmarkEmpty = !publicBookmarks.value.length + const isHiddenBookmarkEmpty = !hiddenBookmarks.value.length + + if (newTab === 'public-bookmarks' && isPublicBookmarkEmpty) { + getBookmarks(false) + } + if (newTab === 'hidden-bookmarks' && isHiddenBookmarkEmpty) { + getBookmarks(true) + } + + if (isSelfUserPage) { + if (!isPublicBookmarkEmpty && !isHiddenBookmarkEmpty) { + stopBookmarksFirstInit() + } + } else { + if (!isPublicBookmarkEmpty) { + stopBookmarksFirstInit() + } + } +}) + onBeforeRouteUpdate((to) => { if (to.name !== 'users') { return From f9d918a0beaa06c91b1c070f2f1789436d8113c2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:16:20 +0000 Subject: [PATCH 04/13] chore(deps): update dependency @types/node to v20.11.24 --- pnpm-lock.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0bbfe3ea..ba49ffa0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,7 +72,7 @@ devDependencies: version: 4.1.9 '@types/node': specifier: ^20.11.22 - version: 20.11.23 + version: 20.11.24 '@types/nprogress': specifier: ^0.2.3 version: 0.2.3 @@ -129,7 +129,7 @@ devDependencies: version: 32.7.2 vite: specifier: ^5.1.4 - version: 5.1.4(@types/node@20.11.23)(sass@1.71.1) + version: 5.1.4(@types/node@20.11.24)(sass@1.71.1) packages: @@ -826,8 +826,8 @@ packages: resolution: {integrity: sha512-qelS/Ra6sacc4loe/3MSjXNL1dNQ/GjxNHVzuChwMfmk7HuycRLVQN2qNY3XahK+fZc5E2szqQSKUyAF0E+2bg==} dev: true - /@types/node@20.11.23: - resolution: {integrity: sha512-ZUarKKfQuRILSNYt32FuPL20HS7XwNT7/uRwSV8tiHWfyyVwDLYZNF6DZKc2bove++pgfsXn9sUwII/OsQ82cQ==} + /@types/node@20.11.24: + resolution: {integrity: sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==} dependencies: undici-types: 5.26.5 dev: true @@ -1086,7 +1086,7 @@ packages: vite: ^5.0.0 vue: ^3.2.25 dependencies: - vite: 5.1.4(@types/node@20.11.23)(sass@1.71.1) + vite: 5.1.4(@types/node@20.11.24)(sass@1.71.1) vue: 3.4.21(typescript@5.3.3) dev: true @@ -4178,7 +4178,7 @@ packages: - supports-color dev: true - /vite@5.1.4(@types/node@20.11.23)(sass@1.71.1): + /vite@5.1.4(@types/node@20.11.24)(sass@1.71.1): resolution: {integrity: sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -4206,7 +4206,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.11.23 + '@types/node': 20.11.24 esbuild: 0.19.8 postcss: 8.4.35 rollup: 4.6.1 From ad12ef1e80df98440a58b5abadd9d9df9eaf359a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=BA=E6=99=BA=E7=9A=84=E5=B0=8F=E9=B1=BC=E5=90=9B?= <44761872+dragon-fish@users.noreply.github.com> Date: Thu, 29 Feb 2024 18:32:09 +0000 Subject: [PATCH 05/13] feat: + following --- auto-imports.d.ts | 21 ++++ components.d.ts | 41 ++++++++ package.json | 1 + pnpm-lock.yaml | 49 +++++++-- src/components/FollowUserCard.vue | 101 +++++++++++++++++++ src/components/SideNav/SideNav.vue | 28 +++-- src/components/SiteHeader.vue | 4 + src/plugins/router.ts | 5 + src/types/Users.ts | 20 +++- src/view/following.vue | 157 +++++++++++++++++++++++++++++ src/view/users.vue | 2 +- tsconfig.json | 1 + vite.config.ts | 4 + 13 files changed, 413 insertions(+), 21 deletions(-) create mode 100644 components.d.ts create mode 100644 src/components/FollowUserCard.vue create mode 100644 src/view/following.vue diff --git a/auto-imports.d.ts b/auto-imports.d.ts index a230b117..8487d9cc 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -6,6 +6,13 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] + const IllustType: typeof import('./src/types/Artworks')['IllustType'] + const UgoiraPlayer: typeof import('./src/utils/UgoiraPlayer')['UgoiraPlayer'] + const UserPrivacyLevel: typeof import('./src/types/Users')['UserPrivacyLevel'] + const addBookmark: typeof import('./src/utils/artworkActions')['addBookmark'] + const addUserFollow: typeof import('./src/utils/userActions')['addUserFollow'] + const ajax: typeof import('./src/utils/ajax')['ajax'] + const ajaxPostWithFormData: typeof import('./src/utils/ajax')['ajaxPostWithFormData'] const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] const autoResetRef: typeof import('@vueuse/core')['autoResetRef'] const axios: typeof import('axios')['default'] @@ -28,22 +35,29 @@ declare global { const customRef: typeof import('vue')['customRef'] const debouncedRef: typeof import('@vueuse/core')['debouncedRef'] const debouncedWatch: typeof import('@vueuse/core')['debouncedWatch'] + const defaultArtwork: typeof import('./src/utils/index')['defaultArtwork'] const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] const defineComponent: typeof import('vue')['defineComponent'] const eagerComputed: typeof import('@vueuse/core')['eagerComputed'] const effectScope: typeof import('vue')['effectScope'] + const exampleSessionId: typeof import('./src/components/userData')['exampleSessionId'] + const existsSessionId: typeof import('./src/components/userData')['existsSessionId'] const extendRef: typeof import('@vueuse/core')['extendRef'] const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentScope: typeof import('vue')['getCurrentScope'] const h: typeof import('vue')['h'] const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch'] + const initUser: typeof import('./src/components/userData')['initUser'] const inject: typeof import('vue')['inject'] const injectLocal: typeof import('@vueuse/core')['injectLocal'] + const isArtwork: typeof import('./src/utils/artworkActions')['isArtwork'] const isDefined: typeof import('@vueuse/core')['isDefined'] const isProxy: typeof import('vue')['isProxy'] const isReactive: typeof import('vue')['isReactive'] const isReadonly: typeof import('vue')['isReadonly'] const isRef: typeof import('vue')['isRef'] + const login: typeof import('./src/components/userData')['login'] + const logout: typeof import('./src/components/userData')['logout'] const makeDestructurable: typeof import('@vueuse/core')['makeDestructurable'] const markRaw: typeof import('vue')['markRaw'] const nextTick: typeof import('vue')['nextTick'] @@ -82,12 +96,16 @@ declare global { const refDefault: typeof import('@vueuse/core')['refDefault'] const refThrottled: typeof import('@vueuse/core')['refThrottled'] const refWithControl: typeof import('@vueuse/core')['refWithControl'] + const removeBookmark: typeof import('./src/utils/artworkActions')['removeBookmark'] + const removeUserFollow: typeof import('./src/utils/userActions')['removeUserFollow'] const resolveComponent: typeof import('vue')['resolveComponent'] const resolveRef: typeof import('@vueuse/core')['resolveRef'] const resolveUnref: typeof import('@vueuse/core')['resolveUnref'] + const setTitle: typeof import('./src/utils/setTitle')['setTitle'] const shallowReactive: typeof import('vue')['shallowReactive'] const shallowReadonly: typeof import('vue')['shallowReadonly'] const shallowRef: typeof import('vue')['shallowRef'] + const sortArtList: typeof import('./src/utils/artworkActions')['sortArtList'] const syncRef: typeof import('@vueuse/core')['syncRef'] const syncRefs: typeof import('@vueuse/core')['syncRefs'] const templateRef: typeof import('@vueuse/core')['templateRef'] @@ -228,6 +246,7 @@ declare global { const useScrollLock: typeof import('@vueuse/core')['useScrollLock'] const useSessionStorage: typeof import('@vueuse/core')['useSessionStorage'] const useShare: typeof import('@vueuse/core')['useShare'] + const useSideNavStore: typeof import('./src/composables/states')['useSideNavStore'] const useSlots: typeof import('vue')['useSlots'] const useSorted: typeof import('@vueuse/core')['useSorted'] const useSpeechRecognition: typeof import('@vueuse/core')['useSpeechRecognition'] @@ -257,6 +276,7 @@ declare global { const useTransition: typeof import('@vueuse/core')['useTransition'] const useUrlSearchParams: typeof import('@vueuse/core')['useUrlSearchParams'] const useUserMedia: typeof import('@vueuse/core')['useUserMedia'] + const useUserStore: typeof import('./src/composables/states')['useUserStore'] const useVModel: typeof import('@vueuse/core')['useVModel'] const useVModels: typeof import('@vueuse/core')['useVModels'] const useVibrate: typeof import('@vueuse/core')['useVibrate'] @@ -269,6 +289,7 @@ declare global { const useWindowFocus: typeof import('@vueuse/core')['useWindowFocus'] const useWindowScroll: typeof import('@vueuse/core')['useWindowScroll'] const useWindowSize: typeof import('@vueuse/core')['useWindowSize'] + const validateSessionId: typeof import('./src/components/userData')['validateSessionId'] const watch: typeof import('vue')['watch'] const watchArray: typeof import('@vueuse/core')['watchArray'] const watchAtMost: typeof import('@vueuse/core')['watchAtMost'] diff --git a/components.d.ts b/components.d.ts new file mode 100644 index 00000000..3b563b60 --- /dev/null +++ b/components.d.ts @@ -0,0 +1,41 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +declare module 'vue' { + export interface GlobalComponents { + ArtTag: typeof import('./src/components/ArtTag.vue')['default'] + ArtworkCard: typeof import('./src/components/ArtworksList/ArtworkCard.vue')['default'] + ArtworkLargeCard: typeof import('./src/components/ArtworksList/ArtworkLargeCard.vue')['default'] + ArtworkLargeList: typeof import('./src/components/ArtworksList/ArtworkLargeList.vue')['default'] + ArtworkList: typeof import('./src/components/ArtworksList/ArtworkList.vue')['default'] + AuthorCard: typeof import('./src/components/AuthorCard.vue')['default'] + Card: typeof import('./src/components/Card.vue')['default'] + Comment: typeof import('./src/components/Comment/Comment.vue')['default'] + CommentsArea: typeof import('./src/components/Comment/CommentsArea.vue')['default'] + CommentSubmit: typeof import('./src/components/Comment/CommentSubmit.vue')['default'] + ErrorPage: typeof import('./src/components/ErrorPage.vue')['default'] + ExternalLink: typeof import('./src/components/ExternalLink.vue')['default'] + FollowUserCard: typeof import('./src/components/FollowUserCard.vue')['default'] + Gallery: typeof import('./src/components/Gallery.vue')['default'] + LazyLoad: typeof import('./src/components/LazyLoad.vue')['default'] + ListLink: typeof import('./src/components/SideNav/ListLink.vue')['default'] + NaiveuiProvider: typeof import('./src/components/NaiveuiProvider.vue')['default'] + NProgress: typeof import('./src/components/NProgress.vue')['default'] + NTabPane: typeof import('naive-ui')['NTabPane'] + NTabs: typeof import('naive-ui')['NTabs'] + NTabsPane: typeof import('naive-ui')['NTabsPane'] + Placeholder: typeof import('./src/components/Placeholder.vue')['default'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] + SearchBox: typeof import('./src/components/SearchBox.vue')['default'] + ShowMore: typeof import('./src/components/ShowMore.vue')['default'] + SideNav: typeof import('./src/components/SideNav/SideNav.vue')['default'] + SiteFooter: typeof import('./src/components/SiteFooter.vue')['default'] + SiteHeader: typeof import('./src/components/SiteHeader.vue')['default'] + UgoiraViewer: typeof import('./src/components/UgoiraViewer.vue')['default'] + } +} diff --git a/package.json b/package.json index 1a3823fd..7b365ec3 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "typescript": "^5.3.3", "unplugin-auto-import": "^0.17.5", "unplugin-icons": "^0.18.5", + "unplugin-vue-components": "^0.26.0", "vercel": "^32.6.1", "vite": "^5.1.4" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0bbfe3ea..c97a3941 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -124,6 +124,9 @@ devDependencies: unplugin-icons: specifier: ^0.18.5 version: 0.18.5 + unplugin-vue-components: + specifier: ^0.26.0 + version: 0.26.0(vue@3.4.21) vercel: specifier: ^32.6.1 version: 32.7.2 @@ -1247,12 +1250,6 @@ packages: hasBin: true dev: true - /acorn@8.11.2: - resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true - /acorn@8.11.3: resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} engines: {node: '>=0.4.0'} @@ -1808,7 +1805,7 @@ packages: supports-color: optional: true dependencies: - ms: 2.1.1 + ms: 2.1.2 dev: true /debug@4.3.4: @@ -2823,6 +2820,11 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dev: true + /local-pkg@0.4.3: + resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} + engines: {node: '>=14'} + dev: true + /local-pkg@0.5.0: resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} engines: {node: '>=14'} @@ -3017,7 +3019,7 @@ packages: /mlly@1.4.2: resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} dependencies: - acorn: 8.11.2 + acorn: 8.11.3 pathe: 1.1.1 pkg-types: 1.0.3 ufo: 1.3.2 @@ -4027,7 +4029,7 @@ packages: estree-walker: 3.0.3 fast-glob: 3.3.2 local-pkg: 0.5.0 - magic-string: 0.30.5 + magic-string: 0.30.7 mlly: 1.4.2 pathe: 1.1.1 pkg-types: 1.0.3 @@ -4109,6 +4111,35 @@ packages: - supports-color dev: true + /unplugin-vue-components@0.26.0(vue@3.4.21): + resolution: {integrity: sha512-s7IdPDlnOvPamjunVxw8kNgKNK8A5KM1YpK5j/p97jEKTjlPNrA0nZBiSfAKKlK1gWZuyWXlKL5dk3EDw874LQ==} + engines: {node: '>=14'} + peerDependencies: + '@babel/parser': ^7.15.8 + '@nuxt/kit': ^3.2.2 + vue: 2 || 3 + peerDependenciesMeta: + '@babel/parser': + optional: true + '@nuxt/kit': + optional: true + dependencies: + '@antfu/utils': 0.7.7 + '@rollup/pluginutils': 5.1.0 + chokidar: 3.6.0 + debug: 4.3.4 + fast-glob: 3.3.2 + local-pkg: 0.4.3 + magic-string: 0.30.7 + minimatch: 9.0.3 + resolve: 1.22.8 + unplugin: 1.7.1 + vue: 3.4.21(typescript@5.3.3) + transitivePeerDependencies: + - rollup + - supports-color + dev: true + /unplugin@1.7.1: resolution: {integrity: sha512-JqzORDAPxxs8ErLV4x+LL7bk5pk3YlcWqpSNsIkAZj972KzFZLClc/ekppahKkOczGkwIG6ElFgdOgOlK4tXZw==} dependencies: diff --git a/src/components/FollowUserCard.vue b/src/components/FollowUserCard.vue new file mode 100644 index 00000000..069ff256 --- /dev/null +++ b/src/components/FollowUserCard.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/src/components/SideNav/SideNav.vue b/src/components/SideNav/SideNav.vue index 62cf9600..92935e2d 100644 --- a/src/components/SideNav/SideNav.vue +++ b/src/components/SideNav/SideNav.vue @@ -11,30 +11,38 @@ aside.global-side-nav(:class='{ hidden: !sideNavStore.isOpened }') .title 导航 ul ListLink(link='/' text='首页') - IFasHome.svg--ListLink + IFasHome.link-icon ListLink.not-allowed(link='' text='插画') - IFasImage.svg--ListLink - ListLink(link='' text='用户') - IFasUser.svg--ListLink + IFasImage.link-icon ListLink(link='/ranking' text='排行榜') - IFasCrown.svg--ListLink + IFasCrown.link-icon .group - .title Pixiv 令牌 + .title 用户 ul ListLink( :text='userStore.isLoggedIn ? "查看令牌" : "设置令牌"' link='/login' ) - IFasFingerprint.svg--ListLink + IFasFingerprint.link-icon + ListLink( + :link='userStore.isLoggedIn ? `/users/${userStore.userId}` : `/login?back=${$route.fullPath}`' + text='我的页面' + ) + IFasUser.link-icon + ListLink( + :link='userStore.isLoggedIn ? `/users/${userStore.userId}/following` : `/login?back=${$route.fullPath}`' + text='我的关注' + ) + IFasUser.link-icon .group .title PixivNow ul ListLink(externalLink='https://www.pixiv.net/' text='Pixiv.net') - IFasExternalLinkAlt.svg--ListLink + IFasExternalLinkAlt.link-icon ListLink(link='/about' text='关于我们') - IFasHeart.svg--ListLink + IFasHeart.link-icon diff --git a/src/view/users.vue b/src/view/users.vue index 5d52337e..39766cf7 100644 --- a/src/view/users.vue +++ b/src/view/users.vue @@ -53,7 +53,7 @@ NButton(round size='small' type='info') | 我真棒 .following - | 关注了 {{ user.following }} 人 + RouterLink(:to='{ name: "following", params: { id: user.userId } }') 关注了 {{ user.following }} 人 .gender(v-if='user.gender?.name') IFasVenusMars(data-icon) | {{ user.gender.name }} diff --git a/tsconfig.json b/tsconfig.json index 592bb8ff..0ccd2dc0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,6 +27,7 @@ "src/**/*.json", "vite.config.ts", "auto-imports.d.ts", + "components.d.ts", "middware.ts" ], "exclude": ["**/dist"], diff --git a/vite.config.ts b/vite.config.ts index 1fc442fe..31ab29c1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,8 @@ import vue from '@vitejs/plugin-vue' import AutoImport from 'unplugin-auto-import/vite' import Icons from 'unplugin-icons/vite' import IconResolver from 'unplugin-icons/resolver' +import Components from 'unplugin-vue-components/vite' +import { NaiveUiResolver } from 'unplugin-vue-components/resolvers' const PROD = process.env.NODE_ENV === 'production' @@ -26,7 +28,9 @@ export default defineConfig({ }, }), ], + dirs: ['src/components/**', 'src/composables', 'src/utils', 'src/types'], }), + Components({ dts: true, resolvers: [NaiveUiResolver()] }), Icons({ scale: 1, defaultClass: 'svg--inline', From da6a362e5c65fa33b79509471d6588eca03b561f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=BA=E6=99=BA=E7=9A=84=E5=B0=8F=E9=B1=BC=E5=90=9B?= <44761872+dragon-fish@users.noreply.github.com> Date: Thu, 29 Feb 2024 18:53:47 +0000 Subject: [PATCH 06/13] chore: minor improvements --- components.d.ts | 1 + src/components/SiteHeader.vue | 4 +-- src/view/following.vue | 51 +++++++++++++++++++++-------------- src/view/users.vue | 12 +-------- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/components.d.ts b/components.d.ts index 3b563b60..a864e164 100644 --- a/components.d.ts +++ b/components.d.ts @@ -24,6 +24,7 @@ declare module 'vue' { LazyLoad: typeof import('./src/components/LazyLoad.vue')['default'] ListLink: typeof import('./src/components/SideNav/ListLink.vue')['default'] NaiveuiProvider: typeof import('./src/components/NaiveuiProvider.vue')['default'] + NButton: typeof import('naive-ui')['NButton'] NProgress: typeof import('./src/components/NProgress.vue')['default'] NTabPane: typeof import('naive-ui')['NTabPane'] NTabs: typeof import('naive-ui')['NTabs'] diff --git a/src/components/SiteHeader.vue b/src/components/SiteHeader.vue index 5815b575..5398c030 100644 --- a/src/components/SiteHeader.vue +++ b/src/components/SiteHeader.vue @@ -59,12 +59,12 @@ header.global-navbar(:class='{ "not-at-top": notAtTop, hidden }') ) {{ userStore.userName }} .uid @{{ userStore.userPixivId }} - li(v-if='$route.path !== "/login"') - RouterLink.plain(:to='"/login?back=" + $route.path') {{ userStore.isLoggedIn ? '查看令牌' : '用户登入' }} li(v-if='userStore.isLoggedIn') RouterLink.plain( :to='{ name: "following", params: { id: userStore.userId } }' ) 我的关注 + li(v-if='$route.path !== "/login"') + RouterLink.plain(:to='"/login?back=" + $route.path') {{ userStore.isLoggedIn ? '查看令牌' : '用户登入' }} li(v-if='userStore.isLoggedIn') a.plain(@click='logoutUser') 用户登出 diff --git a/src/view/following.vue b/src/view/following.vue index 4a417c72..d56a99a5 100644 --- a/src/view/following.vue +++ b/src/view/following.vue @@ -1,15 +1,23 @@