{"issue":{"milestone":null,"user":{"id":399496,"login":"smurthas","url":"https://api.github.com/users/smurthas","avatar_url":"https://secure.gravatar.com/avatar/c0ffbda2aaf58c66407e55f9091acde8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c0ffbda2aaf58c66407e55f9091acde8"},"title":"Synclet Auth Cleanup","created_at":"2011-12-19T00:36:46Z","updated_at":"2011-12-19T05:35:07Z","labels":[],"state":"open","id":2595923,"pull_request":{"patch_url":"https://github.com/LockerProject/Locker/pull/510.patch","html_url":"https://github.com/LockerProject/Locker/pull/510","diff_url":"https://github.com/LockerProject/Locker/pull/510.diff"},"html_url":"https://github.com/LockerProject/Locker/issues/510","closed_at":null,"body":"There are few goals of this work:\r\n\r\n0. Make it easier to build a synclet -- de-obfuscate things as much as possible!!!\r\n1. Move all the synclet-specfic auth code into the synclet dir itself such that:\r\n    * Creating a new synclet doesn't require making changes to core files\r\n    * Synclets become more package-like -- could be pulled in from a registry, etc.\r\n\r\nThere was lots of synclet-specific code in ```Ops/webservice-synclets-auth.js``` and ```lsyncmanager.js``` -- that all got moved to ```auth.js``` files in the synclet dirs, which get required into those two files. They can specify oauth2 settings, in which case they will use common code, or simply drop out and specify their own handler function (ala twitter, tumblr, and flickr, which each use their own cute variant of oauth 1). This felt like a good balance between abstraction and flexibility. From here on out, any service using oauth 2 should require no auth code and at all, and (in theory!) no new synclets should require changes core code -- woooo!\r\n\r\n\r\nSince there were some naming clashes, I ended up removing old connector code for Flickr, GoogleContacts, and Twitter. That feels like a step forward to me (the code was dead and confusing), but if that is a concern, it is easy to change and bring back -- I don't want these improvements to get held up as a result of something like that.\r\n","number":510,"url":"https://api.github.com/repos/LockerProject/Locker/issues/510","comments":1,"assignee":null},"comment":{"user":{"id":61632,"login":"quartzjer","url":"https://api.github.com/users/quartzjer","avatar_url":"https://secure.gravatar.com/avatar/37f35d1f68254e700446b361d3c61782?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"37f35d1f68254e700446b361d3c61782"},"created_at":"2011-12-19T05:35:07Z","updated_at":"2011-12-19T05:35:07Z","id":3199493,"body":"OMFG, you beat me to it! I love you!!!\r\n\r\nOn Dec 18, 2011, at 6:36 PM, Simon Murtha-Smith<reply@reply.github.com> wrote:\r\n\r\n> There are few goals of this work:\r\n> \r\n> 0. Make it easier to build a synclet -- de-obfuscate things as much as possible!!!\r\n> 1. Move all the synclet-specfic auth code into the synclet dir itself such that:\r\n>    * Creating a new synclet doesn't require making changes to core files\r\n>    * Synclets become more package-like -- could be pulled in from a registry, etc.\r\n> \r\n> There was lots of synclet-specific code in ```Ops/webservice-synclets-auth.js``` and ```lsyncmanager.js``` -- that all got moved to ```auth.js``` files in the synclet dirs, which get required into those two files. They can specify oauth2 settings, in which case they will use common code, or simply drop out and specify their own handler function (ala twitter, tumblr, and flickr, which each use their own cute variant of oauth 1). This felt like a good balance between abstraction and flexibility. From here on out, any service using oauth 2 should require no auth code and at all, and (in theory!) no new synclets should require changes core code -- woooo!\r\n> \r\n> \r\n> Since there were some naming clashes, I ended up removing old connector code for Flickr, GoogleContacts, and Twitter. That feels like a step forward to me (the code was dead and confusing), but if that is a concern, it is easy to change and bring back -- I don't want these improvements to get held up as a result of something like that.\r\n> \r\n> \r\n> You can merge this Pull Request by running:\r\n> \r\n>  git pull https://github.com/smurthas/Locker synclet-reorg\r\n> \r\n> Or you can view, comment on it, or merge it online at:\r\n> \r\n>  https://github.com/LockerProject/Locker/pull/510\r\n> \r\n> -- Commit Summary --\r\n> \r\n> * first pass at reorg, synclet auth config and logic lives with the synclets now. Core code is as generic as possible - a few more things to deal with, but 95 percent there. All tests passing.\r\n> * further cleanup. all code in lsyncmanager and Ops/webservice-synclets-auth is now common and provides simple hooks and config settings for authentication. It can still get a bit better though!\r\n> * sane error messages if no apikeys file. removed duplicate requires in Ops/webservice.js. bug fix is webservice-synclets-auth\r\n> * reverting a few migration-requiring changes to Twitter and Tumblr that arent really needed\r\n> * reverting a debug change to the testing config\r\n> \r\n> -- File Changes --\r\n> \r\n> M Common/node/lsyncmanager.js (57)\r\n> A Connectors/Facebook/auth.js (6)\r\n> A Connectors/Flickr/auth.js (17)\r\n> D Connectors/Flickr/client.js (351)\r\n> D Connectors/Flickr/flickr.connector (9)\r\n> A Connectors/GitHub/auth.js (21)\r\n> M Connectors/GoogleContacts/auth.js (133)\r\n> D Connectors/GoogleContacts/googleContacts.connector (10)\r\n> D Connectors/GoogleContacts/init.js (25)\r\n> D Connectors/GoogleContacts/migrations/1309052824000.js (14)\r\n> D Connectors/GoogleContacts/sync-api.js (60)\r\n> D Connectors/GoogleContacts/sync.js (257)\r\n> M Connectors/GoogleLatitude/GoogleLatitude.synclet (3)\r\n> A Connectors/GoogleLatitude/auth.js (6)\r\n> A Connectors/GooglePlus/auth.js (6)\r\n> A Connectors/Instagram/auth.js (6)\r\n> A Connectors/Tumblr/auth.js (14)\r\n> M Connectors/Twitter/auth.js (136)\r\n> D Connectors/Twitter/init.js (3)\r\n> D Connectors/Twitter/migrations/1309052824000.js (14)\r\n> D Connectors/Twitter/sync-api.js (201)\r\n> D Connectors/Twitter/sync.js (405)\r\n> D Connectors/Twitter/twitter.connector (12)\r\n> A Connectors/foursquare/auth.js (6)\r\n> M Ops/webservice-synclets-auth.js (236)\r\n> M Ops/webservice.js (11)\r\n> M _lockerd.js (12)\r\n> M tests/Config/config.json (2)\r\n> D tests/Data.tests/9fdfb7e5c6551dc45300aeb0d21fdff4/auth.json (1)\r\n> D tests/Data.tests/9fdfb7e5c6551dc45300aeb0d21fdff4/me.json (1)\r\n> A tests/Tests/testSynclet/auth.js (1)\r\n> M tests/lservicemanager-test-local.js (12)\r\n> \r\n> -- Patch Links --\r\n> \r\n>  https://github.com/LockerProject/Locker/pull/510.patch\r\n>  https://github.com/LockerProject/Locker/pull/510.diff\r\n> \r\n> --- \r\n> Reply to this email directly or view it on GitHub:\r\n> https://github.com/LockerProject/Locker/pull/510","url":"https://api.github.com/repos/LockerProject/Locker/issues/comments/3199493"},"action":"created"}