forked from jorrit-stack/Raycast-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopen-user-url.js
More file actions
executable file
·37 lines (29 loc) · 971 Bytes
/
open-user-url.js
File metadata and controls
executable file
·37 lines (29 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env node
// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title Open Bolt Rate Limits
// @raycast.mode silent
// @raycast.icon 🚀
// Documentation:
// @raycast.description Open Bolt API rate limits page for user ID from clipboard
// @raycast.author jorrit_harmamny
// @raycast.authorURL https://raycast.com/jorrith_harmamny
const { execSync } = require("child_process");
// Template URL with {clipboard} placeholder
const templateUrl = "https://bolt.new/api/rate-limits/{clipboard}";
// Get clipboard contents (user ID)
let clipboard = "";
try {
clipboard = execSync("pbpaste").toString().trim();
} catch {
clipboard = "";
}
if (!clipboard) {
console.error("Clipboard is empty. Copy a user ID first.");
process.exit(1);
}
// Replace {clipboard} in URL
const url = templateUrl.replace("{clipboard}", encodeURIComponent(clipboard));
// Open the URL in the default browser
execSync(`open "${url}"`);
console.log(`Opened: ${url}`);