Permalink
Browse files

Merge branch 'hotfix/648372'

  • Loading branch information...
jrburke committed Apr 12, 2011
2 parents 6efdcda + c7c80f3 commit caf4a063cee413a73763579b989432bb5801cfd9
Showing with 22,036 additions and 90 deletions.
  1. +15 −12 linkdrop/lib/oauth/facebook_.py
  2. +56 −50 linkdrop/lib/oauth/linkedin_.py
  3. +9 −5 linkdrop/lib/oauth/twitter_.py
  4. +2 −2 production.ini
  5. +1 −1 setup.py
  6. +2 −2 staging.ini
  7. +323 −0 web/0.3.6/auth.html
  8. +8 −0 web/0.3.6/blank.html
  9. +10 −0 web/0.3.6/build.js
  10. BIN web/0.3.6/favicon.ico
  11. BIN web/0.3.6/favicon.png
  12. BIN web/0.3.6/i/LinkedIn_Logo16px.png
  13. BIN web/0.3.6/i/check.png
  14. BIN web/0.3.6/i/cornerBottomLeft.png
  15. BIN web/0.3.6/i/cornerBottomRight.png
  16. BIN web/0.3.6/i/cornerTopLeft.png
  17. BIN web/0.3.6/i/cornerTopRight.png
  18. BIN web/0.3.6/i/f1Icon.png
  19. BIN web/0.3.6/i/f1Logo.png
  20. BIN web/0.3.6/i/f1LogoVert.png
  21. BIN web/0.3.6/i/facebookIcon.png
  22. BIN web/0.3.6/i/fancybox/blank.gif
  23. BIN web/0.3.6/i/fancybox/fancy_close.png
  24. BIN web/0.3.6/i/fancybox/fancy_loading.png
  25. BIN web/0.3.6/i/fancybox/fancy_nav_left.png
  26. BIN web/0.3.6/i/fancybox/fancy_nav_right.png
  27. BIN web/0.3.6/i/fancybox/fancy_shadow_e.png
  28. BIN web/0.3.6/i/fancybox/fancy_shadow_n.png
  29. BIN web/0.3.6/i/fancybox/fancy_shadow_ne.png
  30. BIN web/0.3.6/i/fancybox/fancy_shadow_nw.png
  31. BIN web/0.3.6/i/fancybox/fancy_shadow_s.png
  32. BIN web/0.3.6/i/fancybox/fancy_shadow_se.png
  33. BIN web/0.3.6/i/fancybox/fancy_shadow_sw.png
  34. BIN web/0.3.6/i/fancybox/fancy_shadow_w.png
  35. BIN web/0.3.6/i/fancybox/fancy_title_left.png
  36. BIN web/0.3.6/i/fancybox/fancy_title_main.png
  37. BIN web/0.3.6/i/fancybox/fancy_title_over.png
  38. BIN web/0.3.6/i/fancybox/fancy_title_right.png
  39. BIN web/0.3.6/i/fancybox/fancybox-x.png
  40. BIN web/0.3.6/i/fancybox/fancybox-y.png
  41. BIN web/0.3.6/i/fancybox/fancybox.png
  42. BIN web/0.3.6/i/gmailIcon.png
  43. BIN web/0.3.6/i/loader-w.gif
  44. BIN web/0.3.6/i/panel/f1accounts.png
  45. BIN web/0.3.6/i/panel/f1panel.png
  46. BIN web/0.3.6/i/panel/step-01.png
  47. BIN web/0.3.6/i/panel/step-02.png
  48. BIN web/0.3.6/i/panel/step-022.png
  49. BIN web/0.3.6/i/panel/step-03.png
  50. BIN web/0.3.6/i/screenshot_01.png
  51. BIN web/0.3.6/i/shareIcon.png
  52. BIN web/0.3.6/i/sprite.png
  53. BIN web/0.3.6/i/step-01.png
  54. BIN web/0.3.6/i/step-02.png
  55. BIN web/0.3.6/i/step-03.png
  56. BIN web/0.3.6/i/toolbar-button.png
  57. BIN web/0.3.6/i/twitterIcon.png
  58. +172 −0 web/0.3.6/index.html
  59. +32 −0 web/0.3.6/index.js
  60. +359 −0 web/0.3.6/jquery.fancybox-1.3.4.css
  61. +57 −0 web/0.3.6/play/ac.html
  62. BIN web/0.3.6/play/designs/i/background.gif
  63. BIN web/0.3.6/play/designs/i/bryanAvatar.jpg
  64. BIN web/0.3.6/play/designs/i/linkdropiconfaded.png
  65. BIN web/0.3.6/play/designs/i/settings.png
  66. +581 −0 web/0.3.6/play/designs/nativeShare.css
  67. +112 −0 web/0.3.6/play/designs/nativeShare.html
  68. +630 −0 web/0.3.6/play/designs/neutralShare.css
  69. +120 −0 web/0.3.6/play/designs/neutralShare.html
  70. +568 −0 web/0.3.6/play/designs/share.css
  71. +113 −0 web/0.3.6/play/designs/share.html
  72. BIN web/0.3.6/play/designs/sidebar/i/sprite.png
  73. BIN web/0.3.6/play/designs/sidebar/i/thumb.jpg
  74. +231 −0 web/0.3.6/play/designs/sidebar/index.html
  75. +103 −0 web/0.3.6/play/designs/sidebar/js/init.js
  76. +108 −0 web/0.3.6/play/designs/sidebar/js/jquery.textOverflow.js
  77. +625 −0 web/0.3.6/play/designs/sidebar/style.css
  78. +152 −0 web/0.3.6/play/scratch/send/index.html
  79. +481 −0 web/0.3.6/rdapi/f/StayPuft/COPYING.LIB
  80. +35 −0 web/0.3.6/rdapi/f/StayPuft/README.txt
  81. BIN web/0.3.6/rdapi/f/StayPuft/StayPuft.ttf
  82. BIN web/0.3.6/rdapi/i/2709984325_f5554afd53_o2.jpeg
  83. +402 −0 web/0.3.6/rdapi/index.css
  84. +240 −0 web/0.3.6/rdapi/index.html
  85. +504 −0 web/0.3.6/rdapi/scripts/index.js
  86. +2 −0 web/0.3.6/robots.txt
  87. +241 −0 web/0.3.6/scripts/AutoComplete.js
  88. +1 −0 web/0.3.6/scripts/AutoCompleteRefresh.html
  89. +251 −0 web/0.3.6/scripts/Contacts.js
  90. +133 −0 web/0.3.6/scripts/ContactsEmail.js
  91. +61 −0 web/0.3.6/scripts/ContactsTwitter.js
  92. +83 −0 web/0.3.6/scripts/Select.css
  93. +9 −0 web/0.3.6/scripts/Select.html
  94. +206 −0 web/0.3.6/scripts/Select.js
  95. +67 −0 web/0.3.6/scripts/TextCounter.js
  96. +404 −0 web/0.3.6/scripts/accounts.js
  97. +147 −0 web/0.3.6/scripts/blade/Widget.js
  98. +38 −0 web/0.3.6/scripts/blade/array.js
  99. +96 −0 web/0.3.6/scripts/blade/defer.js
  100. +227 −0 web/0.3.6/scripts/blade/dispatch.js
  101. +58 −0 web/0.3.6/scripts/blade/fn.js
  102. +858 −0 web/0.3.6/scripts/blade/jig.js
  103. +128 −0 web/0.3.6/scripts/blade/object.js
  104. +101 −0 web/0.3.6/scripts/blade/url.js
  105. +173 −0 web/0.3.6/scripts/cards.js
  106. +81 −0 web/0.3.6/scripts/dispatch.js
  107. +61 −0 web/0.3.6/scripts/dotCompare.js
  108. +174 −0 web/0.3.6/scripts/fancyzoom.js
  109. +128 −0 web/0.3.6/scripts/friendly.js
  110. +65 −0 web/0.3.6/scripts/hashDispatch.js
  111. +1 −0 web/0.3.6/scripts/iscroll-min.js
  112. +172 −0 web/0.3.6/scripts/isoDate.js
  113. +68 −0 web/0.3.6/scripts/jquery-ui-1.8.6.custom.min.js
  114. +404 −0 web/0.3.6/scripts/jquery-ui-1.8.7.min.js
  115. +123 −0 web/0.3.6/scripts/jquery.colorFade.js
  116. +91 −0 web/0.3.6/scripts/jquery.cookie.js
  117. +205 −0 web/0.3.6/scripts/jquery.easing.1.3.js
  118. +1,156 −0 web/0.3.6/scripts/jquery.fancybox-1.3.4.js
  119. +308 −0 web/0.3.6/scripts/jquery.masonry.js
  120. +108 −0 web/0.3.6/scripts/jquery.textOverflow.js
  121. +486 −0 web/0.3.6/scripts/jquery.tmpl.js
  122. +334 −0 web/0.3.6/scripts/jquery.vgrid.0.1.5.js
  123. +2 −0 web/0.3.6/scripts/jqueryStub.js
  124. +7 −0 web/0.3.6/scripts/json2.js
  125. +381 −0 web/0.3.6/scripts/md5.js
  126. +94 −0 web/0.3.6/scripts/oauth.js
  127. +104 −0 web/0.3.6/scripts/placeholder.js
  128. +277 −0 web/0.3.6/scripts/protovis/protovis-r3.2.js
  129. +244 −0 web/0.3.6/scripts/rdapi.js
  130. +214 −0 web/0.3.6/scripts/requireplugins-jquery.js
  131. +71 −0 web/0.3.6/scripts/rssFeed.js
  132. +290 −0 web/0.3.6/scripts/services.js
  133. +109 −0 web/0.3.6/scripts/shareOptions.js
  134. +52 −0 web/0.3.6/scripts/storage.js
  135. +8 −0 web/0.3.6/scripts/templates/cardsHeader.html
  136. +741 −0 web/0.3.6/scripts/webtrends.js
  137. +112 −0 web/0.3.6/service/down.html
  138. BIN web/0.3.6/service/favicon.png
  139. BIN web/0.3.6/service/i/f1Logo.png
  140. +94 −0 web/0.3.6/service/privacy.html
  141. +26 −0 web/0.3.6/service/style.css
  142. +10 −0 web/0.3.6/settings/build.js
  143. BIN web/0.3.6/settings/i/LinkedIn_Logo16px.png
  144. BIN web/0.3.6/settings/i/f1Logo.png
  145. BIN web/0.3.6/settings/i/sprite.png
  146. BIN web/0.3.6/settings/i/thumb.jpg
  147. +173 −0 web/0.3.6/settings/index.html
  148. +99 −0 web/0.3.6/settings/index.js
  149. +558 −0 web/0.3.6/settings/style.css
  150. +10 −0 web/0.3.6/share/build.js
  151. BIN web/0.3.6/share/i/LinkedIn_Logo16px.png
  152. BIN web/0.3.6/share/i/bug_b.png
  153. BIN web/0.3.6/share/i/bug_w.png
  154. BIN web/0.3.6/share/i/f1-icon-grey.png
  155. BIN web/0.3.6/share/i/face2.png
  156. BIN web/0.3.6/share/i/loader.gif
  157. BIN web/0.3.6/share/i/sprite.png
  158. +226 −0 web/0.3.6/share/index.html
  159. +139 −0 web/0.3.6/share/index.js
  160. +12 −0 web/0.3.6/share/panel/build.js
  161. BIN web/0.3.6/share/panel/i/sprite.png
  162. BIN web/0.3.6/share/panel/i/thumb.jpg
  163. +208 −0 web/0.3.6/share/panel/index.html
  164. +541 −0 web/0.3.6/share/panel/index.js
  165. +108 −0 web/0.3.6/share/panel/js/jquery.textOverflow.js
  166. +69 −0 web/0.3.6/share/panel/scripts/widgets/AccountPanel.html
  167. +506 −0 web/0.3.6/share/panel/scripts/widgets/AccountPanel.js
  168. +58 −0 web/0.3.6/share/panel/scripts/widgets/AccountPanelFaceBook.js
  169. +47 −0 web/0.3.6/share/panel/scripts/widgets/AccountPanelLinkedIn.js
  170. +19 −0 web/0.3.6/share/panel/scripts/widgets/DebugPanel.html
  171. +37 −0 web/0.3.6/share/panel/scripts/widgets/DebugPanel.js
  172. +13 −0 web/0.3.6/share/panel/scripts/widgets/PageInfo.html
  173. +78 −0 web/0.3.6/share/panel/scripts/widgets/PageInfo.js
  174. +81 −0 web/0.3.6/share/panel/scripts/widgets/jigFuncs.js
  175. +1,105 −0 web/0.3.6/share/panel/style.css
  176. +1,038 −0 web/0.3.6/share/share.css
  177. +82 −0 web/0.3.6/share/testframe.html
  178. +48 −0 web/0.3.6/stats/index.html
  179. +180 −0 web/0.3.6/stats/index.js
  180. +339 −0 web/0.3.6/style.css
  181. +13 −5 web/dev/scripts/Contacts.js
  182. +9 −10 web/dev/scripts/services.js
  183. +7 −0 web/dev/share/panel/scripts/widgets/AccountPanel.html
  184. +74 −3 web/dev/share/panel/scripts/widgets/AccountPanel.js
  185. +23 −0 web/dev/share/panel/style.css
