-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relay Server to simplify Twitch configuration (#405)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f84520d
commit 7a114b6
Showing
49 changed files
with
1,216 additions
and
214 deletions.
There are no files selected for viewing
This file contains 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,51 @@ | ||
name: Build and deploy .NET Core application to Function App TagzAppTwitchRelay | ||
on: | ||
push: | ||
branches: [main] | ||
paths: ["src/TagzApp.TwitchRelay/**"] | ||
env: | ||
AZURE_FUNCTIONAPP_NAME: TagzAppTwitchRelay | ||
AZURE_FUNCTIONAPP_PACKAGE_PATH: TagzApp.TwitchRelay/published | ||
CONFIGURATION: Release | ||
DOTNET_CORE_VERSION: 8.0.x | ||
WORKING_DIRECTORY: src/TagzApp.TwitchRelay | ||
DOTNET_CORE_VERSION_INPROC: 6.0.x | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_CORE_VERSION }} | ||
- name: Setup .NET Core (for inproc extensions) | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_CORE_VERSION_INPROC }} | ||
- name: Restore | ||
run: dotnet restore "${{ env.WORKING_DIRECTORY }}" | ||
- name: Build | ||
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore | ||
- name: Publish | ||
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}" | ||
- name: Publish Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: functionapp | ||
path: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Download artifact from build job | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: functionapp | ||
path: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} | ||
- name: Deploy to Azure Function App | ||
uses: Azure/functions-action@v1 | ||
with: | ||
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} | ||
publish-profile: ${{ secrets.TagzAppTwitchRelay_2EC9 }} | ||
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} |
This file contains 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 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,3 @@ | ||
#!/bin/bash | ||
cd ../src/TagzApp.TwitchRelay | ||
func start --cors http://localhost:5000 --port 7082 --csharp |
This file contains 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<Project> | ||
|
||
<ItemGroup> | ||
<!-- <ItemGroup> | ||
<Using Include="TagzApp.Common" /> | ||
<Using Include="TagzApp.Common.Models" /> | ||
</ItemGroup> | ||
</ItemGroup> --> | ||
|
||
</Project> |
This file contains 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 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 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 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 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
52 changes: 52 additions & 0 deletions
52
src/TagzApp.Blazor/Components/Admin/Pages/TwitchRelayReceive.razor
This file contains 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,52 @@ | ||
@page "/Admin/TwitchRelay" | ||
@inject IMessagingService messagingService | ||
|
||
@if (TwitchProvider is null) { | ||
<div class="alert alert-danger" role="alert">Unable to connect to the Twitch Chat provider</div> | ||
} | ||
else | ||
{ | ||
<div class="alert alert-primary" role="alert"> | ||
Connecting TwitchChat with bot name @User | ||
</div> | ||
} | ||
|
||
@code { | ||
|
||
[Parameter, SupplyParameterFromQuery(Name="access_token")] | ||
public string Access_Token { get; set; } | ||
|
||
[Parameter, SupplyParameterFromQuery(Name="user")] | ||
public string User { get; set; } | ||
|
||
private ISocialMediaProvider TwitchProvider { get; set; } | ||
|
||
private IProviderConfiguration Configuration { get; set; } | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
|
||
// Get the Twitch provider and then its configuration | ||
TwitchProvider = messagingService.Providers.FirstOrDefault(p => p.Id == "TWITCH"); | ||
if (TwitchProvider is null) return; | ||
|
||
Configuration = await TwitchProvider.GetConfiguration(ConfigureTagzAppFactory.Current); | ||
|
||
await base.OnInitializedAsync(); | ||
} | ||
|
||
protected override async Task OnParametersSetAsync() | ||
{ | ||
|
||
if (TwitchProvider is null) return; | ||
|
||
// Update the Twitch configuration with the AccessToken and chat bot name returned | ||
Configuration.SetConfigurationByKey("ChatBotName", User); | ||
Configuration.SetConfigurationByKey("OAuthToken", Access_Token); | ||
|
||
await TwitchProvider.SaveConfiguration(ConfigureTagzAppFactory.Current, Configuration); | ||
|
||
} | ||
|
||
|
||
} |
This file contains 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 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 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 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 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 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 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
Oops, something went wrong.