heathrow 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +58 -0
- data/README.md +205 -0
- data/bin/heathrow +42 -0
- data/bin/heathrowd +283 -0
- data/docs/ARCHITECTURE.md +1172 -0
- data/docs/DATABASE_SCHEMA.md +685 -0
- data/docs/DEVELOPMENT_WORKFLOW.md +867 -0
- data/docs/DISCORD_SETUP.md +142 -0
- data/docs/GMAIL_OAUTH_SETUP.md +120 -0
- data/docs/PLUGIN_SYSTEM.md +1370 -0
- data/docs/PROJECT_PLAN.md +1022 -0
- data/docs/README.md +417 -0
- data/docs/REDDIT_SETUP.md +174 -0
- data/docs/REPLY_FORWARD.md +182 -0
- data/docs/WHATSAPP_TELEGRAM_SETUP.md +306 -0
- data/heathrow.gemspec +34 -0
- data/heathrowd.service +21 -0
- data/img/heathrow.svg +95 -0
- data/img/rss_threaded.png +0 -0
- data/img/sources.png +0 -0
- data/lib/heathrow/address_book.rb +42 -0
- data/lib/heathrow/config.rb +332 -0
- data/lib/heathrow/database.rb +731 -0
- data/lib/heathrow/database_new.rb +392 -0
- data/lib/heathrow/event_bus.rb +175 -0
- data/lib/heathrow/logger.rb +122 -0
- data/lib/heathrow/message.rb +176 -0
- data/lib/heathrow/message_composer.rb +399 -0
- data/lib/heathrow/message_organizer.rb +774 -0
- data/lib/heathrow/migrations/001_initial_schema.rb +248 -0
- data/lib/heathrow/notmuch.rb +45 -0
- data/lib/heathrow/oauth2_smtp.rb +254 -0
- data/lib/heathrow/plugin/base.rb +212 -0
- data/lib/heathrow/plugin_manager.rb +141 -0
- data/lib/heathrow/poller.rb +93 -0
- data/lib/heathrow/smtp_sender.rb +204 -0
- data/lib/heathrow/source.rb +39 -0
- data/lib/heathrow/sources/base.rb +74 -0
- data/lib/heathrow/sources/discord.rb +357 -0
- data/lib/heathrow/sources/gmail.rb +294 -0
- data/lib/heathrow/sources/imap.rb +198 -0
- data/lib/heathrow/sources/instagram.rb +307 -0
- data/lib/heathrow/sources/instagram_fetch.py +101 -0
- data/lib/heathrow/sources/instagram_send.py +55 -0
- data/lib/heathrow/sources/instagram_send_marionette.py +104 -0
- data/lib/heathrow/sources/maildir.rb +606 -0
- data/lib/heathrow/sources/messenger.rb +212 -0
- data/lib/heathrow/sources/messenger_fetch.js +297 -0
- data/lib/heathrow/sources/messenger_fetch_marionette.py +138 -0
- data/lib/heathrow/sources/messenger_send.js +32 -0
- data/lib/heathrow/sources/messenger_send.py +100 -0
- data/lib/heathrow/sources/reddit.rb +461 -0
- data/lib/heathrow/sources/rss.rb +299 -0
- data/lib/heathrow/sources/slack.rb +375 -0
- data/lib/heathrow/sources/source_manager.rb +328 -0
- data/lib/heathrow/sources/telegram.rb +498 -0
- data/lib/heathrow/sources/webpage.rb +207 -0
- data/lib/heathrow/sources/weechat.rb +479 -0
- data/lib/heathrow/sources/whatsapp.rb +474 -0
- data/lib/heathrow/ui/application.rb +8098 -0
- data/lib/heathrow/ui/navigation.rb +8 -0
- data/lib/heathrow/ui/panes.rb +8 -0
- data/lib/heathrow/ui/source_wizard.rb +567 -0
- data/lib/heathrow/ui/threaded_view.rb +780 -0
- data/lib/heathrow/ui/views.rb +8 -0
- data/lib/heathrow/version.rb +3 -0
- data/lib/heathrow/wizards/discord_wizard.rb +193 -0
- data/lib/heathrow/wizards/slack_wizard.rb +140 -0
- data/lib/heathrow.rb +55 -0
- metadata +147 -0
data/docs/README.md
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
# Heathrow Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to Heathrow documentation! This directory contains comprehensive guides for understanding, developing, and contributing to Heathrow.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick Navigation
|
|
8
|
+
|
|
9
|
+
### For Users
|
|
10
|
+
|
|
11
|
+
- **Getting Started** - (Coming in Phase 6: Polish & Distribution)
|
|
12
|
+
- **User Manual** - (Coming in Phase 6: Polish & Distribution)
|
|
13
|
+
- **Configuration Guide** - (Coming in Phase 1: Email Mastery)
|
|
14
|
+
|
|
15
|
+
### For Developers
|
|
16
|
+
|
|
17
|
+
- **[PROJECT_PLAN.md](PROJECT_PLAN.md)** - Complete implementation roadmap
|
|
18
|
+
- **[ARCHITECTURE.md](ARCHITECTURE.md)** - System design and component isolation
|
|
19
|
+
- **[DATABASE_SCHEMA.md](DATABASE_SCHEMA.md)** - Complete database structure
|
|
20
|
+
- **[PLUGIN_SYSTEM.md](PLUGIN_SYSTEM.md)** - How to create plugins
|
|
21
|
+
- **[DEVELOPMENT_WORKFLOW.md](DEVELOPMENT_WORKFLOW.md)** - Git, testing, and releases
|
|
22
|
+
|
|
23
|
+
### For Contributors
|
|
24
|
+
|
|
25
|
+
- **CONTRIBUTING.md** - (Coming soon)
|
|
26
|
+
- **CODE_OF_CONDUCT.md** - (Coming soon)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Documentation Overview
|
|
31
|
+
|
|
32
|
+
### PROJECT_PLAN.md
|
|
33
|
+
|
|
34
|
+
**What:** The master implementation plan for Heathrow
|
|
35
|
+
|
|
36
|
+
**Covers:**
|
|
37
|
+
- Complete roadmap from current state to 1.0 release
|
|
38
|
+
- 6 phases of development (Foundation → Polish)
|
|
39
|
+
- Detailed breakdown of each feature
|
|
40
|
+
- Timeline estimates (aggressive, realistic, MVP)
|
|
41
|
+
- Success criteria for each phase
|
|
42
|
+
|
|
43
|
+
**Read this if you want to:**
|
|
44
|
+
- Understand the project vision
|
|
45
|
+
- See what features are planned
|
|
46
|
+
- Know when features will be delivered
|
|
47
|
+
- Understand project priorities
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### ARCHITECTURE.md
|
|
52
|
+
|
|
53
|
+
**What:** The technical architecture and system design
|
|
54
|
+
|
|
55
|
+
**Covers:**
|
|
56
|
+
- Layer architecture (UI → Application → Core → Plugins)
|
|
57
|
+
- Component isolation strategies
|
|
58
|
+
- Data flow diagrams
|
|
59
|
+
- Concurrency model
|
|
60
|
+
- Error handling strategy
|
|
61
|
+
- Testing strategy
|
|
62
|
+
- Performance considerations
|
|
63
|
+
|
|
64
|
+
**Read this if you want to:**
|
|
65
|
+
- Understand how Heathrow is structured
|
|
66
|
+
- Know which components can fail independently
|
|
67
|
+
- See how messages flow through the system
|
|
68
|
+
- Understand threading and concurrency
|
|
69
|
+
- Know performance targets and budgets
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### DATABASE_SCHEMA.md
|
|
74
|
+
|
|
75
|
+
**What:** Complete database structure and design
|
|
76
|
+
|
|
77
|
+
**Covers:**
|
|
78
|
+
- All table schemas with column definitions
|
|
79
|
+
- Index strategies for performance
|
|
80
|
+
- Full-text search implementation
|
|
81
|
+
- Migration system
|
|
82
|
+
- Encryption strategy
|
|
83
|
+
- Backup and recovery
|
|
84
|
+
- Sample data and queries
|
|
85
|
+
|
|
86
|
+
**Read this if you want to:**
|
|
87
|
+
- Understand data storage
|
|
88
|
+
- Query the database directly
|
|
89
|
+
- Create database migrations
|
|
90
|
+
- Optimize database performance
|
|
91
|
+
- Understand security measures
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### PLUGIN_SYSTEM.md
|
|
96
|
+
|
|
97
|
+
**What:** How plugins work and how to create them
|
|
98
|
+
|
|
99
|
+
**Covers:**
|
|
100
|
+
- Plugin architecture and isolation
|
|
101
|
+
- Plugin lifecycle (load → start → run → stop → unload)
|
|
102
|
+
- Plugin interface (Base class API)
|
|
103
|
+
- Plugin discovery and registration
|
|
104
|
+
- Error handling and recovery
|
|
105
|
+
- Example plugins (Gmail, RSS, Slack)
|
|
106
|
+
- Step-by-step plugin development guide
|
|
107
|
+
- Testing plugins
|
|
108
|
+
- Publishing community plugins
|
|
109
|
+
|
|
110
|
+
**Read this if you want to:**
|
|
111
|
+
- Create a new plugin for a service
|
|
112
|
+
- Understand how plugins are isolated
|
|
113
|
+
- Debug plugin issues
|
|
114
|
+
- Publish a plugin to the community
|
|
115
|
+
- Understand plugin capabilities
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### DEVELOPMENT_WORKFLOW.md
|
|
120
|
+
|
|
121
|
+
**What:** How to contribute to Heathrow
|
|
122
|
+
|
|
123
|
+
**Covers:**
|
|
124
|
+
- Development environment setup
|
|
125
|
+
- Git workflow and branching strategy
|
|
126
|
+
- Commit message conventions
|
|
127
|
+
- Coding standards and style guide
|
|
128
|
+
- Testing workflow and coverage goals
|
|
129
|
+
- Documentation standards
|
|
130
|
+
- Code review process
|
|
131
|
+
- Release process
|
|
132
|
+
- Troubleshooting common issues
|
|
133
|
+
|
|
134
|
+
**Read this if you want to:**
|
|
135
|
+
- Contribute code to Heathrow
|
|
136
|
+
- Understand the development process
|
|
137
|
+
- Set up your development environment
|
|
138
|
+
- Know coding standards
|
|
139
|
+
- Understand the release process
|
|
140
|
+
- Get your PR merged
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Document Relationships
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
PROJECT_PLAN.md ──┐
|
|
148
|
+
│
|
|
149
|
+
├──→ ARCHITECTURE.md ──┐
|
|
150
|
+
│ │
|
|
151
|
+
│ ├──→ DATABASE_SCHEMA.md
|
|
152
|
+
│ │
|
|
153
|
+
└──→ PLUGIN_SYSTEM.md ─┤
|
|
154
|
+
│
|
|
155
|
+
└──→ DEVELOPMENT_WORKFLOW.md
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Flow:**
|
|
159
|
+
1. **PROJECT_PLAN.md** - What are we building?
|
|
160
|
+
2. **ARCHITECTURE.md** - How is it structured?
|
|
161
|
+
3. **DATABASE_SCHEMA.md** - How is data stored?
|
|
162
|
+
4. **PLUGIN_SYSTEM.md** - How do integrations work?
|
|
163
|
+
5. **DEVELOPMENT_WORKFLOW.md** - How do I contribute?
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Key Concepts
|
|
168
|
+
|
|
169
|
+
### Airport Metaphor
|
|
170
|
+
|
|
171
|
+
Heathrow is named after the major international airport. This metaphor runs throughout:
|
|
172
|
+
|
|
173
|
+
- **Hub** - Central connection point for all communications
|
|
174
|
+
- **Terminals** - Different platforms (Gmail, Slack, Discord, etc.)
|
|
175
|
+
- **Gates** - Individual channels within platforms
|
|
176
|
+
- **Arrivals** - Incoming messages
|
|
177
|
+
- **Departures** - Outgoing messages
|
|
178
|
+
- **Transit** - Forwarding messages between platforms
|
|
179
|
+
- **Lounge** - Read/archived messages
|
|
180
|
+
|
|
181
|
+
### LEGO Architecture
|
|
182
|
+
|
|
183
|
+
Every component is a self-contained LEGO piece:
|
|
184
|
+
|
|
185
|
+
- **Modularity** - Each piece has one clear purpose
|
|
186
|
+
- **Isolation** - Breaking one piece doesn't break others
|
|
187
|
+
- **Interfaces** - Clear connection points between pieces
|
|
188
|
+
- **Testability** - Each piece can be tested independently
|
|
189
|
+
- **Replaceability** - Can swap out pieces without rewriting
|
|
190
|
+
|
|
191
|
+
### Plugin Isolation
|
|
192
|
+
|
|
193
|
+
Plugins are completely isolated:
|
|
194
|
+
|
|
195
|
+
- **No shared state** - Plugins can't access each other
|
|
196
|
+
- **Independent failure** - Plugin crash doesn't affect core
|
|
197
|
+
- **Hot reload** - Can load/unload without restart
|
|
198
|
+
- **Clear API** - Plugins only access core via Base class
|
|
199
|
+
- **Error boundaries** - Exceptions caught and logged
|
|
200
|
+
|
|
201
|
+
### Layer Separation
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
UI Layer ────────────→ User sees and interacts
|
|
205
|
+
│
|
|
206
|
+
▼
|
|
207
|
+
Application Layer ───→ Business logic and routing
|
|
208
|
+
│
|
|
209
|
+
▼
|
|
210
|
+
Core Layer ──────────→ Infrastructure (DB, events, config)
|
|
211
|
+
│
|
|
212
|
+
▼
|
|
213
|
+
Plugin Layer ────────→ External service integrations
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Each layer:
|
|
217
|
+
- Only talks to adjacent layers
|
|
218
|
+
- Has well-defined interfaces
|
|
219
|
+
- Can fail independently (except Core)
|
|
220
|
+
- Can be tested in isolation
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Development Phases
|
|
225
|
+
|
|
226
|
+
### Phase 0: Foundation (Current)
|
|
227
|
+
|
|
228
|
+
**Goal:** Unbreakable core for all future features
|
|
229
|
+
|
|
230
|
+
- [x] Project planning
|
|
231
|
+
- [x] Architecture design
|
|
232
|
+
- [x] Database schema
|
|
233
|
+
- [x] Plugin system design
|
|
234
|
+
- [ ] Rename Heathrow → Heathrow
|
|
235
|
+
- [ ] Core component implementation
|
|
236
|
+
- [ ] Plugin manager
|
|
237
|
+
- [ ] Testing framework
|
|
238
|
+
|
|
239
|
+
### Phase 1: Email Mastery
|
|
240
|
+
|
|
241
|
+
**Goal:** Replace mutt
|
|
242
|
+
|
|
243
|
+
- Gmail plugin (OAuth2)
|
|
244
|
+
- Generic IMAP/SMTP
|
|
245
|
+
- Thread view
|
|
246
|
+
- HTML rendering
|
|
247
|
+
- Attachments
|
|
248
|
+
- Search
|
|
249
|
+
|
|
250
|
+
### Phase 2: Chat Platforms
|
|
251
|
+
|
|
252
|
+
**Goal:** Replace weechat
|
|
253
|
+
|
|
254
|
+
- Slack
|
|
255
|
+
- Discord
|
|
256
|
+
- Telegram
|
|
257
|
+
- IRC
|
|
258
|
+
- Real-time streaming
|
|
259
|
+
|
|
260
|
+
### Phase 3: Social & News
|
|
261
|
+
|
|
262
|
+
**Goal:** Replace newsboat and reddit clients
|
|
263
|
+
|
|
264
|
+
- RSS/Atom feeds
|
|
265
|
+
- Reddit integration
|
|
266
|
+
- Mastodon
|
|
267
|
+
- Hacker News
|
|
268
|
+
|
|
269
|
+
### Phase 4: Proprietary Messengers
|
|
270
|
+
|
|
271
|
+
**Goal:** Bridge to closed ecosystems
|
|
272
|
+
|
|
273
|
+
- WhatsApp
|
|
274
|
+
- Facebook Messenger
|
|
275
|
+
- Signal (if possible)
|
|
276
|
+
|
|
277
|
+
### Phase 5: Advanced Features
|
|
278
|
+
|
|
279
|
+
**Goal:** Beyond replacement - innovation
|
|
280
|
+
|
|
281
|
+
- Unified search
|
|
282
|
+
- Smart filters
|
|
283
|
+
- Automation/scripting
|
|
284
|
+
- Notifications
|
|
285
|
+
|
|
286
|
+
### Phase 6: Polish & Distribution
|
|
287
|
+
|
|
288
|
+
**Goal:** Production-ready for mass adoption
|
|
289
|
+
|
|
290
|
+
- Installation wizard
|
|
291
|
+
- Migration tools
|
|
292
|
+
- Documentation
|
|
293
|
+
- Package distribution
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Timeline
|
|
298
|
+
|
|
299
|
+
### Minimum Viable Product
|
|
300
|
+
|
|
301
|
+
- Phase 0: Foundation
|
|
302
|
+
- Phase 1: Email only (Gmail + IMAP)
|
|
303
|
+
- Phase 2: Slack + Discord only
|
|
304
|
+
|
|
305
|
+
### Realistic Release
|
|
306
|
+
|
|
307
|
+
- All 6 phases complete
|
|
308
|
+
- Full testing
|
|
309
|
+
- Complete documentation
|
|
310
|
+
- Community feedback incorporated
|
|
311
|
+
|
|
312
|
+
### Aggressive
|
|
313
|
+
|
|
314
|
+
- All 6 phases complete
|
|
315
|
+
- Minimal testing
|
|
316
|
+
- Basic documentation
|
|
317
|
+
- **Not recommended** - quality over speed
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Contributing
|
|
322
|
+
|
|
323
|
+
### How to Get Started
|
|
324
|
+
|
|
325
|
+
1. Read **PROJECT_PLAN.md** to understand the vision
|
|
326
|
+
2. Read **ARCHITECTURE.md** to understand the structure
|
|
327
|
+
3. Read **DEVELOPMENT_WORKFLOW.md** to set up your environment
|
|
328
|
+
4. Pick an issue labeled "good first issue"
|
|
329
|
+
5. Submit a PR following the workflow
|
|
330
|
+
|
|
331
|
+
### Where to Contribute
|
|
332
|
+
|
|
333
|
+
**Code:**
|
|
334
|
+
- Core components (Foundation phase)
|
|
335
|
+
- New plugins (any platform)
|
|
336
|
+
- UI improvements
|
|
337
|
+
- Test coverage
|
|
338
|
+
|
|
339
|
+
**Documentation:**
|
|
340
|
+
- User guides
|
|
341
|
+
- API documentation
|
|
342
|
+
- Tutorials
|
|
343
|
+
- Examples
|
|
344
|
+
|
|
345
|
+
**Testing:**
|
|
346
|
+
- Manual testing
|
|
347
|
+
- Bug reports
|
|
348
|
+
- Performance testing
|
|
349
|
+
- Security review
|
|
350
|
+
|
|
351
|
+
**Community:**
|
|
352
|
+
- Answer questions
|
|
353
|
+
- Review PRs
|
|
354
|
+
- Write blog posts
|
|
355
|
+
- Create videos
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Getting Help
|
|
360
|
+
|
|
361
|
+
### Resources
|
|
362
|
+
|
|
363
|
+
- **GitHub Issues** - Bug reports and feature requests
|
|
364
|
+
- **GitHub Discussions** - Questions and ideas
|
|
365
|
+
- **IRC** - `#heathrow` on Libera.Chat (coming soon)
|
|
366
|
+
- **Discord** - Heathrow community server (coming soon)
|
|
367
|
+
|
|
368
|
+
### FAQs
|
|
369
|
+
|
|
370
|
+
**Q: When will Heathrow be ready for daily use?**
|
|
371
|
+
|
|
372
|
+
A: We're targeting MVP (email + basic chat) soon, with full 1.0 following. Watch the repo for updates!
|
|
373
|
+
|
|
374
|
+
**Q: Can I use Heathrow now?**
|
|
375
|
+
|
|
376
|
+
A: Not yet. We're in Phase 0 (Foundation). Stay tuned!
|
|
377
|
+
|
|
378
|
+
**Q: How can I help?**
|
|
379
|
+
|
|
380
|
+
A: See CONTRIBUTING.md (coming soon). For now, star the repo and spread the word!
|
|
381
|
+
|
|
382
|
+
**Q: Will Heathrow support platform X?**
|
|
383
|
+
|
|
384
|
+
A: If it can be integrated via plugin, yes! See PLUGIN_SYSTEM.md for how to create one.
|
|
385
|
+
|
|
386
|
+
**Q: Why terminal/CLI only?**
|
|
387
|
+
|
|
388
|
+
A: Focus and simplicity. Power users love the terminal. Web/GUI could come later as separate projects.
|
|
389
|
+
|
|
390
|
+
**Q: Is this production-ready?**
|
|
391
|
+
|
|
392
|
+
A: No. Currently in early development (Phase 0). Do not use for critical communications yet.
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## License
|
|
397
|
+
|
|
398
|
+
MIT License - See LICENSE file
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Credits
|
|
403
|
+
|
|
404
|
+
**Inspired by:**
|
|
405
|
+
- mutt - Email client that taught us email can be beautiful in the terminal
|
|
406
|
+
- weechat - IRC client with perfect UX
|
|
407
|
+
- newsboat - RSS reader with clean design
|
|
408
|
+
- RTFM - The perfect rcurses reference implementation
|
|
409
|
+
|
|
410
|
+
**Built with:**
|
|
411
|
+
- Ruby - Beautiful, expressive language
|
|
412
|
+
- SQLite - Reliable, embedded database
|
|
413
|
+
- rcurses - Terminal UI library
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
**Welcome to Heathrow - Where all your messages connect!**
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Reddit Setup Guide for Heathrow
|
|
2
|
+
|
|
3
|
+
This guide will help you set up Reddit as a source in Heathrow to monitor subreddit posts and optionally your private messages.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Subreddit Posts**: Monitor multiple subreddits for new posts
|
|
8
|
+
- **Comments**: Optionally fetch top comments on posts
|
|
9
|
+
- **Private Messages**: Read your Reddit inbox (requires authentication)
|
|
10
|
+
- **Rich Content**: Handles images, videos, and Reddit galleries
|
|
11
|
+
- **Metadata**: Includes post scores, comment counts, and flairs
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
You need a Reddit application to use the Reddit API. If you don't have one, follow the setup below.
|
|
16
|
+
|
|
17
|
+
## Creating a Reddit Application
|
|
18
|
+
|
|
19
|
+
### 1. Go to Reddit App Preferences
|
|
20
|
+
- Navigate to https://www.reddit.com/prefs/apps
|
|
21
|
+
- Log in with your Reddit account
|
|
22
|
+
|
|
23
|
+
### 2. Create a New App
|
|
24
|
+
- Click "Create App" or "Create Another App"
|
|
25
|
+
- Fill in:
|
|
26
|
+
- **Name**: Your app name (e.g., "Heathrow Integration")
|
|
27
|
+
- **App type**: Choose "script" for full features or "web app" for read-only
|
|
28
|
+
- **Description**: Brief description
|
|
29
|
+
- **About URL**: (optional)
|
|
30
|
+
- **Redirect URI**: http://localhost:8080 (required but not used)
|
|
31
|
+
|
|
32
|
+
### 3. Save Your Credentials
|
|
33
|
+
- **Client ID**: The short string under your app name
|
|
34
|
+
- **Client Secret**: The longer "secret" string
|
|
35
|
+
|
|
36
|
+
## Quick Setup
|
|
37
|
+
|
|
38
|
+
Run the setup script:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
ruby setup_reddit_sources.rb
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This will:
|
|
45
|
+
1. Add a Reddit Posts source monitoring r/programming, r/ruby, r/linux, r/vim
|
|
46
|
+
2. Optionally set up private messages (requires username/password)
|
|
47
|
+
|
|
48
|
+
## Manual Setup in Heathrow
|
|
49
|
+
|
|
50
|
+
1. In Heathrow, press 's' for Sources
|
|
51
|
+
2. Press 'a' to add a new source
|
|
52
|
+
3. Choose "Reddit"
|
|
53
|
+
4. Fill in the configuration:
|
|
54
|
+
|
|
55
|
+
### For Subreddit Posts:
|
|
56
|
+
|
|
57
|
+
- **Account Name**: Reddit Posts (or any name you prefer)
|
|
58
|
+
- **Client ID**: Your Reddit app's client ID
|
|
59
|
+
- **Client Secret**: Your Reddit app's client secret
|
|
60
|
+
- **User Agent**: Descriptive string (e.g., "Heathrow/1.0 by /u/yourusername")
|
|
61
|
+
- **Mode**: subreddit
|
|
62
|
+
- **Subreddits**: Comma-separated list (e.g., "programming,ruby,linux")
|
|
63
|
+
- **Fetch Limit**: Posts per subreddit (default: 25)
|
|
64
|
+
- **Include Comments**: true/false (fetch top comments)
|
|
65
|
+
- **Check Interval**: Seconds between checks (e.g., 300 for 5 minutes)
|
|
66
|
+
|
|
67
|
+
### For Private Messages:
|
|
68
|
+
|
|
69
|
+
- **Account Name**: Reddit Messages
|
|
70
|
+
- **Client ID**: Your Reddit app's client ID
|
|
71
|
+
- **Client Secret**: Your Reddit app's client secret
|
|
72
|
+
- **User Agent**: Descriptive string
|
|
73
|
+
- **Mode**: messages
|
|
74
|
+
- **Username**: Your Reddit username
|
|
75
|
+
- **Password**: Your Reddit password
|
|
76
|
+
- **Check Interval**: Seconds between checks (e.g., 180 for 3 minutes)
|
|
77
|
+
|
|
78
|
+
## Configuration Examples
|
|
79
|
+
|
|
80
|
+
### Monitor Specific Subreddits
|
|
81
|
+
```ruby
|
|
82
|
+
{
|
|
83
|
+
mode: 'subreddit',
|
|
84
|
+
subreddits: 'programming,webdev,javascript',
|
|
85
|
+
fetch_limit: 30,
|
|
86
|
+
include_comments: false
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Monitor with Comments
|
|
91
|
+
```ruby
|
|
92
|
+
{
|
|
93
|
+
mode: 'subreddit',
|
|
94
|
+
subreddits: 'askreddit',
|
|
95
|
+
fetch_limit: 10,
|
|
96
|
+
include_comments: true # Fetches top 5 comments per post
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Private Messages Only
|
|
101
|
+
```ruby
|
|
102
|
+
{
|
|
103
|
+
mode: 'messages',
|
|
104
|
+
username: 'your_reddit_username',
|
|
105
|
+
password: 'your_reddit_password'
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Testing the Connection
|
|
110
|
+
|
|
111
|
+
After adding a Reddit source:
|
|
112
|
+
1. Go to Sources view (press 's')
|
|
113
|
+
2. Navigate to your Reddit source
|
|
114
|
+
3. Press 't' to test the connection
|
|
115
|
+
4. You should see "Connected with read-only access" or "Connected as u/username"
|
|
116
|
+
|
|
117
|
+
## Content Types
|
|
118
|
+
|
|
119
|
+
The Reddit source handles various content types:
|
|
120
|
+
|
|
121
|
+
- **Text Posts**: Full self-text content
|
|
122
|
+
- **Link Posts**: URL with preview
|
|
123
|
+
- **Images**: Direct image links and Reddit-hosted images
|
|
124
|
+
- **Galleries**: Multiple images in a single post
|
|
125
|
+
- **Videos**: Reddit-hosted videos
|
|
126
|
+
- **Comments**: Top comments if enabled
|
|
127
|
+
|
|
128
|
+
## Troubleshooting
|
|
129
|
+
|
|
130
|
+
### "401 Unauthorized" Error
|
|
131
|
+
- Check your client_id and client_secret
|
|
132
|
+
- Ensure they match your Reddit app exactly
|
|
133
|
+
|
|
134
|
+
### No Messages Appearing
|
|
135
|
+
- Reddit API has rate limits - wait a few minutes
|
|
136
|
+
- Check subreddit names are spelled correctly
|
|
137
|
+
- Try testing the connection with 't' key
|
|
138
|
+
|
|
139
|
+
### Private Messages Not Working
|
|
140
|
+
- Requires "script" app type on Reddit
|
|
141
|
+
- Username and password must be correct
|
|
142
|
+
- 2FA may need to be temporarily disabled
|
|
143
|
+
|
|
144
|
+
### Rate Limiting
|
|
145
|
+
- Reddit limits API requests to 60 per minute
|
|
146
|
+
- Set reasonable polling intervals (minimum 60 seconds)
|
|
147
|
+
- Avoid fetching too many posts or comments at once
|
|
148
|
+
|
|
149
|
+
## Security Notes
|
|
150
|
+
|
|
151
|
+
- Client credentials are stored locally in Heathrow's database
|
|
152
|
+
- For private messages, your Reddit password is stored
|
|
153
|
+
- Consider using a dedicated Reddit account for Heathrow
|
|
154
|
+
- The app only needs read access for subreddit posts
|
|
155
|
+
|
|
156
|
+
## Advanced Features
|
|
157
|
+
|
|
158
|
+
### Filter by Flair
|
|
159
|
+
You can modify the source to filter posts by flair - useful for subreddits that use flair for categorization.
|
|
160
|
+
|
|
161
|
+
### Sort Options
|
|
162
|
+
The source fetches "hot" posts by default. Can be modified to fetch "new", "top", or "rising" posts.
|
|
163
|
+
|
|
164
|
+
### Comment Depth
|
|
165
|
+
Currently fetches top 5 comments. Can be adjusted in the source code.
|
|
166
|
+
|
|
167
|
+
## API Limits
|
|
168
|
+
|
|
169
|
+
Reddit's API has the following limits:
|
|
170
|
+
- 60 requests per minute for OAuth clients
|
|
171
|
+
- 100 items maximum per request
|
|
172
|
+
- Some endpoints require authentication
|
|
173
|
+
|
|
174
|
+
The Heathrow Reddit source respects these limits automatically.
|