-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add livestream REST endpoints #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mrdarrengriffin
wants to merge
24
commits into
main
Choose a base branch
from
youtube-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d144070
Add livestream service
mrdarrengriffin 5ff8c27
Potential fix for pull request finding
mrdarrengriffin dfb64ca
Potential fix for pull request finding
mrdarrengriffin 519a220
Potential fix for pull request finding
mrdarrengriffin 290fc9a
Potential fix for pull request finding
mrdarrengriffin 5c9b8d4
Potential fix for pull request finding
mrdarrengriffin e4bbc26
Switch implementation
mrdarrengriffin d12e059
Potential fix for pull request finding
mrdarrengriffin 3bee330
Potential fix for pull request finding
mrdarrengriffin 9cfc4f4
Refactor YouTube feed URL usage to utilize a centralized feedUrl func…
mrdarrengriffin 92b2eb2
Enhance LivestreamService with discovery and reconcile state manageme…
mrdarrengriffin 0284ebb
Refactor error handling in LivestreamService, PubSubController, and P…
mrdarrengriffin 0b463b5
Enhance LivestreamService error handling and ensure deterministic sta…
mrdarrengriffin 6219cb1
Update environment configuration and enhance PubSub handling; require…
mrdarrengriffin 382b0dc
Potential fix for pull request finding
mrdarrengriffin 1d584a1
Potential fix for pull request finding
mrdarrengriffin 14beac1
Potential fix for pull request finding
mrdarrengriffin cf5c20e
Potential fix for pull request finding
mrdarrengriffin 495aeba
Potential fix for pull request finding
mrdarrengriffin 704f106
Potential fix for pull request finding
mrdarrengriffin db0f8c0
Potential fix for pull request finding
mrdarrengriffin 612f960
Potential fix for pull request finding
mrdarrengriffin 849eb22
Potential fix for pull request finding
mrdarrengriffin baab315
Potential fix for pull request finding
mrdarrengriffin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # YouTube Data API v3 key (https://console.cloud.google.com/apis/credentials) | ||
| YOUTUBE_API_KEY= | ||
|
|
||
| # Publicly reachable base URL of this service, used as the WebSub callback | ||
| # target for YouTube push notifications (e.g. https://api.openhomefoundation.org). | ||
| # Leave blank in local dev without a public tunnel; status will still update via | ||
| # the periodic reconcile. | ||
| PUBLIC_BASE_URL= | ||
|
|
||
| # Shared secret for verifying WebSub push payloads (HMAC signature). Required | ||
| # for push notifications: without it the service skips subscriptions and the | ||
| # /pubsub webhook rejects all incoming notifications (403). Generate one with | ||
| # `openssl rand -hex 32`. | ||
| PUBSUB_SECRET= | ||
|
|
||
| # Optional token echoed by the hub during subscription verification. | ||
| # If set, /pubsub GET requires hub.verify_token to match this value. | ||
| PUBSUB_VERIFY_TOKEN= | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ node_modules/ | |
| dist/ | ||
| *.log | ||
| .DS_Store | ||
| .env | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export * from './livestream.channels'; | ||
| export * from './livestream.module'; | ||
| export * from './livestream.service'; | ||
| export * from './pubsub.service'; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| export interface Channel { | ||
| /** URL-safe identifier used in the API path, e.g. "home-assistant". */ | ||
| slug: string; | ||
| /** Human-friendly display name. */ | ||
| name: string; | ||
| /** YouTube handle without the leading "@". */ | ||
| handle: string; | ||
| } | ||
|
|
||
| /** | ||
| * Open Home Foundation project channels tracked for livestreams. | ||
| * Add a new project by appending an entry here — no other code changes needed. | ||
| */ | ||
| export const CHANNELS: readonly Channel[] = [ | ||
| { slug: 'home-assistant', name: 'Home Assistant', handle: 'home_assistant' }, | ||
| { slug: 'esphome', name: 'ESPHome', handle: 'esphomeio' }, | ||
| { | ||
| slug: 'open-home-foundation', | ||
| name: 'Open Home Foundation', | ||
| handle: 'OpenHomeFndn', | ||
| }, | ||
| { | ||
| slug: 'music-assistant', | ||
| name: 'Music Assistant', | ||
| handle: 'musicassistantio', | ||
| }, | ||
| ]; | ||
|
|
||
| /** | ||
| * Canonical YouTube channel RSS feed URL, used both as the discovery source and | ||
| * as the WebSub (PubSubHubbub) subscription topic — keep a single form so the | ||
| * two code paths cannot drift. This is the URL documented for the hub topic: | ||
| * https://developers.google.com/youtube/v3/guides/push_notifications | ||
| */ | ||
| export const feedUrl = (channelId: string): string => | ||
| `https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}`; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Controller, Get, Param } from '@nestjs/common'; | ||
|
|
||
| import { LivestreamInfo, LivestreamService } from './livestream.service'; | ||
|
|
||
| @Controller('livestream') | ||
| export class LivestreamController { | ||
| constructor(private readonly livestream: LivestreamService) {} | ||
|
|
||
| @Get() | ||
| getAll(): LivestreamInfo[] { | ||
| return this.livestream.getAll(); | ||
| } | ||
|
|
||
| @Get(':slug') | ||
| getStatus(@Param('slug') slug: string): LivestreamInfo { | ||
| return this.livestream.getStatus(slug); | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { Module } from '@nestjs/common'; | ||
|
|
||
| import { LivestreamController } from './livestream.controller'; | ||
| import { LivestreamService } from './livestream.service'; | ||
| import { PubSubController } from './pubsub.controller'; | ||
| import { PubSubService } from './pubsub.service'; | ||
|
|
||
| @Module({ | ||
| controllers: [LivestreamController, PubSubController], | ||
| providers: [LivestreamService, PubSubService], | ||
| }) | ||
| export class LivestreamModule {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.