Updates to finally secure the Twitch codes so i don't have to keep adding them for compile and removing them for Source Distribution. fixed a Bug in the notification system that ment dismiss did not work.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@
|
||||
/TwitchDesktopNotifications/obj
|
||||
/.vs
|
||||
/TwitchDesktopNotifications/App.config
|
||||
/TwitchDesktopNotifications/TwitchDetails.cs
|
||||
|
||||
15
Readme.md
15
Readme.md
@@ -11,10 +11,17 @@ Want to contribute? Great!
|
||||
|
||||
Project is built using Visual Studios 2022,
|
||||
|
||||
You need to create Application to obtain a ID and Secret on [Twitch Developer Console](https://dev.twitch.tv/console) replace lines 15 and 16 in TwitchFetcher.cs
|
||||
```pwsh
|
||||
TwitchClientID = "";
|
||||
TwitchClientSecret = "";
|
||||
You need to create Application to obtain a ID and Secret on [Twitch Developer Console](https://dev.twitch.tv/console)
|
||||
Add a new C# Class to the project named `TwitchDetails.cs` add the following code with your ID and Secret
|
||||
```cs
|
||||
namespace TwitchDesktopNotifications
|
||||
{
|
||||
static public class TwitchDetails
|
||||
{
|
||||
public static string TwitchClientID = "";
|
||||
public static string TwitchClientSecret = "";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### CommunityToolkit 8.0.0 Pre-release
|
||||
|
||||
@@ -22,10 +22,18 @@ namespace TwitchDesktopNotifications.Core
|
||||
|
||||
try
|
||||
{
|
||||
if (
|
||||
// action is defined and set to watch
|
||||
( args.Contains("action") && args["action"] == "watch" )
|
||||
||
|
||||
// action is not defined so the user just generally clicked on the notification
|
||||
!args.Contains("action")
|
||||
){
|
||||
Process myProcess = new Process();
|
||||
myProcess.StartInfo.UseShellExecute = true;
|
||||
myProcess.StartInfo.FileName = args["streamerUrl"];
|
||||
myProcess.Start();
|
||||
}
|
||||
}catch(Exception ex) { }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,15 +12,10 @@ namespace TwitchDesktopNotifications.Core
|
||||
internal class TwitchFetcher
|
||||
{
|
||||
private TwitchFetcher() {
|
||||
TwitchClientID = "";
|
||||
TwitchClientSecret = "";
|
||||
}
|
||||
|
||||
public static TwitchFetcher instance { get; private set; }
|
||||
|
||||
string TwitchClientID = "";
|
||||
string TwitchClientSecret = "";
|
||||
|
||||
List <StreamsData> currentlyLive = null;
|
||||
|
||||
public string guid { get; private set; }
|
||||
@@ -60,7 +55,7 @@ namespace TwitchDesktopNotifications.Core
|
||||
WebRequest request = WebRequest.Create("https://api.twitch.tv/" + endpoint);
|
||||
request.Method = "GET";
|
||||
request.Headers[HttpRequestHeader.Authorization] = String.Format("Bearer {0}", DataStore.GetInstance().Store.Authentication.AccessToken);
|
||||
request.Headers["Client-ID"] = TwitchClientID;
|
||||
request.Headers["Client-ID"] = TwitchDetails.TwitchClientID;
|
||||
WebResponse response = request.GetResponse();
|
||||
Stream dataStream = response.GetResponseStream();
|
||||
StreamReader reader = new StreamReader(dataStream);
|
||||
@@ -139,8 +134,8 @@ namespace TwitchDesktopNotifications.Core
|
||||
{
|
||||
Dictionary<string, string> postData = new Dictionary<string, string>();
|
||||
|
||||
postData["client_id"] = TwitchClientID;
|
||||
postData["client_secret"] = TwitchClientSecret;
|
||||
postData["client_id"] = TwitchDetails.TwitchClientID;
|
||||
postData["client_secret"] = TwitchDetails.TwitchClientSecret;
|
||||
postData["grant_type"] = "refresh_token";
|
||||
postData["refresh_token"] = DataStore.GetInstance().Store.Authentication.RefreshToken;
|
||||
|
||||
@@ -173,7 +168,7 @@ namespace TwitchDesktopNotifications.Core
|
||||
WebServer.GetInstance().TwitchState = guid;
|
||||
Process myProcess = new Process();
|
||||
myProcess.StartInfo.UseShellExecute = true;
|
||||
myProcess.StartInfo.FileName = String.Format("https://id.twitch.tv/oauth2/authorize?&redirect_uri=http://localhost:32584/twitchRedirect&scope=user:read:subscriptions%20user:read:follows%20user:read:email%20openid&response_type=code&state={0}&nonce={1}&client_id={2}", guid, guid, TwitchClientID);
|
||||
myProcess.StartInfo.FileName = String.Format("https://id.twitch.tv/oauth2/authorize?&redirect_uri=http://localhost:32584/twitchRedirect&scope=user:read:subscriptions%20user:read:follows%20user:read:email%20openid&response_type=code&state={0}&nonce={1}&client_id={2}", guid, guid, TwitchDetails.TwitchClientID);
|
||||
myProcess.Start();
|
||||
}
|
||||
|
||||
@@ -181,8 +176,8 @@ namespace TwitchDesktopNotifications.Core
|
||||
{
|
||||
Dictionary<string, string> postData = new Dictionary<string, string>();
|
||||
|
||||
postData["client_id"] = TwitchClientID;
|
||||
postData["client_secret"] = TwitchClientSecret;
|
||||
postData["client_id"] = TwitchDetails.TwitchClientID;
|
||||
postData["client_secret"] = TwitchDetails.TwitchClientSecret;
|
||||
postData["grant_type"] = "authorization_code";
|
||||
postData["redirect_uri"] = "http://localhost:32584/twitchRedirect";
|
||||
postData["code"] = code;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
Reference in New Issue
Block a user