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

@3-/webpush

v0.1.1

Published

[test/main.coffee](./test/main.coffee) :

Downloads

2

Readme

@3-/webpush

test/main.coffee :

#!/usr/bin/env coffee

> @3-/webpush
  @3-/dbq > $q
  @3-/utf8/utf8d.js

{
  VAPID_PK
  VAPID_SK
} = process.env

push = webpush(
  {
    proxy: "http://127.0.0.1:7890"
    vapidDetails: {
      subject: 'mailto:[email protected]'
      publicKey : VAPID_PK
      privateKey: VAPID_SK
    }
  }
  'https://i18n.site/android-chrome-512x512.png'
)

base64url = 'base64url'

ID_HOST = new Map (
  await $q("SELECT id,host FROM webpushEndpointHost")
).map ([id, host])=> [id, utf8d(host)]

for [endpointHostId, endpoint, auth, p256dh] from await $q("SELECT endpointHostId,endpoint,auth,p256dh FROM webpush")
  endpoint = 'https://' + ID_HOST.get(endpointHostId) + '/' + utf8d(endpoint)
  console.log endpoint
  auth = auth.toString(base64url)
  p256dh = p256dh.toString(base64url)
  try
    console.log await push(
      '测试webpush'
      'https://www.npmjs.com/package/web-push'
      '主体'
      endpoint
      auth
      p256dh
    )
  catch err
    console.log err.statusCode, err.body
console.log('done')
# {"endpoint":"https://web.push.apple.com/QD8StnDGB1khT2Ehn0itRDrN4rZzF3XqYxG4ELn9ovO39-vIL1C39Mvx2uA8HpNO-d_E8yQtGIDJ92p43ciqp_x0aoi3A930Zbi4C86g7bVjDM6NQ79v_sev4twHXYGWqJSEplvFbUcIN4S_feTPWc-zhnE0vBmPBdaaJSQGghI","keys":{"p256dh":"BBdcKG-6UrSSb8kJJWZ-I0NWDNIqF9_7IDJLfMvr5fv0ZJOlUsFFC5Rz11gEY_fhJlmgeRL96V4hQ27llcDnsuA","auth":"TqzuWW63r_vTfyINDjmVAg"}}

# ARG = [
#   [
#     "https://web.push.apple.com/QD8StnDGB1khT2Ehn0itRDrN4rZzF3XqYxG4ELn9ovO39-vIL1C39Mvx2uA8HpNO-d_E8yQtGIDJ92p43ciqp_x0aoi3A930Zbi4C86g7bVjDM6NQ79v_sev4twHXYGWqJSEplvFbUcIN4S_feTPWc-zhnE0vBmPBdaaJSQGghI"
#     "TqzuWW63r_vTfyINDjmVAg"
#     "BBdcKG-6UrSSb8kJJWZ-I0NWDNIqF9_7IDJLfMvr5fv0ZJOlUsFFC5Rz11gEY_fhJlmgeRL96V4hQ27llcDnsuA"
#   ]
#   ["https://updates.push.services.mozilla.com/wpush/v2/gAAAAABmaRzB2cyqwa5h1iR2Yz9TJjGlfgw5r6OZXkPrJwj3FVtQucKHoDCbPFHFXBElhz8Uz-CrybHYOGZvuA3PQAZ7xx36FXSFELFdc_RDdFz_b99sZzLG7tNpGiXYXu_M-V5EUb93FPhqASfgX-77dQrF1x_cn4-WO_wHwBcw6y6WzEqVHmw","PSCbzbnnMPAFQ9Qcfez_yQ","BGD2kV9zk0d1fv7xCJ00_EPIG335fws_MCrpLX3x852r7ySPqJ8gUqlSTAcyHxetcoMRckIwQyk0FvsdFp8VUxQ",0]
#   ["https://fcm.googleapis.com/fcm/send/eQh3we0tMkk:APA91bFxO_ydkPXvWlnt_3K9Pn4WbIHEPJ2dS5a4Hz0P5wqm40rB13i3QOA29bvqVxqS0oJH6__PXx1GmnpPGb_nwwuHYS2q5I5wQ1vbglGHLEfzssK-CzdhIQaf_FrDPqR67Zzcea8V","5jGSvwj2_K7GGd4-dGw18w","BFoecbFSWzJib91A4UPiqdmJmAVw_b1-hmgdkLsXwqrahcVlP4gj_GxqWKxuOiiLF0fS9_4v0EoW-yRzGjmsOVw",0]
# ]
#
# for arg in ARG
#   console.log await push(
#     '测试webpush'
#     'https://www.npmjs.com/package/web-push'
#     '主体'
#     ... arg
#   )

output :

SET NAMES utf8mb4 - parameters:[]
SELECT id,host FROM webpushEndpointHost - parameters:[]
SELECT endpointHostId,endpoint,auth,p256dh FROM webpush - parameters:[]
https://fcm.googleapis.com/fcm/send/c0iC4geeCa4:APA91bHUNS6TBAHLuqF_bXARxyn8TyqHj9V-NJWo8V9vqyLRFkk4-Rh0E79OgjzxTSCZ3R2jGbDhKqsIWVi6Iu4L97RVPvHFRD0vB5o-iQmk9NGnsZBU90MEG3t3KOLz378eJzyIfDsD
SET NAMES utf8mb4 - parameters:[]
SET NAMES utf8mb4 - parameters:[]
SET NAMES utf8mb4 - parameters:[]
SET NAMES utf8mb4 - parameters:[]
SET NAMES utf8mb4 - parameters:[]
SET NAMES utf8mb4 - parameters:[]
SET NAMES utf8mb4 - parameters:[]
410 push subscription has unsubscribed or expired.

https://fcm.googleapis.com/fcm/send/fVOPL8StQCc:APA91bF8PMUiKe-yyXmkKK5N0giiVplsW7SwV3b9SfklyDZR2JnlKtoOmGHs0a0j-BeOdMxYThW1cVvMbnxthA9xGXvZg7VrMdcdyzTTJpuIv8A92xHjHj8iUkTudgBwLqm7TkOtJMMT
{
  statusCode: 201,
  body: '',
  headers: {
    'content-security-policy-report-only': "script-src 'none'; form-action 'none'; frame-src 'none'; report-uri https://csp.withgoogle.com/csp/goa-520bfc14",
    'cross-origin-opener-policy-report-only': 'same-origin; report-to="goa-520bfc14"',
    location: 'https://fcm.googleapis.com/0:1718179466461611%cc9b4facf9fd7ecd',
    'report-to': '{"group":"goa-520bfc14","max_age":2592000,"endpoints":[{"url":"https://csp.withgoogle.com/csp/report-to/goa-520bfc14"}]}',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'SAMEORIGIN',
    'x-xss-protection': '0',
    date: 'Wed, 12 Jun 2024 08:04:26 GMT',
    'content-length': '0',
    'content-type': 'text/html; charset=UTF-8',
    'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
    connection: 'close'
  }
}
done

About This Project

This project is an open-source component of i18n.site ⋅ Internationalization Solution.

关于本项目

本项目为 i18n.site ⋅ 国际化解决方案 的开源组件。