Merge lp:~mardy/account-plugins/vkontakte-1564883 into lp:account-plugins

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
Approved revision: 156
Merged at revision: 158
Proposed branch: lp:~mardy/account-plugins/vkontakte-1564883
Merge into: lp:account-plugins
Diff against target: 189 lines (+92/-2)
9 files modified
.bzrignore (+1/-0)
Makefile.am (+6/-0)
configure.ac (+9/-0)
data/providers/vk.provider.in.in (+26/-0)
debian/account-plugin-vk.install (+3/-0)
debian/control (+7/-0)
debian/rules (+2/-1)
qml/Makefile.am (+2/-1)
qml/vk/Main.qml (+36/-0)
To merge this branch: bzr merge lp:~mardy/account-plugins/vkontakte-1564883
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Online Accounts Pending
Review via email: mp+291359@code.launchpad.net

Commit message

Add account plugin for vk.com

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-03-19 08:52:34 +0000
3+++ .bzrignore 2016-04-08 12:10:34 +0000
4@@ -31,6 +31,7 @@
5 /debian/account-plugin-sohu/
6 /debian/account-plugin-tools/
7 /debian/account-plugin-twitter/
8+/debian/account-plugin-vk/
9 /debian/account-plugin-windows-live/
10 /debian/autoreconf.after
11 /debian/autoreconf.before
12
13=== modified file 'Makefile.am'
14--- Makefile.am 2015-04-17 08:53:11 +0000
15+++ Makefile.am 2016-04-08 12:10:34 +0000
16@@ -69,6 +69,7 @@
17 data/providers/sina.provider.in.in \
18 data/providers/sohu.provider.in.in \
19 data/providers/twitter.provider.in.in \
20+ data/providers/vk.provider.in.in \
21 data/providers/windows-live.provider.in.in
22
23 providers_DATA = \
24@@ -112,6 +113,11 @@
25 data/webkit-options/www.facebook.com.conf \
26 data/webkit-options/www.linkedin.com.conf
27
28+# Temporary until https://bugs.launchpad.net/bugs/1567908 is fixed
29+iconsdir = $(datadir)/icons/hicolor/32x32/apps
30+dist_icons_DATA = \
31+ data/icons/vk.png
32+
33 dist_bin_SCRIPTS = \
34 tools/account-console
35
36
37=== modified file 'configure.ac'
38--- configure.ac 2014-09-11 10:07:28 +0000
39+++ configure.ac 2016-04-08 12:10:34 +0000
40@@ -225,6 +225,14 @@
41 AC_SUBST(SOHU_CLIENT_ID, ["$sohu_client_id"])
42 AC_SUBST(SOHU_CLIENT_SECRET, ["$sohu_client_secret"])
43
44+# Set VK client id
45+AC_ARG_WITH(vk-client-id,
46+ [AS_HELP_STRING([--with-vk-client-id],
47+ [VK client ID])],
48+ [vk_client_id=$withval],
49+ [vk_client_id="5404010"])
50+AC_SUBST(VK_CLIENT_ID, ["$vk_client_id"])
51+
52 # Set Windows Live client id
53 AC_ARG_WITH(windows-live-client-id,
54 [AS_HELP_STRING([--with-windows-live-client-id],
55@@ -244,6 +252,7 @@
56 data/providers/sina.provider.in
57 data/providers/sohu.provider.in
58 data/providers/twitter.provider.in
59+ data/providers/vk.provider.in
60 data/providers/windows-live.provider.in
61 Makefile
62 po/Makefile.in
63
64=== added directory 'data/icons'
65=== added file 'data/icons/vk.png'
66Binary files data/icons/vk.png 1970-01-01 00:00:00 +0000 and data/icons/vk.png 2016-04-08 12:10:34 +0000 differ
67=== added file 'data/providers/vk.provider.in.in'
68--- data/providers/vk.provider.in.in 1970-01-01 00:00:00 +0000
69+++ data/providers/vk.provider.in.in 2016-04-08 12:10:34 +0000
70@@ -0,0 +1,26 @@
71+<?xml version="1.0" encoding="UTF-8"?>
72+<provider id="vk">
73+ <name>VKontakte</name>
74+ <icon>vk</icon>
75+ <translations>account-plugins</translations>
76+ <domains>.*vk\.com</domains>
77+
78+ <template>
79+ <group name="auth">
80+ <setting name="method">oauth2</setting>
81+ <setting name="mechanism">user_agent</setting>
82+ <group name="oauth2">
83+ <group name="user_agent">
84+ <setting name="Host">oauth.vk.com</setting>
85+ <setting name="AuthPath">authorize</setting>
86+ <setting name="TokenPath">access_token</setting>
87+ <setting name="RedirectUri">https://oauth.vk.com/blank.html</setting>
88+ <setting name="ResponseType">token</setting>
89+ <setting name="ClientId">@VK_CLIENT_ID@</setting>
90+ <setting type="as" name="Scope">['offline']</setting>
91+ <setting type="s" name="v">5.50</setting>
92+ </group>
93+ </group>
94+ </group>
95+ </template>
96+</provider>
97
98=== added file 'debian/account-plugin-vk.install'
99--- debian/account-plugin-vk.install 1970-01-01 00:00:00 +0000
100+++ debian/account-plugin-vk.install 2016-04-08 12:10:34 +0000
101@@ -0,0 +1,3 @@
102+usr/share/accounts/providers/vk.provider
103+usr/share/accounts/qml-plugins/vk/Main.qml
104+usr/share/icons/hicolor/32x32/apps/vk.png
105
106=== modified file 'debian/control'
107--- debian/control 2015-07-23 14:10:26 +0000
108+++ debian/control 2016-04-08 12:10:34 +0000
109@@ -121,6 +121,13 @@
110 Description: GNOME Control Center account plugin for single signon - Instagram
111 GNOME Control Center account plugins for single signon
112
113+Package: account-plugin-vk
114+Architecture: all
115+Depends: ${misc:Depends},
116+ libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts,
117+Description: GNOME Control Center account plugin for single signon - VKontakte
118+ GNOME Control Center account plugins for single signon
119+
120 Package: account-plugin-tools
121 Architecture: all
122 Depends: ${misc:Depends},
123
124=== modified file 'debian/rules'
125--- debian/rules 2015-07-23 14:10:26 +0000
126+++ debian/rules 2016-04-08 12:10:34 +0000
127@@ -21,7 +21,8 @@
128 --with-linkedin-consumer-key="34gnzrg96iq5" \
129 --with-linkedin-consumer-secret="BazRki2LE8eZtcqh" \
130 --with-instagram-client-id="01c3df41a2274a14882adea8e8ebbd46" \
131- --with-instagram-client-secret="4751ccdc39c648719ea83cfb1c866c26"
132+ --with-instagram-client-secret="4751ccdc39c648719ea83cfb1c866c26" \
133+ --with-vk-client-id="5402699"
134
135 override_dh_install:
136 rm -f debian/*/usr/lib/*/*/*.la
137
138=== modified file 'qml/Makefile.am'
139--- qml/Makefile.am 2013-06-07 11:56:25 +0000
140+++ qml/Makefile.am 2016-04-08 12:10:34 +0000
141@@ -2,4 +2,5 @@
142 facebook/Main.qml \
143 flickr/Main.qml \
144 google/Main.qml \
145- twitter/Main.qml
146+ twitter/Main.qml \
147+ vk/Main.qml
148
149=== added directory 'qml/vk'
150=== added file 'qml/vk/Main.qml'
151--- qml/vk/Main.qml 1970-01-01 00:00:00 +0000
152+++ qml/vk/Main.qml 2016-04-08 12:10:34 +0000
153@@ -0,0 +1,36 @@
154+import Ubuntu.OnlineAccounts.Plugin 1.0
155+
156+OAuthMain {
157+ creationComponent: OAuth {
158+ function completeCreation(reply) {
159+ console.log("Access token: " + reply.AccessToken)
160+ var http = new XMLHttpRequest()
161+ var url = "https://api.vk.com/method/users.get?access_token=" + reply.AccessToken + "&fields=nickname,first_name,last_name";
162+ http.open("GET", url, true);
163+ http.onreadystatechange = function() {
164+ if (http.readyState === 4){
165+ if (http.status == 200) {
166+ console.log("ok")
167+ console.log("response text: " + http.responseText)
168+ var response = JSON.parse(http.responseText)
169+ if (response.response && response.response.length > 0) {
170+ var data = response.response[0]
171+ var name = data.first_name + " " + data.last_name
172+ if (data.nickname) {
173+ name += " (" + data.nickname + ")"
174+ }
175+ account.updateDisplayName(name)
176+ }
177+ account.synced.connect(finished)
178+ account.sync()
179+ } else {
180+ console.log("error: " + http.status)
181+ cancel()
182+ }
183+ }
184+ };
185+
186+ http.send(null);
187+ }
188+ }
189+}

Subscribers

People subscribed via source and target branches