dorky 2.1.4 → 2.1.6

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/README.md CHANGED
@@ -85,5 +85,4 @@ Anyhow, we shall store it on a private storage, using **dorky**, that stores it
85
85
  ## To-Do
86
86
 
87
87
  [ ] Add stages for variables.
88
- [ ] Convert to TypeScript.
89
88
 
package/bin/index.js CHANGED
@@ -104,7 +104,7 @@ async function init(storage) {
104
104
  var credentials;
105
105
  switch (storage) {
106
106
  case "aws":
107
- credentials = { storage: "aws", acessKey: process.env.AWS_ACCESS_KEY, secretKey: process.env.AWS_SECRET_KEY, region: process.env.AWS_REGION, bucket: process.env.BUCKET_NAME }
107
+ credentials = { storage: "aws", accessKey: process.env.AWS_ACCESS_KEY, secretKey: process.env.AWS_SECRET_KEY, awsRegion: process.env.AWS_REGION, bucket: process.env.BUCKET_NAME }
108
108
  setupFilesAndFolders(metaData, credentials);
109
109
  break;
110
110
  case "google-drive":
@@ -172,22 +172,53 @@ function rm(listOfFiles) {
172
172
  else console.log(chalk.red("No files found that can be removed."));
173
173
  }
174
174
 
175
- function checkCredentials() {
176
- const credentials = JSON.parse(fs.readFileSync(".dorky/credentials.json"));
177
- // This only works for AWS S3, add credential checker for google drive also, fix this => TP | 2024-09-28 16:04:41
178
- if (credentials.accessKey && credentials.secretKey && credentials.region && credentials.bucket) {
179
- if (process.env.AWS_ACCESS_KEY && process.env.AWS_SECRET_KEY && process.env.AWS_REGION && process.env.BUCKET_NAME) {
180
- return true;
175
+ async function checkCredentials() {
176
+ try {
177
+ if (fs.existsSync(".dorky/credentials.json")) {
178
+ const credentials = JSON.parse(fs.readFileSync(".dorky/credentials.json"));
179
+ if (credentials.storage === "google-drive") {
180
+ if (credentials.access_token && credentials.scope && credentials.token_type && credentials.expiry_date) return true;
181
+ else return false;
182
+ } else {
183
+ if (credentials.accessKey && credentials.secretKey && credentials.awsRegion && credentials.bucket) return true;
184
+ else return false;
185
+ }
181
186
  } else {
182
- console.log(chalk.red("Please provide credentials in .dorky/credentials.json"));
183
- return false;
187
+ console.log("Setting the credentials again.")
188
+ if (process.env.AWS_ACCESS_KEY && process.env.AWS_SECRET_KEY && process.env.AWS_REGION && process.env.BUCKET_NAME) {
189
+ fs.writeFileSync(".dorky/credentials.json", JSON.stringify({
190
+ "storage": "aws",
191
+ "accessKey": process.env.AWS_ACCESS_KEY,
192
+ "secretKey": process.env.AWS_SECRET_KEY,
193
+ "awsRegion": process.env.AWS_REGION,
194
+ "bucket": process.env.BUCKET_NAME
195
+ }, null, 2));
196
+ return true;
197
+ } else {
198
+ try {
199
+ let credentials;
200
+ const client = await authorizeGoogleDriveClient();
201
+ credentials = { storage: "google-drive", ...client.credentials };
202
+ fs.writeFileSync(".dorky/credentials.json", JSON.stringify(credentials, null, 2));
203
+ console.log(chalk.green("Credentials saved in .dorky/credentials.json"));
204
+ console.log(chalk.red("Please ignore the warning to set credentials below and run the command again."));
205
+ return false;
206
+ } catch (err) {
207
+ console.log(chalk.red("Failed to authorize Google Drive client: " + err.message));
208
+ console.log(chalk.red("Please provide credentials in .dorky/credentials.json"));
209
+ return false;
210
+ }
211
+ }
184
212
  }
185
- } else return true;
213
+ } catch (err) {
214
+ console.log(chalk.red("Please provide credentials in .dorky/credentials.json"));
215
+ return false;
216
+ }
186
217
  }
187
218
 
188
- function push() {
219
+ async function push() {
189
220
  checkIfDorkyProject();
190
- if (!checkCredentials()) {
221
+ if (!(await checkCredentials())) {
191
222
  console.log(chalk.red("Please setup credentials in environment variables or in .dorky/credentials.json"));
192
223
  return;
193
224
  }
@@ -228,7 +259,7 @@ function push() {
228
259
  function pushToS3(files, credentials) {
229
260
  const s3 = new S3Client({
230
261
  credentials: {
231
- accessKeyId: credentials.acessKey ?? process.env.AWS_ACCESS_KEY,
262
+ accessKeyId: credentials.accessKey ?? process.env.AWS_ACCESS_KEY,
232
263
  secretAccessKey: credentials.secretKey ?? process.env.AWS_SECRET_KEY
233
264
  },
234
265
  region: credentials.awsRegion ?? process.env.AWS_REGION
@@ -304,9 +335,9 @@ async function pushToGoogleDrive(files) {
304
335
  }
305
336
  }
306
337
 
307
- function pull() {
338
+ async function pull() {
308
339
  checkIfDorkyProject();
309
- if (!checkCredentials()) {
340
+ if (!(await checkCredentials())) {
310
341
  console.log(chalk.red("Please setup credentials in environment variables or in .dorky/credentials.json"));
311
342
  return;
312
343
  }
@@ -330,7 +361,7 @@ function pull() {
330
361
  function pullFromS3(files, credentials) {
331
362
  const s3 = new S3Client({
332
363
  credentials: {
333
- accessKeyId: credentials.acessKey ?? process.env.AWS_ACCESS_KEY,
364
+ accessKeyId: credentials.accessKey ?? process.env.AWS_ACCESS_KEY,
334
365
  secretAccessKey: credentials.secretKey ?? process.env.AWS_SECRET_KEY
335
366
  },
336
367
  region: credentials.awsRegion ?? process.env.AWS_REGION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dorky",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "DevOps Records Keeper.",
5
5
  "bin": {
6
6
  "dorky": "bin/index.js"
@@ -40,4 +40,4 @@
40
40
  "mime-types": "^2.1.35",
41
41
  "yargs": "^17.7.2"
42
42
  }
43
- }
43
+ }
@@ -13,6 +13,7 @@
13
13
  "@testing-library/user-event": "^13.5.0",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0",
16
+ "react-router": "^7.1.1",
16
17
  "react-scripts": "5.0.1",
17
18
  "web-vitals": "^2.1.4"
18
19
  },
@@ -3701,6 +3702,12 @@
3701
3702
  "@types/node": "*"
3702
3703
  }
3703
3704
  },
3705
+ "node_modules/@types/cookie": {
3706
+ "version": "0.6.0",
3707
+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
3708
+ "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==",
3709
+ "license": "MIT"
3710
+ },
3704
3711
  "node_modules/@types/eslint": {
3705
3712
  "version": "8.56.12",
3706
3713
  "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.12.tgz",
@@ -14258,6 +14265,39 @@
14258
14265
  "node": ">=0.10.0"
14259
14266
  }
14260
14267
  },
14268
+ "node_modules/react-router": {
14269
+ "version": "7.1.1",
14270
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.1.tgz",
14271
+ "integrity": "sha512-39sXJkftkKWRZ2oJtHhCxmoCrBCULr/HAH4IT5DHlgu/Q0FCPV0S4Lx+abjDTx/74xoZzNYDYbOZWlJjruyuDQ==",
14272
+ "license": "MIT",
14273
+ "dependencies": {
14274
+ "@types/cookie": "^0.6.0",
14275
+ "cookie": "^1.0.1",
14276
+ "set-cookie-parser": "^2.6.0",
14277
+ "turbo-stream": "2.4.0"
14278
+ },
14279
+ "engines": {
14280
+ "node": ">=20.0.0"
14281
+ },
14282
+ "peerDependencies": {
14283
+ "react": ">=18",
14284
+ "react-dom": ">=18"
14285
+ },
14286
+ "peerDependenciesMeta": {
14287
+ "react-dom": {
14288
+ "optional": true
14289
+ }
14290
+ }
14291
+ },
14292
+ "node_modules/react-router/node_modules/cookie": {
14293
+ "version": "1.0.2",
14294
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz",
14295
+ "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==",
14296
+ "license": "MIT",
14297
+ "engines": {
14298
+ "node": ">=18"
14299
+ }
14300
+ },
14261
14301
  "node_modules/react-scripts": {
14262
14302
  "version": "5.0.1",
14263
14303
  "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz",
@@ -15121,6 +15161,12 @@
15121
15161
  "node": ">= 0.8.0"
15122
15162
  }
15123
15163
  },
15164
+ "node_modules/set-cookie-parser": {
15165
+ "version": "2.7.1",
15166
+ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz",
15167
+ "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==",
15168
+ "license": "MIT"
15169
+ },
15124
15170
  "node_modules/set-function-length": {
15125
15171
  "version": "1.2.2",
15126
15172
  "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
@@ -16498,6 +16544,12 @@
16498
16544
  "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
16499
16545
  "license": "0BSD"
16500
16546
  },
16547
+ "node_modules/turbo-stream": {
16548
+ "version": "2.4.0",
16549
+ "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz",
16550
+ "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==",
16551
+ "license": "ISC"
16552
+ },
16501
16553
  "node_modules/type-check": {
16502
16554
  "version": "0.4.0",
16503
16555
  "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -8,6 +8,7 @@
8
8
  "@testing-library/user-event": "^13.5.0",
9
9
  "react": "^19.0.0",
10
10
  "react-dom": "^19.0.0",
11
+ "react-router": "^7.1.1",
11
12
  "react-scripts": "5.0.1",
12
13
  "web-vitals": "^2.1.4"
13
14
  },
@@ -0,0 +1,26 @@
1
+ export default function PrivacyPolicy() {
2
+ return (
3
+ <div className="p-8 text-white">
4
+ <h1 className="text-3xl font-bold mb-4">Privacy Policy</h1>
5
+ <p className="mb-4"><strong>Effective Date:</strong> 28th December 2024</p>
6
+
7
+ <h2 className="text-2xl font-semibold mb-2">Introduction</h2>
8
+ <p className="mb-4">Dorky is committed to protecting your privacy. This Privacy Policy outlines our practices regarding the collection, use, and disclosure of information when you use our software.</p>
9
+
10
+ <h2 className="text-2xl font-semibold mb-2">Information Collection and Use</h2>
11
+ <p className="mb-4">Dorky does not collect, store, or transmit any personal data from its users. All operations are performed locally on your machine, and any interactions with storage services like AWS S3 or Google Drive are conducted directly between your environment and the respective service.</p>
12
+
13
+ <h2 className="text-2xl font-semibold mb-2">Third-Party Services</h2>
14
+ <p className="mb-4">While Dorky facilitates the storage of files on third-party services such as AWS S3 and Google Drive, it does not transmit any data to these services on its own. Users are responsible for configuring and managing their credentials and data with these services.</p>
15
+
16
+ <h2 className="text-2xl font-semibold mb-2">Security</h2>
17
+ <p className="mb-4">We prioritize the security of your data. However, it's essential to ensure that your environment and the third-party services you use are properly secured and that you follow best practices for credential management.</p>
18
+
19
+ <h2 className="text-2xl font-semibold mb-2">Changes to This Privacy Policy</h2>
20
+ <p className="mb-4">We may update our Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on our GitHub repository.</p>
21
+
22
+ <h2 className="text-2xl font-semibold mb-2">Contact Us</h2>
23
+ <p className="mb-4">If you have any questions about this Privacy Policy, please contact us through our GitHub repository's issue tracker.</p>
24
+ </div>
25
+ );
26
+ }
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+
3
+ export default function TermsAndConditions() {
4
+ return (
5
+ <div className="p-6 shadow-md rounded-lg">
6
+ <h1 className="text-2xl font-bold mb-4">Terms and Conditions</h1>
7
+ <p className="mb-2"><strong>Effective Date:</strong> 28th December 2024</p>
8
+
9
+ <h2 className="text-xl font-semibold mt-4 mb-2">Acceptance of Terms</h2>
10
+ <p className="mb-2">By using Dorky, you agree to comply with and be bound by these Terms and Conditions. If you do not agree, please do not use the software.</p>
11
+
12
+ <h2 className="text-xl font-semibold mt-4 mb-2">License</h2>
13
+ <p className="mb-2">Dorky is licensed under the <strong> MIT License</strong>. You may use, distribute, and modify the software in accordance with the terms of this license.</p>
14
+
15
+ <h2 className="text-xl font-semibold mt-4 mb-2">Usage Restrictions</h2>
16
+ <ul className="list-disc list-inside mb-2">
17
+ <li>Do not use Dorky for any illegal or unauthorized purposes.</li>
18
+ <li>Ensure that your use of Dorky does not violate any applicable laws or regulations.</li>
19
+ </ul>
20
+
21
+ <h2 className="text-xl font-semibold mt-4 mb-2">Limitation of Liability</h2>
22
+ <p className="mb-2">Dorky is provided "as is," without warranty of any kind. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability arising from the use of the software.</p>
23
+
24
+ <h2 className="text-xl font-semibold mt-4 mb-2">User Responsibilities</h2>
25
+ <ul className="list-disc list-inside mb-2">
26
+ <li>Maintain the confidentiality of any credentials used with Dorky.</li>
27
+ <li>Ensure that you have the necessary permissions to store and manage files on third-party services.</li>
28
+ </ul>
29
+
30
+ <h2 className="text-xl font-semibold mt-4 mb-2">Modifications to the Software</h2>
31
+ <p className="mb-2">We reserve the right to modify, suspend, or discontinue Dorky at any time without prior notice.</p>
32
+
33
+ <h2 className="text-xl font-semibold mt-4 mb-2">Governing Law</h2>
34
+ <p className="mb-2">These Terms and Conditions are governed by and construed in accordance with the laws of <strong>[Insert Jurisdiction]</strong>.</p>
35
+
36
+ <h2 className="text-xl font-semibold mt-4 mb-2">Contact Information</h2>
37
+ <p className="mb-2">For any questions or concerns regarding these Terms and Conditions, please reach out via the issue tracker on our GitHub repository.</p>
38
+
39
+ </div>
40
+ );
41
+ }
@@ -1,13 +1,22 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom/client';
3
+ import { BrowserRouter, Routes, Route } from 'react-router';
3
4
  import './index.css';
4
5
  import App from './App';
6
+ import PrivacyPolicy from './PrivacyPolicy';
5
7
  import reportWebVitals from './reportWebVitals';
8
+ import TermsAndConditions from './TermsAndConditions';
6
9
 
7
10
  const root = ReactDOM.createRoot(document.getElementById('root'));
8
11
  root.render(
9
12
  <React.StrictMode>
10
- <App />
13
+ <BrowserRouter>
14
+ <Routes>
15
+ <Route path="/" element={<App />} />
16
+ <Route path="/privacy-policy" element={<PrivacyPolicy />} />
17
+ <Route path="/terms-and-conditions" element={<TermsAndConditions />} />
18
+ </Routes>
19
+ </BrowserRouter>
11
20
  </React.StrictMode>
12
21
  );
13
22