adjusted to api requirements

adjusted to api requirements
This commit is contained in:
hama3254 2024-04-21 10:35:49 +02:00
parent 31aa603e74
commit 8f3b4f4108
10 changed files with 450 additions and 3 deletions

Binary file not shown.

View File

@ -44,6 +44,16 @@ Public Class Anime_Add
Private Sub Anime_Add_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Main.Mail = Nothing And My.Settings.Mail = "na" Then
'Dim Login As Form = LoginForm
'Login.StartPosition = 0
'Login.Location = New Point(CInt(Main.Location.X + Main.Width / 2 - Me.Width / 2), CInt(Main.Location.Y + Main.Height / 2 - Me.Height / 2))
LoginForm.ShowDialog()
ElseIf Main.Mail = Nothing Then
Main.Mail = My.Settings.Mail
Main.PW = My.Settings.PW
End If
DownloadScope.SelectedIndex = Main.DownloadScope
Manager.Owner = Me

View File

@ -156,6 +156,12 @@
<setting name="FixCRStream" serializeAs="String">
<value>True</value>
</setting>
<setting name="Mail" serializeAs="String">
<value>na</value>
</setting>
<setting name="PW" serializeAs="String">
<value>na</value>
</setting>
</Crunchyroll_Downloader.My.MySettings>
</userSettings>
</configuration>

View File

