介紹
可將你的google drive內檔案在workers上建立index,可以看一下作者的Demo:oss.achirou.workers.dev/,可以線上觀看影片,看圖片,也可以下載任何檔案,index網頁是可以設定密碼也不用怕被陌生人看到,試試看如何使用,不懂程式語言也可以手把手輕鬆做出來。
- 使用GoIndex-theme-acrou版本github:goindex-theme-acrou
設定方法
請先註冊 dash.cloudflare.com/sign-up/workers,右上可選擇語言
免費方案,每天可請求10萬筆
使用rclone 取得refresh_token
-
需要使用rclone取得個人的refresh_token、client_id、client_secret
-
使用colab 安裝rclone
colab.research.google.com/github/kobojp/aria2-colab/blob/master/install_rclone.ipynb
設定說明
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
No remotes found - make a new one n) New remote s) Set configuration password q) Quit config n/s/q> n # 輸入n 建立remote name> gd Type of storage to configure. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / 1Fichier \ "fichier" 2 / Alias for an existing remote \ "alias" 3 / Amazon Drive \ "amazon cloud drive" 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc) \ "s3" 5 / Backblaze B2 \ "b2" 6 / Box \ "box" 7 / Cache a remote \ "cache" 8 / Citrix Sharefile \ "sharefile" 9 / Dropbox \ "dropbox" 10 / Encrypt/Decrypt a remote \ "crypt" 11 / FTP Connection \ "ftp" 12 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage" 13 / Google Drive \ "drive" 14 / Google Photos \ "google photos" 15 / Hubic \ "hubic" 16 / In memory object storage system. \ "memory" 17 / Jottacloud \ "jottacloud" 18 / Koofr \ "koofr" 19 / Local Disk \ "local" 20 / Mail.ru Cloud \ "mailru" 21 / Mega \ "mega" 22 / Microsoft Azure Blob Storage \ "azureblob" 23 / Microsoft OneDrive \ "onedrive" 24 / OpenDrive \ "opendrive" 25 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ "swift" 26 / Pcloud \ "pcloud" 27 / Put.io \ "putio" 28 / QingCloud Object Storage \ "qingstor" 29 / SSH/SFTP Connection \ "sftp" 30 / Sugarsync \ "sugarsync" 31 / Tardigrade Decentralized Cloud Storage \ "tardigrade" 32 / Transparently chunk/split large files \ "chunker" 33 / Union merges the contents of several upstream fs \ "union" 34 / Webdav \ "webdav" 35 / Yandex Disk \ "yandex" 36 / http Connection \ "http" 37 / premiumize.me \ "premiumizeme" 38 / seafile \ "seafile" Storage> 13 # 輸入 13 ** See help for drive backend at: https://rclone.org/drive/ ** OAuth Client Id Leave blank normally. Enter a string value. Press Enter for the default (""). client_id> # 留空 OAuth Client Secret Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret> # 留空 Scope that rclone should use when requesting access from drive. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Full access all files, excluding Application Data Folder. \ "drive" 2 / Read-only access to file metadata and file contents. \ "drive.readonly" / Access to files created by rclone only. 3 | These are visible in the drive website. | File authorization is revoked when the user deauthorizes the app. \ "drive.file" / Allows read and write access to the Application Data folder. 4 | This is not visible in the drive website. \ "drive.appfolder" / Allows read-only access to file metadata but 5 | does not allow any access to read or download file content. \ "drive.metadata.readonly" scope> 1 # 輸入 1 ID of the root folder Leave blank normally. Fill in to access "Computers" folders (see docs), or for rclone to use a non root folder as its starting point. Enter a string value. Press Enter for the default (""). root_folder_id> Service Account Credentials JSON file path Leave blank normally. Needed only if you want use SA instead of interactive login. Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`. Enter a string value. Press Enter for the default (""). service_account_file> # 留空 Edit advanced config? (y/n) y) Yes n) No (default) y/n> n # 輸入 n Remote config Use auto config? * Say Y if not sure * Say N if you are working on a remote or headless machine y) Yes (default) n) No y/n> n # 輸入n 如果輸入Y會無法取得授權 Please go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=CCcaa&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=2tcyRHXyFQr1zZkmGcwYMw Log in and authorize rclone for access Enter verification code> 4/5wFubkoEF4ivZfYC3B8mbxPL8tRbKv4ZO8dKPqizl1nzbm2dQgfrtKg Configure this as a team drive? y) Yes n) No (default) y/n> y # 輸入 Y Fetching team drive list... Choose a number from below, or type in your own value 1 / share \ "0ANz2seq1rrO59PVA" Enter a Team Drive ID> 1 # 輸入 1 或選擇你要的team drive -------------------- [gd] # 以下是設定檔資訊,請複製 refresh_token type = drive scope = drive token = {"access_token":"","token_type":"Bearer","refresh_token":"...","expiry":"2020"} team_drive = 0ANz2seq1rrO59PVA root_folder_id = -------------------- y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d> y # 輸入y Current remotes: Name Type ==== ==== gd drive e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q> q #輸入q退出
複製index.js所有程式碼到workers上
-
建立worker
-
複製index.js code
-
設定配置
-
client_id、client_secret 可不改,使用默認的,建議使用自己的api
-
refresh_token 命令列輸入rclone config show 可查詢config檔
-
新增 team drive(團隊盤ID)
假設團隊盤網址是:https://drive.google.com/drive/u/0/folders/0AAVuckskaiewDUk9PVA0AAVuckskaiewDUk9PVA
是 ID -
例子: 如果不開放請必須設定帳號密碼、name可隨意取名稱
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
roots: [ { id: "0AAVuckskaiewDUk9PVA", name: "TeamDrive", pass: "", // 沒設定等於不需密碼 }, { id: "root", // root 是個人雲端 name: "PrivateDrive", user: "abc", //帳號 pass: "123", //密碼 protect_file_link: true, }, { id: "", name: "folder1", pass: "", }, ],
儲存部署就完成了,最上方可開啟網址
-