-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1152 from RedBaron2/patch-5
(wps-office-free) update to read JS rendered page in posh
- Loading branch information
Showing
4 changed files
with
98 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import-module au | ||
. ".\update_helper.ps1" | ||
|
||
function global:au_SearchReplace { | ||
@{ | ||
".\tools\chocolateyInstall.ps1" = @{ | ||
"(^[$]version\s*=\s*)('.*')" = "`$1'$($Latest.Version)'" | ||
"(^\s*packageName\s*=\s*)('.*')" = "`$1'$($Latest.PackageName)'" | ||
"(^\s*url\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'" | ||
"(^\s*checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'" | ||
"(^\s*checksumType\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType32)'" | ||
} | ||
} | ||
} | ||
|
||
function global:au_GetLatest { | ||
$streams = [ordered] @{ | ||
wps = Get-JavaSiteUpdates -package "wps-office-free" -Title "WPS Office Free" | ||
} | ||
|
||
return @{ Streams = $streams } | ||
} | ||
|
||
update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
|
||
function Get-PackageName() { | ||
param( | ||
[string]$a | ||
) | ||
|
||
switch -w ( $a ) { | ||
|
||
'wps-office-free' { | ||
$PackageUrl = "https://www.wps.com/en-US/office/windows/" | ||
} | ||
|
||
} | ||
|
||
return $PackageUrl | ||
|
||
} | ||
|
||
function Get-JavaSiteUpdates { | ||
# $wait number can be adjusted per the package needs | ||
param( | ||
[string]$package, | ||
[string]$Title, | ||
[string]$padVersionUnder = '10.2.1', | ||
[string]$wait = 4 | ||
) | ||
|
||
$OS_caption = ( Get-CimInstance win32_operatingsystem -Property Caption ) | ||
$check = @{$true=$true;$false=$false}[ ( $OS_caption -match 'Server' ) ] | ||
$regex = '([\d]{0,2}[\.][\d]{0,2}[\.][\d]{0,2}[\.][\d]{0,5})' | ||
$url = Get-PackageName $package | ||
$ie = New-Object -comobject InternetExplorer.Application | ||
$ie.Navigate2($url) | ||
$ie.Visible = $false | ||
while($ie.ReadyState -ne $wait) { | ||
start-sleep -Seconds 20 | ||
} | ||
if ( $check ) { | ||
$url32 = $ie.Document.IHTMLDocument3_getElementsByTagName("a") | % { $_.href } | where { $_ -match $regex } | select -First 1 | ||
} else { | ||
$url32 = $ie.Document.getElementsByTagName("a") | % { $_.href } | where { $_ -match $regex } | select -First 1 | ||
} | ||
|
||
foreach ( $_ in $ie.Document.getElementsByTagName("a") ) { | ||
$url = $_.href; | ||
if ( $url -match $regex) { | ||
$yes = $url | select -last 1 | ||
$version = $Matches[0] | ||
$the_match = $yes -match( $rev_regex ); | ||
$revision = $Matches[0]; | ||
break; | ||
} | ||
} | ||
$ie.quit() | ||
if ($package -match 'wps') { | ||
$version = $version | ||
} else { | ||
$version = $version + $revision | ||
} | ||
|
||
|
||
@{ | ||
PackageName = $package | ||
Title = $Title | ||
fileType = 'exe' | ||
Version = Get-FixVersion $version -OnlyFixBelowVersion $padVersionUnder | ||
URL32 = $yes | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"wps": "10.2.0.7549" | ||
} |