Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

donate button #746

Closed
plakhin opened this issue Sep 8, 2019 · 18 comments

Comments

@plakhin
Copy link

commented Sep 8, 2019

Steps to reproduce this issue

  1. Step 1; Open about window. Enter email use who made donation, click "ok".
  2. Step 2; Close about window. Big green "Donate" button disappeared.
  3. Step 3; Close HeidiSql. Open again. Donate button is back.

Current behavior

Donate button is back on each restart.

Expected behavior

Donate button not appearing after on restart after entering email of user who made donation.

Environment

Windows 10

  • HeidiSQL version:
    10.2.0.5684, first issue appeared in 5683
@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented Sep 9, 2019

Can confirm that. Maybe a logic problem in the changed code.

@ansgarbecker ansgarbecker added this to the v10.3 milestone Sep 9, 2019
ansgarbecker added a commit that referenced this issue Sep 13, 2019
… Probably some requests take a bit longer on the new webserver.
@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented Sep 13, 2019

After analyzing this I found there was no change in the code which would suddenly make the first donor check ineffective. Instead, I am suspecting my new server behind heidisql.com to be slower than the old one. If that is really the case, my just pushed change increases the timeout from 3s to 10s.
"Unfortunately" I cannot reproduce the staying donate button on another machine, so I will try later with the first pc where I could.
Probably you could try and report back if the button still is staying, if yes, please update to the latest build.

ansgarbecker added a commit that referenced this issue Sep 13, 2019
… from FormCreate to AfterFormCreate, and repaint image after show/hide
@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented Sep 14, 2019

I got feedback from an external user that the last build solves the issue. Could you please verify?

For me the log panel also shows now this, probably different to what you get:
grafik

@plakhin

This comment has been minimized.

Copy link
Author

commented Sep 14, 2019

Checked build 5685, still getting donate button after restart. I can check again tonight and provide more details if you tell me what details you need.

@plakhin

This comment has been minimized.

Copy link
Author

commented Sep 14, 2019

Just updated to 5687 and still getting donate button after restart.
Also I noticed /* Access is denied */ message in console right after starting HeidiSQL and opening a connection.

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented Sep 14, 2019

Please post what you get in the log panel in that "Check success response:" line. Please use the latest build (currently 5687).

@Cubittus

This comment has been minimized.

Copy link

commented Sep 14, 2019

For me the problem is a bit different, so this might be an unrelated issue. The donate button used to be hidden since I donated a few years back. The button reappeared recently and now I can't remove it.

With Build 5688 when I press the OK button in About I immediately get 'Could not check donation state'.
The log panel shows (after many attempts):

/* Check success response: "漱" /
/
Check success response: "팱" /
/
Check success response: "팱" /
/
Check success response: "팱" /
/
Check success response: "팱" /
/
Check success response: "蜱" /
/
Check success response: "팱" /
/
Check success response: "팱" /
/
Check success response: "팱" /
/
Check success response: "팱" /
/
Check success response: "팱" /
/
Check success response: "팱" /
/
Check success response: "餱" /
/
Check success response: "퀱" /
/
Check success response: "由" /
/
Check success response: "팱" /
/
Check success response: "週" /
/
Check success response: "팱" /
/
Check success response: "팱" */

I ran Wireshark to check whether there was a network issue and I can see that a https encrypted request is made to the ip address of the heidisql.com domain, and an encrypted response is received.

If I use this browser on the same machine to visit
https://www.heidisql.com/hasdonated.php?email=
then I get a page showing '1', which, according to the source, suggests that I have not donated, which is wrong. I still have the email from you acknowleding the donation, sent to that email address.

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented Sep 14, 2019

"1" means yes, "0" means no. (the "1" that came with an empty email was a bug, just fixed that)

The problem is that broken character, which I cannot detect as "1", obviously. As you reported the issue was introduce with the change in build 5683. Relevant code is this, but I still don't know why that fails on some systems, and not on mine here:

var
    Buffer: array[1..4096] of Byte;
    BytesInChunk: Cardinal;
    ContentChunk, FLastContent: String;
begin
    ...
    FLastContent := '';
    ...
    SetString(ContentChunk, PChar(@Buffer[1]), BytesInChunk);
    FLastContent := FLastContent + ContentChunk;

Pointer arithmetic... hate that.

@plakhin

This comment has been minimized.

Copy link
Author

commented Sep 14, 2019

Build 5688. Absolutely the same behavior.
After starting HeidiSQL, I get donate button.
After opening "About" window I get /* Check success response: "̱" */
After entering email: /* Check success response: "1" */ and button gets hidden.
But after restarting everything is the same again.

@plakhin

This comment has been minimized.

Copy link
Author

commented Sep 14, 2019

When making curl requests to the https://www.heidisql.com/hasdonated.php?email= with my email address inserted, I'm always getting 1 as a response and not that broken characters.

@plakhin

This comment has been minimized.

Copy link
Author

commented Sep 14, 2019

Just checked build 5682, it behaves correct. So confirming that issue appeared since 5683.

@Cubittus

This comment has been minimized.

Copy link

commented Sep 14, 2019

A couple of revisions to my comment above (github munged it somewhat):

Re: the missing email - The email check I did in my browser did use my email address - github lost it when I submitted the comment.

Re: 1 for yes - I was looking in the source code at main.pas line 12843 in the HasDonated function. The comments there lead me to think that 0 meant not checked, 1 meant not a donor and 2 meant valid donor, but reading further I see that the variable FHasDonatedDatabaseCheck is a simple boolean.

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented Sep 15, 2019

@Cubittus : the comments refer to FHasDonatedDatabaseCheck which is my weird TThreeStateBoolean type, defined as (nbUnset, nbFalse, nbTrue) - 0/1/2 internally. The http result is different - just "0" or "1".

However, I just changed the buffer data type from Byte to AnsiString, and now it's starting at 0 instead of 1st character. Please update again and see what that "Check success" says now.
And sorry for the mess..

@Cubittus

This comment has been minimized.

Copy link

commented Sep 15, 2019

I just tried again with build 5689 - same result:

/* Check success response: "ေ" */
/* Check success response: "팱" */
/* Check success response: "팱" */

That is what the log shows after trying the OK button twice. The first line with the UTF 0x1031 is from the startup check for the toolbar button (I am assuming).

The 0x1031 caught my eye as 0x31 is the ascii codepoint for '1'. Could there be some issue involving internal conversion between windows 'unicode' (UTF-16) and UTF-8 or ASCII string types, or with the result string not being terminated correctly.
What makes it more interesting is that the other strange character 팱 is Unicode 0xD331. Again the low byte is 0x31 == '1'.
I'm not too familiar with Pascal, but I have fought similar problems when writing C++ code.

Thanks for looking into this!

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented Sep 16, 2019

Thanks, that hex code was a good hint. Asked on Stackoverflow for the right decoding approach: https://stackoverflow.com/q/57951463/4110077
And I think I got it now. Please test once more with the latest build.

@Cubittus

This comment has been minimized.

Copy link

commented Sep 16, 2019

Build 5690 works perfectly for me - the Donate button is now hidden upon startup, and pressing OK in the About dialog gives the 'Thanks for donating!' message.

Thanks for a great application and top-notch support!

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented Sep 16, 2019

Thanks for your appreciation!

@plakhin

This comment has been minimized.

Copy link
Author

commented Sep 16, 2019

Build 5691 works perfect. Thanks everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.