FileShare/Server

From Sugar Labs
< FileShare
Revision as of 15:36, 12 January 2010 by Jlew (talk | contribs) (Created page with 'This is a simple python script that allows the file share activity to save files on the jabber server. This optional server is for the FileShare Activity. ==Code== The code…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is a simple python script that allows the file share activity to save files on the jabber server.

This optional server is for the FileShare Activity.

Code

The code can be found in the FileShare Activity's git repo

Future Plans

  • Allow users to have private upload/download files.
    • Would allow user to upload file to a private folder for them/admins to access (example, student turning in an assignment)

Network Policy

This is the network policy in place by the FileShare system.

Connecting

All clients must check version and announce themselves if they with to have more then download rights

  1. When the client first connects it sends a GET request to /version.
    • Version must return the protocol version. The current version is 2.
  2. Then if the version is 2 or greater, it makes a POST request to /announce_user
    • Announce user expects id and nick'
    • This tells the server about the user list.
    • Returns the permission string (0 download only, 1 add/remove, 2 administer)

Downloading

  1. Any user can GET request /fileList.
    • File list returns a JSON object in the format the xo is expecting.
  2. To download a file a GET request of the file id will return the file.

Uploading/Removing

  1. To upload a file, just POST the file to /upload.
    • Expects id, jdata, and file
  2. To remove a file, POST file id to /remove
    • Expects id and fid

Administer Users

  1. Admin can request user list by POST to /user_list.
    • Expects id (must have admin permission)
  2. Modify User level by POST to /user_mod.
    • Expects id, userId, and level.