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

weauth

v1.0.19

Published

[![CircleCI Build Status](https://circleci.com/gh/WeYouMe/weauth.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/WeYouMe/weauth) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com

Downloads

22

Readme

CircleCI Build Status GitHub license WeYouMe channel on Discord

WeAuth API and Console UI

Install

Download and install Node.js >= 7.7.1 then run

npm install

Add config vars

NODE_API_URL=https://api.WeYouMe.io
NODE_API_URL_SERVER=https://api.WeYouMe.io
BROADCASTER_USERNAME=CHAIN_ACCOUNT_NAME_STRING
BROADCASTER_POSTING_KEY=CHAIN_ACCOUNT_POSTING_PRIVATE_KEY
JWT_SECRET=somerandomstringsecret
DEBUG=weauth:*
dburl=postgresql://user:pass@localhost:port/db
PORT=5555
CONTENT_DEFAULT='self'
CONTENT_SCRIPT_SRC='self','unsafe-eval','unsafe-inline'
CONTENT_CONNECT_SRC='self',*.WeYouMe.io
CONTENT_FRAME_SRC='self'
CONTENT_STYLE_SRC='self','unsafe-inline'
CONTENT_IMG_SRC='self',steemitimages.com,steemit-production-imageproxy-thumbnail.s3.amazonaws.com,data:
CONTENT_FONT_SRC='self'

Run

npm start

Api

Routes

/api/me - Get user profile (require user or app token)

/api/ - Broadcast posting operation for user (require app token)

OAuth2

/api/oauth2/authorize - Issue new app token (require user token)

Tokens

Tokens are created with JWT, the payload is public. Here is how it look:

Token for user

{
  role: 'user',
  user: 'guest'
}

The token hash is saved on user localStorage once he login.

Token for application

{
  role: 'app',
  proxy: 'example',
  user: 'guest',
  scope: ['vote', 'comment']
}

The token hash is sent to the application once user authorize the application.

HELPFUL STUFF

RUN ASAP

npm i

LINUX - INSTALL POSTGRESQL VIA APT-GET/YUM

[user@linux ~]$ sudo yum -y install postgresql94 postgresql94-server
[user@linux ~]$ sudo service postgresql94 initdb
# Use MD5 Authentication
[user@linux ~]$ sudo sed -i.bak -e 's/ident$/md5/' -e 's/peer$/md5/' /var/lib/pgsql94/data/pg_hba.conf
#start
[user@linux ~]$ sudo service postgresql94 start

or

./scripts/install_postgresql_yum.sh

or

./scripts/install_postgresql_apt-get.sh

depending on the package manager

OSX - INSTALL POSTGRESQL VIA BREW

user@osx:~$ brew install postgresql

START AS SERVICE OSX

user@osx:~$ brew services start postgresql

LINUX USING THE POSTGRESQL SHELL

you can then enter the postgresql shell via

// postgres : linux username , psql : linux cli program

OSX USING THE POSTGRESQL SHELL

user@osx:~$ psql postgres

FYI

/** 
 * I THINK IT'S STUPID THAT THE USER IS POSTGRES 
 * THE PACKAGES ARE CALLED POSTGRESQL
 * AND THE CLI IS PSQL
 * WUT o.O
 **/
OSX/LINUX create a psql user within psql, the one which will be running the sequelize command below
[user@linux weauth]$ whoami
user
[user@linux weauth]$ sudo -u postgres psql
psql (9.4.17)
Type "help" for help.

postgres=# CREATE ROLE user LOGIN;
CREATE ROLE
postgres=# CREATE DATABASE user;
CREATE DATABASE
postgres=# CREATE DATABASE auth;
CREATE DATABASE
postgres=# ALTER USER user WITH PASSWORD 'password';
ALTER USER
check the port in the PSQL Shell
LINUX
[user@linux weauth]$ sudo -u postgres psql
OSX
user@osx:~$ psql postgresql

then

[sudo] password for user: __________
psql (9.4.17)
Type "help" for help.

postgres=# SHOW port;
 port
------
 5432
(1 row)

postgres=# _

let's figure out our database url!

there's a few formats

postgresql://
postgresql://localhost
postgresql://localhost:5432
postgresql://localhost/mydb
postgresql://user@localhost
postgresql://user:secret@localhost
postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
postgresql://localhost/mydb?user=other&password=secret

we're going to use

postgresql://user:password@localhost:5432/auth

just a precaution

an npm version of mysql needs to be installed, either mysql or mysql2, it's a dev dependancy but you may need to install it via

[user@linux ~]$ npm i -g mysql

or

[user@linux ~]$ npm i -g mysql2

install sequelize

[user@linux weauth]$ npm i -g sequelize-cli

We run sequelize in the root of our weauth repo to autogenerate some tables from json schema's The configuration is set in db/config/config.json and is used at db/model/index.js to initialize sequelize

MAKE SURE THAT POSTGRESQL DB "auth" OR WHATEVER YOU WANT TO USE EXISTS FIRST

[user@linux weauth]$ sequelize db:migrate

HELPFUL POSTGRES KNOWLEDGE

\dg shows roles AKA users

user=# \dg
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 user      | Create DB                                      | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}

add attributes to role

user=# ALTER ROLE user WITH SUPERUSER CREATEROLE REPLICATION;
ALTER ROLE
user=# \dg
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 lopu      | Superuser, Create role, Create DB, Replication | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}

user=# _

if you fall into authentication woes then you'll have to read about md5, trust, peer, ident authentication methods, ident is annoying, so we want md5, trust, or peer

TO RESTART POSTGRESQL

[user@linux weauth]$ /etc/init.d/postgresql reload

or

[user@linux weauth]$ ./scripts/repost.sh