@@ -65,7 +65,7 @@ def extract_fb_data(data):
#import sys; print >> sys.stderr, data
# Setup the normalized poco contact object
nick = None
-
+
# Setup the nick and preferred username to the last portion of the
# FB link URL if its not their ID
# if a user sets up their personal link, they get a url that looks like:
@@ -114,9 +114,9 @@ def extract_fb_data(data):
if part:
name[val] = part
name['formatted'] = data.get('name')
-
+
profile['name'] = name
-
+
# facebook gives us an absolute url, these work and redirect to their CDN
profile['photos'] = [
{'type':"thumbnail", 'value':"https://graph.facebook.com/" + data['id'] + "/picture?type=square"},
@@ -127,7 +127,7 @@ def extract_fb_data(data):
for k, v in profile.items():
if not v or (isinstance(v, list) and not v[0]):
del profile[k]
-
+
return profile
@@ -149,17 +149,17 @@ def _get_credentials(self, access_token):
raise Exception("Error status: %r", resp['status'])
fb_profile = json.loads(content)
-
+
profile = extract_fb_data(fb_profile)
result_data = {'profile': profile,
'oauth_token': access_token}
-
+
return result_data
class api():
def __init__(self, account):
self.access_token = account.get('oauth_token')
-
+
def _make_error(self, data, resp):
# Facebook makes error handling fun! So much for standards.
# handle the various error mechanisms they deliver and hope
@@ -199,7 +199,7 @@ def _make_error(self, data, resp):
error = {
'message': data.get('error_msg', 'it\'s an error, kthx'),
}
- # who knows, some other abberation
+ # who knows, some other abberation
else:
error = {
'message': "expectedly, an unexpected facebook error: %r"% (data,),
@@ -253,11 +253,14 @@ def rawcall(self, url, body=None, method="GET"):
'source': 'source'
}
def sendmessage(self, message, options={}):
- # Comment out for now direct = options.get('to', None)
share_type = options.get('shareType', None)
if share_type == 'groupWall':
- raise Exception("NOT IMPLEMENTED")
- # url = "https://graph.facebook.com/%s/feed" % (direct,)
+ direct = options.get('to', None)
+ if not direct:
+ return None, {'code': 400,
+ 'provider': domain,
+ 'message': 'Wall name is missing'}
+ url = "https://graph.facebook.com/%s/feed" % (direct,)
else:
url = config.get("oauth.facebook.com.feed", "https://graph.facebook.com/me/feed")
body = {
@@ -276,7 +279,7 @@ def getcontacts(self, start=0, page=25, group=None):
result, error = self.rawcall(url)
if error:
return result, error
-
+
groups = []
for group in result['data']:
groups.append({
@@ -64,7 +64,7 @@ def _get_credentials(self, access_token):
li_profile = json.loads(content)
profile = extract_li_data(li_profile)
result_data = {'profile': profile,
- 'oauth_token': access_token['oauth_token'],
+ 'oauth_token': access_token['oauth_token'],
'oauth_token_secret': access_token['oauth_token_secret']}
return result_data
@@ -90,11 +90,11 @@ def rawcall(self, url, body=None, method="GET"):
oauth_request.sign_request(self.sigmethod, self.consumer, self.oauth_token)
headers = oauth_request.to_header()
headers['x-li-format'] = 'json'
-
+
body = json.dumps(body)
headers['Content-type'] = 'application/json'
headers['Content-Length'] = str(len(body))
-
+
resp, content = httplib2.Http.request(client, url, method=method, headers=headers, body=body)
data = content and json.loads(content) or resp
@@ -109,14 +109,16 @@ def rawcall(self, url, body=None, method="GET"):
return result, error
def sendmessage(self, message, options={}):
-
- share_type = options.get('shareType', None)
- if share_type == 'contact':
- raise Exception("NOT IMPLEMENTED")
+ share_type = str(options.get('shareType', ''))
# TODO: this needs a bit work, it is not really "direct".
- direct = options.get('to', 'anyone')
- if direct in ('anyone', 'connections-only'):
+ if share_type in ('public', 'myConnections'):
+ direct = options.get('to', 'anyone')
+ if (share_type == 'public' and direct != 'anyone') or \
+ (share_type == 'myConnections' and direct != 'connections-only'):
+ return None, {'code': 400,
+ 'provider': 'linkedin',
+ 'message': 'Incorrect addressing for post'}
url = "http://api.linkedin.com/v1/people/~/shares"
body = {
"comment": message,
@@ -131,47 +133,50 @@ def sendmessage(self, message, options={}):
}
}
else:
- raise Exception("NOT IMPLEMENTED")
# we have to do a direct message, different api
- #url = "http://api.linkedin.com/v1/people/~/mailbox"
- #
- #profile = self.account.get('profile', {})
- #from_email = from_ = profile.get('verifiedEmail')
- #fullname = profile.get('displayName', None)
- #
- #to_addrs = AddressList(options['to'])
- #subject = options.get('subject', config.get('share_subject', 'A web link has been shared with you'))
- #title = options.get('title', options.get('link', options.get('shorturl', '')))
- #description = options.get('description', '')[:280]
- #
- #to_ = []
- #for a in to_addrs.addresslist:
- # to_.append({'person': {'_path': '/people/'+a[1] }})
- #
- #c.safeHTML = safeHTML
- #c.options = options
- #
- ## insert the url if it is not already in the message
- #c.longurl = options.get('link')
- #c.shorturl = options.get('shorturl')
- #
- ## get the title, or the long url or the short url or nothing
- ## wrap these in literal for text email
- #c.from_name = literal(fullname)
- #c.subject = literal(subject)
- #c.from_header = literal(from_)
- #c.to_header = literal(to_)
- #c.title = literal(title)
- #c.description = literal(description)
- #c.message = literal(message)
- #
- #text_message = render('/text_email.mako').encode('utf-8')
- #
- #body = {
- # 'recipients': {'values': to_},
- # 'subject': subject,
- # 'body': text_message
- #}
+ url = "http://api.linkedin.com/v1/people/~/mailbox"
+
+ profile = self.account.get('profile', {})
+ from_email = from_ = profile.get('verifiedEmail')
+ fullname = profile.get('displayName', None)
+
+ to_addrs = AddressList(options['to'])
+ subject = options.get('subject', config.get('share_subject', 'A web link has been shared with you'))
+ title = options.get('title', options.get('link', options.get('shorturl', '')))
+ description = options.get('description', '')[:280]
+
+ to_ = []
+ ids = [a[1] for a in to_addrs.addresslist]
+ if not ids:
+ return None, {'code': 400,
+ 'message': 'Missing contacts for direct messaging.'}
+ for id in ids:
+ to_.append({'person': {'_path': '/people/' + id}})
+
+ c.safeHTML = safeHTML
+ c.options = options
+
+ # insert the url if it is not already in the message
+ c.longurl = options.get('link')
+ c.shorturl = options.get('shorturl')
+
+ # get the title, or the long url or the short url or nothing
+ # wrap these in literal for text email
+ c.from_name = literal(fullname)
+ c.subject = literal(subject)
+ c.from_header = literal(from_)
+ c.to_header = literal(to_)
+ c.title = literal(title)
+ c.description = literal(description)
+ c.message = literal(message)
+
+ text_message = render('/text_email.mako').encode('utf-8')
+
+ body = {
+ 'recipients': {'values': to_},
+ 'subject': subject,
+ 'body': text_message
+ }
return self.rawcall(url, body, method="POST")
def getcontacts(self, start=0, page=25, group=None):
@@ -190,7 +195,7 @@ def getcontacts(self, start=0, page=25, group=None):
contacts = []
for entry in entries:
contacts.append(extract_li_data(entry))
-
+
connectedto = {
'entry': contacts,
'itemsPerPage': result.get('_count', result.get('_total', 0)),
@@ -199,3 +204,4 @@ def getcontacts(self, start=0, page=25, group=None):
}
return connectedto, error
+
@@ -113,7 +113,7 @@ def _get_credentials(self, access_token):
profile['accounts'] = [account]
result_data = {'profile': profile,
- 'oauth_token': access_token['oauth_token'],
+ 'oauth_token': access_token['oauth_token'],
'oauth_token_secret': access_token['oauth_token_secret']}
result, error = api(oauth_token=access_token['oauth_token'],
oauth_token_secret=access_token['oauth_token_secret']).profile()
@@ -186,10 +186,14 @@ def sendmessage(self, message, options={}):
# some reason we dont have a short url, add the long url
message += " %s" % longurl
- # Comment out direct = options.get('to', None)
if share_type == 'direct':
- raise Exception("NOT IMPLEMENTED")
- # result = self.api().direct_messages.new(text=message, user=direct)
+ direct = options.get('to', None)
+ if not direct:
+ return None, \
+ {'code': 400,
+ 'provider': domain,
+ 'message': 'Missing addressee for direct message'}
+ result = self.api().direct_messages.new(text=message, user=direct)
else:
result = self.api().statuses.update(status=message)
result[domain] = result['id']
@@ -202,7 +206,7 @@ def sendmessage(self, message, options={}):
'message': e.args[0]
}
return result, error
-
+
def profile(self):
result = error = None
try:
View
@@ -11,8 +11,8 @@ import = %(here)s/private.ini
smtp_server = localhost
error_email_from = paste@localhost
-oauth_failure = /0.3.5/auth.html#oauth_failure
-oauth_success = /0.3.5/auth.html#oauth_success
+oauth_failure = /0.3.6/auth.html#oauth_failure
+oauth_success = /0.3.6/auth.html#oauth_success
# Register with twitter at http://dev.twitter.com/apps/new
oauth.twitter.com.request = https://twitter.com/oauth/request_token
View
@@ -28,7 +28,7 @@
use_setuptools()
from setuptools import setup, find_packages
-VERSION='0.3.5'
+VERSION='0.3.6'
setup(
name='linkdrop',
View
@@ -11,8 +11,8 @@ import = %(here)s/private.ini
smtp_server = localhost
error_email_from = paste@localhost
-oauth_failure = /0.3.5/auth.html#oauth_failure
-oauth_success = /0.3.5/auth.html#oauth_success
+oauth_failure = /0.3.6/auth.html#oauth_failure
+oauth_success = /0.3.6/auth.html#oauth_success
# Register with twitter at http://dev.twitter.com/apps/new
oauth.twitter.com.request = https://twitter.com/oauth/request_token
Oops, something went wrong.

0 comments on commit caf4a06

Please sign in to comment.