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

talk-plugin-gravatar

v0.1.3

Published

A talk plugin to show gravatar avatars of users via talk proxy url.

Downloads

22

Readme

talk-plugin-gravatar

Demo

A simple Talk plugin to display Talk users' Gravatar avatars with as much privacy as possible. The plugin acts as a proxy to gravatar and never directly reveal the md5sum of a talk user's email. This avoids two key privacy concerns normally faced when using gravatar:

  1. Leaking emails via md5sums of said emails

By adding Gravatar image URLs to your site you are effectively leaking a lot of information. The md5sum itself will be searchable and might reveal which other sites the user registered for. md5sums are also trivially bruteforceable, and any reverse lookup databases of emails that have been part of databreaches will be even easier to look up.

  1. Referer header passed to Gravatar

When a user's browser loads a Gravatar URL it will also send a referer header. This header will reveal the exact page from which the avatar was loaded. This info can be used by Gravatar to see which sites a user is posting on.

This plugin was inspired by the blog post How Gravatar hurts your visitors.

Caveats

Gravatar still learns the IP of the Talk instance being used for comments thus revealing which possible sites a user has commented on. The Fly.io solution does not suffer this problem as their proxy, or the one you host yourself, bears no direct conncetion to any sites. Another caveat is the added load being imposed on your Talk instance.

Installation

Add the plugin to the plugins.default.json file or create a plugins.json file and add it there. See the Coral Talk plugin docs for details about adding plugins.

Example plugins.json file:

{
  "server": [
    {"talk-plugin-gravatar": "^0.1.2"}
  ],
  "client": [
    {"talk-plugin-gravatar": "^0.1.2"}
  ]
}

Then run ./bin/cli plugins reconcile for source installs or an appropriate command for your talk installation to make the plugin available.

How the plugin works

The plugin works by adding an avatar property to the User type in the graphql schema. When the avatar property resolver is called it will check if the user model in the database contains an avatar value, if not an uuid is created and stored. Finally the avatar resolver will return the uuid.

Next the client Avatar component will add an img element to a comment referencing the plugin's avatar endpoint: <your-talk-domain>/avatar/:avatar. The request handler in the plugin will first check if the avatar with the given id is cached in Talk's Redis cache. Cached avatars are immediately returned. If an avatar is not cached the request handler will fetch it from Gravatar and then cache it for 24 hours. The request handler also returns an ETag header based on an md5sum of the avatar contents to save bandwith.

Caching is set to 24 hours expiry time to avoid hammering Gravatar with requests from the API.

Development

Fork this repository if you have not already done so. Then follow the Installation from source guide to get a local copy of Talk. Once you have a local talk folder enter the plugins directory and clone your forked repository:

$ cd plugins
$ git clone [email protected]:<youruser>/talk-plugin-gravatar.git

Add a plugins.json file with the following contents under the talk folder:

{
  "server": [
    "talk-plugin-gravatar"
  ],
  "client": [
    "talk-plugin-gravatar"
  ]
}

Make sure you have set up mongodb and redis correctly and have configured Talk according to the setup guide. Finally run the talk development script:

$ yarn watch

This will start the Talk server with the plugin enabled. You will have to go through the Talk installation steps before you can create some test comments and see the plugin in action.

Demonstration

See Github page