Add support for SSE extensions via scheme URI (#2073)

This commit is contained in:
Jim Bennett
2025-04-10 09:10:51 -07:00
committed by GitHub
parent 4b9cb74402
commit ac56756df6
3 changed files with 155 additions and 72 deletions

View File

@@ -79,6 +79,12 @@ export default function App() {
return `${cmd} ${args.join(' ')}`.trim();
}
// Utility function to extract the remote url from the link
function extractRemoteUrl(link: string): string {
const url = new URL(link);
return url.searchParams.get('url');
}
const setView = (view: View, viewOptions: ViewOptions = {}) => {
console.log(`Setting view to: ${view}`, viewOptions);
setInternalView({ view, viewOptions });
@@ -257,11 +263,14 @@ export default function App() {
try {
console.log(`Received add-extension event with link: ${link}`);
const command = extractCommand(link);
const remoteUrl = extractRemoteUrl(link);
const extName = extractExtensionName(link);
window.electron.logInfo(`Adding extension from deep link ${link}`);
setPendingLink(link);
const messageDetails = remoteUrl ? `Remote URL: ${remoteUrl}` : `Command: ${command}`;
setModalMessage(
`Are you sure you want to install the ${extName} extension?\n\nCommand: ${command}`
`Are you sure you want to install the ${extName} extension?\n\n${messageDetails}`
);
setModalVisible(true);
} catch (error) {