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

@drkforums/discord-sso-drk

v1.0.1

Published

NodeBB Discord OAuth2 SSO

Downloads

1

Readme

NodeBB Discord OAuth2 SSO

This plugin for NodeBB provides a way to register/authenticate users against Discord. When enabled, and configured properly, there will be a Discord icon available on the login screen. Click that icon to authenticate against Discord.

New users who register using Discord should have their avatar carry over automatically rather than using the default avatar.

Config

  1. Create an application -- https://discordapp.com/developers/applications/me
  2. Ensure the application's URI ends with /auth/discord/callback
  3. Create a bot for your application
  4. Fill in the id, secret, and bot token for the application via the NodeBB admin control panel (under "Social Authentication")
  5. Replace your NodeBB FontAwesome fonts with the custom ones included (See below)
  6. Edit your theme's profile.tpl to include a section for Discord information. (See below)

Using the Discord Logo:

I have included a modified version of the FontAwesome font that replaces the Discover card (fa-cc-discover) with a simplified Discord logo. I've picked Discover to overwrite because it starts with the same letters, so it's intuitive to search in the NodeBB icon box in case you want to use it elsewhere.

You'll have to patch this manually by replacing the font files in public/vendor/fontawesome/fonts/ with the ones in the fontawesome-discoverToDiscord folder. I recommend keeping a copy of the folder itself in the font folder so that you can replace everything quickly everytime NodeBB upgrades, since they'll get overwritten with the default FontAwesome fonts.

If using the Discover card is unacceptable for you, you can do what I did and make your own version of the FontAwesome font using FontForge. Just open up one of the standard FontAweesome fonts included in NodeBB, scroll down to the icon you want to replace (they're buried deep), delete it and import the svg of your choice. Then export all of the filetypes and replace them in the fontawesome folder.

Profile Information

A quick panel of the user's full username and their avatar from discord can be added to their profile. Just modify profile.tpl and use

    <!-- IF discordData -->
    <div class="panel panel-default">
        <div class="panel-body text-center">
            <!-- IMPORT partials/account/discord_profile_panel.tpl -->
        </div>
    </div>
    <!-- ENDIF discordData -->

or, if you'd like to inject the data directly, use variables such as {discordData.username}. Currently you can access username, discriminator, id, and pfp (avatar URL), but theoretically any information that can be pulled from Discord.js can be added to DiscordAuth.filterAccount.

Local Testing URL Override

I've added a setting in the admin panel that allows a workaround when testing local setups. Localhost isn't a valid OAuth URL, so to bypass this you can use http://lvh.me, which will always resolve to 127.0.0.1. Just enter http://lvh.me:4567 (or whatever your port number is). (Don't forget to add lvh.me to your application URI in the discord application settings as well!)

To Do

  • Adjust inconsistencies. SSO sometimes prompts to reauth in profile, and multiple users can auth one account.
  • Remove association button?
  • Clone and upload avatar locally instead of linking to Discord server
  • Add button to Profile Picture editor that allows you to pull your avatar from Discord?

Acknowledgements

This plugin is built from the one at https://github.com/jsumners/nodebb-plugin-sso-discord-alt.

License

MIT License