From 90be6cc5e43ffa4ad7897d96147bf7393c6b5a9c Mon Sep 17 00:00:00 2001 From: Dmitry Mukhin Date: Wed, 28 Jan 2015 19:25:02 +0300 Subject: [PATCH] update widget, bump version --- HISTORY.rst | 6 ++++++ pyuploadcare/__init__.py | 2 +- pyuploadcare/dj/conf.py | 2 +- .../{uploadcare-1.5.4.min.js => uploadcare-1.5.5.min.js} | 8 ++++---- setup.py | 4 +++- 5 files changed, 15 insertions(+), 7 deletions(-) rename pyuploadcare/dj/static/uploadcare/{uploadcare-1.5.4.min.js => uploadcare-1.5.5.min.js} (84%) diff --git a/HISTORY.rst b/HISTORY.rst index 5ea30594..452c3892 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,12 @@ History ------- +1.2.14 +~~~~~~ + +- update widget to 1.5.5 (see `widget changelog`_) + + 1.2.13 ~~~~~~ diff --git a/pyuploadcare/__init__.py b/pyuploadcare/__init__.py index 3472cc3e..4fe6bcff 100644 --- a/pyuploadcare/__init__.py +++ b/pyuploadcare/__init__.py @@ -15,7 +15,7 @@ from __future__ import unicode_literals -__version__ = '1.2.12' +__version__ = '1.2.14' from .api_resources import File, FileList, FileGroup from .exceptions import ( diff --git a/pyuploadcare/dj/conf.py b/pyuploadcare/dj/conf.py index b88751e8..0bcad9ed 100644 --- a/pyuploadcare/dj/conf.py +++ b/pyuploadcare/dj/conf.py @@ -20,7 +20,7 @@ conf.secret = settings.UPLOADCARE['secret'] -widget_version = settings.UPLOADCARE.get('widget_version', '1.5.4') +widget_version = settings.UPLOADCARE.get('widget_version', '1.5.5') hosted_url = 'https://ucarecdn.com/widget/{version}/uploadcare/uploadcare-{version}.min.js'.format( version=widget_version) diff --git a/pyuploadcare/dj/static/uploadcare/uploadcare-1.5.4.min.js b/pyuploadcare/dj/static/uploadcare/uploadcare-1.5.5.min.js similarity index 84% rename from pyuploadcare/dj/static/uploadcare/uploadcare-1.5.4.min.js rename to pyuploadcare/dj/static/uploadcare/uploadcare-1.5.5.min.js index ed1a9dea..45c0d480 100644 --- a/pyuploadcare/dj/static/uploadcare/uploadcare-1.5.4.min.js +++ b/pyuploadcare/dj/static/uploadcare/uploadcare-1.5.5.min.js @@ -1,7 +1,7 @@ /* - * Uploadcare (1.5.4) - * Date: 2015-01-19 19:32:21 +0300 - * Rev: 14f38c9bfd + * Uploadcare (1.5.5) + * Date: 2015-01-28 18:02:48 +0300 + * Rev: 7b97d8c7f3 */ (function(uploadcare,SCRIPT_BASE){ /*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ @@ -13,4 +13,4 @@ * Copyright 2011, Pusher * Released under the MIT licence. */ -(function(){var Pusher,_require;(function(){if(Function.prototype.scopedTo===undefined){Function.prototype.scopedTo=function(context,args){var f=this;return function(){return f.apply(context,Array.prototype.slice.call(args||[]).concat(Array.prototype.slice.call(arguments)))}}}Pusher=function(app_key,options){this.options=options||{};this.key=app_key;this.channels=new Pusher.Channels();this.global_emitter=new Pusher.EventsDispatcher();var self=this;this.checkAppKey();this.connection=new Pusher.Connection(this.key,this.options);this.connection.bind("connected",function(){self.subscribeAll()}).bind("message",function(params){var internal=(params.event.indexOf("pusher_internal:")===0);if(params.channel){var channel;if(channel=self.channel(params.channel)){channel.emit(params.event,params.data)}}if(!internal){self.global_emitter.emit(params.event,params.data)}}).bind("disconnected",function(){self.channels.disconnect()}).bind("error",function(err){Pusher.warn("Error",err)});Pusher.instances.push(this);if(Pusher.isReady){self.connect()}};Pusher.instances=[];Pusher.prototype={channel:function(name){return this.channels.find(name)},connect:function(){this.connection.connect()},disconnect:function(){this.connection.disconnect()},bind:function(event_name,callback){this.global_emitter.bind(event_name,callback);return this},bind_all:function(callback){this.global_emitter.bind_all(callback);return this},subscribeAll:function(){var channel;for(channelName in this.channels.channels){if(this.channels.channels.hasOwnProperty(channelName)){this.subscribe(channelName)}}},subscribe:function(channel_name){var self=this;var channel=this.channels.add(channel_name,this);if(this.connection.state==="connected"){channel.authorize(this.connection.socket_id,this.options,function(err,data){if(err){channel.emit("pusher:subscription_error",data)}else{self.send_event("pusher:subscribe",{channel:channel_name,auth:data.auth,channel_data:data.channel_data})}})}return channel},unsubscribe:function(channel_name){this.channels.remove(channel_name);if(this.connection.state==="connected"){this.send_event("pusher:unsubscribe",{channel:channel_name})}},send_event:function(event_name,data,channel){return this.connection.send_event(event_name,data,channel)},checkAppKey:function(){if(this.key===null||this.key===undefined){Pusher.warn("Warning","You must pass your app key when you instantiate Pusher.")}}};Pusher.Util={extend:function extend(target,extensions){for(var property in extensions){if(extensions[property]&&extensions[property].constructor&&extensions[property].constructor===Object){target[property]=extend(target[property]||{},extensions[property])}else{target[property]=extensions[property]}}return target},stringify:function stringify(){var m=["Pusher"];for(var i=0;i0){self.emit("connecting_in",self.connectionWait)}if(self.netInfo.isOnLine()&&self.connectionAttempts<=4){updateState("connecting")}else{updateState("unavailable")}if(self.netInfo.isOnLine()){self._waitingTimer=setTimeout(function(){self._machine.transition("connecting")},connectionDelay())}},waitingExit:function(){clearTimeout(self._waitingTimer)},connectingPre:function(){if(self.netInfo.isOnLine()===false){self._machine.transition("waiting");updateState("unavailable");return}var url=formatURL(self.key,self.connectionSecure);Pusher.debug("Connecting",url);self.socket=new Pusher.Transport(url);self.socket.onopen=ws_onopen;self.socket.onclose=transitionToWaiting;self.socket.onerror=ws_onError;self._connectingTimer=setTimeout(TransitionToImpermanentlyClosing,self.openTimeout)},connectingExit:function(){clearTimeout(self._connectingTimer);self.socket.onopen=undefined},connectingToWaiting:function(){updateConnectionParameters()},connectingToImpermanentlyClosing:function(){updateConnectionParameters()},openPre:function(){self.socket.onmessage=ws_onMessageOpen;self.socket.onerror=ws_onError;self.socket.onclose=transitionToWaiting;self._openTimer=setTimeout(TransitionToImpermanentlyClosing,self.connectedTimeout)},openExit:function(){clearTimeout(self._openTimer);self.socket.onmessage=undefined},openToWaiting:function(){updateConnectionParameters()},openToImpermanentlyClosing:function(){updateConnectionParameters()},connectedPre:function(socket_id){self.socket_id=socket_id;self.socket.onmessage=ws_onMessageConnected;self.socket.onerror=ws_onError;self.socket.onclose=transitionToWaiting;resetConnectionParameters(self);self.connectedAt=new Date().getTime();resetActivityCheck()},connectedPost:function(){updateState("connected")},connectedExit:function(){stopActivityCheck();updateState("disconnected")},impermanentlyClosingPost:function(){if(self.socket){self.socket.onclose=transitionToWaiting;self.socket.close()}},permanentlyClosingPost:function(){if(self.socket){self.socket.onclose=function(){resetConnectionParameters(self);self._machine.transition("permanentlyClosed")};self.socket.close()}else{resetConnectionParameters(self);self._machine.transition("permanentlyClosed")}},failedPre:function(){updateState("failed");Pusher.debug("WebSockets are not available in this browser.")},permanentlyClosedPost:function(){updateState("disconnected")}});function updateConnectionParameters(){if(self.connectionWait "+newState);self.emit("state_change",{previous:prevState,current:newState});self.emit(newState,data)}}}Connection.prototype.connect=function(){if(!this._machine.is("failed")&&!Pusher.Transport){this._machine.transition("failed")}else{if(this._machine.is("initialized")){resetConnectionParameters(this);this._machine.transition("waiting")}else{if(this._machine.is("waiting")&&this.netInfo.isOnLine()===true){this._machine.transition("connecting")}else{if(this._machine.is("permanentlyClosed")){resetConnectionParameters(this);this._machine.transition("waiting")}}}}};Connection.prototype.send=function(data){if(this._machine.is("connected")){var self=this;setTimeout(function(){self.socket.send(data)},0);return true}else{return false}};Connection.prototype.send_event=function(event_name,data,channel){var payload={event:event_name,data:data};if(channel){payload.channel=channel}Pusher.debug("Event sent",payload);return this.send(JSON.stringify(payload))};Connection.prototype.disconnect=function(){if(this._machine.is("permanentlyClosed")){return}if(this._machine.is("waiting")||this._machine.is("failed")){this._machine.transition("permanentlyClosed")}else{this._machine.transition("permanentlyClosing")}};Pusher.Util.extend(Connection.prototype,Pusher.EventsDispatcher.prototype);Pusher.Connection=Connection})();(function(){Pusher.Channels=function(){this.channels={}};Pusher.Channels.prototype={add:function(channel_name,pusher){var existing_channel=this.find(channel_name);if(!existing_channel){var channel=Pusher.Channel.factory(channel_name,pusher);this.channels[channel_name]=channel;return channel}else{return existing_channel}},find:function(channel_name){return this.channels[channel_name]},remove:function(channel_name){delete this.channels[channel_name]},disconnect:function(){for(var channel_name in this.channels){this.channels[channel_name].disconnect()}}};Pusher.Channel=function(channel_name,pusher){var self=this;Pusher.EventsDispatcher.call(this,function(event_name,event_data){Pusher.debug("No callbacks on "+channel_name+" for "+event_name)});this.pusher=pusher;this.name=channel_name;this.subscribed=false;this.bind("pusher_internal:subscription_succeeded",function(data){self.onSubscriptionSucceeded(data)})};Pusher.Channel.prototype={init:function(){},disconnect:function(){this.subscribed=false;this.emit("pusher_internal:disconnected")},onSubscriptionSucceeded:function(data){this.subscribed=true;this.emit("pusher:subscription_succeeded")},authorize:function(socketId,options,callback){return callback(false,{})},trigger:function(event,data){return this.pusher.send_event(event,data,this.name)}};Pusher.Util.extend(Pusher.Channel.prototype,Pusher.EventsDispatcher.prototype);Pusher.Channel.PrivateChannel={authorize:function(socketId,options,callback){var self=this;var authorizer=new Pusher.Channel.Authorizer(this,Pusher.channel_auth_transport,options);return authorizer.authorize(socketId,function(err,authData){if(!err){self.emit("pusher_internal:authorized",authData)}callback(err,authData)})}};Pusher.Channel.PresenceChannel={init:function(){this.members=new Members(this)},onSubscriptionSucceeded:function(data){this.subscribed=true}};var Members=function(channel){var self=this;var reset=function(){this._members_map={};this.count=0;this.me=null};reset.call(this);channel.bind("pusher_internal:authorized",function(authorizedData){var channelData=JSON.parse(authorizedData.channel_data);channel.bind("pusher_internal:subscription_succeeded",function(subscriptionData){self._members_map=subscriptionData.presence.hash;self.count=subscriptionData.presence.count;self.me=self.get(channelData.user_id);channel.emit("pusher:subscription_succeeded",self)})});channel.bind("pusher_internal:member_added",function(data){if(self.get(data.user_id)===null){self.count++}self._members_map[data.user_id]=data.user_info;channel.emit("pusher:member_added",self.get(data.user_id))});channel.bind("pusher_internal:member_removed",function(data){var member=self.get(data.user_id);if(member){delete self._members_map[data.user_id];self.count--;channel.emit("pusher:member_removed",member)}});channel.bind("pusher_internal:disconnected",function(){reset.call(self)})};Members.prototype={each:function(callback){for(var i in this._members_map){callback(this.get(i))}},get:function(user_id){if(this._members_map.hasOwnProperty(user_id)){return{id:user_id,info:this._members_map[user_id]}}else{return null}}};Pusher.Channel.factory=function(channel_name,pusher){var channel=new Pusher.Channel(channel_name,pusher);if(channel_name.indexOf("private-")===0){Pusher.Util.extend(channel,Pusher.Channel.PrivateChannel)}else{if(channel_name.indexOf("presence-")===0){Pusher.Util.extend(channel,Pusher.Channel.PrivateChannel);Pusher.Util.extend(channel,Pusher.Channel.PresenceChannel)}}channel.init();return channel}})();(function(){Pusher.Channel.Authorizer=function(channel,type,options){this.channel=channel;this.type=type;this.authOptions=(options||{}).auth||{}};Pusher.Channel.Authorizer.prototype={composeQuery:function(socketId){var query="&socket_id="+encodeURIComponent(socketId)+"&channel_name="+encodeURIComponent(this.channel.name);for(var i in this.authOptions.params){query+="&"+encodeURIComponent(i)+"="+encodeURIComponent(this.authOptions.params[i])}return query},authorize:function(socketId,callback){return Pusher.authorizers[this.type].call(this,socketId,callback)}};Pusher.auth_callbacks={};Pusher.authorizers={ajax:function(socketId,callback){var self=this,xhr;if(Pusher.XHR){xhr=new Pusher.XHR()}else{xhr=(window.XMLHttpRequest?new window.XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"))}xhr.open("POST",Pusher.channel_auth_endpoint,true);xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var headerName in this.authOptions.headers){xhr.setRequestHeader(headerName,this.authOptions.headers[headerName])}xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200){var data,parsed=false;try{data=JSON.parse(xhr.responseText);parsed=true}catch(e){callback(true,"JSON returned from webapp was invalid, yet status code was 200. Data was: "+xhr.responseText)}if(parsed){callback(false,data)}}else{Pusher.warn("Couldn't get auth info from your webapp",xhr.status);callback(true,xhr.status)}}};xhr.send(this.composeQuery(socketId));return xhr},jsonp:function(socketId,callback){if(this.authOptions.headers!==undefined){Pusher.warn("Warn","To send headers with the auth request, you must use AJAX, rather than JSONP.")}var script=document.createElement("script");Pusher.auth_callbacks[this.channel.name]=function(data){callback(false,data)};var callback_name="Pusher.auth_callbacks['"+this.channel.name+"']";script.src=Pusher.channel_auth_endpoint+"?callback="+encodeURIComponent(callback_name)+this.composeQuery(socketId);var head=document.getElementsByTagName("head")[0]||document.documentElement;head.insertBefore(script,head.firstChild)}}})();var _require=(function(){function handleScriptLoaded(elem,callback){if(document.addEventListener){elem.addEventListener("load",callback,false)}else{elem.attachEvent("onreadystatechange",function(){if(elem.readyState=="loaded"||elem.readyState=="complete"){callback()}})}}function addScript(src,callback){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.setAttribute("src",src);script.setAttribute("type","text/javascript");script.setAttribute("async",true);handleScriptLoaded(script,function(){callback()});head.appendChild(script)}return function(deps,callback){var deps_loaded=0;for(var i=0;i0){_require(deps,initializeOnDocumentBody)}else{initializeOnDocumentBody()}})();this.Pusher=Pusher}).call(uploadcare);(function(){}).call(this);(function(){uploadcare.namespace("uploadcare.utils.abilities",function(ns){ns.fileAPI=!!(window.File&&window.FileList&&window.FileReader);ns.sendFileAPI=!!(window.FormData&&ns.fileAPI);ns.blob=(function(){try{return !!new Blob}catch(_error){return false}})();ns.dragAndDrop=(function(){var el;el=document.createElement("div");return("draggable" in el)||("ondragstart" in el&&"ondrop" in el)})();ns.canvas=(function(){var el;el=document.createElement("canvas");return !!(el.getContext&&el.getContext("2d"))})();return ns.fileDragAndDrop=ns.fileAPI&&ns.dragAndDrop})}).call(this);(function(){uploadcare.namespace("uploadcare.utils.pusher",function(ns){var hasOwners,pusherInstance,pusherWrapped,pushers,releasePusher,updateConnection;pushers={};ns.getPusher=function(key,owner){if(!(key in pushers)){pushers[key]={instance:null,owners:{}}}if(!pushers[key].owners[owner]){pushers[key].owners[owner]=true}updateConnection(key);return pusherWrapped(key,owner)};releasePusher=function(key,owner){if(!pushers[key].owners[owner]){return}pushers[key].owners[owner]=false;return updateConnection(key)};hasOwners=function(key){var owner;return((function(){var _results;_results=[];for(owner in pushers[key].owners){if(pushers[key].owners[owner]){_results.push(owner)}}return _results})()).length>0};updateConnection=function(key){var instance;instance=pusherInstance(key);if(hasOwners(key)){return instance.connect()}else{return setTimeout((function(){if(!hasOwners(key)){return instance.disconnect()}}),5000)}};pusherInstance=function(key){var _ref;if(((_ref=pushers[key])!=null?_ref.instance:void 0)!=null){return pushers[key].instance}return pushers[key].instance=new uploadcare.Pusher(key)};return pusherWrapped=function(key,owner){var Wrapped;Wrapped=function(){this.owner=owner;this.release=function(){return releasePusher(key,owner)};return this};Wrapped.prototype=pusherInstance(key);return new Wrapped()}})}).call(this);(function(){var $,namespace,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child},__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i=0){return}return UniqCollection.__super__.add.apply(this,arguments)};UniqCollection.prototype.__replace=function(oldItem,newItem,i){if(__indexOf.call(this.__items,newItem)>=0){return this.remove(oldItem)}else{return UniqCollection.__super__.__replace.apply(this,arguments)}};return UniqCollection})(utils.Collection);return utils.CollectionOfPromises=(function(_super){__extends(CollectionOfPromises,_super);function CollectionOfPromises(){this.onAnyDone=$.Callbacks();this.onAnyFail=$.Callbacks();this.onAnyProgress=$.Callbacks();this.onAnyProgress.add(function(item,firstArgument){return $(item).data("lastProgress",firstArgument)});CollectionOfPromises.__super__.constructor.apply(this,arguments)}CollectionOfPromises.prototype.lastProgresses=function(){var item,_i,_len,_ref1,_results;_ref1=this.__items;_results=[];for(_i=0,_len=_ref1.length;_i<_len;_i++){item=_ref1[_i];_results.push($(item).data("lastProgress"))}return _results};CollectionOfPromises.prototype.add=function(item){if(!(item&&item.done&&item.fail&&item.then)){return}CollectionOfPromises.__super__.add.apply(this,arguments);return this.__watchItem(item)};CollectionOfPromises.prototype.__watchItem=function(item){var handler,_this=this;handler=function(callbacks){return function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];if(__indexOf.call(_this.__items,item)>=0){args.unshift(item);return callbacks.fire.apply(callbacks,args)}}};return item.then(handler(this.onAnyDone),handler(this.onAnyFail),handler(this.onAnyProgress))};CollectionOfPromises.prototype.__replace=function(oldItem,newItem,i){if(!(newItem&&newItem.done&&newItem.fail&&newItem.then)){return this.remove(oldItem)}else{CollectionOfPromises.__super__.__replace.apply(this,arguments);return this.__watchItem(newItem)}};return CollectionOfPromises})(utils.UniqCollection)})}).call(this);(function(){var namespace;namespace=uploadcare.namespace;namespace("uploadcare.utils",function(ns){var common,messages;ns.log=function(msg){if(window.console&&console.log){return console.log(msg)}else{}};ns.warn=function(msg){if(window.console&&console.warn){return console.warn(msg)}else{return ns.log("Warning: "+msg)}};messages={};ns.warnOnce=function(msg){if(messages[msg]==null){messages[msg]=true;return ns.warn(msg)}};common={autostore:"You have enabled autostore in the widget, but not on the server.\nTo use autostore, make sure it's enabled in project settings.\n\nhttps://uploadcare.com/accounts/settings/",publicKey:"Global public key not set. Uploads may not work!\nAdd this to the tag to set your key:\n\n