Explorar o código

UI: Make OAuth base URL configurable

derrod %!s(int64=3) %!d(string=hai) anos
pai
achega
5dcabaf5cf
Modificáronse 5 ficheiros con 15 adicións e 6 borrados
  1. 6 0
      UI/CMakeLists.txt
  2. 3 1
      UI/auth-oauth.cpp
  3. 2 3
      UI/auth-restream.cpp
  4. 2 2
      UI/auth-twitch.cpp
  5. 2 0
      UI/ui-config.h.in

+ 6 - 0
UI/CMakeLists.txt

@@ -26,6 +26,12 @@ if(TARGET obs-browser
     obs-browser-panels INTERFACE ${CMAKE_SOURCE_DIR}/plugins/obs-browser/panel)
 endif()
 
+set(OAUTH_BASE_URL
+    "https://auth.obsproject.com/"
+    CACHE STRING "Default OAuth base URL")
+
+mark_as_advanced(OAUTH_BASE_URL)
+
 if(NOT DEFINED TWITCH_CLIENTID
    OR "${TWITCH_CLIENTID}" STREQUAL ""
    OR NOT DEFINED TWITCH_HASH

+ 3 - 1
UI/auth-oauth.cpp

@@ -14,6 +14,8 @@
 
 #include <json11.hpp>
 
+#include "ui-config.h"
+
 using namespace json11;
 
 #ifdef BROWSER_AVAILABLE
@@ -93,7 +95,7 @@ void OAuthLogin::urlChanged(const QString &url)
 	if (code_idx == -1)
 		return;
 
-	if (url.left(22) != "https://obsproject.com")
+	if (!url.startsWith(OAUTH_BASE_URL))
 		return;
 
 	code_idx += (int)uri.size();

+ 2 - 3
UI/auth-restream.cpp

@@ -19,9 +19,8 @@ using namespace json11;
 
 /* ------------------------------------------------------------------------- */
 
-#define RESTREAM_AUTH_URL \
-	"https://obsproject.com/app-auth/restream?action=redirect"
-#define RESTREAM_TOKEN_URL "https://obsproject.com/app-auth/restream-token"
+#define RESTREAM_AUTH_URL OAUTH_BASE_URL "v1/restream/redirect"
+#define RESTREAM_TOKEN_URL OAUTH_BASE_URL "v1/restream/token"
 #define RESTREAM_STREAMKEY_URL "https://api.restream.io/v2/user/streamKey"
 #define RESTREAM_SCOPE_VERSION 1
 

+ 2 - 2
UI/auth-twitch.cpp

@@ -22,8 +22,8 @@ using namespace json11;
 
 /* ------------------------------------------------------------------------- */
 
-#define TWITCH_AUTH_URL "https://obsproject.com/app-auth/twitch?action=redirect"
-#define TWITCH_TOKEN_URL "https://obsproject.com/app-auth/twitch-token"
+#define TWITCH_AUTH_URL OAUTH_BASE_URL "v1/twitch/redirect"
+#define TWITCH_TOKEN_URL OAUTH_BASE_URL "v1/twitch/token"
 
 #define TWITCH_SCOPE_VERSION 1
 

+ 2 - 0
UI/ui-config.h.in

@@ -18,6 +18,8 @@
 
 #cmakedefine USE_XDG
 
+#define OAUTH_BASE_URL "@OAUTH_BASE_URL@"
+
 #define TWITCH_ENABLED  @TWITCH_ENABLED@
 #define TWITCH_CLIENTID "@TWITCH_CLIENTID@"
 #define TWITCH_HASH     0x@TWITCH_HASH@