Buildout pre-3.8.1; Anonymise user_id etc, fixes xes #232
This commit is contained in:
@ -1 +1 @@
|
||||
3.8.0
|
||||
3.8.1
|
||||
@ -13,7 +13,7 @@ from core import IrisCore
|
||||
from raven import Client
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
__version__ = '3.8.0'
|
||||
__version__ = '3.8.1'
|
||||
|
||||
##
|
||||
# Core extension class
|
||||
|
||||
@ -65,21 +65,21 @@ class IrisCore(object):
|
||||
|
||||
# if we've been given a valid array
|
||||
try:
|
||||
clientid = protocol[0]
|
||||
client_id = protocol[0]
|
||||
connection_id = protocol[1]
|
||||
username = protocol[2]
|
||||
generated = False
|
||||
|
||||
# invalid, so just create a default connection, and auto-generate an ID
|
||||
except:
|
||||
clientid = self.generateGuid(12)
|
||||
client_id = self.generateGuid(12)
|
||||
connection_id = self.generateGuid(12)
|
||||
username = 'Anonymous'
|
||||
generated = True
|
||||
|
||||
# construct our protocol object, and return
|
||||
return {
|
||||
"clientid": clientid,
|
||||
"client_id": client_id,
|
||||
"connection_id": connection_id,
|
||||
"username": username,
|
||||
"generated": generated
|
||||
@ -150,7 +150,9 @@ class IrisCore(object):
|
||||
data={
|
||||
'type': 'connected',
|
||||
'connection_id': connection_id,
|
||||
'username': client['username']
|
||||
'client_id': client['client_id'],
|
||||
'username': client['username'],
|
||||
'ip': client['ip']
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ class WebsocketHandler(tornado.websocket.WebSocketHandler):
|
||||
|
||||
# otherwise, just return one of the supplied subprotocols
|
||||
else:
|
||||
return protocols['clientid']
|
||||
return protocols['client_id']
|
||||
|
||||
def open(self):
|
||||
|
||||
@ -37,7 +37,7 @@ class WebsocketHandler(tornado.websocket.WebSocketHandler):
|
||||
protocolElements = mem.iris.digest_protocol(self.request.headers.get('Sec-Websocket-Protocol', []))
|
||||
|
||||
connection_id = protocolElements['connection_id']
|
||||
clientid = protocolElements['clientid']
|
||||
client_id = protocolElements['client_id']
|
||||
self.connection_id = connection_id
|
||||
username = protocolElements['username']
|
||||
created = datetime.strftime(datetime.now(), '%Y-%m-%d %H:%M:%S')
|
||||
@ -50,7 +50,7 @@ class WebsocketHandler(tornado.websocket.WebSocketHandler):
|
||||
|
||||
# construct our client object, and add to our list of connections
|
||||
client = {
|
||||
'clientid': clientid,
|
||||
'client_id': client_id,
|
||||
'connection_id': connection_id,
|
||||
'username': username,
|
||||
'ip': ip,
|
||||
|
||||
@ -49252,6 +49252,7 @@ function reducer() {
|
||||
connected: true,
|
||||
connecting: false,
|
||||
connection_id: action.connection_id,
|
||||
client_id: action.client_id,
|
||||
username: action.username
|
||||
});
|
||||
|
||||
@ -50822,19 +50823,25 @@ var PusherMiddleware = function () {
|
||||
|
||||
case 'PUSHER_CONNECT':
|
||||
|
||||
if (socket != null) socket.close();
|
||||
// Stagnant socket, close it first
|
||||
if (socket != null) {
|
||||
socket.close();
|
||||
}
|
||||
|
||||
store.dispatch({ type: 'PUSHER_CONNECTING' });
|
||||
|
||||
var state = store.getState();
|
||||
var connection = {
|
||||
clientid: helpers.generateGuid(),
|
||||
client_id: helpers.generateGuid(),
|
||||
connection_id: helpers.generateGuid(),
|
||||
username: 'Anonymous'
|
||||
};
|
||||
if (state.pusher.username) connection.username = state.pusher.username;
|
||||
if (state.pusher.username) {
|
||||
connection.username = state.pusher.username;
|
||||
}
|
||||
connection.username = connection.username.replace(/\W/g, '');
|
||||
|
||||
socket = new WebSocket('ws' + (window.location.protocol === 'https:' ? 's' : '') + '://' + state.mopidy.host + ':' + state.mopidy.port + '/iris/ws/', [connection.clientid, connection.connection_id, connection.username]);
|
||||
socket = new WebSocket('ws' + (window.location.protocol === 'https:' ? 's' : '') + '://' + state.mopidy.host + ':' + state.mopidy.port + '/iris/ws/', [connection.client_id, connection.connection_id, connection.username]);
|
||||
|
||||
socket.onmessage = function (message) {
|
||||
var message = JSON.parse(message.data);
|
||||
@ -55586,7 +55593,13 @@ var SpotifyMiddleware = function () {
|
||||
|
||||
case 'SPOTIFY_CONNECTED':
|
||||
var label = null;
|
||||
if (store.getState().spotify.me) label = store.getState().spotify.me.id;
|
||||
if (store.getState().spotify.me) {
|
||||
if (store.getState().core.anonymise_analytics) {
|
||||
label = "anonymised_" + store.getState().pusher.client_id;
|
||||
} else {
|
||||
label = store.getState().spotify.me.id;
|
||||
}
|
||||
}
|
||||
_reactGa2.default.event({ category: 'Spotify', action: 'Connected', label: label });
|
||||
|
||||
// TODO: remove this so we don't tap out our API limits before we even get started
|
||||
@ -55610,7 +55623,11 @@ var SpotifyMiddleware = function () {
|
||||
case 'SPOTIFY_AUTHORIZATION_REVOKED':
|
||||
var label = null;
|
||||
if (store.getState().spotify.me) {
|
||||
label = store.getState().spotify.me.id;
|
||||
if (store.getState().core.anonymise_analytics) {
|
||||
label = "anonymised_" + store.getState().pusher.client_id;
|
||||
} else {
|
||||
label = store.getState().spotify.me.id;
|
||||
}
|
||||
}
|
||||
_reactGa2.default.event({ category: 'Spotify', action: 'Authorization revoked', label: label });
|
||||
next(action);
|
||||
@ -55626,7 +55643,11 @@ var SpotifyMiddleware = function () {
|
||||
case 'SPOTIFY_IMPORT_AUTHORIZATION':
|
||||
var label = null;
|
||||
if (action.me && action.me.id) {
|
||||
label = action.me.id;
|
||||
if (store.getState().core.anonymise_analytics) {
|
||||
label = "anonymised_" + store.getState().pusher.client_id;
|
||||
} else {
|
||||
label = action.me.id;
|
||||
}
|
||||
}
|
||||
_reactGa2.default.event({ category: 'Spotify', action: 'Authorization imported', label: label });
|
||||
|
||||
@ -55955,8 +55976,15 @@ var SpotifyMiddleware = function () {
|
||||
// Use 'me' name as my Pusher username
|
||||
store.dispatch(pusherActions.setUsername(name));
|
||||
}
|
||||
_reactGa2.default.set({ userId: action.data.id });
|
||||
_reactGa2.default.event({ category: 'Spotify', action: 'Authorization verified', label: action.data.id });
|
||||
|
||||
var label = null;
|
||||
if (store.getState().core.anonymise_analytics) {
|
||||
label = "anonymised_" + store.getState().pusher.client_id;
|
||||
} else {
|
||||
_reactGa2.default.set({ userId: action.data.id });
|
||||
label = action.data.id;
|
||||
}
|
||||
_reactGa2.default.event({ category: 'Spotify', action: 'Authorization verified', label: label });
|
||||
|
||||
store.dispatch({
|
||||
type: 'USERS_LOADED',
|
||||
@ -65299,8 +65327,34 @@ var Settings = function (_React$Component) {
|
||||
} }),
|
||||
_react2.default.createElement(
|
||||
'span',
|
||||
{ className: 'label' },
|
||||
'Clear tracklist on play of URI(s)'
|
||||
{ className: 'label has-tooltip' },
|
||||
'Clear tracklist on play of URI(s)',
|
||||
_react2.default.createElement(
|
||||
'span',
|
||||
{ className: 'tooltip' },
|
||||
'Playing one or more URIs will clear the current play queue first'
|
||||
)
|
||||
)
|
||||
),
|
||||
_react2.default.createElement(
|
||||
'label',
|
||||
null,
|
||||
_react2.default.createElement('input', {
|
||||
type: 'checkbox',
|
||||
name: 'log_actions',
|
||||
checked: this.props.core.anonymise_analytics,
|
||||
onChange: function onChange(e) {
|
||||
return _this3.props.coreActions.set({ anonymise_analytics: !_this3.props.core.anonymise_analytics });
|
||||
} }),
|
||||
_react2.default.createElement(
|
||||
'span',
|
||||
{ className: 'label has-tooltip' },
|
||||
'Exclude personal data from collection',
|
||||
_react2.default.createElement(
|
||||
'span',
|
||||
{ className: 'tooltip' },
|
||||
'Personal data used for debugging Iris is not collected by Google Analytics'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
mopidy_iris/static/app.min.js
vendored
4
mopidy_iris/static/app.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -38,8 +38,8 @@
|
||||
|
||||
// Release details
|
||||
// These are automatically injected by build.sh
|
||||
var build = "1510946938";
|
||||
var version = "3.8.0";
|
||||
var build = "1511077017";
|
||||
var version = "3.8.1";
|
||||
|
||||
// Construct the script tag
|
||||
var js = document.createElement("script");
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mopidy-iris",
|
||||
"version": "3.8.0",
|
||||
"version": "3.8.1",
|
||||
"description": "Mopidy HTTP interface",
|
||||
"repository": "https://github.com/jaedb/iris",
|
||||
"author": "James Barnsley <james@barnsley.nz>",
|
||||
|
||||
@ -99,21 +99,27 @@ const PusherMiddleware = (function(){
|
||||
|
||||
case 'PUSHER_CONNECT':
|
||||
|
||||
if (socket != null) socket.close();
|
||||
// Stagnant socket, close it first
|
||||
if (socket != null){
|
||||
socket.close();
|
||||
}
|
||||
|
||||
store.dispatch({ type: 'PUSHER_CONNECTING' });
|
||||
|
||||
var state = store.getState();
|
||||
var connection = {
|
||||
clientid: helpers.generateGuid(),
|
||||
client_id: helpers.generateGuid(),
|
||||
connection_id: helpers.generateGuid(),
|
||||
username: 'Anonymous'
|
||||
}
|
||||
if (state.pusher.username ) connection.username = state.pusher.username;
|
||||
connection.username = connection.username.replace(/\W/g, '')
|
||||
if (state.pusher.username){
|
||||
connection.username = state.pusher.username;
|
||||
}
|
||||
connection.username = connection.username.replace(/\W/g, '');
|
||||
|
||||
socket = new WebSocket(
|
||||
'ws'+(window.location.protocol === 'https:' ? 's' : '')+'://'+state.mopidy.host+':'+state.mopidy.port+'/iris/ws/',
|
||||
[ connection.clientid, connection.connection_id, connection.username ]
|
||||
[ connection.client_id, connection.connection_id, connection.username ]
|
||||
);
|
||||
|
||||
socket.onmessage = (message) => {
|
||||
@ -135,7 +141,7 @@ const PusherMiddleware = (function(){
|
||||
break;
|
||||
|
||||
case 'PUSHER_CONNECTED':
|
||||
ReactGA.event({ category: 'Pusher', action: 'Connected', label: action.username })
|
||||
ReactGA.event({ category: 'Pusher', action: 'Connected', label: action.username})
|
||||
request(store, 'get_config')
|
||||
.then(
|
||||
response => {
|
||||
@ -145,7 +151,7 @@ const PusherMiddleware = (function(){
|
||||
}
|
||||
|
||||
response.type = 'PUSHER_CONFIG'
|
||||
store.dispatch(response)
|
||||
store.dispatch(response);
|
||||
|
||||
var core = store.getState().core
|
||||
if (!core.country || !core.locale){
|
||||
|
||||
@ -11,6 +11,7 @@ export default function reducer(pusher = {}, action){
|
||||
connected: true,
|
||||
connecting: false,
|
||||
connection_id: action.connection_id,
|
||||
client_id: action.client_id,
|
||||
username: action.username
|
||||
});
|
||||
|
||||
|
||||
@ -18,7 +18,13 @@ const SpotifyMiddleware = (function(){
|
||||
|
||||
case 'SPOTIFY_CONNECTED':
|
||||
var label = null
|
||||
if (store.getState().spotify.me) label = store.getState().spotify.me.id
|
||||
if (store.getState().spotify.me){
|
||||
if (store.getState().core.anonymise_analytics){
|
||||
label = "anonymised_"+store.getState().pusher.client_id;
|
||||
} else {
|
||||
label = store.getState().spotify.me.id;
|
||||
}
|
||||
}
|
||||
ReactGA.event({ category: 'Spotify', action: 'Connected', label: label })
|
||||
|
||||
// TODO: remove this so we don't tap out our API limits before we even get started
|
||||
@ -31,7 +37,7 @@ const SpotifyMiddleware = (function(){
|
||||
break
|
||||
|
||||
case 'SPOTIFY_AUTHORIZATION_GRANTED':
|
||||
ReactGA.event({ category: 'Spotify', action: 'Authorization granted' });
|
||||
ReactGA.event({ category: 'Spotify', action: 'Authorization granted'});
|
||||
|
||||
// Flush out the previous user's library
|
||||
store.dispatch(spotifyActions.flushLibrary());
|
||||
@ -42,9 +48,13 @@ const SpotifyMiddleware = (function(){
|
||||
case 'SPOTIFY_AUTHORIZATION_REVOKED':
|
||||
var label = null
|
||||
if (store.getState().spotify.me){
|
||||
label = store.getState().spotify.me.id;
|
||||
if (store.getState().core.anonymise_analytics){
|
||||
label = "anonymised_"+store.getState().pusher.client_id;
|
||||
} else {
|
||||
label = store.getState().spotify.me.id;
|
||||
}
|
||||
}
|
||||
ReactGA.event({ category: 'Spotify', action: 'Authorization revoked', label: label })
|
||||
ReactGA.event({ category: 'Spotify', action: 'Authorization revoked', label: label})
|
||||
next(action)
|
||||
|
||||
// Now dispatch a getMe to get the backend-provided user
|
||||
@ -58,7 +68,11 @@ const SpotifyMiddleware = (function(){
|
||||
case 'SPOTIFY_IMPORT_AUTHORIZATION':
|
||||
var label = null;
|
||||
if (action.me && action.me.id){
|
||||
label = action.me.id
|
||||
if (store.getState().core.anonymise_analytics){
|
||||
label = "anonymised_"+store.getState().pusher.client_id;
|
||||
} else {
|
||||
label = action.me.id;
|
||||
}
|
||||
}
|
||||
ReactGA.event({ category: 'Spotify', action: 'Authorization imported', label: label });
|
||||
|
||||
@ -420,8 +434,15 @@ const SpotifyMiddleware = (function(){
|
||||
// Use 'me' name as my Pusher username
|
||||
store.dispatch(pusherActions.setUsername(name));
|
||||
}
|
||||
ReactGA.set({userId: action.data.id});
|
||||
ReactGA.event({category: 'Spotify', action: 'Authorization verified', label: action.data.id});
|
||||
|
||||
var label = null;
|
||||
if (store.getState().core.anonymise_analytics){
|
||||
label = "anonymised_"+store.getState().pusher.client_id;
|
||||
} else {
|
||||
ReactGA.set({userId: action.data.id});
|
||||
label = action.data.id;
|
||||
}
|
||||
ReactGA.event({category: 'Spotify', action: 'Authorization verified', label: label});
|
||||
|
||||
store.dispatch({
|
||||
type: 'USERS_LOADED',
|
||||
|
||||
@ -395,7 +395,21 @@ class Settings extends React.Component {
|
||||
name="log_actions"
|
||||
checked={ this.props.ui.clear_tracklist_on_play }
|
||||
onChange={ e => this.props.uiActions.set({ clear_tracklist_on_play: !this.props.ui.clear_tracklist_on_play })} />
|
||||
<span className="label">Clear tracklist on play of URI(s)</span>
|
||||
<span className="label has-tooltip">
|
||||
Clear tracklist on play of URI(s)
|
||||
<span className="tooltip">Playing one or more URIs will clear the current play queue first</span>
|
||||
</span>
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="log_actions"
|
||||
checked={ this.props.core.anonymise_analytics }
|
||||
onChange={ e => this.props.coreActions.set({ anonymise_analytics: !this.props.core.anonymise_analytics })} />
|
||||
<span className="label has-tooltip">
|
||||
Exclude personal data from collection
|
||||
<span className="tooltip">Personal data used for debugging Iris is not collected by Google Analytics</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user