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-srutils

v0.0.5

Published

Subreddit CSS tool for Reddit moderators

Downloads

7

Readme

node-srutils

Authenticating

To use this tool, you must authenticate to the Reddit API. You must provide either:

  • (a) clientId, clientSecret, refreshToken
  • (b) clientId, clientSecret, username, password

To store the client ID and client secret token in the configuration file, you must run the config command. You can choose to enter either a refresh token in the config command or provide username and password on the command line.

Username/password authentication

Pass in your reddit username and password as options in the command line. If you have 2-Factor Authentication enabled, append your 2FA code to the end of your password with a colon (password:code).

node-srutils backup /r/<subreddit> --username <reddit-username> --password <reddit-password>

Refresh token

With the config command, you can save your OAuth refresh token to avoid having to authenticate manually on each run of the script. Your refresh token requires the following scopes:

  • flair
  • modconfig
  • modflair
  • mysubreddits
  • read
  • structuredstyles

Commands

config

Create a configuration file which contains OAuth credentials. Follow the prompts and provide the required information (client key, client secret, and optional refresh token). For more information on obtaining the required credentials, you can visit https://github.com/reddit-archive/reddit/wiki/OAuth2-Quick-Start-Example#first-steps and https://not-an-aardvark.github.io/reddit-oauth-helper/ for more information.

node-srutils config

reset

Resets a subreddit's settings and stylesheet back to default. You must be a moderator of the subreddit to run this command.

node-srutils reset /r/example [filters]
node-srutils reset /r/example            // to completely reset a subreddit to default
node-srutils reset /r/example all        // to completely reset a subreddit to default
node-srutils reset /r/example css,images // to reset stylesheet and stylesheet images
node-srutils reset /r/example flair      // to remove all flair settings and templates

The filters allow you to selectively reset parts of the subreddit. Filters may be all (by default) to clear all data, or any comma-separated combination of css, images, header, icon, banner, settings, and flair.` If no filters are specified, all of the filters will be applied.

clone

Clones the stylesheet and settings from one subreddit to another.

node-srutils clone /r/from /r/to

Settings and styles will first be reset to default in the destination subreddit, and then populated with the settings and styles from the source subreddit. You must be a moderator of the destination subreddit, and you must be able to view the styles and settings of the target subreddit.

backup

Creates a zip archive containing a subreddit's settings and styles.

node-srutils backup /r/example

Includes subreddit stylesheet, images, sidebar content, and flair templates.

restore

Restores a subreddit's settings and styles from a backup zip archive.

node-srutils restore valid_node_srutils_subreddit_backup.zip

Includes subreddit stylesheet, images, sidebar content, and flair templates.

Development

$ git clone https://github.com/emyarod/node-srutils.git
$ cd node-srutils
$ npm install
$ NODE_ENV=dev node bin/cli.js <command>