This commit is contained in:
Tanasart 2024-11-14 13:45:26 +07:00
parent 3e494d29b9
commit af6aa7d533
3 changed files with 27 additions and 11 deletions

View file

@ -16,4 +16,10 @@ event_inherited();
server = network_create_server_raw(network_socket_ws, port, 32); server = network_create_server_raw(network_socket_ws, port, 32);
} until(server >= 0 || attmp++ >= 100); } 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 #endregion

View file

@ -32,15 +32,14 @@ if !ready exit;
var _bx = cx - _bw / 2; var _bx = cx - _bw / 2;
var _by = yy + ui(104); var _by = yy + ui(104);
if(buttonInstant(THEME.button_def, _bx, _by, _bw, _bh, mouse_ui, sFOCUS, sHOVER) == 2) { // 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(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");
} }
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
draw_text(cx, _by + _bh / 2, "Sign-in with Patreon");
#endregion #endregion

View file

@ -18,11 +18,22 @@ function patreon_create_verification_key(mail, code) {
ds_map_secure_save(_map, _path); 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() { function __initPatreon() {
IS_PATREON = false; IS_PATREON = false;
var _path = DIRECTORY + "patreon"; var _path = DIRECTORY + "patreon";
if(!file_exists_empty(_path)) return; 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");
} }