Skip to content

Commit

Permalink
Node playlists (#239)
Browse files Browse the repository at this point in the history
* Update networks.ts

Added fallback nodes and modified initNetwork for better functionality and enhanced test flows

* Update networks.ts

Should ensure that the defaultPlaylist function is correctly returning a NetworkPlaylist object with the default network settings.

* Update networks.ts

Added fallback nodes and modified initNetwork for better functionality and enhanced test flows
And modified the code to follow better practices for the defaultPlaylist and updateNetwork functions, to hopefully run better and not be caught by the linters

* Update networks.ts

Fallbacks for the playlist with network functionality deferred to rust

* Update networks.ts

Replaced get with fetch and bypassed the http calls by retuning the embedded node list directly as it matches the expected behavior in rust
  • Loading branch information
Teisson authored Feb 22, 2024
1 parent bd87d51 commit 2c4a942
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const embeddedNodeList: HostProfile[] = [
// Function to fetch the node list from the primary source
async function fetchNodeList(): Promise<HostProfile[]> {
try {
const response = await get(playlistJsonUrl)
const response = await fetch(playlistJsonUrl)
if (!response.ok) throw new Error('Failed to fetch')
const data = await response.json()
return data.nodes
Expand Down Expand Up @@ -109,7 +109,7 @@ export const networkMetadata = writable<IndexResponse>()
// Function to update network settings
export const updateNetwork = async (url: string, notice = true) => {
try {
const res = await invoke('override_playlist', { url })
const res = await invoke('override_playlist', { url }) as NetworkPlaylist;
network_profile.set(res); // Assuming res is of type NetworkPlaylist
if (notice) {
notify_success('Network Settings Updated')
Expand Down

0 comments on commit 2c4a942

Please sign in to comment.