Jump to content

Mypal 68 in Windows XP - Custom Buttons and Extensions


Recommended Posts

5 hours ago, UCyborg said:

Yes, I know it, 'been using it for a long time, though I've recently gravitated towards KeePassXC-Browser extension on browsers supporting web extensions. Its specialty, it supports filling one time passcodes. It requires KeePassNatMsg plugin, its configuration is very similar to the old KeePassHttp plugin, but it also downloads separate .exe as the communication mechanism uses Native Messaging Host.

On XP x64, I had to modify the plugin to not request TLS 1.2 as XP x64 doesn't do TLS 1.2 and normal XP x86 doesn't either unless you do POSReady 2009 Updates. Presumably the following isn't required if you have an update that adds TLS 1.2. When you download the ZIP with source code from GitHub, you just have to extract KeePassNatMsg folder, inside you open /NativeMessaging/NativeMessagingHost.cs, where you have to modify this piece of code:

protected NativeMessagingHost()
{
    // enable TLS 1.2
    System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;
}

I changed it like so:

protected NativeMessagingHost()
{
    // enable TLS 1.2 if possible
    try
    {
        System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;
    }
    catch
    {
    }
}

Also changed:

public Version GetLatestProxyVersion()
{
    var web = new System.Net.WebClient();
    var latestVersion = web.DownloadString(string.Format("{0}/raw/master/version.txt", GithubRepo));
    Version lv;
    if (Version.TryParse(latestVersion, out lv))
    {
        return lv;
    }
    return null;
}

To:

