增加xml格式的支持

This commit is contained in:
zhl 2023-04-05 17:51:41 +08:00
parent 6948958cf3
commit 3551e5084c
4 changed files with 30 additions and 3 deletions

View File

@ -21,6 +21,7 @@
"dotenv": "^16.0.3",
"fastify": "^4.14.1",
"fastify-plugin": "^4.5.0",
"fastify-xml-body-parser": "^2.2.0",
"nodemailer": "^6.9.1",
"tracer": "^1.1.6"
},

View File

@ -37,6 +37,7 @@ export class ApiServer {
private registerPlugins() {
this.server.register(require('@fastify/formbody'))
this.server.register(require('fastify-xml-body-parser'))
this.server.register(zReqParserPlugin)
this.server.register(helmet, { hidePoweredBy: false })
this.server.register(zTokenParserPlugin)

View File

@ -28,12 +28,12 @@ class WorkFlowController extends BaseController {
@role('anon')
@router('post /workflow/notify')
async flowNotify(req, res) {
let { msg_signature, timestamp, nonce, echostr } = req.params
const signature = getSignature(TOKEN, timestamp, nonce, echostr)
let { msg_signature, timestamp, nonce, Encrypt } = req.params
const signature = getSignature(TOKEN, timestamp, nonce, Encrypt)
if (msg_signature !== signature) {
throw new ZError(10, 'params mismatch')
}
const { message, id } = decrypt(AES_KEY, echostr)
const { message, id } = decrypt(AES_KEY, Encrypt)
console.log(id)
console.log(message)
res.send('success')

View File

@ -807,6 +807,13 @@ fast-uri@^2.0.0, fast-uri@^2.1.0:
resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-2.2.0.tgz#519a0f849bef714aad10e9753d69d8f758f7445a"
integrity sha512-cIusKBIt/R/oI6z/1nyfe2FvGKVTohVRfvkOhvx0nCEW+xf5NoCXjAHcWp93uOUBchzYcsvPlrapAdX1uW+YGg==
fast-xml-parser@^4.1.2:
version "4.1.3"
resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.1.3.tgz#0254ad0d4d27f07e6b48254b068c0c137488dd97"
integrity sha512-LsNDahCiCcJPe8NO7HijcnukHB24tKbfDDA5IILx9dmW3Frb52lhbeX6MPNUSvyGNfav2VTYpJ/OqkRoVLrh2Q==
dependencies:
strnum "^1.0.5"
fastfall@^1.5.0:
version "1.5.1"
resolved "https://registry.yarnpkg.com/fastfall/-/fastfall-1.5.1.tgz#3fee03331a49d1d39b3cdf7a5e9cd66f475e7b94"
@ -814,11 +821,24 @@ fastfall@^1.5.0:
dependencies:
reusify "^1.0.0"
fastify-plugin@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/fastify-plugin/-/fastify-plugin-3.0.1.tgz#79e84c29f401020f38b524f59f2402103fd21ed2"
integrity sha512-qKcDXmuZadJqdTm6vlCqioEbyewF60b/0LOFCcYN1B6BIZGlYJumWWOYs70SFYLDAH4YqdE1cxH/RKMG7rFxgA==
fastify-plugin@^4.0.0, fastify-plugin@^4.2.1, fastify-plugin@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/fastify-plugin/-/fastify-plugin-4.5.0.tgz#8b853923a0bba6ab6921bb8f35b81224e6988d91"
integrity sha512-79ak0JxddO0utAXAQ5ccKhvs6vX2MGyHHMMsmZkBANrq3hXc1CHzvNPHOcvTsVMEPl5I+NT+RO4YKMGehOfSIg==
fastify-xml-body-parser@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/fastify-xml-body-parser/-/fastify-xml-body-parser-2.2.0.tgz#c8ed420b26a3a4457be27dac48a9629cebc9fed8"
integrity sha512-Jxltec0Iin4QX+DEQoYCyGmU5cTRtI0x22mRT/3FBQMhTEn7KNTHnnEtbyN3+6SLgW8cSirnOe1t8vqn77vR+Q==
dependencies:
fast-xml-parser "^4.1.2"
fastify-plugin "^3.0.0"
fastify@^4.14.1:
version "4.14.1"
resolved "https://registry.yarnpkg.com/fastify/-/fastify-4.14.1.tgz#be1b27a13910c74ecb8625de4fa42feab9703259"
@ -1567,6 +1587,11 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
strnum@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db"
integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==
supports-color@^7.1.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"