Skip to content

Update mullvad extension#17789

Merged
raycastbot merged 2 commits intoraycast:mainfrom
svenhofman:ext/mullvad
Mar 13, 2025
Merged

Update mullvad extension#17789
raycastbot merged 2 commits intoraycast:mainfrom
svenhofman:ext/mullvad

Conversation

@svenhofman
Copy link
Contributor

@svenhofman svenhofman commented Mar 12, 2025

Description

I made a mistake and didn't push the correct code, so this is the actual update, sorry!

  • Added config to select server for location based on ranking, added actions to reset ranking

Screencast

Checklist

- Added config for selecting most ranked server when choosing location
- Initial commit
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: mullvad Issues related to the mullvad extension OP is contributor The OP of the PR is a contributor of the extension labels Mar 12, 2025
@raycastbot
Copy link
Collaborator

Thank you for your contribution! 🎉

🔔 @0x46616c6b @SebKranz you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

Due to our current reduced availability, the initial review may take up to 10-15 business days

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR enhances the Mullvad VPN extension with server ranking capabilities and improved location selection functionality.

  • Added server ranking persistence using Cache API with ability to reset rankings for both locations and servers
  • Implemented preference-based server selection through new selectByRanking preference
  • Added detailed metadata display showing country/city codes in location list
  • Fixed CHANGELOG.md to use {PR_MERGE_DATE} template string instead of hardcoded date
  • Improved error handling by utilizing showFailureToast from @raycast/utils

💡 (4/5) You can add custom instructions or style guidelines for the bot here!

2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +115 to 116
setTopServer(sortedServers[0]);
execSync(`mullvad relay set location ${server.id}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Incorrect command format - server.id alone won't work. Should be ${countryCode} ${cityCode} ${server.id}

Suggested change
setTopServer(sortedServers[0]);
execSync(`mullvad relay set location ${server.id}`);
setTopServer(sortedServers[0]);
execSync(`mullvad relay set location ${location.countryCode} ${location.cityCode} ${server.id}`);

Comment on lines +124 to +128
if (rankingCacheRef.current.get(`ranked-servers-${location.id}`).size > 1) {
setTopServer(sortedServers[0]);
} else {
setTopServer({ id: "" });
}
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Race condition possible here. sortedServers[0] might be stale after resetRanking. Should fetch fresh sorted servers list

Comment on lines +194 to +196
let topServerID = "";
if (selectByRanking) topServerID = rankingCacheRef.current.get("top-servers")?.[location.id] || "";
execSync(`mullvad relay set location ${countryCode} ${cityCode} ${topServerID}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider wrapping execSync in try-catch to handle potential CLI execution errors

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

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

Hi 👋

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit d3567ee into raycast:main Mar 13, 2025
2 checks passed
@github-actions
Copy link
Contributor

Published to the Raycast Store:
https://raycast.com/0x46616c6b/mullvad

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

@svenhofman svenhofman deleted the ext/mullvad branch May 24, 2025 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: mullvad Issues related to the mullvad extension OP is contributor The OP of the PR is a contributor of the extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants