erickutcher / httpdownloader

HTTP(S) download manager that uses input/output completion ports (IOCP).
https://erickutcher.github.io/#HTTP_Downloader
571 stars 61 forks source link

It is recommended to windowize the pop-up window when right-clicking on the link. #288

Closed StrollStars closed 5 months ago

StrollStars commented 5 months ago

As title, Currently, the pop-up window is maximized when I right-click a link. To modify settings, I need to move the mouse across most of the window area, which is inconvenient.

erickutcher commented 5 months ago

What pop-up window? Are you able to take a screenshot? I would say that, at a minimum, the program should run on a 1280 x 720 screen or higher. Anything smaller and it's going to get clipped or scrunched. I don't have much leeway because some languages have long strings that aren't going to fit the windows and it'll just be a mess for everyone. That's the tradeoff.

StrollStars commented 5 months ago

1 The picture above is the default window size. 2 The picture above is the recommended window size, I think it's better to narrow down the URL area.

erickutcher commented 5 months ago

That's bizarre. The default width and height should be 600x300. I see you're using Windows 7? I know that Chrome is no longer issuing updates for that version of Windows and it's possible that the extension code isn't 100% compatible with whatever version you're using. Version 109?

If you can install Firefox, does it do the same thing?

Dean-Corso commented 5 months ago

So I have the same issue when using Firefox Add-on. I made a snapshot too so that you can see it... Size_2024-05-27_224717 ...below you can see the default window sizes used when calling that window. In case of Chrome extension is much smaller (better) as in Firefox.

erickutcher commented 5 months ago

I'm not sure why that's happening. What happens if you toggle the Advanced options button a couple times?

Dean-Corso commented 5 months ago

The advanced window is showing then (General, Cookies etc tabs) that's all. It does not change anything about window position. Problem is that the edit control in Firefox Add-on is using a static height size which is too large. Look at this image below... Size2_2024-05-27_224717 ...you can see the Firefox Add-on & Chrome / Brave (now) extension URL add window I have set manually to the lowest size (W & H) before the H & V scroll is showing. So you can see the different. The width is OK but the height is too high in the Firefox Add-on. Just use other value for the Height of the Add-on edit control. Or do you use any function to set window position extra each time? Just make it same like in the Chrome extension to show a smaller window. Just check this out again so maybe you can find the reason in the source.

erickutcher commented 5 months ago

This is the function that creates the window: https://github.com/erickutcher/httpdownloader/blob/6d170ec064fafe1923a2f352768d496ec138a7c9/HTTP_Downloader_Firefox_WebExtension/background.js#L26

g_width and g_height are hard-coded to make the window 600x300. There's also nothing in the download.html file that would cause the elements to expand the window. It should all be responsive.

StrollStars seems to have the same problem, but with Chrome instead of Firefox. My setup on Windows and Linux has them both opening at the correct size.

I'll play around with it.

Dean-Corso commented 5 months ago

Hi again,

pretty strange that window behavior. I tried to debug the Add-on in Firefox and see the hard code values for g_width & g_height. So when I call the Add URL window from Add-on / browser and breakpoint "CreateDownloadWindow" function in backfground.js...

