Open Mistium opened 4 days ago
OFTPS Server should be based on a websocket server Example: -Connects to server-
Server: {"action":"login_required"} - Server asks for login User: {"login":"USERNAME:PASSWORD-MD5"} - Login Details. Server (Login Successful): {"login":"OK", "type":"login-ok"} - Everything worked, you are logged in. Server (Login Unsuccessful - Invalid Credentials): {"login":"ERROR", "error":"Invalid Credentials", "type":"invalid_login"} - Username or password wrong. Server (Login Unsuccessful - Banned User): {"login":"ERROR", "error":"You are banned.", "type":"banned"} - You are banned (user) Server (Login Unsuccessful - Banned User): {"login":"ERROR", "error":"You are banned.", "type":"banned-ip"} - You are banned (IP)
User: {"action":"get-dir"} - List current directory's files and folders. Server: {"files:["file1.txt","file2.txt","file3.txt"], "sizes:["69b","7.8mb","420gb"], "permissions":["ALLOW","ALLOW","DENY"]} - Lists the files, in this case, file1.txt with 69 bytes, file2.txt with 7.8mb and file3.txt with 420gb, permissions show in order which files you can access (for the origin files app to gray them out or something).
User: {"action":"cat","file":"file3.txt"} - See the content of a file (the permissions of file3.txt DO NOT ALLOW SEEING THE CONTENT) Server: {"error":"Insufficient Permissions"}
User: {"action":"set","file":"file3.txt","content":"No more 420gb :D"} - Tells the server the action, the file to set the content to and the content. (Using a file which you do not have permissions on.) Server: {"error":"Insufficient Permissions"} - Not enough permissions
User: {"action":"mv","file":"file1.txt","path":"some-folder/file1.txt"} - Tells the action of moving the file, the file name and the path. Server (if the folder exists): {"mv":"OK"} - The file was moved successfully. Server (if the folder doesnt exist): {"mv":"ERROR","error":"The specified folder doesnt exist"} - The folder where you wanted to move the file doesnt exist.
Folder: User: {"action":"create","type":"folder","name":"some-folder"} - Tells the action of creating a folder and the name of it. Server (enough permissions): {"create":"OK"} - The folder was created. Server (not enough permissions): {"create":"ERROR","error":"Insufficient Permissions"} - The folder wasnt created because you dont have enough permissions. Server (the folder already exists): {"create":"ERROR","error":"The folder already exists."} File: User (file with content): {"action":"create","type":"file","name":"file4.txt","content":"Cool"} - Tells the action of creating a file called file4.txt with the content "Cool". User (file without content): {"action":"create","type":"file","name":"file4.txt","content":""} - Tells the action of creating a blank file called file4.txt Server (enough permissions): {"create":"OK"} - The file was created. Server (not enough permissions): {"create":"ERROR","error":"Insufficient Permissions"} - Not enough permissions. Server (the file already exists): {"create":"ERROR","error":"The file already exists."}
User: {"action":"delete","file":"file3.txt"} - Tells the server the action of deleting the file3.txt (which you dont have permissions on) Server: {"delete":"ERROR", "error":"Insufficient Permissions"}
User: {"action":"delete","folder":"some-folder"} - Tells the server the action of deleting the folder "some-folder" (which you dont have permissions on) Server: {"delete":"ERROR", "error":"Insufficient Permissions"}
User: {"login":"change_password","password":"PASSWORD-MD5","new":"NEW-PASSWORD-MD5"} - Tells that you wanna realize an action on the login part and the action is changing your password, you also specified the old and new password to the server. Server: {"change_password":"OK"} - The password was changed successfully. Server: {"change_password":"ERROR","error":"Invalid Credentials"} - Your old password isnt correct. Server: {"change_password":"WARNING","warning":"Insecure Password"} - Your password is in the lost of the most common passwords, please use another password. Your password wasnt changed.
User: (whatever action while not being logged in) Server: {"login":"ERROR","error":"You are not logged in."}
A file transfer protocol for accessing origin files remotely from oftps clients
i can probably write this 100% in osl
Requests
Responses
Status codes
0 - successful
1 - unknown command
2 - unknown file
3 - unknown directory
4 - too much data