meetfy 1.0.4 → 1.0.5
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/dist/index.js +46 -15
- package/package.json +10 -13
- package/README.md +0 -5
package/dist/index.js
CHANGED
|
@@ -28,9 +28,33 @@ function clearConfig() {
|
|
|
28
28
|
// src/auth.ts
|
|
29
29
|
var WORKER_URL = (process.env.MEETFY_AUTH_URL ?? "https://meetfy.eduardoborges.dev").replace(/\/$/, "");
|
|
30
30
|
var REDIRECT_PORT = 3434;
|
|
31
|
-
var HTML_OK =
|
|
32
|
-
|
|
33
|
-
<
|
|
31
|
+
var HTML_OK = `
|
|
32
|
+
<!DOCTYPE html>
|
|
33
|
+
<html>
|
|
34
|
+
<head>
|
|
35
|
+
<meta charset="utf-8">
|
|
36
|
+
<title>Meetfy</title>
|
|
37
|
+
<style>
|
|
38
|
+
body {
|
|
39
|
+
font-family: system-ui;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
height: 100vh;
|
|
45
|
+
margin: 0;
|
|
46
|
+
}
|
|
47
|
+
h1 {
|
|
48
|
+
color: #22c55e;
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
51
|
+
</head>
|
|
52
|
+
<body>
|
|
53
|
+
<h1>\u2705 Authenticated!</h1>
|
|
54
|
+
<p>You can close this tab.</p>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
57
|
+
`;
|
|
34
58
|
function makeClient(clientId, tokens) {
|
|
35
59
|
const client = new google.auth.OAuth2(clientId, "");
|
|
36
60
|
client.setCredentials(tokens);
|
|
@@ -79,6 +103,13 @@ async function authenticate() {
|
|
|
79
103
|
}
|
|
80
104
|
function waitForTokensThenSave(port) {
|
|
81
105
|
return new Promise((resolve, reject) => {
|
|
106
|
+
let settled = false;
|
|
107
|
+
const once = (err, client) => {
|
|
108
|
+
if (settled) return;
|
|
109
|
+
settled = true;
|
|
110
|
+
if (err) reject(err);
|
|
111
|
+
else resolve(client);
|
|
112
|
+
};
|
|
82
113
|
const server = http.createServer({ maxHeaderSize: 64 * 1024 }, (req, res) => {
|
|
83
114
|
const url = new URL(req.url ?? "/", `http://localhost:${port}`);
|
|
84
115
|
const raw = url.searchParams.get("tokens");
|
|
@@ -93,15 +124,15 @@ function waitForTokensThenSave(port) {
|
|
|
93
124
|
res.writeHead(200, { "Content-Type": "text/html", Connection: "close" }).end(HTML_OK);
|
|
94
125
|
setConfig("googleTokens", tokens);
|
|
95
126
|
setConfig("googleClientId", clientId);
|
|
96
|
-
|
|
127
|
+
once(null, makeClient(clientId, tokens));
|
|
97
128
|
server.close();
|
|
98
129
|
} catch {
|
|
99
130
|
res.writeHead(400, { "Content-Type": "text/plain", Connection: "close" }).end("Invalid tokens");
|
|
100
|
-
|
|
131
|
+
once(new Error("Invalid tokens"));
|
|
101
132
|
server.close();
|
|
102
133
|
}
|
|
103
134
|
});
|
|
104
|
-
server.on("error",
|
|
135
|
+
server.on("error", (err) => once(err));
|
|
105
136
|
server.listen(port);
|
|
106
137
|
});
|
|
107
138
|
}
|
|
@@ -194,13 +225,13 @@ function welcome() {
|
|
|
194
225
|
""
|
|
195
226
|
].join("\n");
|
|
196
227
|
}
|
|
197
|
-
function meeting(
|
|
228
|
+
function meeting(meet) {
|
|
198
229
|
const lines = [
|
|
199
|
-
chalk.cyan.bold(` ${
|
|
200
|
-
chalk.dim(` \u{1F550} ${
|
|
230
|
+
chalk.cyan.bold(` ${meet.title}`),
|
|
231
|
+
chalk.dim(` \u{1F550} ${meet.startTime} \u2013 ${meet.endTime}`)
|
|
201
232
|
];
|
|
202
|
-
if (
|
|
203
|
-
if (
|
|
233
|
+
if (meet.hangoutLink) lines.push(chalk.blue(` \u{1F517} ${meet.hangoutLink}`));
|
|
234
|
+
if (meet.location) lines.push(chalk.dim(` \u{1F4CD} ${meet.location}`));
|
|
204
235
|
return lines.join("\n");
|
|
205
236
|
}
|
|
206
237
|
function authNeedCode(authUrl) {
|
|
@@ -224,12 +255,12 @@ function authSuccess() {
|
|
|
224
255
|
chalk.cyan(" meetfy logout") + chalk.dim(" Log out from Google")
|
|
225
256
|
].join("\n");
|
|
226
257
|
}
|
|
227
|
-
function createSuccess(
|
|
258
|
+
function createSuccess(m) {
|
|
228
259
|
return [
|
|
229
260
|
chalk.green("\u2705 Meeting created successfully!"),
|
|
230
|
-
chalk.cyan(`\u{1F4C5} ${
|
|
231
|
-
chalk.blue(`\u{1F517} ${
|
|
232
|
-
chalk.dim(`\u23F0 ${
|
|
261
|
+
chalk.cyan(`\u{1F4C5} ${m.title}`),
|
|
262
|
+
chalk.blue(`\u{1F517} ${m.hangoutLink}`),
|
|
263
|
+
chalk.dim(`\u23F0 ${m.startTime} \u2013 ${m.endTime}`)
|
|
233
264
|
].join("\n");
|
|
234
265
|
}
|
|
235
266
|
function logoutSuccess() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meetfy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "CLI tool for creating instant meetings and reserving time in Google Calendar",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,12 +11,8 @@
|
|
|
11
11
|
"dist",
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"build": "tsx scripts/build.ts",
|
|
17
|
-
"prepublishOnly": "pnpm run build",
|
|
18
|
-
"lint": "eslint src/**/*.ts",
|
|
19
|
-
"deploy": "npm publish"
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"registry": "https://registry.npmjs.org"
|
|
20
16
|
},
|
|
21
17
|
"engines": {
|
|
22
18
|
"node": ">=22"
|
|
@@ -40,13 +36,14 @@
|
|
|
40
36
|
},
|
|
41
37
|
"devDependencies": {
|
|
42
38
|
"@types/node": "25.4.0",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
44
|
-
"@typescript-eslint/parser": "^7.18.0",
|
|
45
39
|
"esbuild": "0.27.3",
|
|
46
|
-
"
|
|
47
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
48
|
-
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
49
|
-
"eslint-plugin-import": "^2.32.0",
|
|
40
|
+
"oxlint": "^1.20.0",
|
|
50
41
|
"tsx": "4.21.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"start": "tsx src/index.ts",
|
|
45
|
+
"build": "tsx scripts/build.ts",
|
|
46
|
+
"lint": "oxlint",
|
|
47
|
+
"deploy": "npm publish"
|
|
51
48
|
}
|
|
52
49
|
}
|