Discord as a filesystem.
Turn Discord into a datastore that can manage and store your files.
4.x
This next major version release 4.0 is ddrive written from scratch. It comes with most requested features and several improvements.
postgres
to store files metadata. Why?
rename
files/folders.move
file/folder (Only via API, Not sure how to do it with frontend, PR welcomes.)webhooks
instead of bot/user tokens
to bypass the discord rate limit5GB of size in just 85 seconds
.download reset
for few mobile devicesI spent several weeks finalizing this new version. Any support is highly appreciated - Buy me a coffee
cd .devcontainer
docker-compose up -d
config/.env_sample
to config/.env
and make necessary changeswebhook.txt
with \n
seperated.npm run migration:up
node bin/ddrive
http://localhost:3000
in your browser.npm install -g pm2
pm2 start bin/ddrive
pm2 list
to check status of ddrivepm2 logs
to check ddrive logs# config/.env
# Required params
DATABASE_URL= # Database URL of postgres with valid postgres uri
WEBHOOKS={url1},{url2} # Webhook urls seperated by ","
# Optional params
PORT=3000 # HTTP Port where ddrive panel will start running
REQUEST_TIMEOUT=60000 # Time in ms after which ddrive will abort request to discord api server. Set it high if you have very slow internet
CHUNK_SIZE=25165824 # ChunkSize in bytes. You should probably never touch this and if you do don't set it to more than 25MB, with discord webhooks you can't upload file bigger than 25MB
SECRET=someverysecuresecret # If you set this every files on discord will be stored using strong encryption, but it will cause significantly high cpu usage, so don't use it unless you're storing important stuff
AUTH=admin:admin # Username password seperated by ":". If you set this panel will ask for username password before access
PUBLIC_ACCESS=READ_ONLY_FILE # If you want to give read only access to panel or file use this option. Check below for valid options.
# READ_ONLY_FILE - User will be only access download links of file and not panel
# READ_ONLY_PANEL - User will be able to browse the panel for files/directories but won't be able to upload/delete/rename any file/folder.
UPLOAD_CONCURRENCY=3 # ddrive will upload this many chunks in parallel to discord. If you have fast internet increasing it will significantly increase performance at cost of cpu/disk usage
docker run -rm -it -p 8080:8080 \
-e PORT=8080 \
-e WEBHOOKS={url1},{url2} \
-e DATABASE_URL={database url} \
--name ddrive forscht/ddrive
neon.tech
postgres - Youtubenpm install @forscht/ddrive
const { DFs, HttpServer } = require('@forscht/ddrive')
const DFsConfig = {
chunkSize: 25165824,
webhooks: 'webhookURL1,webhookURL2',
secret: 'somerandomsecret',
maxConcurrency: 3, // UPLOAD_CONCURRENCY
restOpts: {
timeout: '60000',
},
}
const httpConfig = {
authOpts: {
auth: { user: 'admin', pass: 'admin' },
publicAccess: 'READ_ONLY_FILE', // or 'READ_ONLY_PANEL'
},
port: 8080,
}
const run = async () => {
// Create DFs Instance
const dfs = new DFs(DFsConfig)
// Create HTTP Server instance
const httpServer = HttpServer(dfs, httpConfig)
return httpServer.listen({ host: '0.0.0.0', port: httpConfig.port })
}
run().then()
Migrating ddrive v3 to v4 is one way process once you migrate ddrive to v4 and add new files you can’t migrate new files to v3 again but you can still use v3 with old files.
--metadata=true
. Ex - ddrive --channelId {id} --token {token} --metadata=true
localhost:{ddrive-port}/metadata
in browserDATABASE_URL
in config/.env
node bin/migrate old_data.json
Migration is done
Feel free to create new issue if it’s not working for you or need any help.