brogers5 / chocolatey-package-messenger

Chocolatey package for Messenger.

Home Page:https://community.chocolatey.org/packages/messenger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chocolatey Package: Messenger

Latest package version shield Total package download count shield

Install

Install Chocolatey, and run the following command to install the latest approved stable version from the Chocolatey Community Repository:

choco install messenger --source="'https://community.chocolatey.org/api/v2'"

Alternatively, the packages as published on the Chocolatey Community Repository will also be mirrored on this repository's Releases page. The nupkg can be installed from the current directory (with dependencies sourced from the Community Repository) as follows:

choco install messenger --source="'.;https://community.chocolatey.org/api/v2/'"

This package also supports the project's beta builds. Opt into these with the --prerelease switch.

Build

Install Chocolatey, clone this repository, and run the following command in the cloned repository:

choco pack

A successful build will create messenger.x.y.z.nupkg, where x.y.z should be the Nuspec's version value at build time.

Note that Chocolatey package builds are non-deterministic. Consequently, an independently built package will fail a checksum validation against officially published packages.

Update

This package should be automatically updated by the Chocolatey Automatic Package Updater Module. If it is outdated by more than a few days, please open an issue.

AU Setup

AU expects the parent directory that contains this repository to share a name with the Nuspec (messenger). Your local repository should therefore be cloned accordingly:

git clone git@github.com:brogers5/chocolatey-package-messenger.git messenger

Alternatively, a junction point can be created that points to the local repository (preferably within a repository adopting the AU packages template):

mklink /J messenger ..\chocolatey-package-messenger

Beta Stream Setup

The update script will request the latest version information for both the stable and beta channels directly from Messenger's Sparkle service.

While information for the stable channel may be anonymously queried, the beta channel requires access to a Facebook account that has joined Messenger's beta testing program. Users can opt into this directly in Messenger - from the menu bar, browse to File > Preferences > General, and toggle Join beta testing:

Screenshot of beta testing toggle

Requests for beta version information will also require sending authentication cookies that contain the account's static user ID (c_user) and a dynamic unique session ID (xs). We can take advantage of session riding to reuse an existing session ID from PowerShell and minimize authenticating to Facebook.

The script depends on PowerShell's SecretManagement module to securely query for the cookies' values from a registered extension vault.

If you do not already have an extension vault registered, install an extension vault module of your choice, then register a secret vault as required by the module's implementation.

Log into Facebook from your web browser, grab the cookies' values, then create the following secrets:

#TODO: Populate using values sourced from web browser
$c_userValue = ''
$xsValue = ''

Set-Secret -Name 'Facebook User ID' -Secret $c_userValue
Set-Secret -Name 'Facebook Session ID' -Secret $xsValue

Note

The session ID secret will require occasional updates to work around sessions expiring or otherwise being invalidated by Facebook (e.g. logging out, password changes, device removal, suspicious account activity, etc.).

VirusTotal Setup

While not strictly necessary to produce a working package, it's recommended to install VirusTotal's CLI and configure an API key. An API key can be procured for free with a VirusTotal account.

This should enable automated submission of the installer binary to VirusTotal, which would improve the user experience for Chocolatey Pro+ users. They have access to Chocolatey's Runtime Malware Protection feature, which by default is enabled and configured for VirusTotal integration.

Normally, the Community Repository's Package Scanner service would upload the installer binary to VirusTotal, as a prerequisite to the moderation process's Scan Testing step. Unfortunately, the package is currently incompatible with it (due to a conflicting OS requirement), and will therefore fail to submit the installer binary.

As new Messenger releases are unlikely to have been scanned prior to an updated package's publication, this would avoid burdening users with a run-time prompt to optionally upload the installer binary to VirusTotal for scanning.

Execution and Testing

Once everything is set up, simply run update.ps1 from within the created directory/junction point. Assuming all goes well, all relevant files should change to reflect the latest version available for the last stream that was built. This will also build a new package version using the modified files.

To limit the scope of update checks to a specific update channel, pass the -IncludeStream parameter with the desired Stream name:

.\update.ps1 -IncludeStream 'Stable'
.\update.ps1 -IncludeStream 'Beta'

Before submitting a pull request, please test the package with a 64-bit Windows 10 v1903+ environment similar to the Chocolatey Testing Environment first.