mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-09 06:55:03 +00:00
* feat: use default browser for oauth2 authorization bru-2167 * fix: coderabbit review comment fixes * fix: coderabbit review comment fixes * fix: protocol registration updates * fix: coderabbit review comment suggestions * fix: oauth2 auth form use system browser option
31 lines
813 B
JavaScript
31 lines
813 B
JavaScript
const { handleOauth2ProtocolUrl } = require('./oauth2-protocol-handler');
|
|
|
|
// Store appProtocolUrl - will be handled in the `did-finish-load` event handler
|
|
const getAppProtocolUrlFromArgv = (argv) => {
|
|
return argv.find((arg) => arg.startsWith('bruno://'));
|
|
};
|
|
|
|
// Handle app protocol URLs
|
|
const handleAppProtocolUrl = (url) => {
|
|
// Handle OAuth2 callback URLs - `bruno://app/oauth2/callback`
|
|
if (isOauth2Url(url)) {
|
|
handleOauth2ProtocolUrl(url);
|
|
}
|
|
return;
|
|
};
|
|
|
|
const isOauth2Url = (url) => {
|
|
try {
|
|
const urlObj = new URL(url);
|
|
|
|
if (urlObj.pathname === '/oauth2/callback') {
|
|
return true;
|
|
}
|
|
} catch (error) {
|
|
console.error('[Protocol Handler] Error handling protocol URL:', error);
|
|
}
|
|
return false;
|
|
};
|
|
|
|
module.exports = { handleAppProtocolUrl, getAppProtocolUrlFromArgv };
|