const getActiveServer = () => {
  const saved = localStorage.getItem("activeServer");
  if (!saved) return null;
  try {
    return JSON.parse(saved);
  } catch (e) {
    return null;
  }
};

export const getServerUrl = () => {
  const server = getActiveServer();
  return server ? server.connectUrl : null;
};

export const config = {
  get serverUrl() {
    return getServerUrl();
  },
};
