rscustom / rocksmith-custom-song-toolkit

Custom song toolkit for Rocksmith and Rocksmith 2014
http://www.rscustom.net/
343 stars 80 forks source link

Server Toolkit AutoUpdate Info #301

Closed cozy1 closed 6 years ago

cozy1 commented 6 years ago

@ray The toolkit updater is pulling JSON formatted version information for the beta (test build) from here:

https://www.rscustom.net/builds/latest_test/ {"version":"2.8.4.1","date":1507998644,"revision":"9eb168c7"}

https://www.rscustom.net/builds/latest_test/beta/ {"update":false}

and for the release build from here:

https://www.rscustom.net/builds/latest/ - nothing found here

Questions: 1) Where on the server (what URLs) are the best places to pull complete toolkit version information for the beta and release versions that I could use with toolkit updater? 2) https://www.rscustom.net/builds/latest_test/beta/ shows {"update":false} . How is this determined? What is this used for? It seems like toolkit code should be determining update status from this data for the beta {"version":"2.8.4.1","date":1507998644,"revision":"9eb168c7"}. Can I get similar data for the release version from some Url?

Thanks Cozy

ray commented 6 years ago

The release URL is fixed and should show data now.

The URLs will give the latest build if no revision is provided, otherwise it will provide a changelog. eg https://www.rscustom.net/builds/latest_test/41d9082b currently gives

{
    "version": "2.8.4.1",
    "date": 1507998644,
    "update": true,
    "commits": [
        "2017-10-14: - Changed updater process execution for MacWine testing",
        "2017-10-13: - Restore AutoUpdater MacWine testing failed"
    ],
    "revision": "9eb168c7"
}

update simply determines whether to show the update button. See https://github.com/rscustom/rocksmith-custom-song-toolkit/blob/9eb168c7d09f38340bd7b16d3b9e27330f8ef3d1/RocksmithToolkitLib/ToolkitVersionOnline.cs#L24-L25 and https://github.com/rscustom/rocksmith-custom-song-toolkit/blob/9eb168c7d09f38340bd7b16d3b9e27330f8ef3d1/RocksmithTookitGUI/MainForm.cs#L116-L120

Rather than just using the presence of data as an indication it should update, it's there as a separate key to allow updates to be disabled on faulty builds, as was done for https://www.rscustom.net/builds/latest_test/a49c2322

{
    "version": "2.8.4.1",
    "date": 1507998644,
    "update": false,
    ...

The valid URLs are:

cozy1 commented 6 years ago

@ray Ah, so toolkit updater pseudo code would be something like:

1) determine type of toolkit download desired by user - either beta or release from GeneralConfig 2) download the JSON info for the latest_test build https://www.rscustom.net/builds/latest_test 3) read the git subversion for the latest test build 4) download the JSON info for the latest_test build git subversion https://www.rscustom.net/builds/latest_test/420e01fc 5) check JSON boolean "update": status and download updated toolkit if 'true'

Thanks for your input and the fix. Cozy

ray commented 6 years ago

There's really no reason to call the URL without a revision, it only exists because the site uses it internally to get the latest build.

The revision you pass to /latest_test/[revision] should be the one you're currently on. Passing the latest would give no data since it's already up to date.

cozy1 commented 6 years ago

I'm not sure I follow you. We don't know the current revision until we check this: /builds/latest_test and then we have to check this /latest_test/[revision] to see if the revision passed the appveyor build.

I was asking if it would be possible for this /builds/latest_test to contain all the JSON data needed to completely populate ToolkitVersionOnline object to avoid a multi step check?

ray commented 6 years ago

The toolkit should know it's own current revision from the assemblyinfo. Check the existing code, there is no multi step check.

It needs to be given a revision to compare to generate a changelog and determine if it should be updated.

cozy1 commented 6 years ago

Agreed, toolkit knows it's own current revision, but the toolkit does not know what revision is available online till it checks /builds/latest_test then we have multi step to check /latest_test/[revision] to check if build passed, revision is newer, and toolkit should update. It is not a problem. I can implement given the current available info from server.

Thanks

cozy1 commented 6 years ago

@ray My dim light bulb just turned on I think. Given the toolkit's current local revision obtained from AssemblyInfo the server is determining the latest revision available and the recommended "update": status

As an example https://www.rscustom.net/builds/latest_test/41d9082b returns {"version":"2.8.4.1","date":1507998644,"update":true,"commits":["2017-10-14: - Changed updater process execution for MacWine testing","2017-10-13: - Restore AutoUpdater MacWine testing failed"],"revision":"9eb168c7"}

Therefore the latest revision available is "revision":"9eb168c7" and the server is recommending "update":true

Did I get it correct this time?

ray commented 6 years ago

Correct :)

cozy1 commented 6 years ago

Thanks