From af6aa7d5334c1d63bffeaf20114cb7402471eb65 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Thu, 14 Nov 2024 13:45:26 +0700 Subject: [PATCH] v --- objects/o_dialog_patreon/Create_0.gml | 6 ++++++ objects/o_dialog_patreon/Draw_64.gml | 19 +++++++++---------- .../patreon_email_check.gml | 13 ++++++++++++- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/objects/o_dialog_patreon/Create_0.gml b/objects/o_dialog_patreon/Create_0.gml index d3403936b..b7a8b7a26 100644 --- a/objects/o_dialog_patreon/Create_0.gml +++ b/objects/o_dialog_patreon/Create_0.gml @@ -16,4 +16,10 @@ event_inherited(); server = network_create_server_raw(network_socket_ws, port, 32); } until(server >= 0 || attmp++ >= 100); + var _url = @"www.patreon.com/oauth2/authorize?response_type=code +&client_id=oZ1PNvUY61uH0FiA7ZPMBy77Xau3Ok9tfvsT_Y8DQwyKeMNjaVC35r1qsK09QJhY +&redirect_uri=https://pixel-composer.com/verify"; + _url += $"&state={port}"; + + url_open(_url); #endregion \ No newline at end of file diff --git a/objects/o_dialog_patreon/Draw_64.gml b/objects/o_dialog_patreon/Draw_64.gml index 79571f544..8724ee070 100644 --- a/objects/o_dialog_patreon/Draw_64.gml +++ b/objects/o_dialog_patreon/Draw_64.gml @@ -32,15 +32,14 @@ if !ready exit; var _bx = cx - _bw / 2; var _by = yy + ui(104); - if(buttonInstant(THEME.button_def, _bx, _by, _bw, _bh, mouse_ui, sFOCUS, sHOVER) == 2) { - var _url = @"www.patreon.com/oauth2/authorize?response_type=code -&client_id=oZ1PNvUY61uH0FiA7ZPMBy77Xau3Ok9tfvsT_Y8DQwyKeMNjaVC35r1qsK09QJhY -&redirect_uri=https://pixel-composer.com/verify"; - _url += $"&state={port}"; - - url_open(_url); - } + // if(buttonInstant(THEME.button_def, _bx, _by, _bw, _bh, mouse_ui, sFOCUS, sHOVER) == 2) {} - draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - draw_text(cx, _by + _bh / 2, "Sign-in with Patreon"); + if(IS_PATREON) { + draw_set_text(f_p1, fa_center, fa_center, COLORS._main_value_positive); + draw_text(cx, _by + _bh / 2, "Patreon verified, thank you for supporting Pixel Composer!\nRestart to see new contents."); + + } else { + draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); + draw_text(cx, _by + _bh / 2, "Sign-in to Patreon on browser"); + } #endregion \ No newline at end of file diff --git a/scripts/patreon_email_check/patreon_email_check.gml b/scripts/patreon_email_check/patreon_email_check.gml index 3c01703cd..2b6d4e7c0 100644 --- a/scripts/patreon_email_check/patreon_email_check.gml +++ b/scripts/patreon_email_check/patreon_email_check.gml @@ -18,11 +18,22 @@ function patreon_create_verification_key(mail, code) { ds_map_secure_save(_map, _path); } +function patreon_create_verification_code(code) { + var _path = DIRECTORY + "patreon"; + + var _map = ds_map_create(); + _map[? "code"] = code; + + ds_map_secure_save(_map, _path); +} + function __initPatreon() { IS_PATREON = false; var _path = DIRECTORY + "patreon"; if(!file_exists_empty(_path)) return; + var _load = ds_map_secure_load(_path); + var _code = ds_map_try_get(_load, "code") - IS_PATREON = _code == _keyTarget; + IS_PATREON = string_starts_with(_code, "pxc"); }