minetest-world / mtlauncher

GNU Lesser General Public License v2.1
5 stars 3 forks source link

automatically prompt for a specific version if a server does not support the selected version #1

Closed recluse4615 closed 1 year ago

recluse4615 commented 1 year ago

tl;dr -

it would probably be best to modify $selectedVersion when selecting a server in the ServerListTable.svelte, that way the rest of the application can "catch on" and prompt to install the specific maximum version needed

recluse4615 commented 1 year ago

https://github.com/minetest-world/mtlauncher/blob/main/src/routes/%2Blayout.svelte#L104

server here is a full server object, which should include 2 fields:

the "recommended version" can be figured out like so:

import { getVersions } from '$lib/api/versions';

// ...
let server = { ... };
let recommendedVersion = getVersions().filter(i => i.branch.protocolVersion === server.proto_max && !i.branch.isDev);

the best way to do this would probably be to subscribe to selectedServer like so:

selectedServer.subscribe(val => {
    if (val.hasOwnProperty('proto_max')) {
         let recommendedVersion = getVersions().filter(i => i.branch.protocolVersion === server.proto_max && !i.branch.isDev);
         $selectedVersion = recommendedVersion;
    }
});

might need some testing/extra reactive-ness tho

recluse4615 commented 1 year ago

resolved in v0.0.2