Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Preferred portal refresh #361

Merged
merged 26 commits into from
Feb 14, 2022
Merged

Preferred portal refresh #361

merged 26 commits into from
Feb 14, 2022

Conversation

mrcnski
Copy link
Contributor

@mrcnski mrcnski commented Dec 17, 2021

PULL REQUEST

Overview

  • Implements redirecting the skapp to be on the user's preferred portal, if he has a preferred portal configured.
  • Updates some URL utilities and tests based on edge cases that were found when implementing the redirect.

Note: Has not been tested yet. Waiting for the corresponding MySky changes, then will test on alpha MySky.

Full flow

 Load MySky:
 1. SDK opens MySky on the same portal as the skapp.
 2. MySky always connects to siasky.net first.
 3. MySky tries to get the saved portal preference.
    1. If the portal is set, MySky switches to using the preferred portal.
    2. If it is not set or we don't have the seed, MySky switches to using
       the current portal as opposed to siasky.net.
 4. After MySky finishes loading, SDK queries `mySky.getPortalPreference`.
 5. If the preferred portal is set and different than the current portal,
    SDK triggers refresh.
 6. We go back to step 1 and repeat, but since we're on the right portal now
    we won't refresh in step 5.

Login:
1. SDK logs in either silently or through the UI.
2. If it was through the UI, MySky switches to siasky.net and tries to get
   the saved portal preference.
   1. If the portal is set, MySky switches to using the preferred portal.
   2. If it is not set or we don't have the seed, MySky switches to using
      the current portal as opposed to siasky.net.
3. SDK queries `mySky.getPortalPreference`.
4. If the preferred portal is set and different than the current portal, SDK
   triggers refresh.
5. We go to "Load MySky" step 1 and go through that flow, but we don't
   refresh in step 5.

Checklist

Review and complete the checklist to ensure that the PR is complete before assigned to an approver.

  • All new methods or updated methods have clear docstrings
  • Testing added or updated for new methods
  • Verify if any changes impact the WebPortal Health Checks
  • Approriate documentation updated
  • Changelog file created

peterjan
peterjan previously approved these changes Dec 20, 2021
src/mysky/index.ts Show resolved Hide resolved
src/mysky/index.ts Outdated Show resolved Hide resolved
src/mysky/utils.ts Outdated Show resolved Hide resolved
src/mysky/utils.ts Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
ro-tex
ro-tex previously approved these changes Dec 21, 2021
src/mysky/index.ts Show resolved Hide resolved
@mrcnski mrcnski marked this pull request as ready for review January 10, 2022 15:56
ro-tex
ro-tex previously approved these changes Jan 11, 2022
src/mysky/index.ts Show resolved Hide resolved
Copy link
Collaborator

@ro-tex ro-tex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the MySky singleton issue, it looks fine. Let's resolve that one and merge this.

src/client.test.ts Show resolved Hide resolved
src/mysky/index.ts Show resolved Hide resolved
src/mysky/index.ts Show resolved Hide resolved
src/mysky/index.ts Outdated Show resolved Hide resolved
@mrcnski mrcnski requested a review from ro-tex February 11, 2022 23:41
@mrcnski mrcnski merged commit 6c009c5 into master Feb 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request High Priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants