remove unused packages
This commit is contained in:
parent
ca0a45d14c
commit
114769c52f
@ -18,17 +18,11 @@
|
|||||||
"@fastify/formbody": "^7.4.0",
|
"@fastify/formbody": "^7.4.0",
|
||||||
"@fastify/helmet": "^10.1.0",
|
"@fastify/helmet": "^10.1.0",
|
||||||
"@fastify/jwt": "^6.7.1",
|
"@fastify/jwt": "^6.7.1",
|
||||||
"@metamask/eth-sig-util": "^4.0.1",
|
|
||||||
"@typegoose/auto-increment": "^0.4.1",
|
"@typegoose/auto-increment": "^0.4.1",
|
||||||
"@typegoose/typegoose": "^7.4.6",
|
"@typegoose/typegoose": "^7.4.6",
|
||||||
"axios": "^0.21.1",
|
|
||||||
"bson": "^4.0.4",
|
"bson": "^4.0.4",
|
||||||
"crypto-js": "^4.2.0",
|
|
||||||
"deepmerge": "^4.2.2",
|
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"ethereumjs-util": "^7.1.5",
|
|
||||||
"ethers": "^5.6.8",
|
"ethers": "^5.6.8",
|
||||||
"fast-rbac": "^1.3.0",
|
|
||||||
"fastify": "^4.15.0",
|
"fastify": "^4.15.0",
|
||||||
"fastify-file-upload": "^3.0.0",
|
"fastify-file-upload": "^3.0.0",
|
||||||
"fastify-plugin": "^3.0.0",
|
"fastify-plugin": "^3.0.0",
|
||||||
@ -37,10 +31,8 @@
|
|||||||
"mongoose": "5.10.3",
|
"mongoose": "5.10.3",
|
||||||
"mongoose-findorcreate": "^3.0.0",
|
"mongoose-findorcreate": "^3.0.0",
|
||||||
"node-schedule": "^2.0.0",
|
"node-schedule": "^2.0.0",
|
||||||
"redis": "^3.1.2",
|
|
||||||
"siwe": "^2.1.4",
|
"siwe": "^2.1.4",
|
||||||
"tracer": "^1.1.6",
|
"tracer": "^1.1.6",
|
||||||
"web3": "^1.7.4",
|
|
||||||
"zutils": "link:packages/zutils"
|
"zutils": "link:packages/zutils"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import { FastifyInstance, FastifyPluginAsync } from 'fastify'
|
|
||||||
import fastifyPlugin from 'fastify-plugin'
|
|
||||||
import RBAC from 'fast-rbac'
|
|
||||||
|
|
||||||
declare module 'fastify' {
|
|
||||||
interface FastifyInstance {
|
|
||||||
/**
|
|
||||||
* RBAC interface
|
|
||||||
*/
|
|
||||||
rbac: RBAC
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const zRBACPlugin: FastifyPluginAsync = async function fastifyMetrics(
|
|
||||||
fastify: FastifyInstance,
|
|
||||||
options?: RBAC.Options,
|
|
||||||
) {
|
|
||||||
const rbac = new RBAC(options)
|
|
||||||
fastify.decorate('rbac', rbac)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
export = fastifyPlugin(zRBACPlugin, {
|
|
||||||
fastify: '>=3.0.0',
|
|
||||||
name: 'zrbac',
|
|
||||||
})
|
|
@ -1,5 +1,5 @@
|
|||||||
import { hmacSha256 } from 'zutils/utils/security.util'
|
import { hmacSha256 } from 'zutils/utils/security.util'
|
||||||
import axios from 'axios'
|
import { handleFetch } from 'zutils/utils/net.util'
|
||||||
|
|
||||||
const SECRET_KEY = process.env.HASH_SALT
|
const SECRET_KEY = process.env.HASH_SALT
|
||||||
|
|
||||||
@ -12,11 +12,11 @@ function createSign(address: string) {
|
|||||||
export function checkTwitter(address: string) {
|
export function checkTwitter(address: string) {
|
||||||
let sign = createSign(address)
|
let sign = createSign(address)
|
||||||
const url = `${process.env.OAUTH_SVR_URL}/activity/twitter/${address}?sign=${sign}`
|
const url = `${process.env.OAUTH_SVR_URL}/activity/twitter/${address}?sign=${sign}`
|
||||||
return axios.get(url)
|
return handleFetch(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkDiscord(address: string) {
|
export function checkDiscord(address: string) {
|
||||||
let sign = createSign(address)
|
let sign = createSign(address)
|
||||||
const url = `${process.env.OAUTH_SVR_URL}/activity/discord/${address}?sign=${sign}`
|
const url = `${process.env.OAUTH_SVR_URL}/activity/discord/${address}?sign=${sign}`
|
||||||
return axios.get(url)
|
return handleFetch(url)
|
||||||
}
|
}
|
||||||
|
@ -13,19 +13,16 @@ export default class DiscordConnect extends ITask {
|
|||||||
const { task } = data
|
const { task } = data
|
||||||
const res = await checkDiscord(address)
|
const res = await checkDiscord(address)
|
||||||
let cfg = this.activity.tasks.find((t: TaskCfg) => t.id === task.id)
|
let cfg = this.activity.tasks.find((t: TaskCfg) => t.id === task.id)
|
||||||
if (res.status !== 200) {
|
if (res.errcode) {
|
||||||
throw new ZError(11, 'discord check failed')
|
throw new ZError(res.errcode, res.errmsg)
|
||||||
}
|
|
||||||
if (res.data.errcode) {
|
|
||||||
throw new ZError(res.data.errcode, res.data.errmsg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.data.data.userid && task.status === TaskStatusEnum.RUNNING) {
|
if (res.data.userid && task.status === TaskStatusEnum.RUNNING) {
|
||||||
task.status = TaskStatusEnum.SUCCESS
|
task.status = TaskStatusEnum.SUCCESS
|
||||||
task.timeFinish = Date.now()
|
task.timeFinish = Date.now()
|
||||||
task.data = res.data.data
|
task.data = res.data
|
||||||
this.user.discordId = res.data.data.userid
|
this.user.discordId = res.data.userid
|
||||||
this.user.discordName = res.data.data.username
|
this.user.discordName = res.data.username
|
||||||
try {
|
try {
|
||||||
await this.user.save()
|
await this.user.save()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -11,19 +11,16 @@ export default class TwitterConnect extends ITask {
|
|||||||
async execute(data: any) {
|
async execute(data: any) {
|
||||||
let { address } = this.user
|
let { address } = this.user
|
||||||
let res = await checkTwitter(address)
|
let res = await checkTwitter(address)
|
||||||
if (res.status !== 200) {
|
if (res.errcode) {
|
||||||
throw new ZError(11, 'twitter check failed')
|
throw new ZError(res.errcode, res.errmsg)
|
||||||
}
|
|
||||||
if (res.data.errcode) {
|
|
||||||
throw new ZError(res.data.errcode, res.data.errmsg)
|
|
||||||
}
|
}
|
||||||
const { task } = data
|
const { task } = data
|
||||||
if (res.data.data.userid && task.status === TaskStatusEnum.RUNNING) {
|
if (res.data.userid && task.status === TaskStatusEnum.RUNNING) {
|
||||||
task.status = TaskStatusEnum.SUCCESS
|
task.status = TaskStatusEnum.SUCCESS
|
||||||
task.timeFinish = Date.now()
|
task.timeFinish = Date.now()
|
||||||
task.data = res.data.data
|
task.data = res.data
|
||||||
this.user.twitterId = res.data.data.userid
|
this.user.twitterId = res.data.userid
|
||||||
this.user.twitterName = res.data.data.username
|
this.user.twitterName = res.data.username
|
||||||
try {
|
try {
|
||||||
await this.user.save()
|
await this.user.save()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
22
yarn.lock
22
yarn.lock
@ -1102,13 +1102,6 @@ aws4@^1.8.0:
|
|||||||
resolved "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz"
|
resolved "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz"
|
||||||
integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==
|
integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==
|
||||||
|
|
||||||
axios@^0.21.1:
|
|
||||||
version "0.21.4"
|
|
||||||
resolved "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz"
|
|
||||||
integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==
|
|
||||||
dependencies:
|
|
||||||
follow-redirects "^1.14.0"
|
|
||||||
|
|
||||||
balanced-match@^1.0.0:
|
balanced-match@^1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
|
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
|
||||||
@ -1674,11 +1667,6 @@ deep-is@^0.1.3:
|
|||||||
resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz"
|
resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz"
|
||||||
integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==
|
integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==
|
||||||
|
|
||||||
deepmerge@^4.2.2:
|
|
||||||
version "4.3.1"
|
|
||||||
resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz"
|
|
||||||
integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==
|
|
||||||
|
|
||||||
defer-to-connect@^2.0.0, defer-to-connect@^2.0.1:
|
defer-to-connect@^2.0.0, defer-to-connect@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz"
|
resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz"
|
||||||
@ -2261,11 +2249,6 @@ fast-querystring@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
fast-decode-uri-component "^1.0.1"
|
fast-decode-uri-component "^1.0.1"
|
||||||
|
|
||||||
fast-rbac@^1.3.0:
|
|
||||||
version "1.3.0"
|
|
||||||
resolved "https://registry.npmjs.org/fast-rbac/-/fast-rbac-1.3.0.tgz"
|
|
||||||
integrity sha512-lr1FbTEQPmhYBjH1AUukaOBmVBrW9TQubWsckdlJDRbjZ5Sz8T3XiSZpB/OBMXEHV+FSEpsa3rhFZZ3xXvB+mA==
|
|
||||||
|
|
||||||
fast-redact@^3.1.1:
|
fast-redact@^3.1.1:
|
||||||
version "3.1.2"
|
version "3.1.2"
|
||||||
resolved "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.2.tgz"
|
resolved "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.2.tgz"
|
||||||
@ -2426,11 +2409,6 @@ flatted@^3.1.0:
|
|||||||
resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz"
|
resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz"
|
||||||
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
|
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
|
||||||
|
|
||||||
follow-redirects@^1.14.0:
|
|
||||||
version "1.15.2"
|
|
||||||
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz"
|
|
||||||
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
|
|
||||||
|
|
||||||
for-each@^0.3.3:
|
for-each@^0.3.3:
|
||||||
version "0.3.3"
|
version "0.3.3"
|
||||||
resolved "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz"
|
resolved "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user