Skip to content

Commit e882c9d

Browse files
committed
remove name from json to avoid encoding issues, force fetchServers when importing
1 parent 9624895 commit e882c9d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/utils/game.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Server } from "./types";
1414
import { useGenericPersistentState } from "../states/genericStates";
1515
import { save, open } from '@tauri-apps/api/dialog';
1616
import { useNotification } from "../states/notification";
17+
import { fetchServers } from "../utils/helpers";
1718

1819
export const copySharedFilesIntoGameFolder = async () => {
1920
const { gtasaPath } = useSettings.getState();
@@ -342,7 +343,6 @@ export const exportFavoriteListFile = async () => {
342343
servers: favorites.map(server => ({
343344
ip: server.ip,
344345
port: server.port,
345-
name: server.hostname,
346346
password: server.password || ""
347347
}))
348348
};
@@ -408,10 +408,13 @@ export const importFavoriteListFile = async () => {
408408

409409
for (const importedServer of data.servers) {
410410
if (importedServer.ip && importedServer.port) {
411+
412+
const tempHostname = `${importedServer.ip}:${importedServer.port}`;
413+
411414
const serverInfo: Server = {
412415
ip: importedServer.ip,
413416
port: Number(importedServer.port),
414-
hostname: importedServer.name || "Imported Server",
417+
hostname: tempHostname,
415418
playerCount: 0,
416419
maxPlayers: 0,
417420
gameMode: "-",
@@ -430,6 +433,8 @@ export const importFavoriteListFile = async () => {
430433
importCount++;
431434
}
432435
}
436+
437+
fetchServers(true);
433438

434439
showNotification(
435440
t("import_successful_title"),

0 commit comments

Comments
 (0)