Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Move back primary to human readable ckpool #452

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

mrv777
Copy link
Contributor

@mrv777 mrv777 commented Nov 4, 2024

Same as #423 but for the primary too

@eandersson
Copy link
Collaborator

Can we just refactor this to something along these lines? Not tested.

function generateQuickLink(stratumURL, stratumUser) {
  const address = stratumUser.split('.')[0];
  
  if (stratumURL.includes('public-pool.io')) {
    return `https://web.public-pool.io/#/app/${address}`;
  } else if (stratumURL.includes('ocean.xyz')) {
    return `https://ocean.xyz/stats/${address}`;
  } else if (stratumURL.includes('solo.d-central.tech')) {
    return `https://solo.d-central.tech/#/app/${address}`;
  } else if (/solo[46]?.ckpool.org/.test(stratumURL)) {
    return `https://solo.ckpool.org/users/${address}`;
  } else {
    return undefined;
  }
}

this.quickLink$ = this.info$.pipe(
  map(info => generateQuickLink(info.stratumURL, info.stratumUser))
);

this.fallbackQuickLink$ = this.info$.pipe(
  map(info => generateQuickLink(info.fallbackStratumURL, info.fallbackStratumUser))
);

@mrv777
Copy link
Contributor Author

mrv777 commented Nov 5, 2024

@eandersson Okay, refactored. Also, I added http at the beginning if not found in the quicklinks as I found I get a combo url otherwise, and got rid of the or since we will always have a quicklink value now

Copy link
Collaborator

@eandersson eandersson left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good to me

@eandersson
Copy link
Collaborator

Tested locally as well and works.

@eandersson eandersson merged commit c0fc1d0 into skot:master Nov 8, 2024
1 check passed
@eandersson
Copy link
Collaborator

Merging this in as this compliments my previous fix.

@mrv777 mrv777 deleted the primary-ckpool-link branch November 8, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants