discfs

Crates.iodiscfs
lib.rsdiscfs
version0.1.1
sourcesrc
created_at2023-12-04 11:37:15.071214
updated_at2023-12-04 11:39:26.173012
descriptionVirtual FUSE filesystem with files stored as Discord attachments
homepagehttps://crates.io/crates/discfs
repositoryhttps://github.com/sqooid/discfs
max_upload_size
id1057537
size110,513
Lucas Liu (sqooid)

documentation

https://docs.rs/discfs

README

DiscFS

Store files as attachments on Discord messages.

Installation

Install with cargo install discfs or using the Nix flake in the project repository.

Note that you will need development libraries fuse3-dev, openssl-dev and pkg-config or whatever they are called in your package manager.

Setup

Creating the Discord bot

First you need to create a Discord bot to upload the files. Following the documentation (https://discord.com/developers/docs/getting-started), create a bot. Under the sidebar "OAuth2 -> URL Generator", give it the bot scope and following bot permissions:

  • Send Messages
  • Attach Files
  • Read Message History

Then copy the generated url at the bottom, paste it in the browser and install the bot in your personal server.

Next, get the bot token by going to sidebar "Bot", clicking "Reset Token" and copying the token.

This token as well as the id of the channel you want the bot to send the messages in needs to be set in the following environment variables:

DISCORD_TOKEN=
CHANNEL_ID=

Channel ID can be retrieved by going to the Discord web application, navigating to the channel, and copying the last part of the url.

https://discord.com/channels/956113749209661480/ -> 956113749209661483 <- (this part)

Running the CLI

Usage text is as follows:

Usage: discfs [OPTIONS] <MOUNTPOINT>

Arguments:
  <MOUNTPOINT>  Path to mount virtual filesystem at

Options:
      --dotenv             Use dotenv-vault (https://www.dotenv.org/docs/)
  -v...                    Logging verbosity. Repeat multiple times to increase logging level
      --db-path <DB_PATH>  Path to create SQLite database file [env: DB_PATH=fs.db] [default: ./fs.db]
  -h, --help               Print help
  -V, --version            Print version

Make sure you don't accidently delete the SQLite database as that maps all the attachments and stores all the file metadata. Deleting it will lead to all uploaded content being unreachable.

Commit count: 74

cargo fmt