Created
March 5, 2026 00:50
-
-
Save shockalotti/cadad64811812c72e87272ff6b93a208 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| /** | |
| * Reddit CLI - Personal posting and browsing tool | |
| * | |
| * Read-only: Uses public JSON API (no auth required) | |
| * Post/Reply: Requires OAuth - run `login` command first | |
| */ | |
| import { createServer } from 'http'; | |
| import { readFileSync, writeFileSync, existsSync } from 'fs'; | |
| import { homedir } from 'os'; | |
| import { join } from 'path'; | |
| import { exec } from 'child_process'; | |
| const BASE_URL = 'https://www.reddit.com'; | |
| const OAUTH_URL = 'https://oauth.reddit.com'; | |
| const USER_AGENT = 'script:personal-reddit-cli:v1.0.0'; | |
| const TOKEN_FILE = join(homedir(), '.reddit-token.json'); | |
| const REDIRECT_URI = 'http://localhost:8080/callback'; | |
| const SCOPES = 'read submit edit identity mysubreddits'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment