Skip to content

PeernetOfficial/BrowserSetup2

Repository files navigation

General

This is Inno Setup script that generates complete setup for Peernet software. The script responsibility:

  • Check if .NET Desktop Runtime 7.0.x is installed.
  • If the runtime is missing, the installer will download the runtime from Official Microsoft website
  • The installer will run downloaded runtime installer
  • The installer will download checked plugins from Peernet servers
  • Once runtime installation is completed and plugins downloaded, it will proceed to core Peernet installation which includes unpacking of Peernet Browser together with Backend and Firewall Allow.cmd batch file.
  • At the last step installer will run Firewall Allow.cmd batch file

Downloading of the runtime from setup file is possible thanks to Inno Download Plugin. It is the set of APIs which use in the script gives ability to download files. For more information install the plugin and read the documentation.

Compilation

Inno Setup Version 6.1 has added support for downloading files without using a third-party tool. Latest Peernet Setup revision uses Download features from Inno Setup 6.1 thus there is no need to install Inno Download Plugin (steps 2-3). Although the plugin might be needed for some historical revisions.

  1. Download and install Inno Setup
    This basically gives ability to compile scripts, although since the script uses downloading features you need to:
  2. Install the Inno Download Plugin from the archive folder.
  3. Modify the file [path]\Inno Setup 6\ISPPBuiltins.iss by adding following to the end of the file
#pragma include __INCLUDE__ + ";" + ReadReg(HKLM, "Software\Mitrich Software\Inno Download Plugin", "InstallDir")
  1. Open the script in the Inno Setup Compiler
  2. Compile.
    You can compile either by CTRL + F9 combination or by Build > Compile

Preparation Checklist

Follow each step before generating a release version for the public.

  1. Core: Update the core version number in the file Config.go. It is going to be part of the User Agent.

  2. Cmd: Open Main.go. Change the User Agent to Peernet Browser. The core version is automatically added to it.

  3. Cmd: Make sure to compile it using these flags: go build -trimpath -ldflags "-H=windowsgui -s"

  4. Browser: Compile it using: dotnet publish -c Release --no-self-contained

  5. Setup: Update [Files] section in the file InnoPeernetSetup.iss. It should list all the files that go to the setup package.

  6. Setup: Change the version number in the file InnoPeernetSetup.iss in the field MyAppVersion

Edge Cases

Running Setup as different User

If the setup is run as different user (for example using right-click "Run as administrator") it will actually install the browser for that selected user. If this is done from non-admin account (started under admin rights), the installed version will be inaccessible to the non-admin user.

Additional Tasks Screen

The setup has an "Additional Tasks" screen. It lists:

The ZIP files downloaded are update packages placed into the data/update folder. They contain an info.ini file that instructs the backend what to do with it.

Improvement Ideas

Pin To Taskbar option

There is a discussion spanning topic of taskbar pin option on Peernet Talk.

Windows 10 possible solution

Pinning to taskbar for many Windows versions used to be easy task with reusing one of COM Object resources to simulate Pin to taskbar context menu click. Starting from some Windows 10 update pinning to taskbar became tricky. Microsoft changed Shell namespaces and introduced new method of Start Layout management. The method uses XML file which defines the Start Layout (including taskbar).

Such file for Peernet Browser could be defined as:

<LayoutModificationTemplate 
xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"  
Version="1" 
xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout">
  <CustomTaskbarLayoutCollection PinListPlacement="Replace">
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:DesktopApp DesktopApplicationLinkPath="%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Peernet Browser.lnk" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
  </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

where

<taskbar:DesktopApp DesktopApplicationLinkPath="%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Peernet Browser.lnk" />

is .lnk file reference created based on 'Peernet Browser.exe'.
.lnk could be created from the Inno script code:

    PinAppFromLayout;
    FileCopy(
         ExpandConstant('{app}\Peernet Browser.lnk'), ExpandConstant('{autoappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Peernet Browser.lnk'),
         False);

where PinAppFromLayout is defined as

procedure PinAppFromLayout;
begin
  CreateShellLink(
    ExpandConstant('{app}\Peernet Browser.lnk'),
    '',
    ExpandConstant('{app}\Peernet Browser.exe'),
    '',
    ExpandConstant('{app}\config'),
    '',
    0,
    SW_SHOWNORMAL);
end;

The XML Start Layout file should be imported to the output directory under [File] directive

Source: "Files Static\TaskBarLayout.xml"; DestDir: "{app}"; Flags: ignoreversion

Having it in the file system the file can later be set as Start Layout definition either via Group Policy Editor or respective registry keys. Inno supports registry management under [Registry] directrive.

Root: HKCU; Subkey: "Software\Policies\Microsoft\Windows\Explorer"; Flags: createvalueifdoesntexist;
Root: HKCU; Subkey: "Software\Policies\Microsoft\Windows\Explorer"; ValueName:"LockedStartLayout"; ValueData: "$1"; ValueType: dword; Flags: createvalueifdoesntexist;
Root: HKCU; Subkey: "Software\Policies\Microsoft\Windows\Explorer"; ValueName:"StartLayoutFile"; ValueData: "{app}\TaskBarLayout.xml"; ValueType: expandsz; Flags: createvalueifdoesntexist;

Changes to the registry require privileged access. The proposed solution requires running the setup with elevated rights. It is recommanded to look for some improvement in this matter. Change of Start Layout XML file requires reboot (or user relog = log out + log in) to have the effect.

About

Setup for Peernet Browser based on Inno Setup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published