draftify-cli 1.0.47 → 1.0.52
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/commands/login.js +1 -1
- package/dist/repl.js +6 -0
- package/dist/utils/config.js +1 -1
- package/package.json +1 -1
package/dist/commands/login.js
CHANGED
|
@@ -11,7 +11,7 @@ const config_1 = require("../utils/config");
|
|
|
11
11
|
const ui_1 = require("../utils/ui");
|
|
12
12
|
const kleur_1 = require("kleur");
|
|
13
13
|
// Default Draftify URL, can be overridden by env
|
|
14
|
-
const DRAFTIFY_WEB_URL = process.env.DRAFTIFY_WEB_URL || "https://draftify.site";
|
|
14
|
+
const DRAFTIFY_WEB_URL = process.env.DRAFTIFY_WEB_URL || "https://www.draftify.site";
|
|
15
15
|
async function loginCommand() {
|
|
16
16
|
const code = crypto_1.default.randomBytes(4).toString("hex");
|
|
17
17
|
const authUrl = `${DRAFTIFY_WEB_URL}/auth/cli?code=${code}`;
|
package/dist/repl.js
CHANGED
|
@@ -300,6 +300,12 @@ async function startRepl(initialUsername) {
|
|
|
300
300
|
let currentModel = (0, config_1.getModel)();
|
|
301
301
|
let username = initialUsername;
|
|
302
302
|
let plan = "Draftify Scale";
|
|
303
|
+
const token = (0, config_1.getToken)();
|
|
304
|
+
if (!token) {
|
|
305
|
+
ui_1.ui.info("You are not logged in! Automatically starting login process...");
|
|
306
|
+
const newUsername = await (0, login_1.loginCommand)();
|
|
307
|
+
username = newUsername;
|
|
308
|
+
}
|
|
303
309
|
const profile = await (0, api_1.getUserProfile)();
|
|
304
310
|
if (profile) {
|
|
305
311
|
username = profile.username;
|
package/dist/utils/config.js
CHANGED
|
@@ -51,7 +51,7 @@ function getToken() {
|
|
|
51
51
|
function getApiUrl() {
|
|
52
52
|
const config = getConfig();
|
|
53
53
|
// Fallback API URL, overrideable via config or DRAFTIFY_API_URL
|
|
54
|
-
return process.env.DRAFTIFY_API_URL || config.apiUrl || "https://draftify.site/api/cli";
|
|
54
|
+
return process.env.DRAFTIFY_API_URL || config.apiUrl || "https://www.draftify.site/api/cli";
|
|
55
55
|
}
|
|
56
56
|
function getModel() {
|
|
57
57
|
const config = getConfig();
|