From da0d5f60929a07973659edcd17f7b7cf4a5d2e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 9 Feb 2020 13:45:44 +0100 Subject: [PATCH] [oauth] add 'port' option (#604) --- docs/configuration.rst | 14 ++++++++++++++ docs/gallery-dl.conf | 3 ++- gallery_dl/extractor/oauth.py | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 1ab4a735..b450a15f 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -838,6 +838,20 @@ Description Controls how a user is directed to an OAuth authorization site. =========== ===== +extractor.oauth.port +-------------------- +=========== ===== +Type ``integer`` +Default ``6414`` +Description Port number to listen on during OAuth authorization. + + Note: All redirects will go to http://localhost:6414/, regardless + of the port specified here. You'll have to manually adjust the + port number in your browser's address bar when using a different + port than the default. +=========== ===== + + extractor.photobucket.subalbums ------------------------------- =========== ===== diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index a0daf857..f57ccc10 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -90,7 +90,8 @@ }, "oauth": { - "browser": true + "browser": true, + "port": 6414 }, "pixiv": { diff --git a/gallery_dl/extractor/oauth.py b/gallery_dl/extractor/oauth.py index 74835bfe..b0706661 100644 --- a/gallery_dl/extractor/oauth.py +++ b/gallery_dl/extractor/oauth.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# Copyright 2017-2019 Mike Fährmann +# Copyright 2017-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -"""Utility classes to setup OAuth and link a users account to gallery-dl""" +"""Utility classes to setup OAuth and link accounts to gallery-dl""" from .common import Extractor, Message from . import deviantart, flickr, reddit, smugmug, tumblr @@ -38,7 +38,7 @@ class OAuthBase(Extractor): print("Waiting for response. (Cancel with Ctrl+c)") server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - server.bind(("localhost", 6414)) + server.bind(("localhost", self.config("port", 6414))) server.listen(1) # workaround for ctrl+c not working during server.accept on Windows