haganbmj / MagicSetEditor2

Magic Set Editor is a program for designing trading cards
Other
16 stars 7 forks source link

reinstating check_updates #88

Open CajunAvenger opened 1 week ago

CajunAvenger commented 1 week ago

I'd like to set up a new host for Check online for updates, but I'm not sure how to format the data I'm sending to MSE. From reading update_checker.cpp and related, it looks like it should be approximately the form

updates:
    version: 2.5.0
    description: HTML description of update
    new updates url: https://host.com/updates
    packages:
        magic-m15:
            package: magic-m15
            version: 2024-09-18
installers:
    magic-m15:
        description:
            name: M15 Basic Style
        installer:
            installer_url: https://host.com/Magic - M15 Style.mse-installer
            installer_file: Magic - M15 Style.mse-installer

i've tried send this as this raw text, this text unindented, in JSON form, and each of those as the content of a file named "updates", and none of those was the trick.

MSE is getting the server response, but here in update_checker isn't reading data MSE understands, so it just closes the update thinking there's no updates.

      Reader reader(*isP, nullptr, _("updates"), true);
      reader.handle(version_data);
CajunAvenger commented 6 days ago

have gotten a lil further

version 2.5.2
description: Test

is showing up, but i haven't got it to recognize there's an mse-install yet

haganbmj commented 2 days ago

Lemme poke around, I think all that package logic is 15+ years old and appears to have been never really fully finished seeing as it wasn't added to all the stuff in the data directory pre-fork.

The entire section titled "Installing" was commented out. https://github.com/haganbmj/MagicSetEditor2/blob/master/src/data/installer.cpp#L55-L159

and has been for 16 years? When it was though it seems like it was while Upgrading and Installing were being combined... so maybe it was just unnecessary stuff.

https://github.com/haganbmj/MagicSetEditor2/commit/eed8ba4274bf802923dfb6aa530ce858244def92#diff-e646c89d75506ba3db2acc1b2d9228fb376c14ac3ec840f39151821ac3ef0126R41

haganbmj commented 2 days ago

This seems to be the only place that new updates url gets used. https://github.com/haganbmj/MagicSetEditor2/blob/ddd49b50d7d947e4451d31243ea29d7778c16884/src/gui/update_checker.cpp#L101-L129

And it's confusing to me since that's after the default update url is applied, and looks like it would never happen?

I also saw this block here that seems to be for representing the status on that update list, but it isn't an else block so it reads as if it would only ever work for fresh installs and not updates. So not sure if I'm reading the wrong spot for that too.

https://github.com/haganbmj/MagicSetEditor2/blob/ddd49b50d7d947e4451d31243ea29d7778c16884/src/data/installer.cpp#L290-L312

CajunAvenger commented 2 days ago

sorry i should have linked better

right here is where MSE reads the data it gets from the server https://github.com/haganbmj/MagicSetEditor2/blob/d0522f6a09a76fa4e7b57e188a22addbd21c45da/src/gui/update_checker.cpp#L110-L117

the VersionData class is defined here, which gets Version, Description, and New Update URL, which I have been able to get the program to recognize https://github.com/haganbmj/MagicSetEditor2/blob/d0522f6a09a76fa4e7b57e188a22addbd21c45da/src/gui/update_checker.cpp#L45-L52

the description gets used here https://github.com/haganbmj/MagicSetEditor2/blob/d0522f6a09a76fa4e7b57e188a22addbd21c45da/src/gui/update_checker.cpp#L190

but i can't figure out how to get it to read the packages list from the server response, so it can actually download the installers. the best idea i've gotten so far is maybe it should be happening here, but we're on USE_OLD_STYLE_UPDATE_CHECKER and this is getting skipped with no alternative being available? https://github.com/haganbmj/MagicSetEditor2/blob/d0522f6a09a76fa4e7b57e188a22addbd21c45da/src/gui/update_checker.cpp#L70-L85

haganbmj commented 1 day ago

Yeah if I'm reading the history of this right it looks like the original update pattern was that all the packages were distributed "officially" and the updater only worked for one endpoint that kind of maintained all of them. I can try removing that "USE_OLD" check and just see what happens. I want to look around and see what else that applies to; the hardcoded update urls are all to the old SourceForge page which is broken anyways.