Git Product home page Git Product logo

Comments (16)

hawkeye116477 avatar hawkeye116477 commented on May 29, 2024

No można by zrobić skrypt bashowy i dodać to do crona. A jest też takie coś https://www.softfluent.com/blog/dev/Be-notified-when-a-new-release-is-created-in-a-GitHub-repository i https://coderelease.io/.

from polishcookieconsent.

hawkeye116477 avatar hawkeye116477 commented on May 29, 2024

@krystian3w A co jaki czas wg ciebie ten skrypt powinien sprawdzać, co tydzień czy szybciej?

from polishcookieconsent.

krystian3w avatar krystian3w commented on May 29, 2024

Może być co tydzień.

from polishcookieconsent.

hawkeye116477 avatar hawkeye116477 commented on May 29, 2024

Ok, a wykonanie skryptu PowerShell zlecam dla @krystian3w 😄. Póki co na razie jest tyle, ja tam raczej za bardzo się nie znam na windowsowych skryptach.

$URI = "https://api.github.com/repos/PolishFiltersTeam/PolishCookieConsent/releases/latest"

$NEW_VERSION_TAG = Invoke-RestMethod -Method Get -Uri $URI | select -expand tag_name  
$NEW_VERSION = "$NEW_VERSION_TAG".Trim("v", " ")



$PATH_INSTALL_EXT=[Environment]::GetFolderPath("UserProfile")+"\Rozszerzenia\PolishCookieConsent"
$OLD_VERSION=cat $PATH_INSTALL_EXT\manifest.json | Select-String -Pattern '"version":'


$PATH_DOWN_EXT=[Environment]::GetFolderPath("UserProfile")+"\Downloads\PolishCookieConsent_v$NEW_VERSION"

