fix: app cache and other issues (#5460)
* fixes * #[serde(untagged)] my BEHATED (still kinda broken) * remove unused hasContent ref * clean up code in fetch instance * ping 3 times for average latency * fix: pinging to be more accurate TCP_NODELAY — Set on the TCP stream right after connect, preventing Nagle's algorithm from buffering the small ping packet (could save up to ~40ms) Instant over Utc::now() — Switched to monotonic std::time::Instant for timing, which is more precise and designed for measuring elapsed time (still using chrono just for the ping magic value) * delete useFetch util and just use native fetch * rename worlds until functions for more clarity * fix lint * fix cache.rs logic * make backend ping use both impls * Add optional timeout to server ping * fix gallery appearing in nav with no items * remove EU countries and add EU option for server country * add uk to europe --------- Co-authored-by: aecsocket <aecsocket@tutanota.com>
This commit is contained in:
@@ -328,7 +328,7 @@ export const installServerProject = async (serverProjectId) => {
|
||||
})
|
||||
await edit_icon(profilePath, originalIconPath)
|
||||
|
||||
await syncServerAsWorld(profilePath, project.title, serverAddress, serverProjectId)
|
||||
await syncServerProjectAsWorld(profilePath, project.title, serverAddress, serverProjectId)
|
||||
}
|
||||
|
||||
export const getServerAddress = (javaServer) => {
|
||||
@@ -337,7 +337,7 @@ export const getServerAddress = (javaServer) => {
|
||||
return port !== 25565 ? `${address}:${port}` : address
|
||||
}
|
||||
|
||||
const syncServerAsWorld = async (
|
||||
const syncServerProjectAsWorld = async (
|
||||
profilePath,
|
||||
serverName,
|
||||
serverAddress,
|
||||
@@ -405,7 +405,7 @@ const findInstalledInstance = async (projectId) => {
|
||||
return packs.find((pack) => pack.linked_data?.project_id === projectId) ?? null
|
||||
}
|
||||
|
||||
const createVanillaInstance = async (project, gameVersion, serverAddress) => {
|
||||
const createVanillaServerInstance = async (project, gameVersion, serverAddress) => {
|
||||
const profilePath = await create(
|
||||
project.title,
|
||||
gameVersion,
|
||||
@@ -420,7 +420,8 @@ const createVanillaInstance = async (project, gameVersion, serverAddress) => {
|
||||
},
|
||||
)
|
||||
|
||||
await syncServerAsWorld(profilePath, project.title, serverAddress, project.id)
|
||||
//
|
||||
await syncServerProjectAsWorld(profilePath, project.title, serverAddress, project.id)
|
||||
|
||||
return profilePath
|
||||
}
|
||||
@@ -514,6 +515,7 @@ export const playServerProject = async (projectId) => {
|
||||
|
||||
if (projectV3?.minecraft_server == null) {
|
||||
console.warn('playServerProject failed: project is not a server project')
|
||||
return
|
||||
}
|
||||
|
||||
const content = projectV3?.minecraft_java_server?.content
|
||||
@@ -529,7 +531,7 @@ export const playServerProject = async (projectId) => {
|
||||
if (installStore.installingServerProjects.includes(projectId)) return
|
||||
installStore.startInstallingServer(projectId)
|
||||
try {
|
||||
const path = await createVanillaInstance(project, recommendedGameVersion, serverAddress)
|
||||
const path = await createVanillaServerInstance(project, recommendedGameVersion, serverAddress)
|
||||
if (path) {
|
||||
instance = await get(path)
|
||||
showModpackInstallSuccess(installStore, instance, serverAddress)
|
||||
@@ -543,8 +545,6 @@ export const playServerProject = async (projectId) => {
|
||||
installStore.showInstallToPlayModal(projectV3, modpackVersionId, async () => {
|
||||
const newInstance = await findInstalledInstance(project.id)
|
||||
if (!newInstance) return
|
||||
// Ensure the server is in the worlds list after modpack install
|
||||
await syncServerAsWorld(newInstance.path, project.title, serverAddress, project.id)
|
||||
showModpackInstallSuccess(installStore, newInstance, serverAddress)
|
||||
})
|
||||
return
|
||||
@@ -552,7 +552,7 @@ export const playServerProject = async (projectId) => {
|
||||
|
||||
if (!instance) return
|
||||
|
||||
await syncServerAsWorld(instance.path, project.title, serverAddress, project.id)
|
||||
await syncServerProjectAsWorld(instance.path, project.title, serverAddress, project.id)
|
||||
|
||||
// Update existing instance if needed
|
||||
if (isModpack && instance.linked_data?.version_id !== modpackVersionId) {
|
||||
|
||||
Reference in New Issue
Block a user