Skip to content

Commit

Permalink
Added an https option at login.
Browse files Browse the repository at this point in the history
  • Loading branch information
primetime43 committed Aug 29, 2021
1 parent 76ed502 commit 02c9226
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion X-IPTV/UserLogin.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ xmlns:xctw="clr-namespace:Xceed.Wpf.Toolkit.Themes.Windows10;assembly=Xceed.Wpf.
<TextBox x:Name="serverTxt" HorizontalAlignment="Left" Height="23" Margin="363,180,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120"/>
<TextBox x:Name="portTxt" HorizontalAlignment="Left" Height="23" Margin="363,211,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120"/>
<Button x:Name="con_btn" Content="Connect" HorizontalAlignment="Left" Margin="301,270,0,0" VerticalAlignment="Top" Width="143" Height="25" Click="Con_btn_Click"/>
<xc:BusyIndicator x:Name="busy_ind" IsBusy="False" BusyContent="Authenticating..."></xc:BusyIndicator>
<xc:BusyIndicator x:Name="busy_ind" IsBusy="False" BusyContent="Authenticating...">
<CheckBox x:Name="protocolCheckBox" Content="HTTPS" HorizontalAlignment="Left" Height="20" Margin="495,185,0,0" VerticalAlignment="Top" Width="90" ToolTip="HTTP will be used by default if not checked"/>
</xc:BusyIndicator>
</Grid>
</Window>
14 changes: 11 additions & 3 deletions X-IPTV/UserLogin.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ private async void Con_btn_Click(object sender, RoutedEventArgs e)
private async Task Connect(string user, string pass, string server, string port)
{
// Create a request for the URL.
WebRequest request = WebRequest.Create($"http://{server}:{port}/player_api.php?username={user}&password={pass}");
WebRequest request;
if ((bool)protocolCheckBox.IsChecked)//use the https protocol
request = WebRequest.Create($"https://{server}:{port}/player_api.php?username={user}&password={pass}");
else//use the http protocol
request = WebRequest.Create($"http://{server}:{port}/player_api.php?username={user}&password={pass}");
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
Expand Down Expand Up @@ -75,8 +79,12 @@ private async Task Connect(string user, string pass, string server, string port)

private async Task LoadChannels(string user, string pass, string server, string port)
{
// Create a request for the URL.
WebRequest request = WebRequest.Create($"http://{server}:{port}/player_api.php?username={user}&password={pass}&action=get_live_streams");
// Create a request for the URL.
WebRequest request;
if ((bool)protocolCheckBox.IsChecked)//use the https protocol
request = WebRequest.Create($"https://{server}:{port}/player_api.php?username={user}&password={pass}&action=get_live_streams");
else//use the http protocol
request = WebRequest.Create($"http://{server}:{port}/player_api.php?username={user}&password={pass}&action=get_live_streams");
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
Expand Down

0 comments on commit 02c9226

Please sign in to comment.