From d794328bbaca08785616dbe768964a91ffe9c77b Mon Sep 17 00:00:00 2001 From: Juan Campos Zambrana Date: Sun, 7 Jun 2020 10:06:32 +0200 Subject: [PATCH 1/5] problems reauthorizing --- src/Accounts.vala | 9 +++++++-- src/Dialogs/NewAccount.vala | 20 ++++++++++++-------- src/Network.vala | 3 ++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/Accounts.vala b/src/Accounts.vala index 80636fc2..fd0a904b 100644 --- a/src/Accounts.vala +++ b/src/Accounts.vala @@ -55,8 +55,12 @@ public class Olifant.Accounts : Object { account.close_notificator (); saved_accounts.remove_index (i); - if (saved_accounts.length < 1) + if (saved_accounts.length < 1){ + formal=null; + current=null; + currentInstance=null; switched (null); + } else { var id = settings.current_account - 1; if (id > saved_accounts.length - 1) @@ -69,7 +73,8 @@ public class Olifant.Accounts : Object { updated (saved_accounts); if (is_empty ()) { - window.destroy (); + window.destroy (); + window=null; Dialogs.NewAccount.open (); } } diff --git a/src/Dialogs/NewAccount.vala b/src/Dialogs/NewAccount.vala index 3da1a8c3..da7cf3fa 100644 --- a/src/Dialogs/NewAccount.vala +++ b/src/Dialogs/NewAccount.vala @@ -20,6 +20,7 @@ public class Olifant.Dialogs.NewAccount : Dialog { private string? token; private string? username; private int64? instance_status_char_limit; + private bool second_click; private const int64 DEFAULT_INSTANCE_STATUS_CHAR_LIMIT = 500; @@ -27,6 +28,7 @@ public class Olifant.Dialogs.NewAccount : Dialog { border_width = 6; deletable = true; resizable = false; + second_click=false; title = _("New Account"); transient_for = window; @@ -104,15 +106,15 @@ public class Olifant.Dialogs.NewAccount : Dialog { request_instance_status_charlimit(); - if (client_id == null || client_secret == null) { + if (!second_click){ request_client_tokens (); - return; } - - if (code == "") - app.error (_("Error"), _("Please paste valid instance authorization code")); - else - try_auth (code); + else{ + if (code == "") + app.error (_("Error"), _("Please paste valid instance authorization code")); + else + try_auth (code); + } } private void request_instance_status_charlimit () { @@ -155,6 +157,7 @@ public class Olifant.Dialogs.NewAccount : Dialog { code_entry.show (); url_hint.show (); url_hint.set_markup ("Browser did not open? Try link".printf (GLib.Markup.escape_text (generate_auth_url ()))); + second_click=true; }, (status, reason) => { network.on_show_error (status, reason); }); @@ -186,8 +189,9 @@ public class Olifant.Dialogs.NewAccount : Dialog { var root = network.parse (msg); token = root.get_string_member ("access_token"); - info ("Got access token"); + info ("Got access token "+token); get_username (); + second_click=false; }, (status, reason) => { network.on_show_error (status, reason); }); diff --git a/src/Network.vala b/src/Network.vala index e78a3330..fe91e67f 100644 --- a/src/Network.vala +++ b/src/Network.vala @@ -61,7 +61,8 @@ public class Olifant.Network : GLib.Object { if (headers.get_one (INJECT_TOKEN) != null) { headers.remove (INJECT_TOKEN); } - if (formal != null) { + if (formal != null && headers.get_one("Authorization")==null) { + info ("Got access token "+formal.token); headers.append ("Authorization", "Bearer " + formal.token); } } From d610af027b2f34c289b224f93441fc8379d88686 Mon Sep 17 00:00:00 2001 From: Juan Campos Zambrana Date: Sun, 7 Jun 2020 10:59:56 +0200 Subject: [PATCH 2/5] remove token in log --- src/Dialogs/NewAccount.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dialogs/NewAccount.vala b/src/Dialogs/NewAccount.vala index da7cf3fa..04ea9106 100644 --- a/src/Dialogs/NewAccount.vala +++ b/src/Dialogs/NewAccount.vala @@ -189,7 +189,7 @@ public class Olifant.Dialogs.NewAccount : Dialog { var root = network.parse (msg); token = root.get_string_member ("access_token"); - info ("Got access token "+token); + info ("Got access token "); get_username (); second_click=false; }, (status, reason) => { From ad768bc97c9ea19328639c9970dc759bb92187b6 Mon Sep 17 00:00:00 2001 From: odiseo Date: Sat, 19 Sep 2020 21:39:54 +0200 Subject: [PATCH 3/5] Merge po file --- po/com.github.cleac.olifant.pot | 1 + 1 file changed, 1 insertion(+) diff --git a/po/com.github.cleac.olifant.pot b/po/com.github.cleac.olifant.pot index 36ff47e3..6b9a02d9 100644 --- a/po/com.github.cleac.olifant.pot +++ b/po/com.github.cleac.olifant.pot @@ -602,3 +602,4 @@ msgstr "" #: src/Views/Federated.vala:12 msgid "Federated Timeline" msgstr "" + From 98f2710e13a38f5355e88526089d79053f698d06 Mon Sep 17 00:00:00 2001 From: odiseo Date: Sat, 19 Sep 2020 22:31:06 +0200 Subject: [PATCH 4/5] field without set --- src/Accounts.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Accounts.vala b/src/Accounts.vala index 5f90aaf1..8e68f2ca 100644 --- a/src/Accounts.vala +++ b/src/Accounts.vala @@ -55,7 +55,7 @@ public class Olifant.Accounts : Object { if (saved_accounts.length < 1){ formal=null; current=null; - currentInstance=null; + //currentInstance=null; switched (null); } else { From bae4951950ffbc9de20b9a66896927c6ab848bc1 Mon Sep 17 00:00:00 2001 From: odiseo Date: Sun, 4 Oct 2020 08:50:25 +0200 Subject: [PATCH 5/5] Trying to resolve building issue --- po/com.github.cleac.olifant.pot | 1 - 1 file changed, 1 deletion(-) diff --git a/po/com.github.cleac.olifant.pot b/po/com.github.cleac.olifant.pot index 6b9a02d9..36ff47e3 100644 --- a/po/com.github.cleac.olifant.pot +++ b/po/com.github.cleac.olifant.pot @@ -602,4 +602,3 @@ msgstr "" #: src/Views/Federated.vala:12 msgid "Federated Timeline" msgstr "" -