Java/Getdown

From
Jump to: navigation, search

Links

Github sourcen
documentation

Create a getdown.txt file

The getdown.txt file contains all of the configuration information used by Getdown to control the downloading, installing, patching and execution of your application. Herein we describe all of the configuration options available.

# where our app is hosted on the internets
appbase = https://www.gallas-it.de/openaifrontend/

# the jar file that contains our code
code = openaifrontend.jar

# include the latest copy of getdown; app checks at startup whether it should upgrade getdown
# code = getdown-new.jar

# the main entry point of our app
class = de.termina.openaifrontend.MainApp

# we pass the appdir to our app so that it can upgrade getdown
apparg = %APPDIR%

# test the %env% mechanism
jvmarg = -Dusername=\%ENV.USER%

strict_comments = true
#resource = funny%test dir/some=file.txt
#resource = crazyhashfile#txt
#uresource = foo.jar
#xresource = script.sh

resource = lib/javafx-base-22.0.1-win.jar
resource = lib/javafx-controls-22.0.1-win.jar
resource = lib/javafx-fxml-22.0.1-win.jar
resource = lib/javafx-graphics-22.0.1-win.jar
resource = lib/javafx-media-22.0.1-win.jar
resource = lib/javafx-swing-22.0.1-win.jar
resource = lib/javafx-web-22.0.1-win.jar
resource = log4j2.xml
resource = runme.bat
resource=background.png

ui.name = Openaifrontend
ui.background_image = background.png
ui.progress = 17, 321, 458, 22
ui.progress_bar = 336600
ui.progress_text = FFFFFF
ui.status = 57, 245, 373, 68
ui.status_text = 000000

# java_min_version = 1080112
# java_exact_version_required = true
# java_location = [windows] java_windows.jar
# java_location = [mac os x] java_macos.jar
# java_location = [linux] java_linux.jar

Create digest file

The digest2 file contains all needed sources incl. Hashcode. The file can be crearted by running:

java -classpath %USERPROFILE%\.m2\repository\com\threerings\getdown\getdown-core\1.8.0\getdown-core-1.8.0.jar com.threerings.getdown.tools.Digester C:\util\openAiFrontend

Copy all file to public location


# Definieren der Basisvariablen
$appbase = "https://www.gallas-it.de/openaifrontend/"

# Abfragen der Anmeldeinformationen
$credentials = Get-Credential -Message "Bitte Ihre Login-Daten eingeben"

# Pfad zur getdown.txt Datei
$getdownFilePath = "getdown.txt"  # Pfad aktualisieren

# Einlesen des Inhalts der getdown.txt Datei
$getdownContent = Get-Content -Path $getdownFilePath -ErrorAction Stop

# Filtern der Zeilen, die Ressourcen beinhalten
$resources = $getdownContent | Where-Object { $_ -match "^resource\s*=\s*(.*)" }

# Schleife über jede gefundene Ressource
foreach ($resourceLine in $resources) {
    # Extrahieren des relativen Pfads der Ressource
    $relativePath = ($resourceLine -split "=")[1].Trim()

    # Vollständige URL der Quellressource bilden
    $sourceUrl = $appbase + $relativePath.Replace("\", "/")

    # Zielverzeichnis, wo die Datei gespeichert werden soll
    $targetDirectory = "appbase"  # Zielverzeichnis aktualisieren, wenn nötig

    # Überprüfe, ob das Verzeichnis existiert, und erstelle es, falls nicht vorhanden
    if (-not (Test-Path -Path $targetDirectory)) {
        New-Item -ItemType Directory -Force -Path $targetDirectory
    }

    # Ziel-Dateipfad festlegen
    $targetFilePath = Join-Path $targetDirectory (Split-Path $relativePath -Leaf)
    
    # Herunterladen und Speichern der Datei im Zielverzeichnis
    # Hier könnte eine Authentifizierung nötig sein, abhängig von der Konfiguration des Servers.
    try {
        Invoke-WebRequest -Uri $sourceUrl -OutFile $targetFilePath -Credential $credentials
        Write-Host "Downloaded resource: $relativePath"
    } catch {
        Write-Host "Failed to download: $relativePath"
    }
}

Write-Host "Copying resources complete."