@ -151,6 +151,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CRD-Classes.vb" />
<Compile Include="LoginForm.Designer.vb">
<DependentUpon>LoginForm.vb</DependentUpon>
</Compile>
<Compile Include="LoginForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="ffmpeg_option.Designer.vb">
<DependentUpon>ffmpeg_option.vb</DependentUpon>
</Compile>
@ -234,6 +240,9 @@
<Compile Include="Subfolder.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LoginForm.resx">
<DependentUpon>LoginForm.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ffmpeg_option.resx">
<DependentUpon>ffmpeg_option.vb</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,196 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class LoginForm
Inherits MetroFramework.Forms.MetroForm
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.Save = New MetroFramework.Controls.MetroCheckBox()
Me.IssueLink = New MetroFramework.Controls.MetroLink()
Me.PW = New MetroFramework.Controls.MetroTextBox()
Me.Mail = New MetroFramework.Controls.MetroTextBox()
Me.StatusLabel = New MetroFramework.Controls.MetroLabel()
Me.Delay = New System.Windows.Forms.Timer(Me.components)
Me.Btn_Save = New System.Windows.Forms.Button()
Me.GroupBox3.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox3
'
Me.GroupBox3.BackColor = System.Drawing.Color.Transparent
Me.GroupBox3.Controls.Add(Me.Btn_Save)
Me.GroupBox3.Controls.Add(Me.Save)
Me.GroupBox3.Controls.Add(Me.IssueLink)
Me.GroupBox3.Controls.Add(Me.PW)
Me.GroupBox3.Controls.Add(Me.Mail)
Me.GroupBox3.Controls.Add(Me.StatusLabel)
Me.GroupBox3.Location = New System.Drawing.Point(13, 60)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(480, 308)
Me.GroupBox3.TabIndex = 38
Me.GroupBox3.TabStop = False
'
'Save
'
Me.Save.AutoSize = True
Me.Save.FontSize = MetroFramework.MetroCheckBoxSize.Medium
Me.Save.Location = New System.Drawing.Point(177, 203)
Me.Save.Name = "Save"
Me.Save.Size = New System.Drawing.Size(129, 19)
Me.Save.TabIndex = 2
Me.Save.Text = "Remember Login"
Me.Save.UseSelectable = True
'
'IssueLink
'
Me.IssueLink.FontSize = MetroFramework.MetroLinkSize.Medium
Me.IssueLink.Location = New System.Drawing.Point(166, 72)
Me.IssueLink.Name = "IssueLink"
Me.IssueLink.Size = New System.Drawing.Size(149, 23)
Me.IssueLink.TabIndex = 41
Me.IssueLink.Text = "See here: Github"
Me.IssueLink.UseSelectable = True
'
'PW
'
'
'
'
Me.PW.CustomButton.Image = Nothing
Me.PW.CustomButton.Location = New System.Drawing.Point(138, 1)
Me.PW.CustomButton.Name = ""
Me.PW.CustomButton.Size = New System.Drawing.Size(21, 21)
Me.PW.CustomButton.Style = MetroFramework.MetroColorStyle.Blue
Me.PW.CustomButton.TabIndex = 1
Me.PW.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light
Me.PW.CustomButton.UseSelectable = True
Me.PW.CustomButton.Visible = False
Me.PW.FontSize = MetroFramework.MetroTextBoxSize.Medium
Me.PW.Lines = New String() {"Password"}
Me.PW.Location = New System.Drawing.Point(165, 140)
Me.PW.MaxLength = 32767
Me.PW.Name = "PW"
Me.PW.PasswordChar = Global.Microsoft.VisualBasic.ChrW(9679)
Me.PW.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.PW.SelectedText = ""
Me.PW.SelectionLength = 0
Me.PW.SelectionStart = 0
Me.PW.ShortcutsEnabled = True
Me.PW.Size = New System.Drawing.Size(160, 23)
Me.PW.TabIndex = 1
Me.PW.Text = "Password"
Me.PW.UseSelectable = True
Me.PW.UseSystemPasswordChar = True
Me.PW.WaterMarkColor = System.Drawing.Color.FromArgb(CType(CType(109, Byte), Integer), CType(CType(109, Byte), Integer), CType(CType(109, Byte), Integer))
Me.PW.WaterMarkFont = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel)
'
'Mail
'
'
'
'
Me.Mail.CustomButton.Image = Nothing
Me.Mail.CustomButton.Location = New System.Drawing.Point(138, 1)
Me.Mail.CustomButton.Name = ""
Me.Mail.CustomButton.Size = New System.Drawing.Size(21, 21)
Me.Mail.CustomButton.Style = MetroFramework.MetroColorStyle.Blue
Me.Mail.CustomButton.TabIndex = 1
Me.Mail.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light
Me.Mail.CustomButton.UseSelectable = True
Me.Mail.CustomButton.Visible = False
Me.Mail.FontSize = MetroFramework.MetroTextBoxSize.Medium
Me.Mail.Lines = New String() {"E-Mail"}
Me.Mail.Location = New System.Drawing.Point(165, 101)
Me.Mail.MaxLength = 32767
Me.Mail.Name = "Mail"
Me.Mail.PasswordChar = Global.Microsoft.VisualBasic.ChrW(0)
Me.Mail.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.Mail.SelectedText = ""
Me.Mail.SelectionLength = 0
Me.Mail.SelectionStart = 0
Me.Mail.ShortcutsEnabled = True
Me.Mail.Size = New System.Drawing.Size(160, 23)
Me.Mail.TabIndex = 0
Me.Mail.Text = "E-Mail"
Me.Mail.UseSelectable = True
Me.Mail.WaterMarkColor = System.Drawing.Color.FromArgb(CType(CType(109, Byte), Integer), CType(CType(109, Byte), Integer), CType(CType(109, Byte), Integer))
Me.Mail.WaterMarkFont = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel)
'
'StatusLabel
'
Me.StatusLabel.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.StatusLabel.BackColor = System.Drawing.Color.Transparent
Me.StatusLabel.FontSize = MetroFramework.MetroLabelSize.Tall
Me.StatusLabel.FontWeight = MetroFramework.MetroLabelWeight.Regular
Me.StatusLabel.ForeColor = System.Drawing.Color.Black
Me.StatusLabel.Location = New System.Drawing.Point(6, 16)
Me.StatusLabel.Name = "StatusLabel"
Me.StatusLabel.Size = New System.Drawing.Size(468, 53)
Me.StatusLabel.TabIndex = 34
Me.StatusLabel.Text = "For the changed switch API i need the direct login now"
Me.StatusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Delay
'
Me.Delay.Interval = 2000
'
'Btn_Save
'
Me.Btn_Save.BackColor = System.Drawing.Color.Transparent
Me.Btn_Save.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.Btn_Save.Cursor = System.Windows.Forms.Cursors.Hand
Me.Btn_Save.FlatAppearance.BorderSize = 0
Me.Btn_Save.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent
Me.Btn_Save.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Btn_Save.Image = Global.Crunchyroll_Downloader.My.Resources.Resources.DialogNotFound_Submit
Me.Btn_Save.ImeMode = System.Windows.Forms.ImeMode.NoControl
Me.Btn_Save.Location = New System.Drawing.Point(165, 246)
Me.Btn_Save.Name = "Btn_Save"
Me.Btn_Save.Size = New System.Drawing.Size(150, 40)
Me.Btn_Save.TabIndex = 3
Me.Btn_Save.UseVisualStyleBackColor = False
'
'LoginForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(507, 379)
Me.Controls.Add(Me.GroupBox3)
Me.Name = "LoginForm"
Me.Text = "CRD-Login"
Me.TextAlign = MetroFramework.Forms.MetroFormTextAlign.Center
Me.GroupBox3.ResumeLayout(False)
Me.GroupBox3.PerformLayout()
Me.ResumeLayout(False)
End Sub
Private WithEvents GroupBox3 As GroupBox
Public WithEvents StatusLabel As MetroFramework.Controls.MetroLabel
Friend WithEvents Delay As Timer
Friend WithEvents PW As MetroFramework.Controls.MetroTextBox
Friend WithEvents Mail As MetroFramework.Controls.MetroTextBox
Friend WithEvents IssueLink As MetroFramework.Controls.MetroLink
Friend WithEvents Save As MetroFramework.Controls.MetroCheckBox
Friend WithEvents Btn_Save As Button
End Class

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Delay.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,66 @@
Option Strict On
Imports Crunchyroll_Downloader.CRD_Classes
Imports MetroFramework.Components
Public Class LoginForm
Dim Manager As MetroStyleManager = Main.Manager
Private Sub Reso_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Me.TopMost = True
Manager.Owner = Me
Me.StyleManager = Manager
Me.StartPosition = 0
Try
Me.Icon = My.Resources.icon
Catch ex As Exception
End Try
Me.Location = New Point(CInt(Main.Location.X + Main.Width / 2 - Me.Width / 2), CInt(Main.Location.Y + Main.Height / 2 - Me.Height / 2))
'MsgBox(CInt(Main.Location.X + Main.Width / 2 - Me.Width / 2).ToString)
End Sub
Private Sub Btn_Save_Click(sender As Object, e As EventArgs) Handles Btn_Save.Click
If PW.Text = "Password" Or Mail.Text = "E-Mail" Then
MsgBox("Invalid Input", MsgBoxStyle.Information)
Exit Sub
ElseIf Save.Checked = True Then
My.Settings.Mail = Mail.Text
My.Settings.PW = PW.Text
End If
Main.PW = PW.Text
Main.Mail = Mail.Text
Me.Close()
End Sub
Private Sub Submit_MouseEnter(sender As Object, e As EventArgs) Handles Btn_Save.MouseEnter
Btn_Save.Image = My.Resources.DialogNotFound_Submit_hover
End Sub
Private Sub Submit_MouseLeave(sender As Object, e As EventArgs) Handles Btn_Save.MouseLeave
Btn_Save.Image = My.Resources.DialogNotFound_Submit
End Sub
Private Sub MetroLink1_Click(sender As Object, e As EventArgs) Handles IssueLink.Click
Process.Start("https://github.com/hama3254/Crunchyroll-Downloader-v3.0/issues/938#issuecomment-2067383212")
End Sub
Private Sub PW_Click(sender As Object, e As EventArgs) Handles PW.Click
If PW.Text = "Password" Then
PW.Text = Nothing
End If
End Sub
Private Sub Mail_Click(sender As Object, e As EventArgs) Handles Mail.Click
If Mail.Text = "E-Mail" Then
Mail.Text = Nothing
End If
End Sub
End Class

