Git Product home page Git Product logo

Comments (5)

o-l-a-v avatar o-l-a-v commented on July 1, 2024

Jabra webpage returns webpage in native language if available, that might be the cause of it.

Here is some (for now) working PowerShell to get latest available version.

[System.Version](
    (
        Invoke-RestMethod -Method 'Get' -Uri 'https://www.jabra.com/Support/release-notes/release-note-jabra-direct'
    ).Split(
        [System.Environment]::NewLine,
        [System.StringSplitOptions]::RemoveEmptyEntries
    ).Where{
        -not [string]::IsNullOrEmpty($_)
    }.ForEach{
        $_.Trim() -replace '\s{2,}', ' '
    }.Where{
        $_ -like '*?.?.?*<br>*'
    }[0].Split(
        ' ',
        [System.StringSplitOptions]::RemoveEmptyEntries
    ).ForEach{
        $_.Replace('<br>','')
    }.Where{
        $_ -like '?.?.?*'
    }[0]
)

I tried to look for some headers or URL parameters to request English language, but did not find anything in my short research here.

from nevergreen.

DanGough avatar DanGough commented on July 1, 2024

Thanks for the report, could you please confirm if it's still an issue? It's working for me at the moment with an English OS, I will investigate!

from nevergreen.

o-l-a-v avatar o-l-a-v commented on July 1, 2024

@DanGough

Yup, still a problem. English OS. en-SE culture (Get-Culture, LCID = 8192).

from nevergreen.

DanGough avatar DanGough commented on July 1, 2024

Hi, would you be able to try the version I've just uploaded to Dev at all?

I got an error if I tried switching it from .co.uk to .com, unless I set the user agent to GoogleBot, so I've now tweaked the internal function Get-Version to support a UserAgent parameter. I've used this and also switched the URL to use .com, and changed the match parameter to find the first version number followed by <br>, so that it works independent of language.

from nevergreen.

o-l-a-v avatar o-l-a-v commented on July 1, 2024

It worked. :)

Test script:

#Requires -Version 5.1
<#
    .SYNOPSIS
        Test dev branch of Nevergreen by first downloading it to desktop and unzip it.

    .NOTES
        Author:   Olav Rønnestad Birkeland
        Created:  211015
        Modified: 211015

    .EXAMPLE
        & $psISE.CurrentFile.FullPath -Name 'JabraDirect'
#>


# Input parameters
[OutputType($null)]
Param(
    [Parameter(Mandatory)]
    [ValidateNotNullOrEmpty()]
    [string] $Name
)


# PowerShell preferences
$ErrorActionPreference = 'Stop'
$InformationPreference = 'Continue'


# Import dev module
## Introduce step
Write-Information -MessageData '# Import module'

## Create expected module path
$ModulePath = [string] '{0}\Nevergreen-dev\Nevergreen\Nevergreen.psm1' -f [System.Environment]::GetFolderPath('Desktop')

## Chech that it exists
if (-not [System.IO.File]) {
    Throw ('Did not find module at "{0}".' -f $ModulePath)
}

## Remove if imported from different path
if ($(Try{(Get-Module -Name 'Nevergreen').'Path' -ne $ModulePath}Catch{$false})) {
    $null = Remove-Module -Name 'Nevergreen' -Force
}

## Import if needed
if ($(Try{(Get-Module -Name 'Nevergreen').'Path' -eq $ModulePath}Catch{$false})) {
    Write-Information -MessageData 'Module already imported.'
}
else {    
    Write-Information -MessageData 'Module not already imported.'
    $null = Import-Module -Name $ModulePath -Force
}

## View module and version
Get-Module -Name 'Nevergreen' | Format-List


# Test getting version of Jabra Direct
## Introduce step
Write-Information -MessageData ('{0}# Try get version of "{1}"' -f [System.Environment]::NewLine, $Name)

## Get version
Get-NevergreenApp -Name $Name

Output

PS C:\Users\birola>         & $psISE.CurrentFile.FullPath -Name 'JabraDirect'
# Import module
Module already imported.


Name              : Nevergreen
Path              : C:\Users\birola\OneDrive - <removed>\Skrivebord\Nevergreen-dev\Nevergreen\Nevergreen.psm1
Description       : 
ModuleType        : Script
Version           : 0.0
NestedModules     : {}
ExportedFunctions : {Find-NevergreenApp, Get-NevergreenApp}
ExportedCmdlets   : 
ExportedVariables : 
ExportedAliases   : 




# Try get version of "JabraDirect"


Name         : Jabra Direct
Architecture : Multi
Type         : Exe
Version      : 5.8.49513
Uri          : https://jabraxpressonlineprdstor.blob.core.windows.net/jdo/JabraDirectSetup.exe




PS C:\Users\birola> 

from nevergreen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.