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

@@ -6,16 +6,21 @@
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY
Imports SCrawler.Plugin.Hosts
Imports PersonalUtilities.Forms
Imports PersonalUtilities.Forms.Controls
Imports PersonalUtilities.Forms.Controls.Base
Imports CView = SCrawler.API.Reddit.IRedditView.View
Imports CPeriod = SCrawler.API.Reddit.IRedditView.Period
Namespace API.Reddit
Friend Class RedditViewSettingsForm
Private WithEvents MyDefs As DefaultFormOptions
Private ReadOnly Property MyOptions As IRedditView
Friend Sub New(ByRef opt As IRedditView)
Private ReadOnly Property IsUserSettings As Boolean
Friend Sub New(ByRef opt As IRedditView, ByVal _IsUserSettings As Boolean)
InitializeComponent()
MyOptions = opt
IsUserSettings = _IsUserSettings
MyDefs = New DefaultFormOptions(Me, Settings.Design)
End Sub
Private Sub RedditViewSettingsForm_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -44,12 +49,52 @@ Namespace API.Reddit
Case Else : OPT_PERIOD_ALL.Checked = True
End Select
ChangePeriodEnabled()
PopulateCMB(Settings(RedditSiteKey), CMB_REDDIT_ACC, MyOptions.RedditAccount)
PopulateCMB(Settings(RedGifs.RedGifsSiteKey), CMB_REDGIFS_ACC, MyOptions.RedGifsAccount)
If IsUserSettings Then
TP_MAIN.Controls.Remove(CMB_REDDIT_ACC)
TP_MAIN.RowStyles(2).Height = 0
TP_MAIN.Refresh()
Dim s As Size = Size
s.Height -= 28
MaximumSize = Nothing
MinimumSize = Nothing
Size = s
MinimumSize = s
MaximumSize = s
Refresh()
End If
.EndLoaderOperations()
End With
Catch ex As Exception
MyDefs.InvokeLoaderError(ex)
End Try
End Sub
Private Sub PopulateCMB(ByVal Plugin As SettingsHostCollection, ByRef CMB As ComboBoxExtended, ByVal Acc As String)
With CMB
Dim indx% = 0
.BeginUpdate()
If Plugin.Count = 1 Then
.Text = SettingsHost.NameAccountNameDefault
.LeaveDefaultButtons = False
.Buttons.Clear()
.Buttons.UpdateButtonsPositions(True)
.CaptionWidth -= 1
Else
Dim data As List(Of String) = Plugin.Select(Function(h) h.AccountName.IfNullOrEmpty(SettingsHost.NameAccountNameDefault)).ToList
If Not Acc.IsEmptyString Then
indx = data.IndexOf(Acc)
If indx = -1 Then indx = 0
End If
.Items.AddRange(data.Select(Function(d) New ListItem(d)))
End If
.EndUpdate(True)
If .Count > 0 Then .SelectedIndex = indx
.Enabled = .Count > 1
End With
End Sub
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
With MyOptions
Select Case True
@@ -65,6 +110,8 @@ Namespace API.Reddit
Case OPT_PERIOD_YEAR.Checked : .ViewPeriod = CPeriod.Year
Case Else : .ViewPeriod = CPeriod.All
End Select
.RedGifsAccount = CMB_REDGIFS_ACC.Text
If Not IsUserSettings Then .RedditAccount = CMB_REDDIT_ACC.Text
End With
MyDefs.CloseForm()
End Sub