r2-explorer 0.2.5 → 0.2.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 ADDED
@@ -0,0 +1,115 @@
1
+ # R2-Explorer
2
+
3
+ A Google Drive Interface for your Cloudflare R2 Buckets!
4
+
5
+ This project is deployed/self-hosted in your own Cloudflare Account as a Worker, and no credential/token is required to start using it.
6
+
7
+ You can see an live example, in `read-only` mode, in your browser at https://r2-explorer.massadas.com/
8
+
9
+ ## Features
10
+
11
+ - Very quick bucket/folder navigation
12
+ - pdf, image, txt, markdown, etc in-browser preview
13
+ - Drag-and-Drop upload
14
+ - Create folders
15
+ - Rename files
16
+ - Download files
17
+ - Delete files
18
+ - Right click in file for extra options
19
+
20
+
21
+ ## FAQ
22
+
23
+ Q. Is there any Authentication for r2-explorer?
24
+
25
+ A. No. If you want authenticated access, you must setup [Cloudflare Access](https://www.cloudflare.com/products/zero-trust/access/) in your account.
26
+ Access is free up to 50 users.
27
+
28
+
29
+ ## Getting Started
30
+
31
+ Run this command to get an example project setup
32
+
33
+ ```bash
34
+ npx r2-explorer my-r2-explorer
35
+ ```
36
+
37
+ Change into the newly created directory and install the packages
38
+
39
+ ```bash
40
+ cd my-r2-explorer
41
+ npm install
42
+ ```
43
+
44
+ Update the `wrangler.toml` with your R2 Buckets (tip: you can setup as many Buckets as your want)
45
+
46
+ ```
47
+ - wrangler.toml -
48
+ ...
49
+ [[r2_buckets]]
50
+ binding = 'my-bucket-name'
51
+ bucket_name = 'my-bucket-name'
52
+ preview_bucket_name = 'my-bucket-name'
53
+ ```
54
+
55
+ If you want to be able to upload/modify your buckets, you must update the `readonly` flag in `src/index.ts` file.
56
+
57
+ After that just run publish and the project will be up and running for you and everyone you invite to use the Buckets
58
+
59
+ ```bash
60
+ wrangler publish
61
+ ```
62
+
63
+ ## TODO
64
+
65
+ - Integration with cloudflare access
66
+ - allow bucket names with spaces
67
+ - Search files
68
+ - CSV Previewer
69
+ - Upload folders
70
+ - Rename folders
71
+ - Delete folders
72
+ - Image thumbnail's using Cloudflare workers
73
+ - Tooltip when hovering a file with absolute time in "x days time ago" format
74
+ - Upload folders with files
75
+ - Automatically load more files, when the bottom is reached (current limit is 1000 files)
76
+ - Download files bigger than 2gb with presigned url's
77
+
78
+ ## Known issues
79
+
80
+ - Rename files with special characters is not possible with current [sdk issue here](https://github.com/aws/aws-sdk-js/issues/1949)
81
+
82
+ ## Images
83
+
84
+ Home Page
85
+ ![Home](https://github.com/G4brym/R2-Explorer/raw/master/docs/images/home.png)
86
+
87
+ Image Previewer
88
+ ![Home](https://github.com/G4brym/R2-Explorer/raw/master/docs/images/image-preview.png)
89
+
90
+ Pdf Previewer
91
+ ![Home](https://github.com/G4brym/R2-Explorer/raw/master/docs/images/pdf-preview.png)
92
+
93
+ New Folder
94
+ ![Home](https://github.com/G4brym/R2-Explorer/raw/master/docs/images/new-folder.png)
95
+
96
+ Uploading Files
97
+ ![Home](https://github.com/G4brym/R2-Explorer/raw/master/docs/images/uploading-files.png)
98
+
99
+ ### Compiles and hot-reloads for development
100
+
101
+ ```
102
+ npm run serve
103
+ ```
104
+
105
+ ### Compiles and minifies for production
106
+
107
+ ```
108
+ npm run build
109
+ ```
110
+
111
+ ### Lints and fixes files
112
+
113
+ ```
114
+ npm run lint
115
+ ```
@@ -0,0 +1,70 @@
1
+ #! /usr/bin/env node
2
+ var fs = require('fs')
3
+
4
+ const args = process.argv.slice(2)
5
+ const projectName = args[0] || 'r2-explorer'
6
+
7
+ const dir = `./${projectName}`
8
+ if (!fs.existsSync(dir)) {
9
+ fs.mkdirSync(dir)
10
+ }
11
+
12
+ fs.writeFileSync(
13
+ `${dir}/wrangler.toml`,
14
+ `name = "${projectName}"
15
+ compatibility_date = "2022-08-09"
16
+ main = "src/index.js"
17
+
18
+ [[r2_buckets]]
19
+ binding = 'my-bucket-name'
20
+ bucket_name = 'my-bucket-name'
21
+ preview_bucket_name = 'my-bucket-name'
22
+ `
23
+ )
24
+ fs.writeFileSync(
25
+ `${dir}/package.json`,
26
+ `{
27
+ "name": "${projectName}",
28
+ "version": "0.0.1",
29
+ "private": true,
30
+ "devDependencies": {
31
+ "wrangler": "^2.4.2"
32
+ },
33
+ "scripts": {
34
+ "publish": "wrangler publish"
35
+ },
36
+ "dependencies": {
37
+ "r2-explorer": "^0.2.6"
38
+ }
39
+ }
40
+
41
+ `
42
+ )
43
+
44
+ const srcDir = `${dir}/src`
45
+ if (!fs.existsSync(srcDir)) {
46
+ fs.mkdirSync(srcDir)
47
+ }
48
+
49
+ fs.writeFileSync(
50
+ `${srcDir}/index.js`,
51
+ `import { R2Explorer } from 'r2-explorer';
52
+
53
+ const explorer = R2Explorer({ readonly: true })
54
+
55
+ export default {
56
+ async fetch(request, env, context) {
57
+ return explorer.handle(request, env, context)
58
+ }
59
+ };
60
+ `
61
+ )
62
+
63
+ console.log(`Project ${projectName} successfully created!`)
64
+ console.log('----------------------------')
65
+ console.log('Next steps:')
66
+ console.log(` 1. Run 'cd ${projectName} && npm install'`)
67
+ console.log(" 2. Update the 'wrangler.toml' file with your R2 Buckets")
68
+ console.log(" 3. Run 'wrangler publish' to deploy your own R2-Explorer!")
69
+
70
+ process.exit(0) //no errors occurred
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "r2-explorer",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "A Google Drive Interface for your Cloudflare R2 Buckets",
5
5
  "main": "dist/umd/index.js",
6
6
  "scripts": {