From 392e178da5cda34e93333108d87a9d839895d243 Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Sun, 8 Oct 2023 15:36:59 +0800 Subject: [PATCH 01/10] :bug: Fix: fix local path picbed upload error --- package.json | 4 ++-- yarn.lock | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 56486915..c03c4cf6 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "electron-updater": "^6.1.4", "element-plus": "2.3.14", "epipebomb": "^1.0.0", - "fast-xml-parser": "^4.3.1", + "fast-xml-parser": "^4.3.2", "form-data": "^4.0.0", "fs-extra": "^11.1.1", "got": "^12.6.0", @@ -67,7 +67,7 @@ "mitt": "^3.0.1", "node-ssh-no-cpu-features": "^1.0.1", "nodejs-file-downloader": "^4.12.1", - "piclist": "^1.1.4", + "piclist": "^1.2.0", "pinia": "^2.1.6", "pinia-plugin-persistedstate": "^3.2.0", "qiniu": "^7.9.0", diff --git a/yarn.lock b/yarn.lock index b55f8232..237c1533 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8330,10 +8330,10 @@ fast-xml-parser@^4.2.4: dependencies: strnum "^1.0.5" -fast-xml-parser@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.3.1.tgz#4f89c31e4c392d6e3d68b299733cad0c2d50d495" - integrity sha512-viVv3xb8D+SiS1W4cv4tva3bni08kAkx0gQnWrykMM8nXPc1FxqZPU00dCEVjkiCg4HoXd2jC4x29Nzg/l2DAA== +fast-xml-parser@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.3.2.tgz#761e641260706d6e13251c4ef8e3f5694d4b0d79" + integrity sha512-rmrXUXwbJedoXkStenj1kkljNF7ugn5ZjR9FJcwmCfcCbtOMDghPajbc+Tck6vE6F5XsDmx+Pr2le9fw8+pXBg== dependencies: strnum "^1.0.5" @@ -12639,10 +12639,10 @@ performance-now@^2.1.0: resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== -piclist@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.1.4.tgz#11a1bf77afe83d245cf86980a9457a3e03341618" - integrity sha512-GnFUsLlBO3DvLAsZxudD7AWNtqNfaCTtMhQnTaBuqgMweLNE+7/Pjvxyv3rzI9wXpbs+Ylemff4uaKvWy2t2kw== +piclist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.2.0.tgz#f71d9777bdcd829d8bfb13ba54863abfe15da06a" + integrity sha512-tcgDa032AVh6IckJzHzS7pKXUxYTo3e0Zbv+ysuExMPafY1/vrgDdvmv8GzFS8ZGAT1rtoUBLJXlQdCY7RNHmA== dependencies: "@picgo/i18n" "^1.0.0" "@picgo/store" "^2.1.0" From 1246e02c0573e77ecb41d2cab966cf556b26c5e9 Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Sun, 8 Oct 2023 16:32:51 +0800 Subject: [PATCH 02/10] :arrow_up: Upgrade: upgrade piclist-core --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c03c4cf6..1c2b7160 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "mitt": "^3.0.1", "node-ssh-no-cpu-features": "^1.0.1", "nodejs-file-downloader": "^4.12.1", - "piclist": "^1.2.0", + "piclist": "^1.2.1", "pinia": "^2.1.6", "pinia-plugin-persistedstate": "^3.2.0", "qiniu": "^7.9.0", diff --git a/yarn.lock b/yarn.lock index 237c1533..90f92052 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12639,10 +12639,10 @@ performance-now@^2.1.0: resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== -piclist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.2.0.tgz#f71d9777bdcd829d8bfb13ba54863abfe15da06a" - integrity sha512-tcgDa032AVh6IckJzHzS7pKXUxYTo3e0Zbv+ysuExMPafY1/vrgDdvmv8GzFS8ZGAT1rtoUBLJXlQdCY7RNHmA== +piclist@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.2.1.tgz#04683aef049f06a769f36bb824dc5d842a4e8578" + integrity sha512-TRTHb5egSQ0Zy9eFevrLdth4LduWVoQPpwLttoswUm8kijYJQvUoNfr0HntHnFIlquq0zeyCSoJwLJIOEW2PsQ== dependencies: "@picgo/i18n" "^1.0.0" "@picgo/store" "^2.1.0" From 64952e19ceb64fbb8320806e8ea9df22486f05ac Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Mon, 9 Oct 2023 14:28:20 +0800 Subject: [PATCH 03/10] :bug: Fix: fix an issue of watermark ISSUES CLOSED: #102 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1c2b7160..b92a164f 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "mitt": "^3.0.1", "node-ssh-no-cpu-features": "^1.0.1", "nodejs-file-downloader": "^4.12.1", - "piclist": "^1.2.1", + "piclist": "^1.2.2", "pinia": "^2.1.6", "pinia-plugin-persistedstate": "^3.2.0", "qiniu": "^7.9.0", diff --git a/yarn.lock b/yarn.lock index 90f92052..e10253cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12639,10 +12639,10 @@ performance-now@^2.1.0: resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== -piclist@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.2.1.tgz#04683aef049f06a769f36bb824dc5d842a4e8578" - integrity sha512-TRTHb5egSQ0Zy9eFevrLdth4LduWVoQPpwLttoswUm8kijYJQvUoNfr0HntHnFIlquq0zeyCSoJwLJIOEW2PsQ== +piclist@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.2.2.tgz#cf32591baf2a094b20decec51973c46e9212942b" + integrity sha512-bKzOzRUBYn5nuBcZDVouXweatohID9jW6L1+YjmFdnKqWt0UJ2H8+jpyVWZQF3FSDvoWMW0ChgXouNrHtrIO7w== dependencies: "@picgo/i18n" "^1.0.0" "@picgo/store" "^2.1.0" From df4d39e9ed86af8333b7eeed34923bd346b853a2 Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Mon, 9 Oct 2023 15:38:04 +0800 Subject: [PATCH 04/10] :arrow_up: Upgrade: upgrade types deps --- package.json | 16 +++--- yarn.lock | 158 +++++++++++++++++++++++++-------------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/package.json b/package.json index b92a164f..5bd15fb7 100644 --- a/package.json +++ b/package.json @@ -97,14 +97,14 @@ "@types/lowdb": "^1.0.12", "@types/mime-types": "^2.1.2", "@types/node": "^16.10.2", - "@types/request-promise-native": "^1.0.18", - "@types/semver": "^7.5.2", - "@types/tunnel": "^0.0.3", + "@types/request-promise-native": "^1.0.19", + "@types/semver": "^7.5.3", + "@types/tunnel": "^0.0.4", "@types/upyun": "^3.4.1", "@types/uuid": "^9.0.3", - "@types/write-file-atomic": "^4.0.0", - "@typescript-eslint/eslint-plugin": "^6.7.3", - "@typescript-eslint/parser": "^6.7.3", + "@types/write-file-atomic": "^4.0.1", + "@typescript-eslint/eslint-plugin": "^6.7.4", + "@typescript-eslint/parser": "^6.7.4", "@vue/cli-plugin-babel": "^5.0.8", "@vue/cli-plugin-eslint": "^5.0.8", "@vue/cli-plugin-router": "^5.0.8", @@ -119,7 +119,7 @@ "dpdm": "^3.14.0", "electron": "^22.0.2", "electron-devtools-installer": "^3.2.0", - "eslint": "^8.50.0", + "eslint": "^8.51.0", "eslint-config-standard": ">=16.0.0", "eslint-plugin-import": "^2.28.1", "eslint-plugin-node": "^11.1.0", @@ -127,7 +127,7 @@ "eslint-plugin-vue": "^9.17.0", "husky": "^3.1.0", "node-loader": "^2.0.0", - "npm-check-updates": "^16.14.4", + "npm-check-updates": "^16.14.5", "stylus": "^0.59.0", "stylus-loader": "^7.1.3", "typescript": "^4.9.5", diff --git a/yarn.lock b/yarn.lock index e10253cc..7fe870ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2066,10 +2066,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.50.0": - version "8.50.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.50.0.tgz#9e93b850f0f3fa35f5fa59adfd03adae8488e484" - integrity sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ== +"@eslint/js@8.51.0": + version "8.51.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.51.0.tgz#6d419c240cfb2b66da37df230f7e7eef801c32fa" + integrity sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg== "@floating-ui/core@^1.0.5": version "1.1.0" @@ -3543,10 +3543,10 @@ resolved "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== -"@types/request-promise-native@^1.0.18": - version "1.0.18" - resolved "https://registry.npmjs.org/@types/request-promise-native/-/request-promise-native-1.0.18.tgz#437ee2d0b772e01c9691a983b558084b4b3efc2c" - integrity sha512-tPnODeISFc/c1LjWyLuZUY+Z0uLB3+IMfNoQyDEi395+j6kTFTTRAqjENjoPJUid4vHRGEozoTrcTrfZM+AcbA== +"@types/request-promise-native@^1.0.19": + version "1.0.19" + resolved "https://registry.yarnpkg.com/@types/request-promise-native/-/request-promise-native-1.0.19.tgz#8c9cd669f069a3aa309ef486aec16d5f37e708de" + integrity sha512-i17J9k5KP2PAMEhoYnoDpHzJHS91aIV1lG0gOqNX1G5mm/48Qm01sIb8gCJMQpddwapXM9KpxdWGSggZNMLKDw== dependencies: "@types/request" "*" @@ -3577,10 +3577,10 @@ resolved "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== -"@types/semver@^7.5.2": - version "7.5.2" - resolved "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz#31f6eec1ed7ec23f4f05608d3a2d381df041f564" - integrity sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw== +"@types/semver@^7.5.3": + version "7.5.3" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.3.tgz#9a726e116beb26c24f1ccd6850201e1246122e04" + integrity sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw== "@types/serve-index@^1.9.1": version "1.9.1" @@ -3631,10 +3631,10 @@ resolved "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.1.tgz#8f80dd965ad81f3e1bc26d6f5c727e132721ff40" integrity sha512-Y0K95ThC3esLEYD6ZuqNek29lNX2EM1qxV8y2FTLUB0ff5wWrk7az+mLrnNFUnaXcgKye22+sFBRXOgpPILZNg== -"@types/tunnel@^0.0.3": - version "0.0.3" - resolved "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.3.tgz#f109e730b072b3136347561fc558c9358bb8c6e9" - integrity sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA== +"@types/tunnel@^0.0.4": + version "0.0.4" + resolved "https://registry.yarnpkg.com/@types/tunnel/-/tunnel-0.0.4.tgz#53ad97139641280ce1ef528c9e0c44615e32852f" + integrity sha512-bQgDBL5XiqrrPUaZd9bZ2esOXcU4GTmgg0n6LHDqoMJezO3VFRZsW8qN6Gp64/LAmjtzNU3iAHBfV3Z2ht5DSg== dependencies: "@types/node" "*" @@ -3665,10 +3665,10 @@ resolved "https://registry.npmjs.org/@types/webpack-env/-/webpack-env-1.16.3.tgz#b776327a73e561b71e7881d0cd6d34a1424db86a" integrity sha512-9gtOPPkfyNoEqCQgx4qJKkuNm/x0R2hKR7fdl7zvTJyHnIisuE/LfvXOsYWL0o3qq6uiBnKZNNNzi3l0y/X+xw== -"@types/write-file-atomic@^4.0.0": - version "4.0.0" - resolved "https://registry.npmmirror.com/@types/write-file-atomic/-/write-file-atomic-4.0.0.tgz#ffcedcb1ae027e0a28ddfe218b72b3573797b5bc" - integrity sha512-piEKt2KKBUtye+feTlfdPjtW7uPFsAaLNX3/f6AJD+Y1T1YPTFwnqtlO9Y+gy9qGshrvxKa/Kay9vqbyVIuhwQ== +"@types/write-file-atomic@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/write-file-atomic/-/write-file-atomic-4.0.1.tgz#e478f70f1b74aa1b086c6f70eea34893895e332c" + integrity sha512-oMJ8hauPkPOPZf7WAvwcyR0r3By7c/MeJr+WVpt1wWiU3ZiPc+BbVXy4Y756wqH+I2p3VR+o5AM5eMKyuHfDng== dependencies: "@types/node" "*" @@ -3715,16 +3715,16 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/eslint-plugin@^6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz#d98046e9f7102d49a93d944d413c6055c47fafd7" - integrity sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA== +"@typescript-eslint/eslint-plugin@^6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.4.tgz#057338df21b6062c2f2fc5999fbea8af9973ac6d" + integrity sha512-DAbgDXwtX+pDkAHwiGhqP3zWUGpW49B7eqmgpPtg+BKJXwdct79ut9+ifqOFPJGClGKSHXn2PTBatCnldJRUoA== dependencies: "@eslint-community/regexpp" "^4.5.1" - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/type-utils" "6.7.3" - "@typescript-eslint/utils" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/scope-manager" "6.7.4" + "@typescript-eslint/type-utils" "6.7.4" + "@typescript-eslint/utils" "6.7.4" + "@typescript-eslint/visitor-keys" "6.7.4" debug "^4.3.4" graphemer "^1.4.0" ignore "^5.2.4" @@ -3743,15 +3743,15 @@ "@typescript-eslint/visitor-keys" "6.7.0" debug "^4.3.4" -"@typescript-eslint/parser@^6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.7.3.tgz#aaf40092a32877439e5957e18f2d6a91c82cc2fd" - integrity sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ== +"@typescript-eslint/parser@^6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.7.4.tgz#23d1dd4fe5d295c7fa2ab651f5406cd9ad0bd435" + integrity sha512-I5zVZFY+cw4IMZUeNCU7Sh2PO5O57F7Lr0uyhgCJmhN/BuTlnc55KxPonR4+EM3GBdfiCyGZye6DgMjtubQkmA== dependencies: - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/typescript-estree" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/scope-manager" "6.7.4" + "@typescript-eslint/types" "6.7.4" + "@typescript-eslint/typescript-estree" "6.7.4" + "@typescript-eslint/visitor-keys" "6.7.4" debug "^4.3.4" "@typescript-eslint/scope-manager@6.7.0": @@ -3762,13 +3762,13 @@ "@typescript-eslint/types" "6.7.0" "@typescript-eslint/visitor-keys" "6.7.0" -"@typescript-eslint/scope-manager@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz#07e5709c9bdae3eaf216947433ef97b3b8b7d755" - integrity sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ== +"@typescript-eslint/scope-manager@6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.7.4.tgz#a484a17aa219e96044db40813429eb7214d7b386" + integrity sha512-SdGqSLUPTXAXi7c3Ob7peAGVnmMoGzZ361VswK2Mqf8UOYcODiYvs8rs5ILqEdfvX1lE7wEZbLyELCW+Yrql1A== dependencies: - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/types" "6.7.4" + "@typescript-eslint/visitor-keys" "6.7.4" "@typescript-eslint/type-utils@6.7.0": version "6.7.0" @@ -3780,13 +3780,13 @@ debug "^4.3.4" ts-api-utils "^1.0.1" -"@typescript-eslint/type-utils@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz#c2c165c135dda68a5e70074ade183f5ad68f3400" - integrity sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw== +"@typescript-eslint/type-utils@6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.7.4.tgz#847cd3b59baf948984499be3e0a12ff07373e321" + integrity sha512-n+g3zi1QzpcAdHFP9KQF+rEFxMb2KxtnJGID3teA/nxKHOVi3ylKovaqEzGBbVY2pBttU6z85gp0D00ufLzViQ== dependencies: - "@typescript-eslint/typescript-estree" "6.7.3" - "@typescript-eslint/utils" "6.7.3" + "@typescript-eslint/typescript-estree" "6.7.4" + "@typescript-eslint/utils" "6.7.4" debug "^4.3.4" ts-api-utils "^1.0.1" @@ -3795,10 +3795,10 @@ resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.0.tgz#8de8ba9cafadc38e89003fe303e219c9250089ae" integrity sha512-ihPfvOp7pOcN/ysoj0RpBPOx3HQTJTrIN8UZK+WFd3/iDeFHHqeyYxa4hQk4rMhsz9H9mXpR61IzwlBVGXtl9Q== -"@typescript-eslint/types@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.7.3.tgz#0402b5628a63f24f2dc9d4a678e9a92cc50ea3e9" - integrity sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw== +"@typescript-eslint/types@6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.7.4.tgz#5d358484d2be986980c039de68e9f1eb62ea7897" + integrity sha512-o9XWK2FLW6eSS/0r/tgjAGsYasLAnOWg7hvZ/dGYSSNjCh+49k5ocPN8OmG5aZcSJ8pclSOyVKP2x03Sj+RrCA== "@typescript-eslint/typescript-estree@6.7.0": version "6.7.0" @@ -3813,13 +3813,13 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/typescript-estree@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz#ec5bb7ab4d3566818abaf0e4a8fa1958561b7279" - integrity sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g== +"@typescript-eslint/typescript-estree@6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.4.tgz#f2baece09f7bb1df9296e32638b2e1130014ef1a" + integrity sha512-ty8b5qHKatlNYd9vmpHooQz3Vki3gG+3PchmtsA4TgrZBKWHNjWfkQid7K7xQogBqqc7/BhGazxMD5vr6Ha+iQ== dependencies: - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/types" "6.7.4" + "@typescript-eslint/visitor-keys" "6.7.4" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -3839,17 +3839,17 @@ "@typescript-eslint/typescript-estree" "6.7.0" semver "^7.5.4" -"@typescript-eslint/utils@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.7.3.tgz#96c655816c373135b07282d67407cb577f62e143" - integrity sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg== +"@typescript-eslint/utils@6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.7.4.tgz#2236f72b10e38277ee05ef06142522e1de470ff2" + integrity sha512-PRQAs+HUn85Qdk+khAxsVV+oULy3VkbH3hQ8hxLRJXWBEd7iI+GbQxH5SEUSH7kbEoTp6oT1bOwyga24ELALTA== dependencies: "@eslint-community/eslint-utils" "^4.4.0" "@types/json-schema" "^7.0.12" "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/typescript-estree" "6.7.3" + "@typescript-eslint/scope-manager" "6.7.4" + "@typescript-eslint/types" "6.7.4" + "@typescript-eslint/typescript-estree" "6.7.4" semver "^7.5.4" "@typescript-eslint/visitor-keys@6.7.0": @@ -3860,12 +3860,12 @@ "@typescript-eslint/types" "6.7.0" eslint-visitor-keys "^3.4.1" -"@typescript-eslint/visitor-keys@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz#83809631ca12909bd2083558d2f93f5747deebb2" - integrity sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg== +"@typescript-eslint/visitor-keys@6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.4.tgz#80dfecf820fc67574012375859085f91a4dff043" + integrity sha512-pOW37DUhlTZbvph50x5zZCkFn3xzwkGtNoJHzIM3svpiSkJzwOYr/kVBaXmf+RAQiUDs1AHEZVNPg6UJCJpwRA== dependencies: - "@typescript-eslint/types" "6.7.3" + "@typescript-eslint/types" "6.7.4" eslint-visitor-keys "^3.4.1" "@videojs-player/vue@^1.0.0": @@ -7960,15 +7960,15 @@ eslint-webpack-plugin@^3.1.0: normalize-path "^3.0.0" schema-utils "^4.0.0" -eslint@^8.50.0: - version "8.50.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.50.0.tgz#2ae6015fee0240fcd3f83e1e25df0287f487d6b2" - integrity sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg== +eslint@^8.51.0: + version "8.51.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.51.0.tgz#4a82dae60d209ac89a5cff1604fea978ba4950f3" + integrity sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" "@eslint/eslintrc" "^2.1.2" - "@eslint/js" "8.50.0" + "@eslint/js" "8.51.0" "@humanwhocodes/config-array" "^0.11.11" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" @@ -11904,10 +11904,10 @@ npm-bundled@^3.0.0: dependencies: npm-normalize-package-bin "^3.0.0" -npm-check-updates@^16.14.4: - version "16.14.4" - resolved "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-16.14.4.tgz#561e97e92079ae4dbab9d9cbeb424d292ca01bae" - integrity sha512-PKg1wv3vno75/9qgRLqV2huBO7eukOlW+PmIGl7LPXjElfYTUTWUtaMOdOckImaSj4Uqe46W/zMbMFZQp5dHRQ== +npm-check-updates@^16.14.5: + version "16.14.5" + resolved "https://registry.yarnpkg.com/npm-check-updates/-/npm-check-updates-16.14.5.tgz#caf7c7d346e21e8a6c9ebf466e4b8f77a0e6ac6a" + integrity sha512-f7v3YzPUgadtkB2LAVhiWMjrSejJ0N8OM9JjjVfxBz2neHqmPSWQUAUA+U/p3xeXHl9bghRD6knRqBhm9dkRGg== dependencies: chalk "^5.3.0" cli-table3 "^0.6.3" From 615cbc5f07d85374cc8398fc1c84413de953b98c Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Mon, 9 Oct 2023 18:37:29 +0800 Subject: [PATCH 05/10] :sparkles: Feature: build-in server support formdata now ISSUES CLOSED: #103 --- package.json | 4 +- src/main/server/index.ts | 100 +++++++++++++++++++++++-------- src/main/server/routerManager.ts | 6 ++ yarn.lock | 76 ++++++++++++++++++++--- 4 files changed, 152 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 5bd15fb7..2a32fe42 100644 --- a/package.json +++ b/package.json @@ -65,9 +65,10 @@ "marked": "^8.0.0", "mime-types": "^2.1.35", "mitt": "^3.0.1", + "multer": "^1.4.5-lts.1", "node-ssh-no-cpu-features": "^1.0.1", "nodejs-file-downloader": "^4.12.1", - "piclist": "^1.2.2", + "piclist": "^1.3.1", "pinia": "^2.1.6", "pinia-plugin-persistedstate": "^3.2.0", "qiniu": "^7.9.0", @@ -96,6 +97,7 @@ "@types/js-yaml": "^4.0.6", "@types/lowdb": "^1.0.12", "@types/mime-types": "^2.1.2", + "@types/multer": "^1.4.8", "@types/node": "^16.10.2", "@types/request-promise-native": "^1.0.19", "@types/semver": "^7.5.3", diff --git a/src/main/server/index.ts b/src/main/server/index.ts index a59b2a43..d726469f 100644 --- a/src/main/server/index.ts +++ b/src/main/server/index.ts @@ -7,6 +7,29 @@ import { import picgo from '@core/picgo' import logger from '@core/picgo/logger' import axios from 'axios' +import multer from 'multer' +import { app } from 'electron' +import path from 'path' +import fs from 'fs-extra' + +const appPath = app.getPath('userData') +const serverTempDir = path.join(appPath, 'serverTemp') + +fs.ensureDirSync(serverTempDir) + +const multerStorage = multer.diskStorage({ + destination: function (_req: any, _file: any, cb: (arg0: null, arg1: any) => void) { + fs.ensureDirSync(serverTempDir) + cb(null, serverTempDir) + }, + filename: function (_req: any, file: { originalname: any }, cb: (arg0: null, arg1: any) => void) { + cb(null, file.originalname) + } +}) + +const uploadMulter = multer({ + storage: multerStorage +}) class Server { private httpServer: http.Server @@ -55,32 +78,59 @@ class Server { } }) } else { - let body: string = '' - let postObj: IObj - request.on('data', chunk => { - body += chunk - }) - request.on('end', () => { - try { - postObj = (body === '') ? {} : JSON.parse(body) - } catch (err: any) { - logger.error('[PicList Server]', err) - return handleResponse({ - response, - body: { - success: false, - message: 'Not sending data in JSON format' - } - }) - } - logger.info('[PicList Server] get the request', body) - const handler = routers.getHandler(url!)?.handler - handler!({ - ...postObj, - response, - urlparams: query ? new URLSearchParams(query) : undefined + if (request.headers['content-type'] && request.headers['content-type'].startsWith('multipart/form-data')) { + // @ts-ignore + uploadMulter.any()(request, response, (err: any) => { + if (err) { + logger.info('[PicList Server]', err) + return handleResponse({ + response, + body: { + success: false, + message: 'Error processing formData' + } + }) + } + // @ts-ignore + const list = request.files.map(file => file.path) + + const handler = routers.getHandler(url)?.handler + if (handler) { + handler({ + list, + response, + urlparams: query ? new URLSearchParams(query) : undefined + }) + } }) - }) + } else { + let body: string = '' + let postObj: IObj + request.on('data', chunk => { + body += chunk + }) + request.on('end', () => { + try { + postObj = (body === '') ? {} : JSON.parse(body) + } catch (err: any) { + logger.error('[PicList Server]', err) + return handleResponse({ + response, + body: { + success: false, + message: 'Not sending data in JSON format' + } + }) + } + logger.info('[PicList Server] get the request', body) + const handler = routers.getHandler(url!)?.handler + handler!({ + ...postObj, + response, + urlparams: query ? new URLSearchParams(query) : undefined + }) + }) + } } } else { logger.warn(`[PicList Server] don't support [${request.method}] method`) diff --git a/src/main/server/routerManager.ts b/src/main/server/routerManager.ts index f391dd72..f27cde24 100644 --- a/src/main/server/routerManager.ts +++ b/src/main/server/routerManager.ts @@ -9,6 +9,11 @@ import path from 'path' import { dbPathDir } from 'apis/core/datastore/dbChecker' import picgo from '@core/picgo' import { changeCurrentUploader } from '../utils/handleUploaderConfig' +import { app } from 'electron' +import fs from 'fs-extra' + +const appPath = app.getPath('userData') +const serverTempDir = path.join(appPath, 'serverTemp') const STORE_PATH = dbPathDir() const LOG_PATH = path.join(STORE_PATH, 'piclist.log') @@ -112,6 +117,7 @@ router.post('/upload', async ({ }) } } + fs.emptyDirSync(serverTempDir) if (needRestore) { changeCurrentUploader(currentPicBedType, currentPicBedConfig, currentPicBedConfigId) } diff --git a/yarn.lock b/yarn.lock index 7fe870ec..3b29dadb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3510,6 +3510,13 @@ resolved "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== +"@types/multer@^1.4.8": + version "1.4.8" + resolved "https://registry.yarnpkg.com/@types/multer/-/multer-1.4.8.tgz#8d98c36f6a4e0b228a9f262cd66e881d7cd64039" + integrity sha512-VMZOW6mnmMMhA5m3fsCdXBwFwC+a+27/8gctNMuQC4f7UtWcF79KAFGoIfKZ4iqrElgWIa3j5vhMJDp0iikQ1g== + dependencies: + "@types/express" "*" + "@types/node@*", "@types/node@^16.10.2", "@types/node@^16.11.26", "@types/node@^18.11.18": version "16.11.18" resolved "https://registry.npmjs.org/@types/node/-/node-16.11.18.tgz#39ed7c52943b0cee6d7299b717707bd51b1f90b9" @@ -4808,6 +4815,11 @@ app-builder-lib@23.3.3: tar "^6.1.11" temp-file "^3.4.0" +append-field@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/append-field/-/append-field-1.0.0.tgz#1e3440e915f0b1203d23748e78edd7b9b5b43e56" + integrity sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw== + "aproba@^1.0.3 || ^2.0.0": version "2.0.0" resolved "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" @@ -5458,6 +5470,13 @@ builtins@^5.0.0, builtins@^5.0.1: dependencies: semver "^7.0.0" +busboy@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" + integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== + dependencies: + streamsearch "^1.1.0" + byte-length@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/byte-length/-/byte-length-1.0.2.tgz#ba5a5909240b0121c079b7f7b15248d6f08223cc" @@ -6104,6 +6123,16 @@ concat-map@0.0.1: resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= +concat-stream@^1.5.2: + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== + dependencies: + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + conf@^9.0.0: version "9.0.2" resolved "https://registry.npmmirror.com/conf/-/conf-9.0.2.tgz#943589602b1ce274d9234265314336a698972bc5" @@ -11550,6 +11579,13 @@ mkdirp@^0.5.1, mkdirp@^0.5.5: dependencies: minimist "^1.2.5" +mkdirp@^0.5.4: + version "0.5.6" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" + integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== + dependencies: + minimist "^1.2.6" + mkdirp@^1.0.3: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" @@ -11610,6 +11646,19 @@ ms@2.1.3, ms@^2.0.0, ms@^2.1.1: resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +multer@^1.4.5-lts.1: + version "1.4.5-lts.1" + resolved "https://registry.yarnpkg.com/multer/-/multer-1.4.5-lts.1.tgz#803e24ad1984f58edffbc79f56e305aec5cfd1ac" + integrity sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ== + dependencies: + append-field "^1.0.0" + busboy "^1.0.0" + concat-stream "^1.5.2" + mkdirp "^0.5.4" + object-assign "^4.1.1" + type-is "^1.6.4" + xtend "^4.0.0" + multicast-dns@^7.2.5: version "7.2.5" resolved "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz#77eb46057f4d7adbd16d9290fa7299f6fa64cced" @@ -12050,7 +12099,7 @@ oauth-sign@~0.9.0: resolved "https://registry.npmmirror.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -12639,10 +12688,10 @@ performance-now@^2.1.0: resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== -piclist@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.2.2.tgz#cf32591baf2a094b20decec51973c46e9212942b" - integrity sha512-bKzOzRUBYn5nuBcZDVouXweatohID9jW6L1+YjmFdnKqWt0UJ2H8+jpyVWZQF3FSDvoWMW0ChgXouNrHtrIO7w== +piclist@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.3.1.tgz#1a626a3c5cf253c47fe88207a4b9822f6a89c580" + integrity sha512-huF+IOm9R7AwO7OZexHUsv9y5pJuHUlLE1W1FTVJCB0bkdUMw4hCz2OiXcujIXXSJxQ6UUUSE4F8GK7MvTD8YQ== dependencies: "@picgo/i18n" "^1.0.0" "@picgo/store" "^2.1.0" @@ -12665,6 +12714,7 @@ piclist@^1.2.2: mime-types "2.1.35" minimatch "^3.0.4" minimist "^1.2.8" + multer "^1.4.5-lts.1" node-ssh-no-cpu-features "^1.0.1" qiniu "^7.9.0" resolve "^1.8.1" @@ -13481,7 +13531,7 @@ readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.0.6, readable-stre string_decoder "^1.1.1" util-deprecate "^1.0.1" -readable-stream@^2.0.0, readable-stream@^2.3.0, readable-stream@^2.3.5: +readable-stream@^2.0.0, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.5: version "2.3.8" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -14660,6 +14710,11 @@ stream-wormhole@^1.0.4: resolved "https://registry.npmmirror.com/stream-wormhole/-/stream-wormhole-1.1.0.tgz#300aff46ced553cfec642a05251885417693c33d" integrity sha512-gHFfL3px0Kctd6Po0M8TzEvt3De/xu6cnRrjlfYNhwbhLPLwigI2t1nc6jrzNuaYg5C4YF78PPFuQPzRiqn9ew== +streamsearch@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" + integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== + strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" @@ -15398,9 +15453,9 @@ type-fest@^4.2.0: resolved "https://registry.npmjs.org/type-fest/-/type-fest-4.3.0.tgz#5cb4dc1c05f868a2a24313893b847b0443a9d504" integrity sha512-XbMcLhoaaX/vw1S8jTKysTlznqSPxDXj1Jf56neDMksT1xoKr02pFAhHhDbW9bFejktlwKto18/UsdXlnUCBMg== -type-is@~1.6.18: +type-is@^1.6.4, type-is@~1.6.18: version "1.6.18" - resolved "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== dependencies: media-typer "0.3.0" @@ -15452,6 +15507,11 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== + typescript@^4.4.3: version "4.5.4" resolved "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8" From 54d289c8f1a54084e4953fb1c313f5f1d508fe55 Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Mon, 9 Oct 2023 23:18:09 +0800 Subject: [PATCH 06/10] :sparkles: Feature: built-in server will listen to 0.0.0.0 other than 127.0.0.1 --- README.md | 3 ++- README_cn.md | 3 ++- currentVersion.md | 10 ++++------ currentVersion_en.md | 10 ++++------ package.json | 2 +- src/main/server/index.ts | 10 ++++++++-- yarn.lock | 8 ++++---- 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4fab5a52..6b9aee14 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ PicList `V1.5.0` and above versions provide the `one-click migration` function. ## PicList-Core -The core of PicList is based on the original PicGo-Core [PicList-core](https://github.com/Kuingsmile/PicList-Core), which is adapted for cloud deletion and other functions, and adds watermark addition and image compression / scaling / rotation / format conversion functions, which can be called through CLI command line, as well as some other function changes. +The core of PicList is based on the original PicGo-Core [PicList-core](https://github.com/Kuingsmile/PicList-Core), which is adapted for cloud deletion and other functions, and adds watermark addition and image compression / scaling / rotation / format conversion functions, which can be called through CLI command line, support starting the built-in upload server through `picgo-server`,as well as some other function changes. if you want to use PicList-core, please go to [https://github.com/Kuingsmile/PicList-Core](https://github.com/Kuingsmile/PicList-Core), or go to [npm official address](https://www.npmjs.com/package/piclist) to view the installation instructions. @@ -38,6 +38,7 @@ if you want to use PicList-core, please go to [https://github.com/Kuingsmile/Pic - Within the album, you can synchronize the deletion of cloud images. This is supported across all built-in image hosts and multiple plugins. - The album now offers advanced search and sorting features, as well as batch URL modification. - Built-in tools for adding watermarks, compressing images, scaling images, rotating images, and converting image formats are now available. Advanced renaming is also supported. +- Upload interface supports form upload files, can be shared by multiple computers - Configuration can be synchronized to Github or Gitee repositories. - Manages over ten types of image hosting platforms, allowing online viewing of cloud directories, file searching, batch uploading, batch downloading, file deletion, and more. - Support previewing multiple formats of files, including pictures, videos, plain text files and markdown files, etc. For the specific formats supported, please refer to [Supported file format list](https://github.com/Kuingsmile/PicList/blob/dev/supported_format.md) diff --git a/README_cn.md b/README_cn.md index e3dadc14..3f65d774 100644 --- a/README_cn.md +++ b/README_cn.md @@ -27,7 +27,7 @@ PicList `V1.5.0`以上版本提供 `一键迁移`功能,进入 `设置`页面 ## PicList-Core -PicList的内核使用的是原版PicGo-Core基础上修改的[PicList-core](https://github.com/Kuingsmile/PicList-Core),为云端删除等功能做了适配,同时,新增了水印添加和图片压缩/缩放/旋转/格式转换等功能,可以通过CLI命令行调用,还有一些其他的功能改动。 +PicList的内核使用的是原版PicGo-Core基础上修改的[PicList-core](https://github.com/Kuingsmile/PicList-Core),为云端删除等功能做了适配,同时,新增了水印添加和图片压缩/缩放/旋转/格式转换等功能,可以通过CLI命令行调用,支持通过`picgo-server`命令开启上传服务器,还有一些其他的功能改动。 如果您希望使用PicList-core,请前往[https://github.com/Kuingsmile/PicList-Core](https://github.com/Kuingsmile/PicList-Core),或者前往[npm官方地址](https://www.npmjs.com/package/piclist)查看安装说明。 @@ -38,6 +38,7 @@ PicList的内核使用的是原版PicGo-Core基础上修改的[PicList-core](htt - 相册中可同步删除云端图片,支持所有内置图床和多个插件 - 相册新增了高级搜索和排序,批量修改URL等功能 - 内置水印添加、图片压缩、图片缩放、图片旋转和图片格式转换等功能,同时支持高级重命名 +- 上传接口支持表单上传文件,可多电脑共用 - 支持配置同步至Github或Gitee仓库 - 支持管理十余种图床,可以在线进行云端目录查看、文件搜索、批量上传、批量下载、删除文件等 - 支持预览多种格式的文件,包括图片、视频、纯文本文件和markdown文件等,具体支持的格式请参考[支持的文件格式列表](https://github.com/Kuingsmile/PicList/blob/dev/supported_format.md) diff --git a/currentVersion.md b/currentVersion.md index 60bda470..461390da 100644 --- a/currentVersion.md +++ b/currentVersion.md @@ -1,11 +1,9 @@ ✨ Features -- 相册页面只显示最后一级文件名,不包含额外的路径 -- 现在更新提示窗口会显示更新日志,方便用户查看 +- 现在已经设置了水印字体文件路径或者使用图片水印时,不再检查内置字体文件 +- PicList和PicList-Core的内置服务器现在均支持通过`formData`的方式上传图片文件 +- PicList-Core现在支持通过`picgo-server`启动内置上传服务器,使用方式与PicList的内置服务器相同 🐛 Bug Fixes -- 修复了从Obsidian插件删除图片时,webdav图床和SFTP图床无法删除的问题 -- 修复了用户无ssh权限时,sftp图床无法进行云端删除的问题 -- 修复了sftp图床上传时,即使出错仍然会判断为上传成功的问题 -- 修复了sftp图床上传时,会额外创建空文件夹的问题 \ No newline at end of file +- 修复了没有新建临时文件夹导致本地图床上传失败的问题 diff --git a/currentVersion_en.md b/currentVersion_en.md index dac0d316..93b09b2d 100644 --- a/currentVersion_en.md +++ b/currentVersion_en.md @@ -1,11 +1,9 @@ ✨ Features -- Now the album page only displays the last level file name, without additional path -- Now the update prompt window will display the update log, which is convenient for users to view +- Now that the watermark font file path has been set or the image watermark is used, the built-in font file is no longer checked +- The built-in server of PicList and PicList-Core now support uploading image files through `formData` +- PicList-Core now supports starting the built-in upload server through `picgo-server`, and the usage is the same as the built-in server of PicList 🐛 Bug Fixes -- Fixed the problem that webdav and SFTP cannot be deleted when deleting pictures from Obsidian plugin -- Fixed the problem that sftp image bed cannot be deleted in the cloud when the user has no ssh permission -- Fixed the problem that when uploading to sftp image bed, it will still be judged as upload success even if there is an error -- Fixed the problem that when uploading to sftp image bed, an empty folder will be created additionally +- Fix the problem that the local image bed upload fails due to not creating a new temporary folder \ No newline at end of file diff --git a/package.json b/package.json index 2a32fe42..1ec7a47f 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "multer": "^1.4.5-lts.1", "node-ssh-no-cpu-features": "^1.0.1", "nodejs-file-downloader": "^4.12.1", - "piclist": "^1.3.1", + "piclist": "^1.3.3", "pinia": "^2.1.6", "pinia-plugin-persistedstate": "^3.2.0", "qiniu": "^7.9.0", diff --git a/src/main/server/index.ts b/src/main/server/index.ts index d726469f..1e14681f 100644 --- a/src/main/server/index.ts +++ b/src/main/server/index.ts @@ -40,10 +40,13 @@ class Server { const result = this.checkIfConfigIsValid(config) if (result) { this.config = config + if (this.config.host === '127.0.0.1') { + this.config.host = '0.0.0.0' + } } else { config = { port: 36677, - host: '127.0.0.1', + host: '0.0.0.0', enable: true } this.config = config @@ -141,7 +144,7 @@ class Server { // port as string is a bug private listen = (port: number | string) => { - logger.info(`[PicList Server] is listening at ${port}`) + logger.info(`[PicList Server] is listening at ${port} of ${this.config.host}`) if (typeof port === 'string') { port = parseInt(port, 10) } @@ -177,6 +180,9 @@ class Server { restart () { this.config = picgo.getConfig('settings.server') + if (this.config.host === '127.0.0.1') { + this.config.host = '0.0.0.0' + } this.shutdown() this.startup() } diff --git a/yarn.lock b/yarn.lock index 3b29dadb..9a7d6140 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12688,10 +12688,10 @@ performance-now@^2.1.0: resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== -piclist@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.3.1.tgz#1a626a3c5cf253c47fe88207a4b9822f6a89c580" - integrity sha512-huF+IOm9R7AwO7OZexHUsv9y5pJuHUlLE1W1FTVJCB0bkdUMw4hCz2OiXcujIXXSJxQ6UUUSE4F8GK7MvTD8YQ== +piclist@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.3.3.tgz#3e56e807f931c24e8b39009c4d63e26f809371a9" + integrity sha512-k716fioNvkq+VMU2q+YCR/Hi4IO5/0x8p6ghhw86sQBchDSxg8aQ7mqmgKCMSc39+iOQCZGVamBjSsueDEe+Aw== dependencies: "@picgo/i18n" "^1.0.0" "@picgo/store" "^2.1.0" From 7e408082c70f194ac94fd06084153b0a7f7e4481 Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Mon, 9 Oct 2023 23:27:44 +0800 Subject: [PATCH 07/10] :bug: Fix: fix upload api copy error after changing to 0.0.0.0 --- src/renderer/pages/PicGoSetting.vue | 6 +++--- src/renderer/pages/picbeds/index.vue | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/renderer/pages/PicGoSetting.vue b/src/renderer/pages/PicGoSetting.vue index 39237bf3..b2526070 100644 --- a/src/renderer/pages/PicGoSetting.vue +++ b/src/renderer/pages/PicGoSetting.vue @@ -1746,7 +1746,7 @@ const logLevel = { const server = ref({ port: 36677, - host: '127.0.0.1', + host: '0.0.0.0', enable: true }) @@ -1859,7 +1859,7 @@ async function initData () { mainWindowHeight.value = settings.mainWindowHeight || 800 server.value = settings.server || { port: 36677, - host: '127.0.0.1', + host: '0.0.0.0', enable: true } advancedRename.value = config.buildIn?.rename || { @@ -2305,7 +2305,7 @@ async function cancelServerSetting () { serverVisible.value = false server.value = await getConfig('settings.server') || { port: 36677, - host: '127.0.0.1', + host: '0.0.0.0', enable: true } } diff --git a/src/renderer/pages/picbeds/index.vue b/src/renderer/pages/picbeds/index.vue index 7b4256ac..96892afa 100644 --- a/src/renderer/pages/picbeds/index.vue +++ b/src/renderer/pages/picbeds/index.vue @@ -238,7 +238,10 @@ async function handleCopyApi () { port: 36677, host: '127.0.0.1' } - const { port, host } = serverConfig + let { port, host } = serverConfig + if (host === '0.0.0.0') { + host = '127.0.0.1' + } const uploader = await getConfig('uploader') as IStringKeyMap || {} const picBedConfigList = uploader[$route.params.type as string].configList || [] const picBedConfig = picBedConfigList.find((item: IUploaderConfigListItem) => item._id === $route.params.configId) From 06c518d9ad345103cf6b12f7f5ff4a97ec5b612b Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Tue, 10 Oct 2023 17:23:52 +0800 Subject: [PATCH 08/10] :sparkles: Feature: add authoration key for built-in server --- package.json | 2 +- public/i18n/en.yml | 2 ++ public/i18n/zh-CN.yml | 2 ++ public/i18n/zh-TW.yml | 2 ++ src/main/server/routerManager.ts | 12 ++++++++++++ src/renderer/pages/PicGoSetting.vue | 18 +++++++++++++++++- src/universal/types/i18n.d.ts | 2 ++ src/universal/types/view.d.ts | 3 ++- yarn.lock | 8 ++++---- 9 files changed, 44 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 1ec7a47f..2157eebc 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "multer": "^1.4.5-lts.1", "node-ssh-no-cpu-features": "^1.0.1", "nodejs-file-downloader": "^4.12.1", - "piclist": "^1.3.3", + "piclist": "^1.3.4", "pinia": "^2.1.6", "pinia-plugin-persistedstate": "^3.2.0", "qiniu": "^7.9.0", diff --git a/public/i18n/en.yml b/public/i18n/en.yml index 720cb2bf..de5e1352 100644 --- a/public/i18n/en.yml +++ b/public/i18n/en.yml @@ -200,8 +200,10 @@ SETTINGS_TIPS_SERVER_NOTICE: If you don't know what is the server's function, pl SETTINGS_ENABLE_SERVER: Enable Server SETTINGS_SET_SERVER_HOST: Set Server Host SETTINGS_SET_SERVER_PORT: Set Server Port +SETTINGS_SET_SERVER_KEY: Set Auth Key SETTINGS_TIP_PLACEHOLDER_HOST: Default:127.0.0.1 SETTINGS_TIP_PLACEHOLDER_PORT: Default:36677 +SETTINGS_TIP_PLACEHOLDER_KEY: This key is used to avoid malicious requests, through urlParams '?key=xxx' to pass SETTINGS_LOG_LEVEL_ALL: All SETTINGS_LOG_LEVEL_SUCCESS: Success SETTINGS_LOG_LEVEL_ERROR: Error diff --git a/public/i18n/zh-CN.yml b/public/i18n/zh-CN.yml index 73e0e708..c6d459a0 100644 --- a/public/i18n/zh-CN.yml +++ b/public/i18n/zh-CN.yml @@ -202,8 +202,10 @@ SETTINGS_TIPS_SERVER_NOTICE: 如果你不知道Server的作用,请阅读文档 SETTINGS_ENABLE_SERVER: 是否开启Server SETTINGS_SET_SERVER_HOST: 设置监听地址 SETTINGS_SET_SERVER_PORT: 设置监听端口 +SETTINGS_SET_SERVER_KEY: 设置鉴权密钥 SETTINGS_TIP_PLACEHOLDER_HOST: 推荐默认地址:127.0.0.1 SETTINGS_TIP_PLACEHOLDER_PORT: 推荐默认端口:36677 +SETTINGS_TIP_PLACEHOLDER_KEY: 用于接口鉴权, 通过url参数添加'?key=xxx' SETTINGS_LOG_LEVEL_ALL: 全部-All SETTINGS_LOG_LEVEL_SUCCESS: 成功-Success SETTINGS_LOG_LEVEL_ERROR: 错误-Error diff --git a/public/i18n/zh-TW.yml b/public/i18n/zh-TW.yml index 848410df..e122d883 100644 --- a/public/i18n/zh-TW.yml +++ b/public/i18n/zh-TW.yml @@ -200,8 +200,10 @@ SETTINGS_TIPS_SERVER_NOTICE: 如果你不知道Server的作用,請閱讀文檔 SETTINGS_ENABLE_SERVER: 是否開啟Server SETTINGS_SET_SERVER_HOST: 設定監聽地址 SETTINGS_SET_SERVER_PORT: 設定監聽端口 +SETTINGS_SET_SERVER_KEY: 設定鑒權密鑰 SETTINGS_TIP_PLACEHOLDER_HOST: 推薦預設地址:127.0.0.1 SETTINGS_TIP_PLACEHOLDER_PORT: 推薦預設端口:36677 +SETTINGS_TIP_PLACEHOLDER_KEY: 用於接口鑒權, 通過url參數添加'?key=xxx' SETTINGS_LOG_LEVEL_ALL: 全部-All SETTINGS_LOG_LEVEL_SUCCESS: 成功-Success SETTINGS_LOG_LEVEL_ERROR: 錯誤-Error diff --git a/src/main/server/routerManager.ts b/src/main/server/routerManager.ts index f27cde24..e714dfd3 100644 --- a/src/main/server/routerManager.ts +++ b/src/main/server/routerManager.ts @@ -32,6 +32,18 @@ router.post('/upload', async ({ }): Promise => { try { const picbed = urlparams?.get('picbed') + const passedKey = urlparams?.get('key') + const serverKey = picgo.getConfig('settings.serverKey') || '' + if (serverKey && passedKey !== serverKey) { + handleResponse({ + response, + body: { + success: false, + message: 'server key is not correct' + } + }) + return + } let currentPicBedType = '' let currentPicBedConfig = {} as IStringKeyMap let currentPicBedConfigId = '' diff --git a/src/renderer/pages/PicGoSetting.vue b/src/renderer/pages/PicGoSetting.vue index b2526070..cc6d0c66 100644 --- a/src/renderer/pages/PicGoSetting.vue +++ b/src/renderer/pages/PicGoSetting.vue @@ -1055,6 +1055,16 @@ :placeholder="$T('SETTINGS_TIP_PLACEHOLDER_PORT')" /> + + +