Remvoed secrets for Twitch since they don't work

This commit is contained in:
Martin Barker
2023-01-28 02:13:17 +00:00
parent 36ad4fff02
commit b09eb0a641
4 changed files with 40 additions and 34 deletions

View File

@@ -1,6 +1,4 @@
using ABI.System; using System.Diagnostics;
using Microsoft.Extensions.Configuration;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Text; using System.Text;
@@ -14,9 +12,8 @@ namespace TwitchDesktopNotifications.Core
internal class TwitchFetcher internal class TwitchFetcher
{ {
private TwitchFetcher() { private TwitchFetcher() {
var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build(); TwitchClientID = "";
TwitchClientID = config["TwitchClientID"]; TwitchClientSecret = "";
TwitchClientSecret = config["TwitchClientSecret"];
} }
public static TwitchFetcher instance { get; private set; } public static TwitchFetcher instance { get; private set; }

View File

@@ -40,6 +40,10 @@ namespace TwitchDesktopNotifications
String FileName = "store.json"; String FileName = "store.json";
string fileContent = JsonSerializer.Serialize<JsonStructure.Store>(Store); string fileContent = JsonSerializer.Serialize<JsonStructure.Store>(Store);
Console.WriteLine("I'm trying to save:");
Console.WriteLine(fileContent);
Console.WriteLine("to {0}", FilePath + "/" + FileName);
Directory.CreateDirectory(FilePath); Directory.CreateDirectory(FilePath);
File.WriteAllText(FilePath + "/" + FileName, fileContent); File.WriteAllText(FilePath + "/" + FileName, fileContent);
} }

View File

@@ -1,5 +1,6 @@
// See https://aka.ms/new-console-template for more information // See https://aka.ms/new-console-template for more information
using System.Drawing; using System.Drawing;
using System.Reflection.Metadata;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text.Json; using System.Text.Json;
using System.Windows.Controls; using System.Windows.Controls;
@@ -18,7 +19,6 @@ internal class Program
private static NotifyIcon notifyIcon; private static NotifyIcon notifyIcon;
private static ContextMenuStrip cms; private static ContextMenuStrip cms;
public static void Ws_CodeRecived(object? sender, EventArgs e) public static void Ws_CodeRecived(object? sender, EventArgs e)
{ {
ws.CodeRecived -= Ws_CodeRecived; ws.CodeRecived -= Ws_CodeRecived;
@@ -74,36 +74,42 @@ internal class Program
private static async Task Main(string[] args) private static async Task Main(string[] args)
{ {
var timer = new PeriodicTimer(TimeSpan.FromSeconds(10)); try
notifyIcon = new NotifyIcon();
notifyIcon.Icon = new Icon("Assets/icon.ico");
notifyIcon.Text = "Notify";
cms = new ContextMenuStrip();
cms.Items.Add(new ToolStripMenuItem("Reconnect", null, new EventHandler(Reconnect_Click)));
cms.Items.Add(new ToolStripSeparator());
cms.Items.Add(new ToolStripMenuItem("Quit", null, new EventHandler(Quit_Click), "Quit"));
notifyIcon.ContextMenuStrip = cms;
notifyIcon.Visible = true;
if (DataStore.GetInstance().Store.Authentication == null)
{ {
TriggerAuthentication(); var timer = new PeriodicTimer(TimeSpan.FromSeconds(10));
}
new Thread(() => notifyIcon = new NotifyIcon();
{ notifyIcon.Icon = new Icon("Assets/icon.ico");
while (true) notifyIcon.Text = "Twitch Notify";
cms = new ContextMenuStrip();
cms.Items.Add(new ToolStripMenuItem("Reconnect", null, new EventHandler(Reconnect_Click)));
cms.Items.Add(new ToolStripSeparator());
cms.Items.Add(new ToolStripMenuItem("Quit", null, new EventHandler(Quit_Click), "Quit"));
notifyIcon.ContextMenuStrip = cms;
notifyIcon.Visible = true;
if (DataStore.GetInstance().Store.Authentication == null)
{ {
Thread.Sleep(10000); TriggerAuthentication();
TwitchFetcher.GetInstance().GetLiveFollowingUsers();
} }
}).Start();
Application.Run(); new Thread(() =>
{
while (true)
{
Thread.Sleep(10000);
TwitchFetcher.GetInstance().GetLiveFollowingUsers();
}
}).Start();
Application.Run();
}
catch (Exception e) {
Console.WriteLine(e.ToString());
}
} }
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework> <TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
@@ -19,7 +19,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="8.0.0-build.65" /> <PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="8.0.0-build.65" />
</ItemGroup> </ItemGroup>