This program can store files in a "database", with a set of commands. However, there is a major difference between your typical "FTP" server and this: Each "commit", or file change, is logged and can be undone/rolled back. This server also supports authentication, so only trusted users can modify your database.
All commands are sent to the server in the form of a table, like so:
{sCommand, vParameter1, vParameter2, ...}
Commands:
- "login" - Allows a client to modify the database, provided a correct username/password combination is provided. Only parameters needed are the username/password combination.
- "logout" - Prevents a client from modifying the database until he/she logs back in. This requires no parameters.
- "commit" - Sends a file to the server for storage. These are logged and can be undone. Parameters are the file's name, the data to store on the file, and an optional commit message.
- "delete" - Deletes a file from the server. Can be undone. Parameters are the file's name.
- "undo" or "revert" - Rolls back changes to a specific commit ID (see below). Parameters are the file's name and the commit ID to revert to.
- "list_commits" - Sends a list of commits and associated changes for a file to the client. The only parameter needed is the file's name.
- "read" - Retrieves a file from the database. The only parameter needed is the file's name.
- "list" - Retrieves a list of files in the current branch.
- "switch" - Switches to another branch (that doesn't need to exist). Only parameter needed is the branch name.
- "clone_branch" or "copy_branch" - Copies the current branch's to form a new branch, which must not exist. Only parameter needed is the new branch's name.
- "pastebin_get" - Downloads a file from Pastebin. Parameters needed are the paste's code, and the filename.
- "github_get" - Downloads a file from Github. Parameters needed are the file to download to, the owner of the repository, the repository's name, the branch to download from (usually "master"), and the file's name in the repository.
- Download the server. Ensure that the HTTP API is enabled.
- Run the server software, but immediately terminate it as soon as it reports that it has "Found ARC4 Cipher".
- You should see a few new folders and a new file named "newUser".
- Run newUser like so: "newUser <user_name> <password>" for everyone who can access the database.
- Run "dbServ".
First, keep these things in mind:
- Any files you download will be placed in the current directory.
- You need to run the database software like this:
db <server> <action> <parameters>
- You may need to log in multiple times, because the server software automatically logs you out after 15 minutes.
- All actions are performed in the current branch.
- If the server has guest read-only access enabled, then you don't need to log in to use "list" and "read".
db <server> login <username> <password>
To list files in your current branch, do this:
db <server> list
To send files to the server, do this:
db <server> sendfile <path/to/local/file> <name of file on the server> <commit_message>
To just put raw data into a file on the server, do this:
db <server> commit <file> <data> <commit_message>
To revert to a commit:
db <server> undo <file> <commitID>
To get files from the server, run this:
db <server> read <file>
Deleting files is done similarly:
db <server> delete <file>
To move or copy files, do this:
db <server> <move/copy> <name_of_file> <name_of_new_file>
To list the commits for a particular file, do this:
db <server> list_commits <file>
To switch branches, do this:
db <server> switch <name_of_branch>
The target branch doesn't need to exist.
If you want to copy an entire branch, do this:
db <server> clone_branch <new_branch_name>
This clones the current branch.To get the data for a commit, do:
db <server> get_commit <file> <commitID>
To make the server download a file from Pastebin, do:
db <server> pastebin_get <pastebin_code> <name_of_file> <commit_message>
To make the server download a file from Github, do:
db <server> github_get <name_of_file> <user> <repository> <branch> <file> <commit_message>
An example user might do this:
db 20 login admin adad2sx2
db 20 sendFile dev/my_awesome_program my_awesome_program
db 20 read my_other_program
db 20 logout
The user above:
- Logged in
- Sent a file to the server
- Downloaded a file from the server
- Logged out
Guest Access
If you run "dbServ" with the option "-guest_read" then the "list" and "read" functions become available without requiring the user to log in.
Guests are only allowed to get files from the "master" branch, however.
Guest Access Mode:
dbServ -guest_read
You can get it here, from pastebin: Rednet Database Server
Or you can download it from in-game by running this:
pastebin get t1StZK2k dbServ
The client can be found here: Database Server Client
Or download it from in-game by running this:
pastebin get 48aP8hfF db_client
If the HTTP API is disabled, than all passwords will be stored on the password in cleartext, but the server will attempt to use the RC4 cipher (automatically downloaded) whenever possible, which may cause problems. This is easily fixed though, only requiring that the person running the database add the users again.
Also, I'm looking for someone to make an actual UI for the client. If you'd like to (or already have one), please PM me.</password></user_name>