added discord functionality to extension and polished some of downloader process.
This commit is contained in:
@@ -95,10 +95,18 @@ async def _download_source_async(source_id: int) -> dict:
|
||||
try:
|
||||
# Get credentials
|
||||
cred_manager = CredentialManager(session)
|
||||
cookies_path = await cred_manager.get_cookies_path(source.platform)
|
||||
cookies_path = None
|
||||
auth_token = None
|
||||
|
||||
if not cookies_path and source.platform in ["patreon", "subscribestar"]:
|
||||
logger.warning(f"No credentials for {source.platform}, download may fail")
|
||||
# Discord uses token auth, others use cookies
|
||||
if source.platform == "discord":
|
||||
auth_token = await cred_manager.get_token(source.platform)
|
||||
if not auth_token:
|
||||
logger.warning(f"No token for {source.platform}, download may fail")
|
||||
else:
|
||||
cookies_path = await cred_manager.get_cookies_path(source.platform)
|
||||
if not cookies_path and source.platform in ["patreon", "subscribestar"]:
|
||||
logger.warning(f"No credentials for {source.platform}, download may fail")
|
||||
|
||||
# Build source config from metadata
|
||||
source_config = SourceConfig.from_dict(source.metadata_ or {})
|
||||
@@ -111,6 +119,7 @@ async def _download_source_async(source_id: int) -> dict:
|
||||
platform=source.platform,
|
||||
source_config=source_config,
|
||||
cookies_path=cookies_path,
|
||||
auth_token=auth_token,
|
||||
)
|
||||
|
||||
# Update download record
|
||||
|
||||
Reference in New Issue
Block a user