View File

@ -42,7 +42,10 @@ Public Class Main
'Public CrBetaMassParameters As String = Nothing
'Public CrBetaMassBaseURL As String = Nothing
Public CrBetaBasic As String = Nothing
Public Mail As String = Nothing
Public PW As String = Nothing
Public CrBetaBasic As String = "Basic dC1rZGdwMmg4YzNqdWI4Zm4wZnE6eWZMRGZNZnJZdktYaDRKWFMxTEVJMmNDcXUxdjVXYW4="
Public locale As String = Nothing
Public Url_locale As String = Nothing
'Public CrBetaObjects As String = Nothing
@ -505,7 +508,7 @@ Public Class Main
Reso = My.Settings.Reso
If Reso = 42 Then
MsgBox("Resolution [Auto] is no longer supportet." + vbNewLine + "Please select a valid Resolution inside the settings.", MsgBoxStyle.Information)
MsgBox("Resolution [Auto] is no longer supported." + vbNewLine + "Please select a valid Resolution inside the settings.", MsgBoxStyle.Information)
End If
LeadingZero = My.Settings.LeadingZero
@ -3095,8 +3098,10 @@ Public Class Main
#End Region
Dim Auth As String = " -H " + Chr(34) + "Authorization: " + CrBetaBasic + Chr(34)
Dim Post As String = " -d " + Chr(34) + "grant_type=etp_rt_cookie" + Chr(34) + " -X POST"
'Dim Post As String = " -d " + Chr(34) + "grant_type=etp_rt_cookie" + Chr(34) + " -X POST"
Dim Post As String = " -d " + Chr(34) + "username=" + Mail + "&password=" + PW + "&grant_type=password&scope=offline_access" + Chr(34) + " -X POST"
'
Dim CRBetaBearer As String = "Bearer "
@ -3105,6 +3110,8 @@ Public Class Main
If CBool(InStr(v1Token, "curl:")) = True And CBool(InStr(v1Token, "400")) = True Then
Debug.WriteLine("Post error!, 400")
Post = " -d " + Chr(34) + "grant_type=client_id&scope=offline_access" + Chr(34) + " -X POST"
Debug.WriteLine(Post.Replace("etp_rt_cookie", "client_id"))
v1Token = CurlPost("https://www.crunchyroll.com/auth/v1/token", Loc_CR_Cookies, Auth, Post.Replace("etp_rt_cookie", "client_id"), "add_main-4499")

View File

@ -594,6 +594,30 @@ Namespace My
Me("FixCRStream") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("na")> _
Public Property Mail() As String
Get
Return CType(Me("Mail"),String)
End Get
Set
Me("Mail") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("na")> _
Public Property PW() As String
Get
Return CType(Me("PW"),String)
End Get
Set
Me("PW") = value
End Set
End Property
End Class
End Namespace

View File

@ -137,5 +137,11 @@
<Setting Name="FixCRStream" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Mail" Type="System.String" Scope="User">
<Value Profile="(Default)">na</Value>
</Setting>
<Setting Name="PW" Type="System.String" Scope="User">
<Value Profile="(Default)">na</Value>
</Setting>
</Settings>
</SettingsFile>