function CreateDownloadWindow(download_info, message = '')
{
  browser.windows.create({
    url: browser.runtime.getURL('download.html'),
    type: 'popup',
    left: g_left,
    top: g_top,
    width: g_width,
    height: g_height
  }).then(

...then I have this value in the variables..../ final window pos & size on right side...

left:  383  +7  = 390
top:   234  +0      = 234
width: 600  +402    =1002
height:300  +333    = 633

The left is OK (+7 more) and the top position does match for 100% but the width & height do not match and are far away. Maybe you should debug it in browser to check this out & or checking all window size positions you do calc with also in download.js etc.

erickutcher commented 5 months ago

See if this code works:

browser.windows.create(
{
  url: browser.runtime.getURL( "download.html" ),
  type: "popup",
  left: g_left,
  top: g_top,
  width: g_width,
  height: g_height
} )
.then( function( window_info )
{
  browser.windows.update( window_info.id,
    {
    width: g_width,
    height: g_height
    } );

It should apply the default width and height after it's been made. It might cause a resize animation to occur.

Dean-Corso commented 5 months ago

Can you compile a text XPI file with those changes? I don't know how to change / apply new code lines in debugger window (not working) or how to install unpacked XPI in Firefox (only can do it in Chrome / dev mode). Do you know?

Dean-Corso commented 5 months ago

Hi again,

OK I found a way to load the modded XPI temporary in Firefox. So I did add your code lines and did load the XPI but then I don't get any entry's of HTTP Downloader to see in the right mouse context menu. Nothing there. Look....

function CreateDownloadWindow( download_info, message = "" )
{
browser.windows.create(
{
  url: browser.runtime.getURL( "download.html" ),
  type: "popup",
  left: g_left,
  top: g_top,
  width: g_width,
  height: g_height
} )
.then( function( window_info )
{
  browser.windows.update( window_info.id,
    {
    width: g_width,
    height: g_height
    } );
    {
        var method = download_info.method;
        var url = download_info.url;
        var cookie_string = download_info.cookie_string;
        var headers = download_info.headers;
        var post_data = download_info.post_data;
        var directory = download_info.directory;
        var filename = download_info.filename;

        g_open_windows.push(
        [
            window_info.id,
            window_info.tabs[ 0 ].id,
            g_options.theme_support,
            method,
            url,
            cookie_string,
            headers,
            post_data,
            directory,
            filename,
            message
        ] );
    } );
}

RC_2024-05-29_013941 ...no menu entry to see / choose now. Without your changes it shows the menu in context.

erickutcher commented 5 months ago

There's a mistake in your code. Here's the full function.

function CreateDownloadWindow( download_info, message = "" )
{
    browser.windows.create(
    {
        url: browser.runtime.getURL( "download.html" ),
        type: "popup",
        left: g_left,
        top: g_top,
        width: g_width,
        height: g_height
    } )
    .then( function( window_info )
    {
        browser.windows.update( window_info.id,
        {
            width: g_width,
            height: g_height
        } );

        var method = download_info.method;
        var url = download_info.url;
        var cookie_string = download_info.cookie_string;
        var headers = download_info.headers;
        var post_data = download_info.post_data;
        var directory = download_info.directory;
        var filename = download_info.filename;

        g_open_windows.push(
        [
            window_info.id,
            window_info.tabs[ 0 ].id,
            g_options.theme_support,
            method,
            url,
            cookie_string,
            headers,
            post_data,
            directory,
            filename,
            message
        ] );
    } );
}
Dean-Corso commented 5 months ago

Ah OK, was just one "{" to much. Now it works and looks much better... Better_2024-05-29_022707 ....and size is 586x293 same like in Chrome now. Well done @erickutcher. When do you want to update the FF Add-on?

erickutcher commented 5 months ago

When do you want to update the FF Add-on?

I'm not certain. I need to figure out why it behaves that way because it's not normal.

erickutcher commented 5 months ago

Here's a new version you can play around with. I added some buttons in the options popup so that you can download various links without having to right click.

HTTP_Downloader_Firefox_WebExtension.zip

StrollStars commented 5 months ago

@erickutcher Sorry I'm late. I'm using Windows 7 and chrome 109. The following screenshots are from Windows 7 and Firefox 115 installed on it, everything looks normal. 1 2 BTW, Firefox extensions is installed through the browser's own menu.

Dean-Corso commented 5 months ago

So today I had an idea about that Window size problem we got in Firefox and I found the reason why it's getting so large every time and not using the default W & H sizes. It's just because of an enabled flag in Firefox... privacy.resistFingerprinting true ...so this flag is set to false in default mode but when you set it to true then it will open the HTTP Downloader Window not with default window sizes. So normally I have this flag enabled / true what does change the browser window sizes when you start the browser and this seems also happen with your Add-on window. But now with adding the update function in your background,js file the problem is solved and you can keep it like that now.

About new test HTTP Downloader version. I have test it and it looks good with the new buttons directly in the popup window. Now we all can access it quickly without using right mouse context anymore. 😃 Would be nice if you could update the Add-on soon on your Mozilla website or adding the valid XPI file here on your GH channel because I can not install your test package permanently only temporary for testing because of missing verification etc. Thanks.

erickutcher commented 5 months ago

privacy.resistFingerprinting

I would not have thought of that. There doesn't seem to be any overrides for extensions. I don't like the workaround, but I guess it'll have to do.

StrollStars commented 5 months ago

@erickutcher privacy.resistFingerprinting true The results of my test are the same. Is the same problem also happening in Chrome? Can it be fixed?

erickutcher commented 5 months ago

Chrome doesn't have resistFingerprinting so there's probably something else going on. The workaround should fix it just the same.

Try this version for Chrome: HTTP_Downloader_Chrome_Extension.zip

StrollStars commented 5 months ago

Try this version for Chrome: HTTP_Downloader_Chrome_Extension.zip

Sorry, this version is still the same as the previous one. Is there any easy way to diagnose it?

Dean-Corso commented 5 months ago

So for me the default Chrome extension works fine to display the normal sized URL window of HTTP Downloader. If you got this problem in Chromium based browser then you should check the changed flags you did set or extensions you do use. Best would be to run a fresh Chrome* instance in any test area (Sandbox etc / otherwise try to run a new guest profile) and then check the HTTP Downlaoder extension in this state. In my case I got same trouble with Firefox just because of using that enabled flag. Something similar like that could be your problem with Chrome too now.

StrollStars commented 5 months ago

@Dean-Corso Thanks for the reminder. I created a new profile and only installed this extension, but the problem still exists. By the way, my Chrome was extracted from the installer for portable use. This should have no impact, right?

erickutcher commented 5 months ago

@StrollStars I've noticed in your screenshot above that the window is maximized as if the maximized button was clicked rather than the width and height filling the screen space. There's nothing in the extension that would do that and so it has to be something external. Maybe you have the --start-maximized flag set in the Chrome shortcut?

Dean-Corso commented 5 months ago

@StrollStars So what if you restore all default settings in your Chrome browser? If the problem isn't any extension then it could be any used flag you possibly changed. You can reset your settings in browser. Not sure about the portable version so I don't use portable browser at the moment. So in your case I would try to run a fresh browser (default) + install the HTTP Downloader extension to test it but I think in your case any flag should be the problem too. Do you use any flags when starting the browser?

EDIT: --start-maximized <-- that's it @erickutcher I just did started browser with this flag and the HTTP Downloader window is showing maximized too every time. 😃

StrollStars commented 5 months ago

@Dean-Corso You are so awesome. I removed the --start-maximized, the window is completely normal.

StrollStars commented 5 months ago

HTTP Downloader's program was recently updated once, and the browser extension was updated twice. However, I'm still experiencing issues with Chrome. @Dean-Corso , Has Firefox been fixed on your end?

I found that the "--start-maximized" parameter affects not only the pop-up windows of HTTP Downloader but all pop-up windows. This might not be something that can be resolved by modifying the extension code.

I'm planning to remove this parameter and instead change the shortcut's run window to maximized, so it won't affect the pop-up windows.

erickutcher commented 5 months ago

There's no workaround for --start-maximized unfortunately.

I'm planning to remove this parameter and instead change the shortcut's run window to maximized, so it won't affect the pop-up windows.

That's probably the only solution in your case.

StrollStars commented 5 months ago

@erickutcher Thank you for your help.