GitHub PullRequestEvent at 2014-09-21 23:02:20
Repository: syncthing
Actor: Nutomic
Payload: {"action":"opened","number":723,"pull_request":{"url":"https://api.github.com/repos/syncthing/syncthing/pulls/723","id":21553754,"html_url":"https://github.com/syncthing/syncthing/pull/723","diff_url":"https://github.com/syncthing/syncthing/pull/723.diff","patch_url":"https://github.com/syncthing/syncthing/pull/723.patch","issue_url":"https://api.github.com/repos/syncthing/syncthing/issues/723","number":723,"state":"open","locked":false,"title":"[do not merge] API functions for file access","user":{"login":"Nutomic","id":1044450,"avatar_url":"https://avatars.githubusercontent.com/u/1044450?v=2","gravatar_id":"c15e8e568e2c8cbdac3af26324f75929","url":"https://api.github.com/users/Nutomic","html_url":"https://github.com/Nutomic","followers_url":"https://api.github.com/users/Nutomic/followers","following_url":"https://api.github.com/users/Nutomic/following{/other_user}","gists_url":"https://api.github.com/users/Nutomic/gists{/gist_id}","starred_url":"https://api.github.com/users/Nutomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nutomic/subscriptions","organizations_url":"https://api.github.com/users/Nutomic/orgs","repos_url":"https://api.github.com/users/Nutomic/repos","events_url":"https://api.github.com/users/Nutomic/events{/privacy}","received_events_url":"https://api.github.com/users/Nutomic/received_events","type":"User","site_admin":false},"body":"This can be used to implement a web interface like Dropbox has it, so files can be accessed from a device that does not have syncthing installed itself. Personally, I want to implement a [DocumentsProvider](https://developer.android.com/guide/topics/providers/document-provider.html) for Android. The next step (after the Android implementation) would be to get all file data from `Model`, so that files are downloaded on the fly, and local storage is not needed (but I didn't understand the code good enough for that).\r\n\r\n**/rest/file/create/**\r\nCreates new file or directory at the given path. To create a directory, pass a trailing '/'. Note that the parent directory must already exist.\r\n(We might also get rid of this and just use `/rest/file/write/`, but I put it in because I was going by the Android API)\r\n`curl -s \"http://localhost:8081/rest/file/create?repo=default&path=testfile\"`\r\n\r\n**/rest/file/delete/**\r\nDeletes the given file. If it is a directory, it has to be empty.\r\n`curl -s \"http://localhost:8081/rest/file/delete?repo=default&path=testfile\"`\r\n\r\n**/rest/file/write/**\r\nUploads and replaces the file. Must exist.\r\n`curl -s \"http://localhost:8081/rest/file/write?repo=default&path=testfile\" -H \"X-API-Key: xyz\" --form \"file=@testfile\"`\r\n\r\n**/rest/file/read/**\r\nDownloads the file. Must exist.\r\ncurl -s \"http://localhost:8081/rest/file/read?repo=default&path=testfile\"\r\n\r\n**/rest/file/list**\r\nLists all directory contents.\r\n```\r\ncurl -s \"http://localhost:8081/rest/file/list?repo=default\"\r\n[ { \r\n\t\"mime\" : \"text/plain; charset=utf-8\",\r\n\t\"modified\" : \"1411333357\",\r\n\t\"name\" : \"file.txt\",\r\n\t\"size\" : \"0\"\r\n}]\r\n```\r\n\r\nThere's lots of duplicate code (mostly error handling), I'll see how I can improve that (open for suggestions).\r\n\r\nI'm not quite sure how the CSRF works, it seems that only `POST` requests are protected? (at least that's how it seemed during my debugging)\r\n\r\nAt the moment, there's no client for this (except for the curls above). You might want to wait until I implement this on Android before merging (I might also have to change stuff for that).\r\n\r\nSorry for this wall of text :D ","created_at":"2014-09-21T23:02:20Z","updated_at":"2014-09-21T23:02:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/syncthing/syncthing/pulls/723/commits","review_comments_url":"https://api.github.com/repos/syncthing/syncthing/pulls/723/comments","review_comment_url":"https://api.github.com/repos/syncthing/syncthing/pulls/comments/{number}","comments_url":"https://api.github.com/repos/syncthing/syncthing/issues/723/comments","statuses_url":"https://api.github.com/repos/syncthing/syncthing/statuses/beccdd8dde639941cf700b04261064f18ecac81d","head":{"label":"Nutomic:rest-file-access","ref":"rest-file-access","sha":"beccdd8dde639941cf700b04261064f18ecac81d","user":{"login":"Nutomic","id":1044450,"avatar_url":"https://avatars.githubusercontent.com/u/1044450?v=2","gravatar_id":"c15e8e568e2c8cbdac3af26324f75929","url":"https://api.github.com/users/Nutomic","html_url":"https://github.com/Nutomic","followers_url":"https://api.github.com/users/Nutomic/followers","following_url":"https://api.github.com/users/Nutomic/following{/other_user}","gists_url":"https://api.github.com/users/Nutomic/gists{/gist_id}","starred_url":"https://api.github.com/users/Nutomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nutomic/subscriptions","organizations_url":"https://api.github.com/users/Nutomic/orgs","repos_url":"https://api.github.com/users/Nutomic/repos","events_url":"https://api.github.com/users/Nutomic/events{/privacy}","received_events_url":"https://api.github.com/users/Nutomic/received_events","type":"User","site_admin":false},"repo":{"id":19462989,"name":"syncthing","full_name":"Nutomic/syncthing","owner":{"login":"Nutomic","id":1044450,"avatar_url":"https://avatars.githubusercontent.com/u/1044450?v=2","gravatar_id":"c15e8e568e2c8cbdac3af26324f75929","url":"https://api.github.com/users/Nutomic","html_url":"https://github.com/Nutomic","followers_url":"https://api.github.com/users/Nutomic/followers","following_url":"https://api.github.com/users/Nutomic/following{/other_user}","gists_url":"https://api.github.com/users/Nutomic/gists{/gist_id}","starred_url":"https://api.github.com/users/Nutomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nutomic/subscriptions","organizations_url":"https://api.github.com/users/Nutomic/orgs","repos_url":"https://api.github.com/users/Nutomic/repos","events_url":"https://api.github.com/users/Nutomic/events{/privacy}","received_events_url":"https://api.github.com/users/Nutomic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nutomic/syncthing","description":"Open Source Continuous Replication / Cluster Synchronization Thing","fork":true,"url":"https://api.github.com/repos/Nutomic/syncthing","forks_url":"https://api.github.com/repos/Nutomic/syncthing/forks","keys_url":"https://api.github.com/repos/Nutomic/syncthing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nutomic/syncthing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nutomic/syncthing/teams","hooks_url":"https://api.github.com/repos/Nutomic/syncthing/hooks","issue_events_url":"https://api.github.com/repos/Nutomic/syncthing/issues/events{/number}","events_url":"https://api.github.com/repos/Nutomic/syncthing/events","assignees_url":"https://api.github.com/repos/Nutomic/syncthing/assignees{/user}","branches_url":"https://api.github.com/repos/Nutomic/syncthing/branches{/branch}","tags_url":"https://api.github.com/repos/Nutomic/syncthing/tags","blobs_url":"https://api.github.com/repos/Nutomic/syncthing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nutomic/syncthing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nutomic/syncthing/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nutomic/syncthing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nutomic/syncthing/statuses/{sha}","languages_url":"https://api.github.com/repos/Nutomic/syncthing/languages","stargazers_url":"https://api.github.com/repos/Nutomic/syncthing/stargazers","contributors_url":"https://api.github.com/repos/Nutomic/syncthing/contributors","subscribers_url":"https://api.github.com/repos/Nutomic/syncthing/subscribers","subscription_url":"https://api.github.com/repos/Nutomic/syncthing/subscription","commits_url":"https://api.github.com/repos/Nutomic/syncthing/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nutomic/syncthing/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nutomic/syncthing/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nutomic/syncthing/issues/comments/{number}","contents_url":"https://api.github.com/repos/Nutomic/syncthing/contents/{+path}","compare_url":"https://api.github.com/repos/Nutomic/syncthing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nutomic/syncthing/merges","archive_url":"https://api.github.com/repos/Nutomic/syncthing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nutomic/syncthing/downloads","issues_url":"https://api.github.com/repos/Nutomic/syncthing/issues{/number}","pulls_url":"https://api.github.com/repos/Nutomic/syncthing/pulls{/number}","milestones_url":"https://api.github.com/repos/Nutomic/syncthing/milestones{/number}","notifications_url":"https://api.github.com/repos/Nutomic/syncthing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nutomic/syncthing/labels{/name}","releases_url":"https://api.github.com/repos/Nutomic/syncthing/releases{/id}","created_at":"2014-05-05T16:41:19Z","updated_at":"2014-08-02T06:13:03Z","pushed_at":"2014-09-21T22:47:48Z","git_url":"git://github.com/Nutomic/syncthing.git","ssh_url":"git@github.com:Nutomic/syncthing.git","clone_url":"https://github.com/Nutomic/syncthing.git","svn_url":"https://github.com/Nutomic/syncthing","homepage":"http://discourse.syncthing.net/","size":16749,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"syncthing:master","ref":"master","sha":"39cf269d6be2f417c0f50f1b4b8a2a82f993bf9c","user":{"login":"syncthing","id":7628018,"avatar_url":"https://avatars.githubusercontent.com/u/7628018?v=2","gravatar_id":null,"url":"https://api.github.com/users/syncthing","html_url":"https://github.com/syncthing","followers_url":"https://api.github.com/users/syncthing/followers","following_url":"https://api.github.com/users/syncthing/following{/other_user}","gists_url":"https://api.github.com/users/syncthing/gists{/gist_id}","starred_url":"https://api.github.com/users/syncthing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syncthing/subscriptions","organizations_url":"https://api.github.com/users/syncthing/orgs","repos_url":"https://api.github.com/users/syncthing/repos","events_url":"https://api.github.com/users/syncthing/events{/privacy}","received_events_url":"https://api.github.com/users/syncthing/received_events","type":"Organization","site_admin":false},"repo":{"id":14712850,"name":"syncthing","full_name":"syncthing/syncthing","owner":{"login":"syncthing","id":7628018,"avatar_url":"https://avatars.githubusercontent.com/u/7628018?v=2","gravatar_id":null,"url":"https://api.github.com/users/syncthing","html_url":"https://github.com/syncthing","followers_url":"https://api.github.com/users/syncthing/followers","following_url":"https://api.github.com/users/syncthing/following{/other_user}","gists_url":"https://api.github.com/users/syncthing/gists{/gist_id}","starred_url":"https://api.github.com/users/syncthing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syncthing/subscriptions","organizations_url":"https://api.github.com/users/syncthing/orgs","repos_url":"https://api.github.com/users/syncthing/repos","events_url":"https://api.github.com/users/syncthing/events{/privacy}","received_events_url":"https://api.github.com/users/syncthing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/syncthing/syncthing","description":"Open Source Continuous File Synchronization","fork":false,"url":"https://api.github.com/repos/syncthing/syncthing","forks_url":"https://api.github.com/repos/syncthing/syncthing/forks","keys_url":"https://api.github.com/repos/syncthing/syncthing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/syncthing/syncthing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/syncthing/syncthing/teams","hooks_url":"https://api.github.com/repos/syncthing/syncthing/hooks","issue_events_url":"https://api.github.com/repos/syncthing/syncthing/issues/events{/number}","events_url":"https://api.github.com/repos/syncthing/syncthing/events","assignees_url":"https://api.github.com/repos/syncthing/syncthing/assignees{/user}","branches_url":"https://api.github.com/repos/syncthing/syncthing/branches{/branch}","tags_url":"https://api.github.com/repos/syncthing/syncthing/tags","blobs_url":"https://api.github.com/repos/syncthing/syncthing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/syncthing/syncthing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/syncthing/syncthing/git/refs{/sha}","trees_url":"https://api.github.com/repos/syncthing/syncthing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/syncthing/syncthing/statuses/{sha}","languages_url":"https://api.github.com/repos/syncthing/syncthing/languages","stargazers_url":"https://api.github.com/repos/syncthing/syncthing/stargazers","contributors_url":"https://api.github.com/repos/syncthing/syncthing/contributors","subscribers_url":"https://api.github.com/repos/syncthing/syncthing/subscribers","subscription_url":"https://api.github.com/repos/syncthing/syncthing/subscription","commits_url":"https://api.github.com/repos/syncthing/syncthing/commits{/sha}","git_commits_url":"https://api.github.com/repos/syncthing/syncthing/git/commits{/sha}","comments_url":"https://api.github.com/repos/syncthing/syncthing/comments{/number}","issue_comment_url":"https://api.github.com/repos/syncthing/syncthing/issues/comments/{number}","contents_url":"https://api.github.com/repos/syncthing/syncthing/contents/{+path}","compare_url":"https://api.github.com/repos/syncthing/syncthing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/syncthing/syncthing/merges","archive_url":"https://api.github.com/repos/syncthing/syncthing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/syncthing/syncthing/downloads","issues_url":"https://api.github.com/repos/syncthing/syncthing/issues{/number}","pulls_url":"https://api.github.com/repos/syncthing/syncthing/pulls{/number}","milestones_url":"https://api.github.com/repos/syncthing/syncthing/milestones{/number}","notifications_url":"https://api.github.com/repos/syncthing/syncthing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/syncthing/syncthing/labels{/name}","releases_url":"https://api.github.com/repos/syncthing/syncthing/releases{/id}","created_at":"2013-11-26T09:48:21Z","updated_at":"2014-09-21T20:28:16Z","pushed_at":"2014-09-21T18:01:47Z","git_url":"git://github.com/syncthing/syncthing.git","ssh_url":"git@github.com:syncthing/syncthing.git","clone_url":"https://github.com/syncthing/syncthing.git","svn_url":"https://github.com/syncthing/syncthing","homepage":"http://discourse.syncthing.net/","size":39961,"stargazers_count":4718,"watchers_count":4718,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":270,"mirror_url":null,"open_issues_count":83,"forks":270,"open_issues":83,"watchers":4718,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/723"},"html":{"href":"https://github.com/syncthing/syncthing/pull/723"},"issue":{"href":"https://api.github.com/repos/syncthing/syncthing/issues/723"},"comments":{"href":"https://api.github.com/repos/syncthing/syncthing/issues/723/comments"},"review_comments":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/723/comments"},"review_comment":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/723/commits"},"statuses":{"href":"https://api.github.com/repos/syncthing/syncthing/statuses/beccdd8dde639941cf700b04261064f18ecac81d"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":7,"additions":189,"deletions":0,"changed_files":1}}