public Version GetLatestProxyVersion()
{
    try
    {
        var web = new System.Net.WebClient();
        var latestVersion = web.DownloadString(string.Format("{0}/raw/master/version.txt", GithubRepo));
        Version lv;
        if (Version.TryParse(latestVersion, out lv))
        {
            return lv;
        }
    }
    catch (Exception ex)
    {
         MessageBox.Show(ParentForm, "An error occurred attempting to check for the latest version of the proxy application:" + Environment.NewLine + ex.ToString(), "Proxy Version Check Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    return null;
}

The latter doesn't really help setting things up, just outputs an error message in case of error connecting to GitHub rather than crashing KeePass. Then you just follow the procedure at https://keepass.info/help/v2_dev/plg_index.html to build PLGX file. You basically just have to call KeePass.exe from command-line to build PLGX file, using parameter --plgx-create with the full path to KeePassNatMsg folder with plugin source code should suffice. I was in the folder with KeePassNatMsg and called KeePass from there, just in case as it should be a sure way for *.plgx file to end up in the same folder where you have the folder with source code.

Then you install .*plgx file as usual, placing it in C:\Program Files\KeePass Password Safe 2\Plugins (or wherever you have KeePass) folder and launching KeePass, then you can configure it through Tools->KeePassNatMsg Options... and install Native Messaging Host. Any time you open dialog, it connects to GitHub to check for updates for the host *.exe, you must have working TLS 1.2 on the OS level, on XP x64 at least, it'll only work through proxy like Proxomitron to handle encrypted connection.

While this was sufficient to get KeePassXC-Browser extension working on Chrome 115 XP backport everyone's talking about these days, I couldn't get the Firefox extension running, I modified its manifest.json to require lesser version of Firefox, it's set at 96.0, I put it at 68.0 (which I'm not sure if it's accurate, even with the following patches...), then copied Object.hasOwn polyfill at the beginning after 'use strict'; line in few files inside background folder that have a reference to Object.hasOwn. This got the options dialog running, but it complains about inability to encrypt the message and asks if KeePassXC is running.

The polyfill was put in:

  • /background/events.js
  • /background/keepass.js
  • /background/page.js

The polyfill itself:

if (!Object.hasOwn) {
  Object.defineProperty(Object, "hasOwn", {
    value: function (object, property) {
      if (object == null) {
        throw new TypeError("Cannot convert undefined or null to object")
      }
      return Object.prototype.hasOwnProperty.call(Object(object), property)
    },
    configurable: true,
    enumerable: false,
    writable: true
  })
}

There should be a better place to put it in, but that can be figured out after changing whatever is required to get the core functionality working.

TBH, I personally am completely satisfied with Kee. And KeePass also works well without Kee if you only retrieve previously saved login data. I never tried the combination of KeePassXC-Browser and KeePassNatMsg. But thanks for the insights when trying to fix the code! idee.gif BTW, I avoid all webextensions which need an additional exe file in Windows due to their restrictions in Chrome/Firefox/Mypal 68. I don't like that at all. :no:

Edited by AstroSkipper
Update of content
Link to comment
Share on other sites


5 hours ago, UCyborg said:

... I couldn't get the Firefox extension running, I modified its manifest.json to require lesser version of Firefox, it's set at 96.0, I put it at 68.0 (which I'm not sure if it's accurate, even with the following patches...), ...

Maybe, you try for example the extension KeePassXC-Browser in version 1.8.5.1 for Firefox 67 and up instead of the more recent ones for Firefox 96 and up. Reducing the minimum Firefox requirements inside webextensions rarely works. nimportequoi.gif

Edited by AstroSkipper
Link to comment
Share on other sites

Got it running after adding few polyfills (Object.hasOwn, navigator.locks, window.visualViewport) and changing few occurrences of array.at to an older, lengthier syntax.

ZIP also includes modified KeePassNatMsg plugin and modified Chrome extension that may work on Chrome 80, though it's confirmed to work on version 86, old minimums were Chrome 93 and Firefox 96.

KeePassXC-Browser_1.8.10.1.zip

Edited by UCyborg
Link to comment
Share on other sites

On 12/17/2023 at 9:36 PM, AstroSkipper said:

BTW, I avoid all webextensions which need an additional exe file in Windows due to their restrictions in Chrome/Firefox/Mypal 68. I don't like that at all. :no:

It works similarly to KeePassXC's proxy. KeePassXC just happens to be a popular fork descendent from KeePass and that's how it communicates. Native messaging - stdio between the browser and proxy process, named pipe between proxy process and password manager on Windows or using Unix domain socket on other systems. Whether that's better or worse than HTTPS I shall not judge. Though HTTPS indeed strikes as the most straightforward since it's the most basic protocol any browser operates with.

But KeePassNatMsg does bring an extension tailored towards KeePassXC to users of KeePass, so they can use another alternative if they wish. I personally consider the communication protocol just a minor implementation detail.

Link to comment
Share on other sites

On 12/18/2023 at 2:01 AM, UCyborg said:

Got it running after adding few polyfills (Object.hasOwn, navigator.locks, window.visualViewport) and changing few occurrences of array.at to an older, lengthier syntax.

ZIP also includes modified KeePassNatMsg plugin and modified Chrome extension that may work on Chrome 80, though it's confirmed to work on version 86, old minimums were Chrome 93 and Firefox 96.

KeePassXC-Browser_1.8.10.1.zip

Good news for all those who intend to use KeePassXC instead of KeePass:)

1 hour ago, UCyborg said:

It works similarly to KeePassXC's proxy. KeePassXC just happens to be a popular fork descendent from KeePass and that's how it communicates. Native messaging - stdio between the browser and proxy process, named pipe between proxy process and password manager on Windows or using Unix domain socket on other systems. Whether that's better or worse than HTTPS I shall not judge. Though HTTPS indeed strikes as the most straightforward since it's the most basic protocol any browser operates with.

But KeePassNatMsg does bring an extension tailored towards KeePassXC to users of KeePass, so they can use another alternative if they wish. I personally consider the communication protocol just a minor implementation detail.

Thanks for the deeper insights! I am very satisfied with KeePass, though. Thus, I will stay with it as long as it works. I personally do not need any new features. But it is good to know there are alternatives.

Edited by AstroSkipper
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
On 11/16/2023 at 12:16 PM, AstroSkipper said:

Here are two screenshots to show where and by what means modifications have been done to the user interface of Mypal 68.13.5b:

Mypal-68-user-interface-redesign-2-marke

Mypal-68-user-interface-redesign-3-marke

The colours of the areas mean how the modification was made. Red stands for CSS only, blue for JavaScript only, and green for both, JavaScript + CSS.

Cheers, AstroSkipper starescreen.gif

 

On 11/17/2023 at 5:23 AM, AstroSkipper said:

In Firefox 4, the status bar was replaced with the add-on bar, an empty, but customizable, toolbar. In Firefox 29, Mozilla decided to rework the UI again, and ended up in removing the add-on bar as well. From Firefox 29 to 56, the add-on bar could be restored by the extensions Status-4-Evar or Classic Theme Restorer. Mypal 68 is based on the code of Firefox 68esr, called Firefox Quantum, where no add-on bar can be found or natively be enabled by the user. Therefore, I have been looking for ways to reimplement such a status or add-on bar in Mypal 68 with the functionality to display currently loading URLs and hovered links and to place toolbar buttons there. I finally managed to do this and now I have my status bar again like in the old days. :cheerleader: The implementation was done by JavaScript and CSS. Here is a screenshot:

Mypal-68-user-interface-redesign-New-sta

Cheers, AstroSkipper matrix.gif

It appears that you added an extra toolbar to Mypal 68.x to add a statusbar-like area.

I also wanted to add a toolbar. Rather, a few toolbars: (1) one for most the various browser buttons, and (2) a statusbar.

You stated that you implemented your statusbar using Javascript and Cascading Style Sheet combination.  Did you rely on a startup auto-configuration script   to do so?  What other things do you think are worth noting?

Link to comment
Share on other sites

Posted (edited)
22 hours ago, Ascii2 said:

It appears that you added an extra toolbar to Mypal 68.x to add a statusbar-like area.

Not only does it seem that way, but I have definitely implemented a toolbar as a status bar in Mypal 68 :thumbup with the functionality to display currently loading URLs and hovered links and to place toolbar buttons there as you can see in my previously posted pictures. :P

22 hours ago, Ascii2 said:

I also wanted to add a toolbar. Rather, a few toolbars: (1) one for most the various browser buttons, and (2) a statusbar.

You stated that you implemented your statusbar using Javascript and Cascading Style Sheet combination.  Did you rely on a startup auto-configuration script   to do so?  What other things do you think are worth noting?

To achieve this, only two files are required, a JavaScript uc.js file in the chrome profile folder and a corresponding Cascading Style Sheet css file in the chrome/css subfolder. The css file must then of course be integrated into the userchrome.css file. The prerequisite for all this is, of course, the preparations that must be made once in order to be able to load scripts and css files from the chrome folder into Mypal 68 as described by me in the first post of this thread. So, I do not use a startup auto-configuration script. :no: You only need, for example, my package MYPAL_68_CB_requirements.7z from the first post.
And to implement an additional toolbar near the navigation bar for placing buttons, you only need one other JavaScript uc.js file. 

In general, the implemetation of a new toolbar can only be done by a JavaScript uc.js file and any styling of it if necessary or desired by a css file. Such changes of the browser interface cannot be done by webextensions due to their damn restrictions.

I actually wanted to write an article about all of this long ago, but refrained from doing so due to a lack of interest. smilie_denk_24.gif Logically, disinterest and passivity are not particularly motivating. nimportequoi.gif Anyway! When I am back at my desktop computer, I can give you more information if you are still interested in. :dubbio:

Cheers, AstroSkipper matrix.gif

Edited by AstroSkipper
Update of content
Link to comment
Share on other sites

Posted (edited)
21 hours ago, NotHereToPlayGames said:

Are you using "window.status"?

No, I do not use the property window.status. The script code for creating such a status bar has not grown out of my own hands, though. :buehehe: I simply took over an old script which is still working in Mypal 68. TBH, there are a couple of scripts but most of them are not compatible with Mypal 68. My part was finding working code. jumelles.gif And that wasn't so easy due to the age of Firefox 68. Many scripts targeting this Firefox version have been lost or replaced by newer ones. However, I modified the css file for exact placing the status panel onto the status bar by myself. :P And the css file I am using is much more modified and exactly adapted to my browser, in which I also made changes to the interface font. This file is therefore useless for other users. smilie_denk_24.gif

Edited by AstroSkipper
Update of content
Link to comment
Share on other sites

On 4/10/2024 at 4:49 AM, AstroSkipper said:

I have definitely implemented a toolbar as a status bar in Mypal 68 :thumbup with the functionality to display currently loading URLs and hovered links and to place toolbar buttons there as you can see in my previously posted pictures. :P

To achieve this, only two files are required, a JavaScript uc.js file in the chrome profile folder and a corresponding Cascading Style Sheet css... So, I do not use a startup auto-configuration script. :no: You only need, for example, my package MYPAL_68_CB_requirements.7z from the first post.
And to implement an additional toolbar near the navigation bar for placing buttons, you only need one other JavaScript uc.js file.

Thank you for the information.

I would note, however, that after examining your MYPAL_68_CB_requirements.7z package, a startup auto-configuration script is indeed used.  The defaults/prefs directory defines startup preference overrides and sets a (also startup) configuration script "config.js".

For reference, some documentation of the functionality may be found at https://bugzilla.mozilla.org/show_bug.cgi?id=222973 .  Also note its attachment at https://bugzilla.mozilla.org/attachment.cgi?id=152002 .

 

On 4/10/2024 at 4:49 AM, AstroSkipper said:

In general, the implemetation of a new toolbar can only be done by a JavaScript uc.js file and any styling of it if necessary or desired by a css file.

I do note code or know the details of the Javascript language; however, it is my understanding that styling can also be done in Javascript.  While it might be possible to implement styling in Javascript, it is my understanding that browsers will tend to handle the CSS faster than the Javascript; it may be more efficient at runtime to use a Javascript and, where styling is desired, Cascading Style Sheet(s).

Edited by Ascii2
Link to comment
Share on other sites

Posted (edited)
5 hours ago, Ascii2 said:

Thank you for the information.

You're welcome!

5 hours ago, Ascii2 said:

I would note, however, that after examining your MYPAL_68_CB_requirements.7z package, a startup auto-configuration script is indeed used.  The defaults/prefs directory defines startup preference overrides and sets a (also startup) configuration script "config.js".

For reference, some documentation of the functionality may be found at https://bugzilla.mozilla.org/show_bug.cgi?id=222973 .  Also note its attachment at https://bugzilla.mozilla.org/attachment.cgi?id=152002 .

This is what I understand by the term autoconfiguration: https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig
My package MYPAL_68_CB_requirements.7z contains configuration files as the prerequisite for loading script and css files. Although these files are loaded automatically when starting the browser, the creators of these configuration files do not use the term autoconfiguration at this point. This is merely a question of defining the term. :P

Edited by AstroSkipper
Link to comment
Share on other sites

Posted (edited)
5 hours ago, Ascii2 said:

I do note code or know the details of the Javascript language; however, it is my understanding that styling can also be done in Javascript.  While it might be possible to implement styling in Javascript, it is my understanding that browsers will tend to handle the CSS faster than the Javascript; it may be more efficient at runtime to use a Javascript and, where styling is desired, Cascading Style Sheet(s).

I do know that CSS styling can also be done inside a JavaScript file. But separating the CSS code in a css file is the usual way when loading files from the chrome folder. Doing so the different CSS styles can be easily enabled or disabled and therefore managed by the userchrome.css file regardless of the script files.

Edited by AstroSkipper
Update of content
Link to comment
Share on other sites

On 4/10/2024 at 3:36 PM, NotHereToPlayGames said:

Are you using "window.status"?

That appears to be a property accessible by websites to set text which shows on the status bar. I don't think anyone really uses it since status bar has come out of fashion. Maybe on some old websites?

It's been a while since I messed with actual Firefox, so can't say if the scripts for bringing the status bar back (which are browser-specific thing and not something web developers deal with) also make the property serve its purpose. The property seems to work on Pale Moon at least unless you disable that function in status bar's settings, in which case setting the property won't affect text on the status bar.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...