@leg3ndy/otto-bridge 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/executors/native_macos.js +26 -10
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,15 +19,15 @@ const KNOWN_APPS = [
|
|
|
19
19
|
{ canonical: "System Settings", patterns: [/\bsystem settings\b/i, /\bajustes do sistema\b/i, /\bconfigura[cç][õo]es do sistema\b/i] },
|
|
20
20
|
];
|
|
21
21
|
const KNOWN_SITES = [
|
|
22
|
-
{ url: "https://www.youtube.com", patterns: [/\byoutube\b/i, /\byou tube\b/i] },
|
|
23
|
-
{ url: "https://music.youtube.com", patterns: [/\byoutube music\b/i] },
|
|
24
|
-
{ url: "https://www.instagram.com", patterns: [/\binstagram\b/i, /\binstagram\.com\b/i] },
|
|
25
|
-
{ url: "https://mail.google.com", patterns: [/\bgmail\b/i] },
|
|
26
|
-
{ url: "https://www.google.com", patterns: [/\bgoogle\b/i] },
|
|
27
|
-
{ url: "https://github.com", patterns: [/\bgithub\b/i] },
|
|
28
|
-
{ url: "https://chat.openai.com", patterns: [/\bchatgpt\b/i] },
|
|
29
|
-
{ url: "https://web.whatsapp.com", patterns: [/\bwhatsapp\b/i] },
|
|
30
|
-
{ url: "https://x.com", patterns: [/\bx\.com\b/i, /\btwitter\b/i, /\bxis\b/i] },
|
|
22
|
+
{ label: "YouTube", url: "https://www.youtube.com", patterns: [/\byoutube\b/i, /\byou tube\b/i] },
|
|
23
|
+
{ label: "YouTube Music", url: "https://music.youtube.com", patterns: [/\byoutube music\b/i] },
|
|
24
|
+
{ label: "Instagram", url: "https://www.instagram.com", patterns: [/\binstagram\b/i, /\binstagram\.com\b/i] },
|
|
25
|
+
{ label: "Gmail", url: "https://mail.google.com", patterns: [/\bgmail\b/i] },
|
|
26
|
+
{ label: "Google", url: "https://www.google.com", patterns: [/\bgoogle\b/i] },
|
|
27
|
+
{ label: "GitHub", url: "https://github.com", patterns: [/\bgithub\b/i] },
|
|
28
|
+
{ label: "ChatGPT", url: "https://chat.openai.com", patterns: [/\bchatgpt\b/i] },
|
|
29
|
+
{ label: "WhatsApp Web", url: "https://web.whatsapp.com", patterns: [/\bwhatsapp\b/i] },
|
|
30
|
+
{ label: "X", url: "https://x.com", patterns: [/\bx\.com\b/i, /\btwitter\b/i, /\bxis\b/i] },
|
|
31
31
|
];
|
|
32
32
|
function asRecord(value) {
|
|
33
33
|
return value && typeof value === "object" ? value : {};
|
|
@@ -72,6 +72,21 @@ function normalizeUrl(raw) {
|
|
|
72
72
|
}
|
|
73
73
|
return `https://${trimmed.replace(/^\/+/, "")}`;
|
|
74
74
|
}
|
|
75
|
+
function humanizeUrl(url) {
|
|
76
|
+
const normalized = normalizeUrl(url);
|
|
77
|
+
for (const site of KNOWN_SITES) {
|
|
78
|
+
if (normalizeUrl(site.url) === normalized) {
|
|
79
|
+
return site.label || site.url;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const parsed = new URL(normalized);
|
|
84
|
+
return parsed.hostname.replace(/^www\./i, "");
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return normalized;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
75
90
|
function expandUserPath(value) {
|
|
76
91
|
const trimmed = value.trim();
|
|
77
92
|
if (!trimmed) {
|
|
@@ -527,7 +542,8 @@ export class NativeMacOSJobExecutor {
|
|
|
527
542
|
if (action.type === "run_shell") {
|
|
528
543
|
return `Comando ${action.command} executado no macOS`;
|
|
529
544
|
}
|
|
530
|
-
|
|
545
|
+
const target = humanizeUrl(action.url);
|
|
546
|
+
return `${target} foi aberto${action.app ? ` em ${action.app}` : ""}`;
|
|
531
547
|
}
|
|
532
548
|
async runCommand(command, args) {
|
|
533
549
|
await this.runCommandCapture(command, args);
|
package/dist/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const BRIDGE_CONFIG_VERSION = 1;
|
|
2
|
-
export const BRIDGE_VERSION = "0.4.
|
|
2
|
+
export const BRIDGE_VERSION = "0.4.1";
|
|
3
3
|
export const BRIDGE_PACKAGE_NAME = "@leg3ndy/otto-bridge";
|
|
4
4
|
export const DEFAULT_API_BASE_URL = "http://localhost:8000";
|
|
5
5
|
export const DEFAULT_POLL_INTERVAL_MS = 3000;
|