forked from jbsparrow/CyberDropDownloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use pydantic models for config validation (jbsparrow#316)
* refactor: use pydantic for config validation * refactor: replace every config setting reference * refactor: use yaml manager for every read/write * refactor: add AppriseURL type * refactor: use proper types * refactor: add default config values * refactor: add aliases * refactor: add yaml custom representers * refactor: add pydantic ValidationError handle * fix: AppriseURL Custom Model * refactor: remove SecretStr from auth data They are annoying to work with and we never log them so it's fine to use regular str * refactor: add HttpAppriseURL validator * refactor: use StrEnum for ScrapeItemType * refactor: replace yaml_manager with a module * refactor: use dataclasses for url_objects * refactor: update configs if some fields were missing * refactor: use pydantic models to create CLI args dinamically * refactor: update parsed_args references delete args_manager and use an instance of ParsedArgs * refactor: add aliases for input_file and download_folder * refactor: do args consolidation before path_startup * fix: incorrect merge of cli and config settings * fix: MediaItem references * sync: rebase from master * refactor: update config to pydantic config if necessary * refactor: remove dedupe options from global settings * refactor: add footer to InvalidYamlError * fix: deprecated warnings * refactor: add "ALL" config * fix: circular import * fix: download_speed_limit * fix: validation error handle for apprise.txt * fix: optional deprecated arguments * refactor: remove humanfriendly dependency
- Loading branch information
1 parent
3ff244e
commit 1947b52
Showing
82 changed files
with
1,363 additions
and
1,682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from .authentication_settings import AuthSettings | ||
from .config_settings import ConfigSettings | ||
from .global_settings import GlobalSettings | ||
|
||
__all__ = { | ||
AuthSettings, | ||
ConfigSettings, | ||
GlobalSettings, | ||
} |
74 changes: 74 additions & 0 deletions
74
cyberdrop_dl/config_definitions/authentication_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
from pydantic import BaseModel, Field | ||
|
||
from .custom_types import AliasModel | ||
|
||
|
||
class ForumAuth(BaseModel): | ||
celebforum_xf_user_cookie: str = "" | ||
celebforum_username: str = "" | ||
celebforum_password: str = "" | ||
f95zone_xf_user_cookie: str = "" | ||
f95zone_username: str = "" | ||
f95zone_password: str = "" | ||
leakedmodels_xf_user_cookie: str = "" | ||
leakedmodels_username: str = "" | ||
leakedmodels_password: str = "" | ||
nudostar_xf_user_cookie: str = "" | ||
nudostar_username: str = "" | ||
nudostar_password: str = "" | ||
simpcity_xf_user_cookie: str = "" | ||
simpcity_username: str = "" | ||
simpcity_password: str = "" | ||
socialmediagirls_xf_user_cookie: str = "" | ||
socialmediagirls_username: str = "" | ||
socialmediagirls_password: str = "" | ||
xbunker_xf_user_cookie: str = "" | ||
xbunker_username: str = "" | ||
xbunker_password: str = "" | ||
|
||
|
||
class CoomerAuth(BaseModel): | ||
session: str = "" | ||
|
||
|
||
class XXXBunkerAuth(BaseModel): | ||
PHPSESSID: str = "" | ||
|
||
|
||
class ImgurAuth(BaseModel): | ||
client_id: str = "" | ||
|
||
|
||
class JDownloaderAuth(AliasModel): | ||
username: str = Field("", validation_alias="jdownloader_username") | ||
password: str = Field("", validation_alias="jdownloader_password") | ||
device: str = Field("", validation_alias="jdownloader_device") | ||
|
||
|
||
class RedditAuth(BaseModel): | ||
personal_use_script: str = "" | ||
secret: str = "" | ||
|
||
|
||
class GoFileAuth(AliasModel): | ||
api_key: str = Field("", validation_alias="gofile_api_key") | ||
|
||
|
||
class PixeldrainAuth(AliasModel): | ||
api_key: str = Field("", validation_alias="pixeldrain_api_key") | ||
|
||
|
||
class RealDebridAuth(AliasModel): | ||
api_key: str = Field("", validation_alias="realdebrid_api_key") | ||
|
||
|
||
class AuthSettings(AliasModel): | ||
coomer: CoomerAuth = Field(validation_alias="Coomer", default=CoomerAuth()) | ||
forums: ForumAuth = Field(validation_alias="Forums", default=ForumAuth()) | ||
gofile: GoFileAuth = Field(validation_alias="GoFile", default=GoFileAuth()) | ||
imgur: ImgurAuth = Field(validation_alias="Imgur", default=ImgurAuth()) | ||
jdownloader: JDownloaderAuth = Field(validation_alias="JDownloader", default=JDownloaderAuth()) | ||
pixeldrain: PixeldrainAuth = Field(validation_alias="PixelDrain", default=PixeldrainAuth()) | ||
realdebrid: RealDebridAuth = Field(validation_alias="RealDebrid", default=RealDebridAuth()) | ||
reddit: RedditAuth = Field(validation_alias="Reddit", default=RedditAuth()) | ||
xxxbunker: XXXBunkerAuth = Field(validation_alias="XXXBunker", default=XXXBunkerAuth()) |
Oops, something went wrong.