James Tombleson
9be985da0a
* Found the meta tags on youtube... in the body and updated the client to pull them out. * Updated namespace on test * I think formatting cleaned this up * Seed migrations have been cleaned up to get my configs out and moving them to a script. * Updates to the ISourcesRepository.cs to allow for new calls to the db. * formatter * Db models updated. Icon now can track sourceID and source can have a youtube id. * Updated api logger to ignore otel if no connection string given. * updated docker init so I can run migrations from the image * seed was updated to reflect the new api changes * Updated the SourcesController.cs to grab icon data. * Added reddit const values * Minor changes to HtmlPageReader.cs * Jobs are now pulling in the config section to bundle values. * Removed youtube api, not needed anymore. * test updates
106 lines
3.7 KiB
PowerShell
106 lines
3.7 KiB
PowerShell
#!/usr/local/bin/pwsh
|
|
param (
|
|
[string] $ApiServer = "http://localhost:5011",
|
|
[string] $JsonSecrets = "./seed.secrets.json"
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
function New-RedditSource {
|
|
param (
|
|
[string] $Url
|
|
)
|
|
$urlEncoded = [uri]::EscapeDataString($Url)
|
|
|
|
$param = "url=$urlEncoded"
|
|
$uri = "$ApiServer/api/sources/new/reddit?$param"
|
|
$res = Invoke-RestMethod -Method Post -Uri $uri
|
|
return $res
|
|
}
|
|
|
|
function New-RssSource {
|
|
param (
|
|
[string] $Name,
|
|
[string] $Url
|
|
)
|
|
$urlEncoded = [uri]::EscapeDataString($Url)
|
|
$param = "name=$Name&url=$urlEncoded"
|
|
[string] $uri = "$ApiServer/api/sources/new/rss?$param"
|
|
$res = Invoke-RestMethod -Method Post -Uri $uri
|
|
return $res
|
|
}
|
|
|
|
function New-YoutubeSource {
|
|
param (
|
|
[Parameter(Required)][string] $Url
|
|
)
|
|
$urlEncoded = [uri]::EscapeDataString($Url)
|
|
[string] $param = "url=$urlEncoded"
|
|
[string] $uri = "$ApiServer/api/sources/new/youtube?$param"
|
|
$res = Invoke-RestMethod -Method Post -Uri $uri
|
|
return $res
|
|
}
|
|
|
|
function New-TwitchSource {
|
|
param (
|
|
[string] $Name
|
|
)
|
|
[string] $param = "name=$Name"
|
|
[string] $uri = "$ApiServer/api/sources/new/twitch?$param"
|
|
$res = Invoke-RestMethod -Method Post -Uri $uri
|
|
return $res
|
|
}
|
|
|
|
function New-DiscordWebhook {
|
|
param (
|
|
[string] $Server,
|
|
[string] $Channel,
|
|
[string] $Url
|
|
)
|
|
$urlEncoded = [uri]::EscapeDataString($Url)
|
|
[string] $param = "server=$Server&channel=$Channel&url=$urlEncoded"
|
|
[string] $uri = "$ApiServer/api/discord/webhooks?$param"
|
|
Write-Host $uri
|
|
$res = Invoke-RestMethod -Method Post -Uri $uri
|
|
return $res
|
|
}
|
|
|
|
function New-Subscription {
|
|
param (
|
|
[string] $SourceId,
|
|
[string] $DiscordWebhookId
|
|
)
|
|
[string] $param = "sourceId=$SourceId&discordId=$DiscordWebhookId"
|
|
[string] $uri = "$ApiServer/api/subscriptions?$param"
|
|
$res = Invoke-RestMethod -Method Post -Uri $uri
|
|
return $res
|
|
}
|
|
|
|
# Load Secrets file
|
|
$secrets = Get-Content $JsonSecrets -Raw | ConvertFrom-Json
|
|
|
|
$redditDadJokes = New-RedditSource -Name "dadjokes"
|
|
$redditSteamDeck = New-RedditSource -Name "steamdeck"
|
|
|
|
$rssSteamDeck = New-RssSource -Name "Steampowered - Steam Deck" -Url "https://store.steampowered.com/feeds/news/app/1675200/?cc=US&l=english&snr=1_2108_9__2107"
|
|
$rssFaysHaremporium = New-RssSource -Name "Fay's Haremporium" -Url "https://blog.nyxstudios.moe/rss/"
|
|
$rssPodcastLetsMosley = New-RssSource -Name "Let's Mosley" -Url "https://anchor.fm/s/6c7aa4c4/podcast/rss"
|
|
|
|
$youtubeGameGrumps = New-YoutubeSource -Url "https://www.youtube.com/user/GameGrumps"
|
|
$youtubeCityPlannerPlays = New-YoutubeSource -Url "https://www.youtube.com/c/cityplannerplays"
|
|
$youtubeLinusTechTips = New-YoutubeSource -Url "https://www.youtube.com/@LinusTechTips"
|
|
|
|
$twitchNintendo = NewTwitchSource -Name "Nintendo"
|
|
|
|
$miharuMonitor = New-DiscordWebhook -Server "Miharu Monitor" -Channel "dev" -Url $secrets.MiharuMonitor.dev01
|
|
|
|
New-Subscription -SourceId $redditDadJokes.id -DiscordWebhookId $miharuMonitor.id
|
|
New-Subscription -SourceId $redditSteamDeck.id -DiscordWebhookId $miharuMonitor.id
|
|
New-Subscription -SourceId $rssSteamDeck.id -DiscordWebhookId $miharuMonitor.id
|
|
New-Subscription -SourceId $rssFaysHaremporium.id -DiscordWebhookId $miharuMonitor.id
|
|
New-Subscription -SourceId $rssPodcastLetsMosley.id -DiscordWebhookId $miharuMonitor.id
|
|
New-Subscription -SourceId $youtubeGameGrumps.id -DiscordWebhookId $miharuMonitor.id
|
|
New-Subscription -SourceId $youtubeCityPlannerPlays.id -DiscordWebhookId $miharuMonitor.id
|
|
New-Subscription -SourceId $youtubeLinusTechTips.id -DiscordWebhookId $miharuMonitor.id
|
|
New-Subscription -SourceId $twitchNintendo.id -DiscordWebhookId $miharuMonitor.id
|