2023.11.9.0

ADD MULTI-ACCOUNT

PluginProvider
IDownloadableMedia: added 'AccountName' property
IPluginContentProvider: added 'AccountName' property
ISiteSettings: added properties: 'AccountName', 'Temporary', 'AvailableText', 'DefaultInstance'; added functions: 'Clone', 'Update', 'Delete'; removed 'Load' function; implement 'IDisposable' interface
PropertyValue: added functions: 'BeginInit', 'EndInit', 'Clone'

YT
YouTubeSettings: make the class compatible for multi-acc
YouTubeMediaContainerBase: add 'AccountName' property

SCrawler
IUserData: add properties: 'HostStatic', 'AccountName'
ProfileSaved: add the ability to download saved posts from all accounts
SiteSettingsBase: add multi-acc support; add 'UserOptionsType' for future purposes; update initializers; update responser initializing; add 'CLONE_PROPERTIES' and 'CloneGetEmptySettingsInstance' functions; 'IDisposable' support
UserDataBase: add multi-acc support; change host retrieval method
DomainsContainer: implements 'IDisposable' interface

API.All sites: add multi-acc support; move the Icon and Image setting to the initializer; update initializer
API.Instagram: change some property types
API.Reddit: set 'AvailableText'; update 'UpdateRedGifsToken' and 'UserOptions' functions
API.Mastodon: remove 'MastodonDomains' class and 'SettingsForm' form; replace 'MastodonDomains' with 'DomainsContainer'; update functions 'IsMyUser' and 'IsMyImageVideo'; update to 'DefaultInstance' environment; update 'UserData.ResetCredentials' function
API.XVIDEOS: update to 'DefaultInstance' environment
API.Xhamster: update to 'DefaultInstance' environment

STDownloader: add multi-acc compatibility

SiteEditorForm: add option 'Download saved posts'; update providers; add additional providers; add multi-acc support

PluginsEnvironment: add 'PClonableAttribute'; add multi-acc support
This commit is contained in:
Andy
2023-11-09 18:10:18 +03:00
parent 6def34d5e9
commit 12c02580f6
76 changed files with 2866 additions and 1586 deletions

View File

