Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 5.10.0 with the new Luanti name! #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 11 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"crypto-js": "^4.1.1",
"jszip": "^3.10.1",
"patch-package": "^6.4.7",
"semver": "^7.6.3",
"svelte-markdown": "^0.2.3",
"tauri-plugin-fs-watch-api": "github:tauri-apps/tauri-plugin-fs-watch"
}
Expand Down
7 changes: 5 additions & 2 deletions src/lib/api/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {fetch as tFetch, ResponseType} from '@tauri-apps/api/http';
import {BaseDirectory, createDir, writeBinaryFile, readDir} from "@tauri-apps/api/fs";
import { type, arch } from '@tauri-apps/api/os';
import {invoke} from "@tauri-apps/api/tauri";
import semverGte from 'semver/functions/gte';

export async function versionExists(version = '5.6.0') {
try {
Expand Down Expand Up @@ -33,6 +34,8 @@ export async function downloadFile(url, targetFile) {
export async function downloadVersion(version = '5.6.0') {
console.log('we downloadin babey!!');
let platform = await type();
// They renamed Minetest to Luanti and since version 5.10.0 they renamed the download files as well on the minetest github repo. Linux binaries are fine tho.
const downloadName = semverGte(version, '5.10.0') ? 'luanti' : 'minetest';
switch (platform) {
case 'Linux':
await createDir(`versions/${version}`, {
Expand All @@ -44,10 +47,10 @@ export async function downloadVersion(version = '5.6.0') {
await createDir(`versions/${version}`, {
dir: BaseDirectory.App,
});
return downloadAndUnzip(`https://github.com/minetest/minetest/releases/download/${version}/minetest-${version}-osx.zip`, `/versions/${version}/minetest.app`);
return downloadAndUnzip(`https://github.com/minetest/minetest/releases/download/${version}/${downloadName}-${version}-osx.zip`, `/versions/${version}/minetest.app`);

case 'Windows_NT':
return downloadAndUnzip(`https://github.com/minetest/minetest/releases/download/${version}/minetest-${version}-win64.zip`, `/versions/${version}`);
return downloadAndUnzip(`https://github.com/minetest/minetest/releases/download/${version}/${downloadName}-${version}-win64.zip`, `/versions/${version}`);
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function getVersions(forceReload = false) {
}

versions = versions.data;
versions = versions.filter(i => i.tag_name !== '5.4.2-android');
versions = versions.filter(i => !i.tag_name.endsWith('-android')); // 5.4.2-android and 5.8.1-android

if ('Darwin' === platform) {
versions = versions.filter(i => i.assets.filter(j => j.name.includes('-osx')).length);
Expand Down
7 changes: 5 additions & 2 deletions src/lib/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type, arch } from '@tauri-apps/api/os';
import { appDir } from "@tauri-apps/api/path";
import { invoke } from '@tauri-apps/api/tauri';
import { watchDebugLog, stopWatching } from '$lib/file/logger';
import semverGte from 'semver/functions/gte';

import { writeMergedConfig } from '$lib/file/config';

Expand All @@ -18,15 +19,17 @@ export async function getBinaryLocation(version) {
getVersionFolder(version)
]);

// They renamed Minetest to Luanti and since version 5.10.0 they renamed the executable file name as well. Linux seems fine...
const executeableName = semverGte(version, '5.10.0') ? 'luanti' : 'minetest';
switch (platform) {
case 'Linux':
return `${baseDir}/minetest.AppImage`;

case 'Darwin':
return `${baseDir}/minetest.app`;
return `${baseDir}/${executeableName}.app`;

case 'Windows_NT':
return `${baseDir}/bin/minetest.exe`;
return `${baseDir}/bin/${executeableName}.exe`;
}

return `${baseDir}/minetest`;
Expand Down