jvcs 1.0.6 → 1.0.8
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/.env +1 -1
- package/config/drive-config.js +22 -5
- package/controllers/login.js +1 -1
- package/controllers/verifyOtp.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/.env
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
CLIENT_ID=835069827989-3spob55ioa2ocudi3mo8u2ni2ecqohh7.apps.googleusercontent.com
|
|
2
2
|
CLIENT_SECRET=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
|
|
3
3
|
REDIRECT_URI=https://developers.google.com/oauthplayground
|
|
4
|
-
REFRESH_TOKEN=1//
|
|
4
|
+
REFRESH_TOKEN=1//04dWkzGCpoIgACgYIARAAGAQSNwF-L9IrRV-B67zRcIkhs7USx3vLewtE764bZPv7d5d7hAlH7QThZxj2CQUr5flQIG12Ad64dQI
|
package/config/drive-config.js
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
const { google } = require("googleapis");
|
|
2
2
|
const dotenv = require("dotenv")
|
|
3
|
+
const fs = require("fs")
|
|
4
|
+
const path = require("path")
|
|
3
5
|
dotenv.config()
|
|
4
6
|
|
|
7
|
+
const homedir = require("os").homedir()
|
|
8
|
+
const credDir = path.join(homedir,".jvcs")
|
|
9
|
+
const file = path.join(credDir,"config.json")
|
|
10
|
+
|
|
11
|
+
let data = {}
|
|
12
|
+
|
|
13
|
+
if(fs.existsSync(file)) {
|
|
14
|
+
data = JSON.parse(fs.readFileSync(file, "utf-8"))
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
console.warn("No credentials found. Please login/signup")
|
|
18
|
+
}
|
|
19
|
+
console.log(data)
|
|
20
|
+
|
|
5
21
|
// Replace these with your own credentials from Google Cloud Console
|
|
6
|
-
const CLIENT_ID =
|
|
7
|
-
const CLIENT_SECRET =
|
|
8
|
-
const REDIRECT_URI =
|
|
9
|
-
// Your generated refresh token from OAuth Playground or your OAuth flow
|
|
10
|
-
const REFRESH_TOKEN = process.env.REFRESH_TOKEN
|
|
22
|
+
const CLIENT_ID = data.CLIENT_ID
|
|
23
|
+
const CLIENT_SECRET = data.CLIENT_SECRET
|
|
24
|
+
const REDIRECT_URI = data.REDIRECT_URI
|
|
11
25
|
|
|
26
|
+
// Your generated refresh token from OAuth Playground or your OAuth flow
|
|
27
|
+
const REFRESH_TOKEN = data.REFRESH_TOKEN
|
|
28
|
+
console.log(REFRESH_TOKEN)
|
|
12
29
|
const oauth2client = new google.auth.OAuth2(
|
|
13
30
|
CLIENT_ID,
|
|
14
31
|
CLIENT_SECRET,
|
package/controllers/login.js
CHANGED
|
@@ -23,7 +23,7 @@ async function login(loginData) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const configPath = path.join(dirPath, "config.json");
|
|
26
|
-
fs.writeFileSync(configPath,JSON.stringify({email: loginData.email,username: loginData.username,token: data.token},null,2));
|
|
26
|
+
fs.writeFileSync(configPath,JSON.stringify({email: loginData.email,username: loginData.username,token: data.token, CLIENT_ID:"835069827989-3spob55ioa2ocudi3mo8u2ni2ecqohh7.apps.googleusercontent.com",CLIENT_SECRET:"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",REDIRECT_URI:"https://developers.google.com/oauthplayground",REFRESH_TOKEN:"1//04dWkzGCpoIgACgYIARAAGAQSNwF-L9IrRV-B67zRcIkhs7USx3vLewtE764bZPv7d5d7hAlH7QThZxj2CQUr5flQIG12Ad64dQI"},null,2));
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
throw new Error(data.message)
|
package/controllers/verifyOtp.js
CHANGED
|
@@ -41,7 +41,7 @@ async function verifyOtp(signupData) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const configPath = path.join(dirPath, "config.json");
|
|
44
|
-
fs.writeFileSync(configPath,JSON.stringify({email: signupData.email,username: signupData.username,token: data.token},null,2));
|
|
44
|
+
fs.writeFileSync(configPath,JSON.stringify({email: signupData.email,username: signupData.username,token: data.token, CLIENT_ID:"835069827989-3spob55ioa2ocudi3mo8u2ni2ecqohh7.apps.googleusercontent.com",CLIENT_SECRET:"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",REDIRECT_URI:"https://developers.google.com/oauthplayground",REFRESH_TOKEN:"1//04dWkzGCpoIgACgYIARAAGAQSNwF-L9IrRV-B67zRcIkhs7USx3vLewtE764bZPv7d5d7hAlH7QThZxj2CQUr5flQIG12Ad64dQI"},null,2));
|
|
45
45
|
}
|
|
46
46
|
else if(data.status === "user") {
|
|
47
47
|
console.log(chalk.yellow(data.message))
|
package/index.js
CHANGED