npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-egg-q

v1.0.8

Published

TypeScript + Vue 3 To get type suggestions for instance variables (this is not needed for composition API), create a new file called shims-vue-recaptcha-v3.d.ts and put the following inside it:

Downloads

4

Readme

keywrds

TypeScript + Vue 3 To get type suggestions for instance variables (this is not needed for composition API), create a new file called shims-vue-recaptcha-v3.d.ts and put the following inside it:

To use this package you only need a valid site key for your domain, which you can easily get here.

$ third party

## $ //back/app/controller/user

async getuser() {
      const { ctx } = this;
      let { code } = ctx.query;
      if (!code) {
          ctx.body = {
              code: 2,
              mes: '缺少参数'
          }
          return;
      }
        let config = ctx.app.config.gitee;
        let res = await axios.post('https://gitee.com/oauth/token', {
            grant_type: 'authorization_code',
            code,
            client_id: config.client_id,
            redirect_uri: config.redirect_uri,
            client_secret: config.client_secret
        });
        console.log(res, '&&&&&&')
        let access_token = res.data.access_token;
        let user = await axios.get('https://gitee.com/api/v5/user', {
            params: {
                access_token
            }
        });
        console.log(user, '&&&&&&&&')
        ctx.body = {
            code: 0,
            token: ctx.helper.gettoken({ name: user.data.name, id: user.data.id }),
            data: user.data
        }
    }

A simple and easy to use reCAPTCHA (v3 only) library for Vue based on reCAPTCHA-v3.

The latest version of this package supports Vue 3! See here for Vue 2 usage.

$ password encryption

app/extend/helper

const { createHmac } = require('crypto');
const jwt = require('jsonwebtoken');
module.exports = {
    cryptopwd(pwd) {
        const secret = '1903a';
        return createHmac('sha256', secret)
            .update(pwd)
            .digest('hex');
    },
    gettoken(data) {
        return jwt.sign(data, this.app.config.keys, { expiresIn: '10h' });
    }
};

TypeScript + Vue 3 To get type suggestions for instance variables (this is not needed for composition API), create a new file called shims-vue-recaptcha-v3.d.ts and put the following inside it:

serviceUser

/service/user

'use strict';

const Service = require('egg').Service;

class UserService extends Service {
    async getuser(name) {
        return await this.app.mysql.get('ykuser', { name });
    }
    async registry(obj) {
        return await this.app.mysql.insert('ykuser', obj);
    }
    async login(obj) {
        return await this.app.mysql.select('ykuser', {
            where: obj
        });
    }
}

module.exports = UserService;

$ routers

app/router

'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, validator } = app;
  //添加自定义校验规则
  validator.addRule('phone', (rule, value) => {
    if (!/^1[3456789]\d{9}$/.test(value)) {
      return '手机号校验失败'
    }
  })

  router.get('/', controller.home.index);
  router.post('/registry', controller.user.registry);
  router.post('/login',controller.user.login);
  router.get('/getcaptcha',controller.user.getcaptcha);
  router.get('/getuser',controller.user.getuser);
};