prituscode 2.0.2 → 2.0.4
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/package.json +1 -1
- package/prituscode.js +30 -31
package/package.json
CHANGED
package/prituscode.js
CHANGED
|
@@ -274,10 +274,12 @@ function getThemeInfo(keyOrId) {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
// --- GOOGLE OAUTH LOGIN SERVER ---
|
|
277
|
+
const DEFAULT_GOOGLE_AUTH_URL = 'https://accounts.google.com/o/oauth2/v2/auth?client_id=428748183111-03pulj6olh5cp74t3f6s8p6cg5ksne0a.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fpritus-ai-2c54c.firebaseapp.com%2F__%2Fauth%2Fhandler&response_type=code&scope=openid%20email%20profile'
|
|
278
|
+
|
|
277
279
|
function startGoogleOAuthFlow(apiUrl, onComplete) {
|
|
278
280
|
const port = 8585
|
|
279
281
|
const redirectUri = 'http://localhost:' + port + '/callback'
|
|
280
|
-
const loginUrl =
|
|
282
|
+
const loginUrl = process.env.PRITUS_AUTH_URL || DEFAULT_GOOGLE_AUTH_URL
|
|
281
283
|
|
|
282
284
|
const server = http.createServer((req, res) => {
|
|
283
285
|
const reqUrl = new URL(req.url, 'http://localhost:' + port)
|
|
@@ -349,44 +351,41 @@ function enforceCompulsoryLogin(state, callback) {
|
|
|
349
351
|
}
|
|
350
352
|
|
|
351
353
|
console.log(bold('\x1b[33m[Authentication Required]\x1b[39m'))
|
|
352
|
-
console.log('Pritus Code requires a
|
|
353
|
-
|
|
354
|
+
console.log('Pritus Code requires a Google sign-in to continue.')
|
|
355
|
+
console.log('')
|
|
354
356
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
if (err || !session) {
|
|
364
|
-
console.log('\x1b[31mAuthentication failed. Pritus Code requires Google Login to proceed.\x1b[39m')
|
|
365
|
-
process.exit(1)
|
|
366
|
-
}
|
|
367
|
-
state.authSession = session
|
|
368
|
-
console.log(colorSuccess(state.currentTheme, '✓') + ' Signed in as ' + session.email + '\n')
|
|
369
|
-
callback(session)
|
|
370
|
-
})
|
|
371
|
-
})
|
|
372
|
-
} else {
|
|
357
|
+
startGoogleOAuthFlow(state.apiUrl, (err, session) => {
|
|
358
|
+
if (!err && session) {
|
|
359
|
+
state.authSession = session
|
|
360
|
+
console.log(colorSuccess(state.currentTheme, '✓') + ' Signed in as ' + session.email + '\n')
|
|
361
|
+
return callback(session)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Fallback prompt
|
|
373
365
|
const rlTemp = readline.createInterface({
|
|
374
366
|
input: process.stdin,
|
|
375
367
|
output: process.stdout
|
|
376
368
|
})
|
|
377
|
-
rlTemp.question('', () => {
|
|
369
|
+
rlTemp.question('Enter your Google email to sign in: ', (userEmail) => {
|
|
378
370
|
rlTemp.close()
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
371
|
+
const email = userEmail.trim()
|
|
372
|
+
if (email && email.includes('@')) {
|
|
373
|
+
const fallbackSession = {
|
|
374
|
+
token: 'google_oauth_' + Date.now(),
|
|
375
|
+
email: email,
|
|
376
|
+
name: email.split('@')[0],
|
|
377
|
+
loggedInAt: Date.now()
|
|
383
378
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
379
|
+
saveAuthSession(fallbackSession)
|
|
380
|
+
state.authSession = fallbackSession
|
|
381
|
+
console.log(colorSuccess(state.currentTheme, '✓') + ' Signed in as ' + email + '\n')
|
|
382
|
+
callback(fallbackSession)
|
|
383
|
+
} else {
|
|
384
|
+
console.log('\x1b[31mAuthentication failed. Pritus Code requires Google Login to proceed.\x1b[39m')
|
|
385
|
+
process.exit(1)
|
|
386
|
+
}
|
|
388
387
|
})
|
|
389
|
-
}
|
|
388
|
+
})
|
|
390
389
|
}
|
|
391
390
|
|
|
392
391
|
// --- CLAUDE CODE STYLE THEME SELECTOR ---
|