@@ -51,6 +51,42 @@ Namespace API.Reddit
Return {CannelsLabelName, CannelsLabelName_ChannelsForm, UserLabelName}
End Get
End Property
Private _RedGifsAccount As String = String.Empty
Friend Property RedGifsAccount As String Implements IRedditView.RedGifsAccount
Get
If Not _RedGifsAccount.IsEmptyString Then
Return _RedGifsAccount
ElseIf Not ChannelInfo Is Nothing Then
Return ChannelInfo.RedGifsAccount
Else
Return String.Empty
End If
End Get
Set(ByVal acc As String)
_RedGifsAccount = acc
End Set
End Property
Private _RedditAccount As String = String.Empty
Friend Property RedditAccount As String Implements IRedditView.RedditAccount
Get
If IsChannelForm Then
Return _RedditAccount
Else
Return MyBase.AccountName
End If
End Get
Set(ByVal acc As String)
_RedditAccount = acc
End Set
End Property
Friend Overrides Property AccountName As String
Get
Return RedditAccount
End Get
Set(ByVal acc As String)
MyBase.AccountName = acc
End Set
End Property
#End Region
#Region "Channels Support"
#Region "IChannelLimits Support"
@@ -72,6 +108,11 @@ Namespace API.Reddit
End With
End Sub
Friend Property AutoGetLimits As Boolean = True Implements IChannelLimits.AutoGetLimits
Private ReadOnly Property IsChannelForm As Boolean
Get
Return Not IsSavedPosts AndAlso IsChannel AndAlso Not ChannelInfo Is Nothing
End Get
End Property
#End Region
Friend Property ChannelInfo As Channel
Private ReadOnly ChannelPostsNames As List(Of String)
@@ -91,6 +132,8 @@ Namespace API.Reddit
If Not Options Is Nothing Then
ViewMode = Options.ViewMode
ViewPeriod = Options.ViewPeriod
RedGifsAccount = Options.RedGifsAccount
RedditAccount = Options.RedditAccount
End If
End Sub
Private ReadOnly Property View As String
@@ -162,6 +205,8 @@ Namespace API.Reddit
ViewPeriod = .Value(Name_ViewPeriod).FromXML(Of Integer)(CInt(CPeriod.All))
IsChannel = .Value(Name_IsChannel).FromXML(Of Boolean)(False)
TrueName = .Value(Name_TrueName)
RedGifsAccount = .Value(Name_RedGifsAccount)
RedditAccount = .Value(Name_RedditAccount)
UpdateNames()
Else
If UpdateNames() Then .Value(Name_LabelsName) = LabelsString
@@ -169,11 +214,13 @@ Namespace API.Reddit
.Add(Name_ViewPeriod, CInt(ViewPeriod))
.Add(Name_IsChannel, IsChannel.BoolToInteger)
.Add(Name_TrueName, TrueName)
.Add(Name_RedGifsAccount, RedGifsAccount)
.Add(Name_RedditAccount, RedditAccount)
End If
End With
End Sub
Friend Overrides Function ExchangeOptionsGet() As Object
Return New RedditViewExchange With {.ViewMode = ViewMode, .ViewPeriod = ViewPeriod}
Return New RedditViewExchange With {.ViewMode = ViewMode, .ViewPeriod = ViewPeriod, .RedGifsAccount = RedGifsAccount, .RedditAccount = RedditAccount}
End Function
Friend Overrides Sub ExchangeOptionsSet(ByVal Obj As Object)
If Not Obj Is Nothing AndAlso TypeOf Obj Is IRedditView Then SetView(DirectCast(Obj, IRedditView))
@@ -187,7 +234,7 @@ Namespace API.Reddit
If IsChannel Or IsSavedPosts Then UseMD5Comparison = False
If IsSavedPosts Then TrueName = MySiteSettings.SavedPostsUserName.Value
UpdateNames()
If Not IsSavedPosts AndAlso (IsChannel AndAlso Not ChannelInfo Is Nothing) Then
If IsChannelForm Then
UseMD5Comparison = False
EnvirDownloadSet()
If Not Responser Is Nothing Then Responser.Dispose()
@@ -790,8 +837,9 @@ Namespace API.Reddit
Dim r$, v$
Dim e As New ErrorsDescriber(EDP.ReturnValue)
Dim m As UserMedia, m2 As UserMedia
Dim RedGifsHost As SettingsHost = Settings(RedGifs.RedGifsSiteKey)
Dim RedGifsHost As SettingsHost = Settings(RedGifs.RedGifsSiteKey, RedGifsAccount)
Dim _repeatForRedgifs As Boolean
If RedGifsHost Is Nothing Then RedGifsHost = Settings(RedGifs.RedGifsSiteKey).Default
RedGifsResponser = RedGifsHost.Responser.Copy
ProgressPre.ChangeMax(_TempMediaList.Count)
For i% = _TempMediaList.Count - 1 To 0 Step -1
@@ -806,7 +854,7 @@ Namespace API.Reddit
r = Gfycat.Envir.GetVideo(m.URL)
If Not r.IsEmptyString AndAlso r.Contains("redgifs.com") Then m.URL = r : _repeatForRedgifs = True
ElseIf m.URL.Contains(SiteRedGifsKey) Then
m2 = RedGifs.UserData.GetDataFromUrlId(m.URL, False, RedGifsResponser, RedGifsHost)
m2 = RedGifs.UserData.GetDataFromUrlId(m.URL, False, RedGifsResponser, RedGifsHost, RedGifsAccount)
If m2.State = UStates.Missing Then
m.State = UStates.Missing
_ContentList.Add(m)
@@ -853,7 +901,8 @@ Namespace API.Reddit
Try
If Not ChannelInfo Is Nothing Or SaveToCache Then Exit Sub
If ContentMissingExists Then
Dim RedGifsHost As SettingsHost = Settings(RedGifs.RedGifsSiteKey)
Dim RedGifsHost As SettingsHost = Settings(RedGifs.RedGifsSiteKey, RedGifsAccount)
If RedGifsHost Is Nothing Then RedGifsHost = Settings(RedGifs.RedGifsSiteKey).Default
RedGifsResponser = RedGifsHost.Responser.Copy
Dim m As UserMedia, m2 As UserMedia
Dim r$
@@ -945,7 +994,7 @@ Namespace API.Reddit
If _ContentNew.Count > 0 Then
Try
If Not _RedGifsResponser Is Nothing Then _RedGifsResponser.Dispose()
_RedGifsResponser = Settings(RedGifs.RedGifsSiteKey).Responser.Copy
_RedGifsResponser = If(Settings(RedGifs.RedGifsSiteKey, RedGifsAccount), Settings(RedGifs.RedGifsSiteKey).Default).Responser.Copy
DownloadContentDefault(Token)
Finally
If Not _RedGifsResponser Is Nothing Then _RedGifsResponser.Dispose() : _RedGifsResponser = Nothing