OLD_VERSION jest niekompletne i dalej trzeba dorobić pobieranie, wypakowywanie i zrobić Task (https://docs.microsoft.com/en-us/powershell/module/scheduledtasks/new-scheduledtasktrigger?view=win10-ps).

from polishcookieconsent.

hawkeye116477 avatar hawkeye116477 commented on May 29, 2024

@krystian3w I jak tam postępy 😄?

from polishcookieconsent.

krystian3w avatar krystian3w commented on May 29, 2024

Brak 😣.

from polishcookieconsent.

krystian3w avatar krystian3w commented on May 29, 2024
# Download latest 'PolishFiltersTeam/PolishCookieConsent' release from github
# Special thanks for  @MarkTiedemann and @f3l3gy
# credits:
# https://gist.github.com/MarkTiedemann/c0adc1701f3f5c215fc2c2d5b1d5efd3
# https://gist.github.com/f3l3gy/0e89dde158dde024959e36e915abf6bd

$repo = "PolishFiltersTeam/PolishCookieConsent"
$file = "PolishCookieConsent_chromium.zip"


$releases = "https://api.github.com/repos/$repo/releases"

Write-Host Determining latest release
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$tag = (Invoke-WebRequest -Uri $releases -UseBasicParsing | ConvertFrom-Json)[0].tag_name

$download = "https://github.com/$repo/releases/download/$tag/$file"
$name = $file.Split(".")[0]
$zip = "$name.zip"
$dir = "$name"

Write-Host Dowloading latest release

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest $download -Out $zip

Write-Host Extracting release files
Expand-Archive $zip -Force

# Cleaning up target dir
#Remove-Item $name -Recurse -Force -ErrorAction SilentlyContinue 

# Moving from temp dir to target dir
#Move-Item $dir\$name -Destination $name -Force

# Removing temp files
Remove-Item $zip -Force
#Remove-Item $dir -Recurse -Force


pause

Jeszcze muszę ogarnąć ten task i wykrywanie już dodanego cyklicznego zadania w harmonogramie.
I by działał z dowolnego folderu zamiast rozszerzenia lub obok tego gdzie mamy dodatek (ścieżka temp i ścieżka właściwa jak podajesz w swoim przykładzie).

from polishcookieconsent.

hawkeye116477 avatar hawkeye116477 commented on May 29, 2024

@krystian3w Powinno być też sprawdzanie wersji, żeby podmieniał tylko jeżeli jest taka potrzeba.

from polishcookieconsent.

krystian3w avatar krystian3w commented on May 29, 2024

To jeszcze pomyśle jak to połączyć albo jak dopisać pobieranie, rozpakowywanie, czyszczenie zbędnej paczki zip.

I to dodawanie do zaplanowanych zadań - na razie mam w nim z 30 czerwonych linii o komunikacie błędu.

from polishcookieconsent.

krystian3w avatar krystian3w commented on May 29, 2024

Nie umiem porównać $NEW_VERSION z $OLD_VERSION, jakoś nie wychodzi mi usunięcie tekstu z stringu.


$NEW_VERSION = '  "version": "' + "$NEW_VERSION_TAG".Trim("v", " ") + '",'

if ($OLD_VERSION[0].Title -eq $NEW_VERSION[0].Title) 
{Write-Host yes } else {Write-Host no }

Ale trochę badziewne

from polishcookieconsent.

hawkeye116477 avatar hawkeye116477 commented on May 29, 2024

@krystian3w


[Net.ServicePointManager]::SecurityProtocol = 'TLS11','TLS12','ssl3'
$repo = "PolishFiltersTeam/PolishCookieConsent"
$releases = "https://api.github.com/repos/$repo/releases"

$NEW_VERSION = $((Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name).TRIM("v", " ")
Write-Output "$NEW_VERSION"

$PATH_DOWN_EXT = [Environment]::GetFolderPath("UserProfile")+"\Downloads\PolishCookieConsent_v$NEW_VERSION"
$PATH_INSTALL_EXT = [Environment]::GetFolderPath("UserProfile")+"\Rozszerzenia\PolishCookieConsent"

$OLD_VERSION = $(cat $PATH_INSTALL_EXT\manifest.json | Select-String -Pattern '"version":').Line.Split(':')[1] -replace '"', "" -replace ',', "" -replace '\s',''
Write-Output "$OLD_VERSION"

$zip = "PolishCookieConsent_chromium.zip"

If ( $NEW_VERSION -gt $OLD_VERSION ) 
{
	new-item $PATH_DOWN_EXT -itemtype directory
	Invoke-WebRequest "https://github.com/$repo/releases/download/v$NEW_VERSION/$zip" -OutFile $PATH_DOWN_EXT/$zip
	Expand-Archive -Path $PATH_DOWN_EXT/$zip -DestinationPath $PATH_INSTALL_EXT -Force
	Remove-Item $PATH_DOWN_EXT -Recurse
	[System.Windows.Forms.MessageBox]::Show("Rozszerzenie Polska Ciasteczkowa Zgoda zostało zaktualizowane. Proszę zrestartować przeglądarkę.", "Sukces")
}
Else
{	
	[System.Windows.Forms.MessageBox]::Show("Aktualnie nie ma nowszej wersji rozszerzenia Polska Ciasteczkowa Zgoda.", "Informacja")
}

To teraz tylko task został.

from polishcookieconsent.

krystian3w avatar krystian3w commented on May 29, 2024

Aha, najpierw musiałbym taki poleceniami CMD ogarnąć i raczej będą działać w PS.

from polishcookieconsent.

hawkeye116477 avatar hawkeye116477 commented on May 29, 2024

@krystian3w Skrypt dla PS już gotowy, wymagany jest PS 5.1+ 😄.

from polishcookieconsent.

krystian3w avatar krystian3w commented on May 29, 2024

A jest sprawdzanie wersji i linki do Uaktualnienia PS do 5.1 na Windows 7 / 8.1?

Nie wiem jaki ma 10 może 6.0.

from polishcookieconsent.

hawkeye116477 avatar hawkeye116477 commented on May 29, 2024

@krystian3w Tzn. sprawdzanie wersji PowerShella? Nie ma, napisałem tylko w readme, że 5.1+, linków do uaktualnienia też brak.

from polishcookieconsent.

krystian3w avatar krystian3w commented on May 29, 2024

https://www.microsoft.com/en-us/download/details.aspx?id=54616

from polishcookieconsent.

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.