2015-01-13 00:29:40 +01:00
2019-10-06 03:20:58 +02:00
/* ---- lib/00-jquery.min.js ---- */
2015-01-13 00:29:40 +01:00
2018-10-20 02:22:38 +02:00
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
! function ( e , t ) { "use strict" ; "object" == typeof module && "object" == typeof module . exports ? module . exports = e . document ? t ( e , ! 0 ) : function ( e ) { if ( ! e . document ) throw new Error ( "jQuery requires a window with a document" ) ; return t ( e ) } : t ( e ) } ( "undefined" != typeof window ? window : this , function ( e , t ) { "use strict" ; var n = [ ] , r = e . document , i = Object . getPrototypeOf , o = n . slice , a = n . concat , s = n . push , u = n . indexOf , l = { } , c = l . toString , f = l . hasOwnProperty , p = f . toString , d = p . call ( Object ) , h = { } , g = function e ( t ) { return "function" == typeof t && "number" != typeof t . nodeType } , y = function e ( t ) { return null != t && t === t . window } , v = { type : ! 0 , src : ! 0 , noModule : ! 0 } ; function m ( e , t , n ) { var i , o = ( t = t || r ) . createElement ( "script" ) ; if ( o . text = e , n ) for ( i in v ) n [ i ] && ( o [ i ] = n [ i ] ) ; t . head . appendChild ( o ) . parentNode . removeChild ( o ) } function x ( e ) { return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? l [ c . call ( e ) ] || "object" : typeof e } var b = "3.3.1" , w = function ( e , t ) { return new w . fn . init ( e , t ) } , T = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g ; w . fn = w . prototype = { jquery : "3.3.1" , constructor : w , length : 0 , toArray : function ( ) { return o . call ( this ) } , get : function ( e ) { return null == e ? o . call ( this ) : e < 0 ? this [ e + this . length ] : this [ e ] } , pushStack : function ( e ) { var t = w . merge ( this . constructor ( ) , e ) ; return t . prevObject = this , t } , each : function ( e ) { return w . each ( this , e ) } , map : function ( e ) { return this . pushStack ( w . map ( this , function ( t , n ) { return e . call ( t , n , t ) } ) ) } , slice : function ( ) { return this . pushStack ( o . apply ( this , arguments ) ) } , first : function ( ) { return this . eq ( 0 ) } , last : function ( ) { return this . eq ( - 1 ) } , eq : function ( e ) { var t = this . length , n = + e + ( e < 0 ? t : 0 ) ; return this . pushStack ( n >= 0 && n < t ? [ this [ n ] ] : [ ] ) } , end : function ( ) { return this . prevObject || this . constructor ( ) } , push : s , sort : n . sort , splice : n . splice } , w . extend = w . fn . extend = function ( ) { var e , t , n , r , i , o , a = arguments [ 0 ] || { } , s = 1 , u = arguments . length , l = ! 1 ; for ( "boolean" == typeof a && ( l = a , a = arguments [ s ] || { } , s ++ ) , "object" == typeof a || g ( a ) || ( a = { } ) , s === u && ( a = this , s -- ) ; s < u ; s ++ ) if ( null != ( e = arguments [ s ] ) ) for ( t in e ) n = a [ t ] , a !== ( r = e [ t ] ) && ( l && r && ( w . isPlainObject ( r ) || ( i = Array . isArray ( r ) ) ) ? ( i ? ( i = ! 1 , o = n && Array . isArray ( n ) ? n : [ ] ) : o = n && w . isPlainObject ( n ) ? n : { } , a [ t ] = w . extend ( l , o , r ) ) : void 0 !== r && ( a [ t ] = r ) ) ; return a } , w . extend ( { expando : "jQuery" + ( "3.3.1" + Math . random ( ) ) . replace ( /\D/g , "" ) , isReady : ! 0 , error : function ( e ) { throw new Error ( e ) } , noop : function ( ) { } , isPlainObject : function ( e ) { var t , n ; return ! ( ! e || "[object Object]" !== c . call ( e ) ) && ( ! ( t = i ( e ) ) || "function" == typeof ( n = f . call ( t , "constructor" ) && t . constructor ) && p . call ( n ) === d ) } , isEmptyObject : function ( e ) { var t ; for ( t in e ) return ! 1 ; return ! 0 } , globalEval : function ( e ) { m ( e ) } , each : function ( e , t ) { var n , r = 0 ; if ( C ( e ) ) { for ( n = e . length ; r < n ; r ++ ) if ( ! 1 === t . call ( e [ r ] , r , e [ r ] ) ) break } else for ( r in e ) if ( ! 1 === t . call ( e [ r ] , r , e [ r ] ) ) break ; return e } , trim : function ( e ) { return null == e ? "" : ( e + "" ) . replace ( T , "" ) } , makeArray : function ( e , t ) { var n = t || [ ] ; return null != e && ( C ( Object ( e ) ) ? w . merge ( n , "string" == typeof e ? [ e ] : e ) : s . call ( n , e ) ) , n } , inArray : function ( e , t , n ) { return null == t ? - 1 : u . call ( t , e , n ) } , merge : function ( e , t ) { for ( var n = + t . length , r = 0 , i = e . length ; r < n ; r ++ ) e [ i ++ ] = t [ r ] ; return e . length = i , e } , grep : function ( e , t , n ) { for ( var r , i = [ ] , o = 0 , a = e . length , s = ! n ; o < a ; o ++ ) ( r = ! t ( e [ o ] , o ) ) !== s && i . push ( e [ o ] ) ; return i } , map : function ( e , t , n ) { var r , i , o = 0 , s = [ ] ; if ( C ( e ) ) for ( r = e . length ; o < r ; o ++ ) null != ( i = t ( e [ o ] , o , n ) ) && s . push ( i ) ; else for ( o in e ) null != ( i = t ( e [ o ] , o , n ) ) && s . push ( i ) ; return a . apply ( [ ] , s ) } , guid : 1 , support : h } ) , "function" == typeof Symbol && ( w . fn [ Symbol . iterator ] = n [ Symbol . iterator ] ) , w . each ( "Boolean Number String Function Array Date RegExp Object Error Symbol" . split ( " " ) , function ( e , t ) { l [ "[object " + t + "]" ] = t . toLowerCase ( ) } ) ; function C ( e ) { var t = ! ! e && "length" in e && e . length , n = x ( e ) ; return ! g ( e ) && ! y ( e ) && ( "array" === n || 0 === t || "number" == typeof t && t > 0 && t - 1 in e ) } var E = function ( e ) { var t , n , r , i , o , a , s , u , l , c , f , p , d , h , g , y , v , m , x , b = "sizzle" + 1 * new Date , w = e . document , T = 0 , C = 0 , E = ae ( ) , k = ae ( ) , S = ae ( ) , D = function ( e , t ) { return e === t && ( f = ! 0 ) , 0 } , N = { } . hasOwnProperty , A = [ ] , j = A . pop , q = A . push , L = A . push , H = A . slice , O = function ( e , t ) { for ( var n = 0 , r = e . length ; n < r ; n ++ ) if ( e [ n ] === t ) return n ; return - 1 } , P = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped" , M = "[\\x20\\t\\r\\n\\f]" , R = " ( ? : \ \ \ \ . | [ \ \ w -
2015-01-13 00:29:40 +01:00
2019-10-06 03:20:58 +02:00
/* ---- lib/RateLimit.coffee ---- */
2017-03-02 23:39:31 +01:00
( function ( ) {
var call _after _interval , limits ;
limits = { } ;
call _after _interval = { } ;
window . RateLimit = function ( interval , fn ) {
if ( ! limits [ fn ] ) {
call _after _interval [ fn ] = false ;
fn ( ) ;
return limits [ fn ] = setTimeout ( ( function ( ) {
if ( call _after _interval [ fn ] ) {
fn ( ) ;
}
delete limits [ fn ] ;
return delete call _after _interval [ fn ] ;
} ) , interval ) ;
} else {
return call _after _interval [ fn ] = true ;
}
} ;
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- lib/Translate.coffee ---- */
2018-09-07 11:33:40 +02:00
( function ( ) {
window . _ = function ( s ) {
return s ;
} ;
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- lib/ZeroWebsocket.coffee ---- */
2015-01-13 00:29:40 +01:00
( function ( ) {
var ZeroWebsocket ,
2018-02-21 03:15:04 +01:00
bind = function ( fn , me ) { return function ( ) { return fn . apply ( me , arguments ) ; } ; } ,
slice = [ ] . slice ;
2015-01-13 00:29:40 +01:00
ZeroWebsocket = ( function ( ) {
function ZeroWebsocket ( url ) {
2018-02-21 03:15:04 +01:00
this . onCloseWebsocket = bind ( this . onCloseWebsocket , this ) ;
this . onErrorWebsocket = bind ( this . onErrorWebsocket , this ) ;
this . onOpenWebsocket = bind ( this . onOpenWebsocket , this ) ;
this . log = bind ( this . log , this ) ;
this . response = bind ( this . response , this ) ;
this . route = bind ( this . route , this ) ;
this . onMessage = bind ( this . onMessage , this ) ;
2015-01-13 00:29:40 +01:00
this . url = url ;
this . next _message _id = 1 ;
this . waiting _cb = { } ;
this . init ( ) ;
}
ZeroWebsocket . prototype . init = function ( ) {
return this ;
} ;
ZeroWebsocket . prototype . connect = function ( ) {
this . ws = new WebSocket ( this . url ) ;
this . ws . onmessage = this . onMessage ;
this . ws . onopen = this . onOpenWebsocket ;
this . ws . onerror = this . onErrorWebsocket ;
2016-11-07 22:53:07 +01:00
this . ws . onclose = this . onCloseWebsocket ;
this . connected = false ;
return this . message _queue = [ ] ;
2015-01-13 00:29:40 +01:00
} ;
ZeroWebsocket . prototype . onMessage = function ( e ) {
var cmd , message ;
message = JSON . parse ( e . data ) ;
cmd = message . cmd ;
if ( cmd === "response" ) {
if ( this . waiting _cb [ message . to ] != null ) {
return this . waiting _cb [ message . to ] ( message . result ) ;
} else {
return this . log ( "Websocket callback not found:" , message ) ;
}
} else if ( cmd === "ping" ) {
return this . response ( message . id , "pong" ) ;
} else {
return this . route ( cmd , message ) ;
}
} ;
ZeroWebsocket . prototype . route = function ( cmd , message ) {
return this . log ( "Unknown command" , message ) ;
} ;
ZeroWebsocket . prototype . response = function ( to , result ) {
return this . send ( {
"cmd" : "response" ,
"to" : to ,
"result" : result
} ) ;
} ;
ZeroWebsocket . prototype . cmd = function ( cmd , params , cb ) {
if ( params == null ) {
params = { } ;
}
if ( cb == null ) {
cb = null ;
}
return this . send ( {
"cmd" : cmd ,
"params" : params
} , cb ) ;
} ;
ZeroWebsocket . prototype . send = function ( message , cb ) {
if ( cb == null ) {
cb = null ;
}
if ( message . id == null ) {
message . id = this . next _message _id ;
this . next _message _id += 1 ;
}
2016-11-07 22:53:07 +01:00
if ( this . connected ) {
this . ws . send ( JSON . stringify ( message ) ) ;
} else {
this . log ( "Not connected, adding message to queue" ) ;
this . message _queue . push ( message ) ;
}
2015-01-13 00:29:40 +01:00
if ( cb ) {
return this . waiting _cb [ message . id ] = cb ;
}
} ;
ZeroWebsocket . prototype . log = function ( ) {
var args ;
2018-02-21 03:15:04 +01:00
args = 1 <= arguments . length ? slice . call ( arguments , 0 ) : [ ] ;
return console . log . apply ( console , [ "[ZeroWebsocket]" ] . concat ( slice . call ( args ) ) ) ;
2015-01-13 00:29:40 +01:00
} ;
ZeroWebsocket . prototype . onOpenWebsocket = function ( e ) {
2018-02-21 03:15:04 +01:00
var i , len , message , ref ;
2015-01-24 19:14:29 +01:00
this . log ( "Open" ) ;
2016-11-07 22:53:07 +01:00
this . connected = true ;
2018-02-21 03:15:04 +01:00
ref = this . message _queue ;
for ( i = 0 , len = ref . length ; i < len ; i ++ ) {
message = ref [ i ] ;
2016-11-07 22:53:07 +01:00
this . ws . send ( JSON . stringify ( message ) ) ;
}
this . message _queue = [ ] ;
2015-01-13 00:29:40 +01:00
if ( this . onOpen != null ) {
return this . onOpen ( e ) ;
}
} ;
ZeroWebsocket . prototype . onErrorWebsocket = function ( e ) {
this . log ( "Error" , e ) ;
if ( this . onError != null ) {
return this . onError ( e ) ;
}
} ;
2015-02-20 01:37:12 +01:00
ZeroWebsocket . prototype . onCloseWebsocket = function ( e , reconnect ) {
if ( reconnect == null ) {
reconnect = 10000 ;
}
2015-01-13 00:29:40 +01:00
this . log ( "Closed" , e ) ;
2016-11-07 22:53:07 +01:00
this . connected = false ;
2015-02-20 01:37:12 +01:00
if ( e && e . code === 1000 && e . wasClean === false ) {
this . log ( "Server error, please reload the page" , e . wasClean ) ;
2015-01-13 00:29:40 +01:00
} else {
setTimeout ( ( ( function ( _this ) {
return function ( ) {
_this . log ( "Reconnecting..." ) ;
return _this . connect ( ) ;
} ;
2015-02-20 01:37:12 +01:00
} ) ( this ) ) , reconnect ) ;
2015-01-13 00:29:40 +01:00
}
if ( this . onClose != null ) {
return this . onClose ( e ) ;
}
} ;
return ZeroWebsocket ;
} ) ( ) ;
window . ZeroWebsocket = ZeroWebsocket ;
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- lib/jquery.cssanim.js ---- */
2015-01-13 00:29:40 +01:00
jQuery . cssHooks [ 'scale' ] = {
2015-09-27 02:08:53 +02:00
get : function ( elem , computed ) {
2015-07-31 23:34:53 +02:00
var match = window . getComputedStyle ( elem ) [ transform _property ] . match ( "[0-9\.]+" )
2015-01-13 00:29:40 +01:00
if ( match ) {
var scale = parseFloat ( match [ 0 ] )
return scale
} else {
return 1.0
}
} ,
set : function ( elem , val ) {
//var transforms = $(elem).css("transform").match(/[0-9\.]+/g)
2015-07-31 23:34:53 +02:00
var transforms = window . getComputedStyle ( elem ) [ transform _property ] . match ( /[0-9\.]+/g )
2015-01-13 00:29:40 +01:00
if ( transforms ) {
transforms [ 0 ] = val
transforms [ 3 ] = val
//$(elem).css("transform", 'matrix('+transforms.join(", ")+")")
2015-07-31 23:34:53 +02:00
elem . style [ transform _property ] = 'matrix(' + transforms . join ( ", " ) + ')'
2015-01-13 00:29:40 +01:00
} else {
2015-07-31 23:34:53 +02:00
elem . style [ transform _property ] = "scale(" + val + ")"
2015-01-13 00:29:40 +01:00
}
}
}
jQuery . fx . step . scale = function ( fx ) {
jQuery . cssHooks [ 'scale' ] . set ( fx . elem , fx . now )
} ;
2015-07-31 23:34:53 +02:00
if ( window . getComputedStyle ( document . body ) . transform ) {
transform _property = "transform"
} else {
transform _property = "webkitTransform"
}
2019-10-06 03:20:58 +02:00
/* ---- lib/jquery.csslater.coffee ---- */
2015-01-13 00:29:40 +01:00
( function ( ) {
jQuery . fn . readdClass = function ( class _name ) {
var elem ;
elem = this ;
elem . removeClass ( class _name ) ;
setTimeout ( ( function ( ) {
return elem . addClass ( class _name ) ;
} ) , 1 ) ;
return this ;
} ;
jQuery . fn . removeLater = function ( time ) {
var elem ;
if ( time == null ) {
time = 500 ;
}
elem = this ;
setTimeout ( ( function ( ) {
return elem . remove ( ) ;
} ) , time ) ;
return this ;
} ;
jQuery . fn . hideLater = function ( time ) {
var elem ;
if ( time == null ) {
time = 500 ;
}
elem = this ;
setTimeout ( ( function ( ) {
version 0.2.8, Namecoin domains using internal resolver site, --disable_zeromq option to skip backward compatiblity layer and save some memory, connectionserver firstchar error fixes, missing unpacker crash fix, sitemanager class to allow extensions, add loaded plugin list to websocket api, faster content publishing, mark updating file as bad, remove coppersurfer tracker add eddie4, internal server error with error displaying, allow site domains in UiRequest, better progress bar, wait for siteinfo before before using localstorage, csslater hide only if opacity is 0
2015-03-30 23:44:29 +02:00
if ( elem . css ( "opacity" ) === 0 ) {
return elem . css ( "display" , "none" ) ;
}
2015-01-13 00:29:40 +01:00
} ) , time ) ;
return this ;
} ;
jQuery . fn . addClassLater = function ( class _name , time ) {
var elem ;
if ( time == null ) {
time = 5 ;
}
elem = this ;
setTimeout ( ( function ( ) {
return elem . addClass ( class _name ) ;
} ) , time ) ;
return this ;
} ;
jQuery . fn . cssLater = function ( name , val , time ) {
var elem ;
if ( time == null ) {
time = 500 ;
}
elem = this ;
setTimeout ( ( function ( ) {
return elem . css ( name , val ) ;
} ) , time ) ;
return this ;
} ;
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- lib/jquery.easing.js ---- */
2015-01-13 00:29:40 +01:00
/ *
2018-10-20 02:22:38 +02:00
* jQuery Easing v1 . 4.1 - http : //gsgd.co.uk/sandbox/jquery/easing/
* Open source under the BSD License .
2015-01-13 00:29:40 +01:00
* Copyright © 2008 George McGinley Smith
* All rights reserved .
2018-10-20 02:22:38 +02:00
* https : //raw.github.com/gdsmith/jquery-easing/master/LICENSE
2015-01-13 00:29:40 +01:00
* /
2018-10-20 02:22:38 +02:00
( function ( factory ) {
if ( typeof define === "function" && define . amd ) {
define ( [ 'jquery' ] , function ( $ ) {
return factory ( $ ) ;
} ) ;
} else if ( typeof module === "object" && typeof module . exports === "object" ) {
exports = factory ( require ( 'jquery' ) ) ;
} else {
factory ( jQuery ) ;
}
} ) ( function ( $ ) {
2015-01-13 00:29:40 +01:00
2018-10-20 02:22:38 +02:00
// Preserve the original jQuery "swing" easing as "jswing"
if ( typeof $ . easing !== 'undefined' ) {
$ . easing [ 'jswing' ] = $ . easing [ 'swing' ] ;
}
var pow = Math . pow ,
sqrt = Math . sqrt ,
sin = Math . sin ,
cos = Math . cos ,
PI = Math . PI ,
c1 = 1.70158 ,
c2 = c1 * 1.525 ,
c3 = c1 + 1 ,
c4 = ( 2 * PI ) / 3 ,
c5 = ( 2 * PI ) / 4.5 ;
// x is the fraction of animation progress, in the range 0..1
function bounceOut ( x ) {
var n1 = 7.5625 ,
d1 = 2.75 ;
if ( x < 1 / d1 ) {
return n1 * x * x ;
} else if ( x < 2 / d1 ) {
return n1 * ( x -= ( 1.5 / d1 ) ) * x + . 75 ;
} else if ( x < 2.5 / d1 ) {
return n1 * ( x -= ( 2.25 / d1 ) ) * x + . 9375 ;
} else {
return n1 * ( x -= ( 2.625 / d1 ) ) * x + . 984375 ;
}
}
$ . extend ( $ . easing ,
2015-01-13 00:29:40 +01:00
{
def : 'easeOutQuad' ,
2018-10-20 02:22:38 +02:00
swing : function ( x ) {
return $ . easing [ $ . easing . def ] ( x ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInQuad : function ( x ) {
return x * x ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutQuad : function ( x ) {
return 1 - ( 1 - x ) * ( 1 - x ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutQuad : function ( x ) {
return x < 0.5 ?
2 * x * x :
1 - pow ( - 2 * x + 2 , 2 ) / 2 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInCubic : function ( x ) {
return x * x * x ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutCubic : function ( x ) {
return 1 - pow ( 1 - x , 3 ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutCubic : function ( x ) {
return x < 0.5 ?
4 * x * x * x :
1 - pow ( - 2 * x + 2 , 3 ) / 2 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInQuart : function ( x ) {
return x * x * x * x ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutQuart : function ( x ) {
return 1 - pow ( 1 - x , 4 ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutQuart : function ( x ) {
return x < 0.5 ?
8 * x * x * x * x :
1 - pow ( - 2 * x + 2 , 4 ) / 2 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInQuint : function ( x ) {
return x * x * x * x * x ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutQuint : function ( x ) {
return 1 - pow ( 1 - x , 5 ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutQuint : function ( x ) {
return x < 0.5 ?
16 * x * x * x * x * x :
1 - pow ( - 2 * x + 2 , 5 ) / 2 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInSine : function ( x ) {
return 1 - cos ( x * PI / 2 ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutSine : function ( x ) {
return sin ( x * PI / 2 ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutSine : function ( x ) {
return - ( cos ( PI * x ) - 1 ) / 2 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInExpo : function ( x ) {
return x === 0 ? 0 : pow ( 2 , 10 * x - 10 ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutExpo : function ( x ) {
return x === 1 ? 1 : 1 - pow ( 2 , - 10 * x ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutExpo : function ( x ) {
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
pow ( 2 , 20 * x - 10 ) / 2 :
( 2 - pow ( 2 , - 20 * x + 10 ) ) / 2 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInCirc : function ( x ) {
return 1 - sqrt ( 1 - pow ( x , 2 ) ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutCirc : function ( x ) {
return sqrt ( 1 - pow ( x - 1 , 2 ) ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutCirc : function ( x ) {
return x < 0.5 ?
( 1 - sqrt ( 1 - pow ( 2 * x , 2 ) ) ) / 2 :
( sqrt ( 1 - pow ( - 2 * x + 2 , 2 ) ) + 1 ) / 2 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInElastic : function ( x ) {
return x === 0 ? 0 : x === 1 ? 1 :
- pow ( 2 , 10 * x - 10 ) * sin ( ( x * 10 - 10.75 ) * c4 ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutElastic : function ( x ) {
return x === 0 ? 0 : x === 1 ? 1 :
pow ( 2 , - 10 * x ) * sin ( ( x * 10 - 0.75 ) * c4 ) + 1 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutElastic : function ( x ) {
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
- ( pow ( 2 , 20 * x - 10 ) * sin ( ( 20 * x - 11.125 ) * c5 ) ) / 2 :
pow ( 2 , - 20 * x + 10 ) * sin ( ( 20 * x - 11.125 ) * c5 ) / 2 + 1 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInBack : function ( x ) {
return c3 * x * x * x - c1 * x * x ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutBack : function ( x ) {
return 1 + c3 * pow ( x - 1 , 3 ) + c1 * pow ( x - 1 , 2 ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInOutBack : function ( x ) {
return x < 0.5 ?
( pow ( 2 * x , 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
( pow ( 2 * x - 2 , 2 ) * ( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2 ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeInBounce : function ( x ) {
return 1 - bounceOut ( 1 - x ) ;
2015-01-13 00:29:40 +01:00
} ,
2018-10-20 02:22:38 +02:00
easeOutBounce : bounceOut ,
easeInOutBounce : function ( x ) {
return x < 0.5 ?
( 1 - bounceOut ( 1 - 2 * x ) ) / 2 :
( 1 + bounceOut ( 2 * x - 1 ) ) / 2 ;
2015-01-13 00:29:40 +01:00
}
} ) ;
2018-10-20 02:22:38 +02:00
} ) ;
2015-01-13 00:29:40 +01:00
2019-10-06 03:20:58 +02:00
/* ---- Fixbutton.coffee ---- */
2015-07-31 23:34:53 +02:00
( function ( ) {
var Fixbutton ;
Fixbutton = ( function ( ) {
function Fixbutton ( ) {
this . dragging = false ;
2015-09-27 02:08:53 +02:00
$ ( ".fixbutton-bg" ) . on ( "mouseover" , function ( ) {
$ ( ".fixbutton-bg" ) . stop ( ) . animate ( {
"scale" : 0.7
} , 800 , "easeOutElastic" ) ;
$ ( ".fixbutton-burger" ) . stop ( ) . animate ( {
"opacity" : 1.5 ,
"left" : 0
} , 800 , "easeOutElastic" ) ;
return $ ( ".fixbutton-text" ) . stop ( ) . animate ( {
"opacity" : 0 ,
"left" : 20
} , 300 , "easeOutCubic" ) ;
} ) ;
$ ( ".fixbutton-bg" ) . on ( "mouseout" , function ( ) {
if ( $ ( ".fixbutton" ) . hasClass ( "dragging" ) ) {
return true ;
}
$ ( ".fixbutton-bg" ) . stop ( ) . animate ( {
"scale" : 0.6
} , 300 , "easeOutCubic" ) ;
$ ( ".fixbutton-burger" ) . stop ( ) . animate ( {
"opacity" : 0 ,
"left" : - 20
} , 300 , "easeOutCubic" ) ;
return $ ( ".fixbutton-text" ) . stop ( ) . animate ( {
2018-10-30 04:47:19 +01:00
"opacity" : 0.9 ,
2015-09-27 02:08:53 +02:00
"left" : 0
} , 300 , "easeOutBack" ) ;
} ) ;
2015-07-31 23:34:53 +02:00
/ * $ ( " . f i x b u t t o n - b g " ) . o n " c l i c k " , - >
return false
* /
2015-09-27 02:08:53 +02:00
$ ( ".fixbutton-bg" ) . on ( "mousedown" , function ( ) { } ) ;
$ ( ".fixbutton-bg" ) . on ( "mouseup" , function ( ) { } ) ;
2015-07-31 23:34:53 +02:00
}
return Fixbutton ;
} ) ( ) ;
window . Fixbutton = Fixbutton ;
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- Infopanel.coffee ---- */
2019-02-02 00:12:50 +01:00
( function ( ) {
2019-02-05 15:54:32 +01:00
var Infopanel ,
bind = function ( fn , me ) { return function ( ) { return fn . apply ( me , arguments ) ; } ; } ;
2019-02-02 00:12:50 +01:00
Infopanel = ( function ( ) {
function Infopanel ( elem ) {
this . elem = elem ;
2019-02-05 15:54:32 +01:00
this . setAction = bind ( this . setAction , this ) ;
2019-02-09 13:56:21 +01:00
this . setClosedNum = bind ( this . setClosedNum , this ) ;
2019-02-05 15:54:32 +01:00
this . setTitle = bind ( this . setTitle , this ) ;
this . open = bind ( this . open , this ) ;
this . close = bind ( this . close , this ) ;
this . hide = bind ( this . hide , this ) ;
this . updateEvents = bind ( this . updateEvents , this ) ;
this . show = bind ( this . show , this ) ;
2019-02-02 00:12:50 +01:00
this . visible = false ;
}
2019-02-05 15:54:32 +01:00
Infopanel . prototype . show = function ( closed ) {
if ( closed == null ) {
closed = false ;
}
this . elem . addClass ( "visible" ) ;
if ( closed ) {
return this . close ( ) ;
} else {
return this . open ( ) ;
}
} ;
Infopanel . prototype . updateEvents = function ( ) {
this . elem . off ( "click" ) ;
this . elem . find ( ".close" ) . off ( "click" ) ;
if ( this . elem . hasClass ( "closed" ) ) {
return this . elem . on ( "click" , ( function ( _this ) {
return function ( ) {
_this . onOpened ( ) ;
return _this . open ( ) ;
} ;
} ) ( this ) ) ;
} else {
return this . elem . find ( ".close" ) . on ( "click" , ( function ( _this ) {
return function ( ) {
_this . onClosed ( ) ;
return _this . close ( ) ;
} ;
} ) ( this ) ) ;
}
2019-02-02 00:12:50 +01:00
} ;
Infopanel . prototype . hide = function ( ) {
return this . elem . removeClass ( "visible" ) ;
} ;
2019-02-05 15:54:32 +01:00
Infopanel . prototype . close = function ( ) {
this . elem . addClass ( "closed" ) ;
this . updateEvents ( ) ;
return false ;
} ;
Infopanel . prototype . open = function ( ) {
this . elem . removeClass ( "closed" ) ;
this . updateEvents ( ) ;
return false ;
} ;
2019-02-02 00:12:50 +01:00
Infopanel . prototype . setTitle = function ( line1 , line2 ) {
this . elem . find ( ".line-1" ) . text ( line1 ) ;
return this . elem . find ( ".line-2" ) . text ( line2 ) ;
} ;
2019-02-09 13:56:21 +01:00
Infopanel . prototype . setClosedNum = function ( num ) {
return this . elem . find ( ".closed-num" ) . text ( num ) ;
} ;
2019-02-02 00:12:50 +01:00
Infopanel . prototype . setAction = function ( title , func ) {
return this . elem . find ( ".button" ) . text ( title ) . off ( "click" ) . on ( "click" , func ) ;
} ;
return Infopanel ;
} ) ( ) ;
window . Infopanel = Infopanel ;
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- Loading.coffee ---- */
2015-01-13 00:29:40 +01:00
( function ( ) {
2020-01-04 16:54:20 +01:00
var Loading ,
slice = [ ] . slice ;
2015-01-13 00:29:40 +01:00
Loading = ( function ( ) {
2018-02-22 23:34:18 +01:00
function Loading ( wrapper ) {
this . wrapper = wrapper ;
2015-01-13 00:29:40 +01:00
if ( window . show _loadingscreen ) {
this . showScreen ( ) ;
}
2016-08-10 12:28:05 +02:00
this . timer _hide = null ;
2015-01-13 00:29:40 +01:00
}
2015-02-26 01:32:27 +01:00
Loading . prototype . setProgress = function ( percent ) {
2016-08-10 12:28:05 +02:00
if ( this . timer _hide ) {
clearInterval ( this . timer _hide ) ;
}
2020-01-04 16:54:20 +01:00
return RateLimit ( 500 , function ( ) {
2018-03-29 02:42:57 +02:00
return $ ( ".progressbar" ) . css ( {
"transform" : "scaleX(" + ( parseInt ( percent * 100 ) / 100 ) + ")"
} ) . css ( "opacity" , "1" ) . css ( "display" , "block" ) ;
2017-03-02 23:39:31 +01:00
} ) ;
2015-02-26 01:32:27 +01:00
} ;
Loading . prototype . hideProgress = function ( ) {
2020-01-04 16:54:20 +01:00
this . log ( "hideProgress" ) ;
2016-08-10 12:28:05 +02:00
return this . timer _hide = setTimeout ( ( ( function ( _this ) {
return function ( ) {
2018-03-29 02:42:57 +02:00
return $ ( ".progressbar" ) . css ( {
"transform" : "scaleX(1)"
} ) . css ( "opacity" , "0" ) . hideLater ( 1000 ) ;
2016-08-10 12:28:05 +02:00
} ;
} ) ( this ) ) , 300 ) ;
2015-02-26 01:32:27 +01:00
} ;
2015-01-13 00:29:40 +01:00
Loading . prototype . showScreen = function ( ) {
$ ( ".loadingscreen" ) . css ( "display" , "block" ) . addClassLater ( "ready" ) ;
this . screen _visible = true ;
return this . printLine ( " Connecting..." ) ;
} ;
2015-04-03 14:31:15 +02:00
Loading . prototype . showTooLarge = function ( site _info ) {
var button , line ;
2020-01-04 16:54:20 +01:00
this . log ( "Displaying large site confirmation" ) ;
2015-04-03 14:31:15 +02:00
if ( $ ( ".console .button-setlimit" ) . length === 0 ) {
line = this . printLine ( "Site size: <b>" + ( parseInt ( site _info . settings . size / 1024 / 1024 ) ) + "MB</b> is larger than default allowed " + ( parseInt ( site _info . size _limit ) ) + "MB" , "warning" ) ;
2016-11-18 20:07:26 +01:00
button = $ ( "<a href='#Set+limit' class='button button-setlimit'>" + ( "Open site and set size limit to " + site _info . next _size _limit + "MB" ) + "</a>" ) ;
2018-02-22 23:34:18 +01:00
button . on ( "click" , ( function ( _this ) {
return function ( ) {
2018-04-28 22:08:43 +02:00
button . addClass ( "loading" ) ;
2018-02-22 23:34:18 +01:00
return _this . wrapper . setSizeLimit ( site _info . next _size _limit ) ;
} ;
} ) ( this ) ) ;
2015-04-03 14:31:15 +02:00
line . after ( button ) ;
return setTimeout ( ( ( function ( _this ) {
return function ( ) {
return _this . printLine ( 'Ready.' ) ;
} ;
} ) ( this ) ) , 100 ) ;
}
} ;
2018-04-28 22:08:43 +02:00
Loading . prototype . showTrackerTorBridge = function ( server _info ) {
var button , line ;
if ( $ ( ".console .button-settrackerbridge" ) . length === 0 && ! server _info . tor _use _meek _bridges ) {
line = this . printLine ( "Tracker connection error detected." , "error" ) ;
button = $ ( "<a href='#Enable+Tor+bridges' class='button button-settrackerbridge'>" + "Use Tor meek bridges for tracker connections" + "</a>" ) ;
button . on ( "click" , ( function ( _this ) {
return function ( ) {
button . addClass ( "loading" ) ;
_this . wrapper . ws . cmd ( "configSet" , [ "tor_use_bridges" , "" ] ) ;
_this . wrapper . ws . cmd ( "configSet" , [ "trackers_proxy" , "tor" ] ) ;
2018-04-29 14:53:31 +02:00
_this . wrapper . ws . cmd ( "siteUpdate" , {
address : _this . wrapper . site _info . address ,
announce : true
} ) ;
2018-04-28 22:08:43 +02:00
_this . wrapper . reloadIframe ( ) ;
return false ;
} ;
} ) ( this ) ) ;
line . after ( button ) ;
if ( ! server _info . tor _has _meek _bridges ) {
button . addClass ( "disabled" ) ;
return this . printLine ( "No meek bridge support in your client, please <a href='https://github.com/HelloZeroNet/ZeroNet#how-to-join'>download the latest bundle</a>." , "warning" ) ;
}
}
} ;
2015-01-13 00:29:40 +01:00
Loading . prototype . hideScreen = function ( ) {
2020-01-04 16:54:20 +01:00
this . log ( "hideScreen" ) ;
2015-01-13 00:29:40 +01:00
if ( ! $ ( ".loadingscreen" ) . hasClass ( "done" ) ) {
if ( this . screen _visible ) {
$ ( ".loadingscreen" ) . addClass ( "done" ) . removeLater ( 2000 ) ;
} else {
$ ( ".loadingscreen" ) . remove ( ) ;
}
}
return this . screen _visible = false ;
} ;
Loading . prototype . print = function ( text , type ) {
var last _line ;
if ( type == null ) {
type = "normal" ;
}
if ( ! this . screen _visible ) {
return false ;
}
$ ( ".loadingscreen .console .cursor" ) . remove ( ) ;
last _line = $ ( ".loadingscreen .console .console-line:last-child" ) ;
if ( type === "error" ) {
text = "<span class='console-error'>" + text + "</span>" ;
}
return last _line . html ( last _line . html ( ) + text ) ;
} ;
Loading . prototype . printLine = function ( text , type ) {
2015-02-14 14:05:00 +01:00
var line ;
2015-01-13 00:29:40 +01:00
if ( type == null ) {
type = "normal" ;
}
if ( ! this . screen _visible ) {
return false ;
}
$ ( ".loadingscreen .console .cursor" ) . remove ( ) ;
if ( type === "error" ) {
text = "<span class='console-error'>" + text + "</span>" ;
} else {
text = text + "<span class='cursor'> </span>" ;
}
2015-02-14 14:05:00 +01:00
line = $ ( "<div class='console-line'>" + text + "</div>" ) . appendTo ( ".loadingscreen .console" ) ;
if ( type === "warning" ) {
line . addClass ( "console-warning" ) ;
}
return line ;
2015-01-13 00:29:40 +01:00
} ;
2020-01-04 16:54:20 +01:00
Loading . prototype . log = function ( ) {
var args ;
args = 1 <= arguments . length ? slice . call ( arguments , 0 ) : [ ] ;
return console . log . apply ( console , [ "[Loading]" ] . concat ( slice . call ( args ) ) ) ;
} ;
2015-01-13 00:29:40 +01:00
return Loading ;
} ) ( ) ;
window . Loading = Loading ;
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- Notifications.coffee ---- */
2015-01-13 00:29:40 +01:00
( function ( ) {
var Notifications ,
2017-07-18 20:55:53 +02:00
slice = [ ] . slice ;
2015-01-13 00:29:40 +01:00
Notifications = ( function ( ) {
2017-07-18 20:55:53 +02:00
function Notifications ( elem1 ) {
this . elem = elem1 ;
2015-01-13 00:29:40 +01:00
this ;
}
Notifications . prototype . test = function ( ) {
setTimeout ( ( ( function ( _this ) {
return function ( ) {
_this . add ( "connection" , "error" , "Connection lost to <b>UiServer</b> on <b>localhost</b>!" ) ;
return _this . add ( "message-Anyone" , "info" , "New from <b>Anyone</b>." ) ;
} ;
} ) ( this ) ) , 1000 ) ;
return setTimeout ( ( ( function ( _this ) {
return function ( ) {
return _this . add ( "connection" , "done" , "<b>UiServer</b> connection recovered." , 5000 ) ;
} ;
} ) ( this ) ) , 3000 ) ;
} ;
Notifications . prototype . add = function ( id , type , body , timeout ) {
2017-07-18 20:55:53 +02:00
var elem , i , len , ref , width ;
2015-01-13 00:29:40 +01:00
if ( timeout == null ) {
timeout = 0 ;
}
2017-10-21 11:01:57 +02:00
id = id . replace ( /[^A-Za-z0-9-]/g , "" ) ;
2017-07-18 20:55:53 +02:00
ref = $ ( ".notification-" + id ) ;
for ( i = 0 , len = ref . length ; i < len ; i ++ ) {
elem = ref [ i ] ;
2015-01-13 00:29:40 +01:00
this . close ( $ ( elem ) ) ;
}
elem = $ ( ".notification.template" , this . elem ) . clone ( ) . removeClass ( "template" ) ;
elem . addClass ( "notification-" + type ) . addClass ( "notification-" + id ) ;
2017-01-16 13:41:11 +01:00
if ( type === "progress" ) {
elem . addClass ( "notification-done" ) ;
}
2015-01-13 00:29:40 +01:00
if ( type === "error" ) {
$ ( ".notification-icon" , elem ) . html ( "!" ) ;
} else if ( type === "done" ) {
$ ( ".notification-icon" , elem ) . html ( "<div class='icon-success'></div>" ) ;
2017-01-16 13:41:11 +01:00
} else if ( type === "progress" ) {
$ ( ".notification-icon" , elem ) . html ( "<div class='icon-success'></div>" ) ;
2015-01-21 12:58:26 +01:00
} else if ( type === "ask" ) {
$ ( ".notification-icon" , elem ) . html ( "?" ) ;
2015-01-13 00:29:40 +01:00
} else {
$ ( ".notification-icon" , elem ) . html ( "i" ) ;
}
2015-01-21 12:58:26 +01:00
if ( typeof body === "string" ) {
2019-04-08 18:15:02 +02:00
$ ( ".body" , elem ) . html ( "<div class='message'><span class='multiline'>" + body + "</span></div>" ) ;
2015-01-21 12:58:26 +01:00
} else {
$ ( ".body" , elem ) . html ( "" ) . append ( body ) ;
}
2015-01-13 00:29:40 +01:00
elem . appendTo ( this . elem ) ;
if ( timeout ) {
$ ( ".close" , elem ) . remove ( ) ;
setTimeout ( ( ( function ( _this ) {
return function ( ) {
return _this . close ( elem ) ;
} ;
} ) ( this ) ) , timeout ) ;
}
2019-10-30 02:28:37 +01:00
width = Math . min ( elem . outerWidth ( ) + 50 , 580 ) ;
2015-01-13 00:29:40 +01:00
if ( ! timeout ) {
width += 20 ;
}
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
if ( elem . outerHeight ( ) > 55 ) {
elem . addClass ( "long" ) ;
}
2015-01-13 00:29:40 +01:00
elem . css ( {
"width" : "50px" ,
"transform" : "scale(0.01)"
} ) ;
elem . animate ( {
"scale" : 1
} , 800 , "easeOutElastic" ) ;
elem . animate ( {
"width" : width
} , 700 , "easeInOutCubic" ) ;
2017-07-28 15:36:49 +02:00
$ ( ".body" , elem ) . css ( {
2019-10-06 03:20:58 +02:00
"width" : width - 50
2017-07-28 15:36:49 +02:00
} ) ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
$ ( ".body" , elem ) . cssLater ( "box-shadow" , "0px 0px 5px rgba(0,0,0,0.1)" , 1000 ) ;
version 0.3.0, rev187, Trusted authorization sites support, --publish option on signing, cryptSign command line option, OpenSSL enabled on OSX, Crypto verify allows list of valid addresses, Option for version 2 json DB tables, DbCursor SELECT parameters bugfix, Add peer to site on ListModified, Download blind includes when new site added, Publish command better messages, Multi-threaded announce, New http Torrent trackers, Wait for dbschema.json on query, Handle json import errors, More compact writeJson storage command, Testcase for signing and verifying, Workaround to make non target=_top links work, More clean UiWebsocket command route, Send cert_user_id on siteinfo, Notify other local clients on local file modify, Option to wait for file download before sql query, File rules websocket API command, Cert add and select, set websocket API command, Put focus on innerframe, innerloaded wrapper api command to add hashtag, Allow more file error on big sites, Keep worker running after stuked on done task, New more stable openSSL layer that works on OSX, Noparallel parameter bugfix, RateLimit allowed again interval bugfix, Updater skips non-writeable files, Try to close openssl dll before update
2015-05-25 01:26:33 +02:00
$ ( ".close, .button" , elem ) . on ( "click" , ( function ( _this ) {
2015-01-13 00:29:40 +01:00
return function ( ) {
_this . close ( elem ) ;
return false ;
} ;
} ) ( this ) ) ;
2017-01-16 13:41:11 +01:00
$ ( ".select" , elem ) . on ( "click" , ( function ( _this ) {
2015-01-21 12:58:26 +01:00
return function ( ) {
version 0.3.0, rev187, Trusted authorization sites support, --publish option on signing, cryptSign command line option, OpenSSL enabled on OSX, Crypto verify allows list of valid addresses, Option for version 2 json DB tables, DbCursor SELECT parameters bugfix, Add peer to site on ListModified, Download blind includes when new site added, Publish command better messages, Multi-threaded announce, New http Torrent trackers, Wait for dbschema.json on query, Handle json import errors, More compact writeJson storage command, Testcase for signing and verifying, Workaround to make non target=_top links work, More clean UiWebsocket command route, Send cert_user_id on siteinfo, Notify other local clients on local file modify, Option to wait for file download before sql query, File rules websocket API command, Cert add and select, set websocket API command, Put focus on innerframe, innerloaded wrapper api command to add hashtag, Allow more file error on big sites, Keep worker running after stuked on done task, New more stable openSSL layer that works on OSX, Noparallel parameter bugfix, RateLimit allowed again interval bugfix, Updater skips non-writeable files, Try to close openssl dll before update
2015-05-25 01:26:33 +02:00
return _this . close ( elem ) ;
2015-01-21 12:58:26 +01:00
} ;
} ) ( this ) ) ;
2018-03-06 12:03:10 +01:00
$ ( "input" , elem ) . on ( "keyup" , ( function ( _this ) {
return function ( e ) {
if ( e . keyCode === 13 ) {
return _this . close ( elem ) ;
}
} ;
} ) ( this ) ) ;
2017-01-16 13:41:11 +01:00
return elem ;
2015-01-13 00:29:40 +01:00
} ;
Notifications . prototype . close = function ( elem ) {
elem . stop ( ) . animate ( {
"width" : 0 ,
"opacity" : 0
} , 700 , "easeInOutCubic" ) ;
return elem . slideUp ( 300 , ( function ( ) {
return elem . remove ( ) ;
} ) ) ;
} ;
Notifications . prototype . log = function ( ) {
var args ;
2017-07-18 20:55:53 +02:00
args = 1 <= arguments . length ? slice . call ( arguments , 0 ) : [ ] ;
return console . log . apply ( console , [ "[Notifications]" ] . concat ( slice . call ( args ) ) ) ;
2015-01-13 00:29:40 +01:00
} ;
return Notifications ;
} ) ( ) ;
window . Notifications = Notifications ;
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- Wrapper.coffee ---- */
2015-01-13 00:29:40 +01:00
( function ( ) {
version 0.3.0, rev187, Trusted authorization sites support, --publish option on signing, cryptSign command line option, OpenSSL enabled on OSX, Crypto verify allows list of valid addresses, Option for version 2 json DB tables, DbCursor SELECT parameters bugfix, Add peer to site on ListModified, Download blind includes when new site added, Publish command better messages, Multi-threaded announce, New http Torrent trackers, Wait for dbschema.json on query, Handle json import errors, More compact writeJson storage command, Testcase for signing and verifying, Workaround to make non target=_top links work, More clean UiWebsocket command route, Send cert_user_id on siteinfo, Notify other local clients on local file modify, Option to wait for file download before sql query, File rules websocket API command, Cert add and select, set websocket API command, Put focus on innerframe, innerloaded wrapper api command to add hashtag, Allow more file error on big sites, Keep worker running after stuked on done task, New more stable openSSL layer that works on OSX, Noparallel parameter bugfix, RateLimit allowed again interval bugfix, Updater skips non-writeable files, Try to close openssl dll before update
2015-05-25 01:26:33 +02:00
var Wrapper , origin , proto , ws _url ,
2017-04-12 17:36:50 +02:00
bind = function ( fn , me ) { return function ( ) { return fn . apply ( me , arguments ) ; } ; } ,
indexOf = [ ] . indexOf || function ( item ) { for ( var i = 0 , l = this . length ; i < l ; i ++ ) { if ( i in this && this [ i ] === item ) return i ; } return - 1 ; } ,
slice = [ ] . slice ;
2015-01-13 00:29:40 +01:00
Wrapper = ( function ( ) {
function Wrapper ( ws _url ) {
2018-04-28 22:08:43 +02:00
this . reloadIframe = bind ( this . reloadIframe , this ) ;
2017-04-12 17:36:50 +02:00
this . setSizeLimit = bind ( this . setSizeLimit , this ) ;
2019-02-02 00:12:50 +01:00
this . updateModifiedPanel = bind ( this . updateModifiedPanel , this ) ;
this . sitePublish = bind ( this . sitePublish , this ) ;
this . siteSign = bind ( this . siteSign , this ) ;
2018-02-21 03:15:04 +01:00
this . onWrapperLoad = bind ( this . onWrapperLoad , this ) ;
this . onPageLoad = bind ( this . onPageLoad , this ) ;
2017-04-12 17:36:50 +02:00
this . onCloseWebsocket = bind ( this . onCloseWebsocket , this ) ;
this . onOpenWebsocket = bind ( this . onOpenWebsocket , this ) ;
2018-02-21 03:15:04 +01:00
this . handleMessage = bind ( this . handleMessage , this ) ;
this . cmd = bind ( this . cmd , this ) ;
2017-04-12 17:36:50 +02:00
this . onMessageInner = bind ( this . onMessageInner , this ) ;
2019-07-01 16:26:37 +02:00
this . handleMessageWebsocket = bind ( this . handleMessageWebsocket , this ) ;
2017-04-12 17:36:50 +02:00
this . onMessageWebsocket = bind ( this . onMessageWebsocket , this ) ;
2018-02-21 03:15:04 +01:00
this . verifyEvent = bind ( this . verifyEvent , this ) ;
2015-01-13 00:29:40 +01:00
this . log ( "Created!" ) ;
2018-02-22 23:34:18 +01:00
this . loading = new Loading ( this ) ;
2015-01-13 00:29:40 +01:00
this . notifications = new Notifications ( $ ( ".notifications" ) ) ;
2019-02-02 00:12:50 +01:00
this . infopanel = new Infopanel ( $ ( ".infopanel" ) ) ;
2019-02-05 15:54:32 +01:00
this . infopanel . onClosed = ( function ( _this ) {
return function ( ) {
return _this . ws . cmd ( "siteSetSettingsValue" , [ "modified_files_notification" , false ] ) ;
} ;
} ) ( this ) ;
this . infopanel . onOpened = ( function ( _this ) {
return function ( ) {
return _this . ws . cmd ( "siteSetSettingsValue" , [ "modified_files_notification" , true ] ) ;
} ;
} ) ( this ) ;
2015-07-31 23:34:53 +02:00
this . fixbutton = new Fixbutton ( ) ;
2015-01-13 00:29:40 +01:00
window . addEventListener ( "message" , this . onMessageInner , false ) ;
this . inner = document . getElementById ( "inner-iframe" ) . contentWindow ;
this . ws = new ZeroWebsocket ( ws _url ) ;
this . ws . next _message _id = 1000000 ;
this . ws . onOpen = this . onOpenWebsocket ;
this . ws . onClose = this . onCloseWebsocket ;
this . ws . onMessage = this . onMessageWebsocket ;
this . ws . connect ( ) ;
this . ws _error = null ;
2018-02-21 03:15:04 +01:00
this . next _cmd _message _id = - 1 ;
2015-01-13 00:29:40 +01:00
this . site _info = null ;
2018-04-28 22:08:43 +02:00
this . server _info = null ;
version 0.2.8, Namecoin domains using internal resolver site, --disable_zeromq option to skip backward compatiblity layer and save some memory, connectionserver firstchar error fixes, missing unpacker crash fix, sitemanager class to allow extensions, add loaded plugin list to websocket api, faster content publishing, mark updating file as bad, remove coppersurfer tracker add eddie4, internal server error with error displaying, allow site domains in UiRequest, better progress bar, wait for siteinfo before before using localstorage, csslater hide only if opacity is 0
2015-03-30 23:44:29 +02:00
this . event _site _info = $ . Deferred ( ) ;
2015-01-13 00:29:40 +01:00
this . inner _loaded = false ;
this . inner _ready = false ;
this . wrapperWsInited = false ;
this . site _error = null ;
version 0.2.8, Namecoin domains using internal resolver site, --disable_zeromq option to skip backward compatiblity layer and save some memory, connectionserver firstchar error fixes, missing unpacker crash fix, sitemanager class to allow extensions, add loaded plugin list to websocket api, faster content publishing, mark updating file as bad, remove coppersurfer tracker add eddie4, internal server error with error displaying, allow site domains in UiRequest, better progress bar, wait for siteinfo before before using localstorage, csslater hide only if opacity is 0
2015-03-30 23:44:29 +02:00
this . address = null ;
2016-03-26 00:20:53 +01:00
this . opener _tested = false ;
2018-04-28 22:08:43 +02:00
this . announcer _line = null ;
2019-04-27 17:19:16 +02:00
this . web _notifications = { } ;
2018-06-28 02:39:46 +02:00
this . allowed _event _constructors = [ window . MouseEvent , window . KeyboardEvent , window . PointerEvent ] ;
2018-02-21 03:15:04 +01:00
window . onload = this . onPageLoad ;
2016-02-27 21:39:36 +01:00
window . onhashchange = ( function ( _this ) {
return function ( e ) {
2015-01-27 22:37:13 +01:00
var src ;
_this . log ( "Hashchange" , window . location . hash ) ;
version 0.2.0, new lib for bitcoin ecc, dont display or track notify errors, dont reload again within 1 sec, null peer ip fix, signingmoved to ContentManager, content.json include support, content.json multisig ready, content.json proper bitcoincore compatible signing, content.json include permissions, multithreaded publish, publish timeout 60s, no exception on invalid bitcoin address, testcase for new lib, bip32 based persite privatekey generation, multiuser ready, simple json database query command, websocket api fileGet, wrapper loading title stuck bugfix
2015-02-09 02:09:02 +01:00
if ( window . location . hash ) {
src = $ ( "#inner-iframe" ) . attr ( "src" ) . replace ( /#.*/ , "" ) + window . location . hash ;
return $ ( "#inner-iframe" ) . attr ( "src" , src ) ;
}
2015-01-27 22:37:13 +01:00
} ;
2016-02-27 21:39:36 +01:00
} ) ( this ) ;
window . onpopstate = ( function ( _this ) {
return function ( e ) {
return _this . sendInner ( {
2016-05-16 22:27:17 +02:00
"cmd" : "wrapperPopState" ,
"params" : {
2016-02-27 21:39:36 +01:00
"href" : document . location . href ,
"state" : e . state
}
} ) ;
} ;
} ) ( this ) ;
version 0.3.0, rev187, Trusted authorization sites support, --publish option on signing, cryptSign command line option, OpenSSL enabled on OSX, Crypto verify allows list of valid addresses, Option for version 2 json DB tables, DbCursor SELECT parameters bugfix, Add peer to site on ListModified, Download blind includes when new site added, Publish command better messages, Multi-threaded announce, New http Torrent trackers, Wait for dbschema.json on query, Handle json import errors, More compact writeJson storage command, Testcase for signing and verifying, Workaround to make non target=_top links work, More clean UiWebsocket command route, Send cert_user_id on siteinfo, Notify other local clients on local file modify, Option to wait for file download before sql query, File rules websocket API command, Cert add and select, set websocket API command, Put focus on innerframe, innerloaded wrapper api command to add hashtag, Allow more file error on big sites, Keep worker running after stuked on done task, New more stable openSSL layer that works on OSX, Noparallel parameter bugfix, RateLimit allowed again interval bugfix, Updater skips non-writeable files, Try to close openssl dll before update
2015-05-25 01:26:33 +02:00
$ ( "#inner-iframe" ) . focus ( ) ;
2015-01-13 00:29:40 +01:00
}
2018-02-21 03:15:04 +01:00
Wrapper . prototype . verifyEvent = function ( allowed _target , e ) {
var ref ;
if ( ! e . originalEvent . isTrusted ) {
throw "Event not trusted" ;
}
if ( ref = e . originalEvent . constructor , indexOf . call ( this . allowed _event _constructors , ref ) < 0 ) {
2018-06-28 02:39:46 +02:00
throw "Invalid event constructor: " + e . constructor + " not in " + ( JSON . stringify ( this . allowed _event _constructors ) ) ;
2018-02-21 03:15:04 +01:00
}
if ( e . originalEvent . currentTarget !== allowed _target [ 0 ] ) {
throw "Invalid event target: " + e . originalEvent . currentTarget + " != " + allowed _target [ 0 ] ;
}
} ;
2015-01-13 00:29:40 +01:00
Wrapper . prototype . onMessageWebsocket = function ( e ) {
2019-07-01 16:26:37 +02:00
var message ;
2015-01-13 00:29:40 +01:00
message = JSON . parse ( e . data ) ;
2019-07-01 16:26:37 +02:00
return this . handleMessageWebsocket ( message ) ;
} ;
Wrapper . prototype . handleMessageWebsocket = function ( message ) {
var cmd , id , ref , script _tag , type ;
2015-01-13 00:29:40 +01:00
cmd = message . cmd ;
if ( cmd === "response" ) {
if ( this . ws . waiting _cb [ message . to ] != null ) {
return this . ws . waiting _cb [ message . to ] ( message . result ) ;
} else {
return this . sendInner ( message ) ;
}
} else if ( cmd === "notification" ) {
2015-08-16 11:51:00 +02:00
type = message . params [ 0 ] ;
2017-07-18 20:55:53 +02:00
id = "notification-ws-" + message . id ;
2017-04-12 17:36:50 +02:00
if ( indexOf . call ( message . params [ 0 ] , "-" ) >= 0 ) {
ref = message . params [ 0 ] . split ( "-" ) , id = ref [ 0 ] , type = ref [ 1 ] ;
2015-08-16 11:51:00 +02:00
}
return this . notifications . add ( id , type , message . params [ 1 ] , message . params [ 2 ] ) ;
2017-01-16 13:41:11 +01:00
} else if ( cmd === "progress" ) {
return this . actionProgress ( message ) ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
} else if ( cmd === "prompt" ) {
2017-05-11 17:54:48 +02:00
return this . displayPrompt ( message . params [ 0 ] , message . params [ 1 ] , message . params [ 2 ] , message . params [ 3 ] , ( function ( _this ) {
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
return function ( res ) {
return _this . ws . response ( message . id , res ) ;
} ;
} ) ( this ) ) ;
2016-04-09 19:49:12 +02:00
} else if ( cmd === "confirm" ) {
return this . displayConfirm ( message . params [ 0 ] , message . params [ 1 ] , ( function ( _this ) {
return function ( res ) {
return _this . ws . response ( message . id , res ) ;
} ;
} ) ( this ) ) ;
2015-01-13 00:29:40 +01:00
} else if ( cmd === "setSiteInfo" ) {
this . sendInner ( message ) ;
version 0.2.8, Namecoin domains using internal resolver site, --disable_zeromq option to skip backward compatiblity layer and save some memory, connectionserver firstchar error fixes, missing unpacker crash fix, sitemanager class to allow extensions, add loaded plugin list to websocket api, faster content publishing, mark updating file as bad, remove coppersurfer tracker add eddie4, internal server error with error displaying, allow site domains in UiRequest, better progress bar, wait for siteinfo before before using localstorage, csslater hide only if opacity is 0
2015-03-30 23:44:29 +02:00
if ( message . params . address === this . address ) {
2016-08-10 12:28:05 +02:00
this . setSiteInfo ( message . params ) ;
2015-01-13 00:29:40 +01:00
}
2016-08-10 12:28:05 +02:00
return this . updateProgress ( message . params ) ;
2018-04-28 22:08:43 +02:00
} else if ( cmd === "setAnnouncerInfo" ) {
this . sendInner ( message ) ;
if ( message . params . address === this . address ) {
this . setAnnouncerInfo ( message . params ) ;
}
return this . updateProgress ( message . params ) ;
2015-08-16 11:51:00 +02:00
} else if ( cmd === "error" ) {
return this . notifications . add ( "notification-" + message . id , "error" , message . params , 0 ) ;
2015-02-20 01:37:12 +01:00
} else if ( cmd === "updating" ) {
2019-04-09 15:06:33 +02:00
this . log ( "Updating: Closing websocket" ) ;
2015-02-20 01:37:12 +01:00
this . ws . ws . close ( ) ;
return this . ws . onCloseWebsocket ( null , 4000 ) ;
2018-11-26 00:05:17 +01:00
} else if ( cmd === "redirect" ) {
return window . top . location = message . params ;
2017-11-29 13:48:30 +01:00
} else if ( cmd === "injectHtml" ) {
return $ ( "body" ) . append ( message . params ) ;
2018-11-26 00:05:17 +01:00
} else if ( cmd === "injectScript" ) {
script _tag = $ ( "<script>" ) ;
script _tag . attr ( "nonce" , this . script _nonce ) ;
script _tag . html ( message . params ) ;
return document . head . appendChild ( script _tag [ 0 ] ) ;
2015-01-13 00:29:40 +01:00
} else {
return this . sendInner ( message ) ;
}
} ;
Wrapper . prototype . onMessageInner = function ( e ) {
2018-02-21 03:15:04 +01:00
var message ;
2016-03-26 00:20:53 +01:00
if ( ! window . postmessage _nonce _security && this . opener _tested === false ) {
if ( window . opener && window . opener !== window ) {
2016-02-23 01:36:47 +01:00
this . log ( "Opener present" , window . opener ) ;
this . displayOpenerDialog ( ) ;
return false ;
} else {
2016-03-26 00:20:53 +01:00
this . opener _tested = true ;
2016-02-23 01:36:47 +01:00
}
}
2015-01-13 00:29:40 +01:00
message = e . data ;
Rev957, Sidebar displays onion peers in graph, Sidebar display bad file retry number, Sidebar site Update/Pause/Delete, Ratelimit sidebar update, Encoded typo, Fix onion findHashId, More retry for bad files, Log file path errors, Testcase for self findhashIds, Testcase for Tor findHashId, Better Tor version parse, UiWebsocket callback on update/pause/resume/delete, Skip invalid postMessage messages
2016-03-09 00:48:57 +01:00
if ( ! message . cmd ) {
2017-08-09 14:21:09 +02:00
this . log ( "Invalid message:" , message ) ;
Rev957, Sidebar displays onion peers in graph, Sidebar display bad file retry number, Sidebar site Update/Pause/Delete, Ratelimit sidebar update, Encoded typo, Fix onion findHashId, More retry for bad files, Log file path errors, Testcase for self findhashIds, Testcase for Tor findHashId, Better Tor version parse, UiWebsocket callback on update/pause/resume/delete, Skip invalid postMessage messages
2016-03-09 00:48:57 +01:00
return false ;
}
Rev900, Sidebar filestats bar width round fix, Sidebar WebGL not supported error, Sidebar optimalizations, Trayicon gray shadow, Trim end of line whitespace from json files, Fix testweb testcase, Implement experimental postMessage nonce security, Return None when testing external ip, Window opener security check and message, Increase timeout for large files
2016-02-10 02:30:04 +01:00
if ( window . postmessage _nonce _security && message . wrapper _nonce !== window . wrapper _nonce ) {
this . log ( "Message nonce error:" , message . wrapper _nonce , '!=' , window . wrapper _nonce ) ;
return ;
}
2018-02-21 03:15:04 +01:00
return this . handleMessage ( message ) ;
} ;
Wrapper . prototype . cmd = function ( cmd , params , cb ) {
var message ;
if ( params == null ) {
params = { } ;
}
if ( cb == null ) {
cb = null ;
}
message = { } ;
message . cmd = cmd ;
message . params = params ;
message . id = this . next _cmd _message _id ;
if ( cb ) {
this . ws . waiting _cb [ message . id ] = cb ;
}
this . next _cmd _message _id -= 1 ;
return this . handleMessage ( message ) ;
} ;
Wrapper . prototype . handleMessage = function ( message ) {
2019-02-05 15:54:32 +01:00
var cmd , query , ref ;
2015-01-13 00:29:40 +01:00
cmd = message . cmd ;
if ( cmd === "innerReady" ) {
this . inner _ready = true ;
if ( this . ws . ws . readyState === 1 && ! this . wrapperWsInited ) {
this . sendInner ( {
"cmd" : "wrapperOpenedWebsocket"
} ) ;
return this . wrapperWsInited = true ;
}
2017-02-16 19:04:00 +01:00
} else if ( cmd === "innerLoaded" || cmd === "wrapperInnerLoaded" ) {
version 0.3.0, rev187, Trusted authorization sites support, --publish option on signing, cryptSign command line option, OpenSSL enabled on OSX, Crypto verify allows list of valid addresses, Option for version 2 json DB tables, DbCursor SELECT parameters bugfix, Add peer to site on ListModified, Download blind includes when new site added, Publish command better messages, Multi-threaded announce, New http Torrent trackers, Wait for dbschema.json on query, Handle json import errors, More compact writeJson storage command, Testcase for signing and verifying, Workaround to make non target=_top links work, More clean UiWebsocket command route, Send cert_user_id on siteinfo, Notify other local clients on local file modify, Option to wait for file download before sql query, File rules websocket API command, Cert add and select, set websocket API command, Put focus on innerframe, innerloaded wrapper api command to add hashtag, Allow more file error on big sites, Keep worker running after stuked on done task, New more stable openSSL layer that works on OSX, Noparallel parameter bugfix, RateLimit allowed again interval bugfix, Updater skips non-writeable files, Try to close openssl dll before update
2015-05-25 01:26:33 +02:00
if ( window . location . hash ) {
$ ( "#inner-iframe" ) [ 0 ] . src += window . location . hash ;
return this . log ( "Added hash to location" , $ ( "#inner-iframe" ) [ 0 ] . src ) ;
}
2015-01-13 00:29:40 +01:00
} else if ( cmd === "wrapperNotification" ) {
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
return this . actionNotification ( message ) ;
2015-01-21 12:58:26 +01:00
} else if ( cmd === "wrapperConfirm" ) {
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
return this . actionConfirm ( message ) ;
2015-01-24 19:14:29 +01:00
} else if ( cmd === "wrapperPrompt" ) {
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
return this . actionPrompt ( message ) ;
2017-01-16 13:41:11 +01:00
} else if ( cmd === "wrapperProgress" ) {
return this . actionProgress ( message ) ;
2015-02-10 00:08:25 +01:00
} else if ( cmd === "wrapperSetViewport" ) {
return this . actionSetViewport ( message ) ;
2016-11-22 02:06:32 +01:00
} else if ( cmd === "wrapperSetTitle" ) {
return $ ( "head title" ) . text ( message . params ) ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
} else if ( cmd === "wrapperReload" ) {
return this . actionReload ( message ) ;
2015-02-17 01:48:15 +01:00
} else if ( cmd === "wrapperGetLocalStorage" ) {
return this . actionGetLocalStorage ( message ) ;
} else if ( cmd === "wrapperSetLocalStorage" ) {
return this . actionSetLocalStorage ( message ) ;
Version 0.3.4, Rev656, CryptMessage plugin for AES and ECIES encryption, Added pyelliptic lib for OpenSSSL based encryption methods, Test CryptMessage plugin, Force reload content.json before signing and after write, Escaped Sql IN queries support, Test Sql parameter escaping, ui_websocket Test fixture, Plugin testing support, Always return websocket errors as dict, Wait for file on weboscket fileGet command if its already in bad_files queue, PushState and ReplaceState url manipulation support in wrapper API, Per auth-address localstorage, Longer timeout for udp tracker query
2015-12-10 21:36:20 +01:00
} else if ( cmd === "wrapperPushState" ) {
query = this . toRelativeQuery ( message . params [ 2 ] ) ;
return window . history . pushState ( message . params [ 0 ] , message . params [ 1 ] , query ) ;
} else if ( cmd === "wrapperReplaceState" ) {
query = this . toRelativeQuery ( message . params [ 2 ] ) ;
return window . history . replaceState ( message . params [ 0 ] , message . params [ 1 ] , query ) ;
2016-02-27 21:39:36 +01:00
} else if ( cmd === "wrapperGetState" ) {
return this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
"result" : window . history . state
} ) ;
2017-08-15 02:40:38 +02:00
} else if ( cmd === "wrapperGetAjaxKey" ) {
return this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
"result" : window . ajax _key
} ) ;
2016-03-19 18:05:08 +01:00
} else if ( cmd === "wrapperOpenWindow" ) {
return this . actionOpenWindow ( message . params ) ;
2016-08-10 12:28:05 +02:00
} else if ( cmd === "wrapperPermissionAdd" ) {
return this . actionPermissionAdd ( message ) ;
2016-12-30 19:32:36 +01:00
} else if ( cmd === "wrapperRequestFullscreen" ) {
return this . actionRequestFullscreen ( ) ;
2019-04-27 17:19:16 +02:00
} else if ( cmd === "wrapperWebNotification" ) {
return this . actionWebNotification ( message ) ;
} else if ( cmd === "wrapperCloseWebNotification" ) {
return this . actionCloseWebNotification ( message ) ;
2015-01-13 00:29:40 +01:00
} else {
2015-02-14 14:05:00 +01:00
if ( message . id < 1000000 ) {
2019-02-05 15:55:12 +01:00
if ( message . cmd === "fileWrite" && ! this . modified _panel _updater _timer && ( typeof site _info !== "undefined" && site _info !== null ? ( ref = site _info . settings ) != null ? ref . own : void 0 : void 0 ) ) {
2019-02-02 00:12:50 +01:00
this . modified _panel _updater _timer = setTimeout ( ( ( function ( _this ) {
return function ( ) {
_this . updateModifiedPanel ( ) ;
return _this . modified _panel _updater _timer = null ;
} ;
} ) ( this ) ) , 1000 ) ;
}
2015-02-14 14:05:00 +01:00
return this . ws . send ( message ) ;
} else {
return this . log ( "Invalid inner message id" ) ;
}
2015-01-13 00:29:40 +01:00
}
} ;
Version 0.3.4, Rev656, CryptMessage plugin for AES and ECIES encryption, Added pyelliptic lib for OpenSSSL based encryption methods, Test CryptMessage plugin, Force reload content.json before signing and after write, Escaped Sql IN queries support, Test Sql parameter escaping, ui_websocket Test fixture, Plugin testing support, Always return websocket errors as dict, Wait for file on weboscket fileGet command if its already in bad_files queue, PushState and ReplaceState url manipulation support in wrapper API, Per auth-address localstorage, Longer timeout for udp tracker query
2015-12-10 21:36:20 +01:00
Wrapper . prototype . toRelativeQuery = function ( query ) {
var back ;
2016-02-27 21:39:36 +01:00
if ( query == null ) {
query = null ;
}
if ( query === null ) {
query = window . location . search ;
}
Version 0.3.4, Rev656, CryptMessage plugin for AES and ECIES encryption, Added pyelliptic lib for OpenSSSL based encryption methods, Test CryptMessage plugin, Force reload content.json before signing and after write, Escaped Sql IN queries support, Test Sql parameter escaping, ui_websocket Test fixture, Plugin testing support, Always return websocket errors as dict, Wait for file on weboscket fileGet command if its already in bad_files queue, PushState and ReplaceState url manipulation support in wrapper API, Per auth-address localstorage, Longer timeout for udp tracker query
2015-12-10 21:36:20 +01:00
back = window . location . pathname ;
2016-12-14 00:25:47 +01:00
if ( back . match ( /^\/[^\/]+$/ ) ) {
Version 0.3.4, Rev656, CryptMessage plugin for AES and ECIES encryption, Added pyelliptic lib for OpenSSSL based encryption methods, Test CryptMessage plugin, Force reload content.json before signing and after write, Escaped Sql IN queries support, Test Sql parameter escaping, ui_websocket Test fixture, Plugin testing support, Always return websocket errors as dict, Wait for file on weboscket fileGet command if its already in bad_files queue, PushState and ReplaceState url manipulation support in wrapper API, Per auth-address localstorage, Longer timeout for udp tracker query
2015-12-10 21:36:20 +01:00
back += "/" ;
}
2017-05-06 17:27:49 +02:00
if ( query . startsWith ( "#" ) ) {
back = query ;
} else if ( query . replace ( "?" , "" ) ) {
Version 0.3.4, Rev656, CryptMessage plugin for AES and ECIES encryption, Added pyelliptic lib for OpenSSSL based encryption methods, Test CryptMessage plugin, Force reload content.json before signing and after write, Escaped Sql IN queries support, Test Sql parameter escaping, ui_websocket Test fixture, Plugin testing support, Always return websocket errors as dict, Wait for file on weboscket fileGet command if its already in bad_files queue, PushState and ReplaceState url manipulation support in wrapper API, Per auth-address localstorage, Longer timeout for udp tracker query
2015-12-10 21:36:20 +01:00
back += "?" + query . replace ( "?" , "" ) ;
}
return back ;
} ;
2016-02-23 01:36:47 +01:00
Wrapper . prototype . displayOpenerDialog = function ( ) {
var elem ;
elem = $ ( "<div class='opener-overlay'><div class='dialog'>You have opened this page by clicking on a link. Please, confirm if you want to load this site.<a href='?' target='_blank' class='button'>Open site</a></div></div>" ) ;
elem . find ( 'a' ) . on ( "click" , function ( ) {
window . open ( "?" , "_blank" ) ;
window . close ( ) ;
return false ;
} ) ;
return $ ( "body" ) . prepend ( elem ) ;
} ;
2016-03-19 18:05:08 +01:00
Wrapper . prototype . actionOpenWindow = function ( params ) {
var w ;
if ( typeof params === "string" ) {
w = window . open ( ) ;
w . opener = null ;
return w . location = params ;
} else {
2016-03-20 21:33:13 +01:00
w = window . open ( null , params [ 1 ] , params [ 2 ] ) ;
2016-03-19 18:05:08 +01:00
w . opener = null ;
return w . location = params [ 0 ] ;
}
} ;
2016-12-30 19:32:36 +01:00
Wrapper . prototype . actionRequestFullscreen = function ( ) {
var elem , request _fullscreen ;
2018-09-07 11:33:40 +02:00
elem = document . getElementById ( "inner-iframe" ) ;
request _fullscreen = elem . requestFullScreen || elem . webkitRequestFullscreen || elem . mozRequestFullScreen || elem . msRequestFullScreen ;
return request _fullscreen . call ( elem ) ;
2016-12-30 19:32:36 +01:00
} ;
2019-04-27 17:19:16 +02:00
Wrapper . prototype . actionWebNotification = function ( message ) {
2019-04-17 11:39:00 +02:00
return $ . when ( this . event _site _info ) . done ( ( function ( _this ) {
return function ( ) {
var res ;
if ( Notification . permission === "granted" ) {
2019-04-27 17:19:16 +02:00
return _this . displayWebNotification ( message ) ;
2019-04-17 11:39:00 +02:00
} else if ( Notification . permission === "denied" ) {
res = {
2019-04-27 17:19:16 +02:00
"error" : "Web notifications are disabled by the user"
2019-04-17 11:39:00 +02:00
} ;
return _this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
"result" : res
} ) ;
} else {
return Notification . requestPermission ( ) . then ( function ( permission ) {
if ( permission === "granted" ) {
2019-04-27 17:19:16 +02:00
return _this . displayWebNotification ( message ) ;
2019-04-17 11:39:00 +02:00
}
} ) ;
}
} ;
} ) ( this ) ) ;
} ;
2019-04-27 17:19:16 +02:00
Wrapper . prototype . actionCloseWebNotification = function ( message ) {
2019-04-17 18:56:19 +02:00
return $ . when ( this . event _site _info ) . done ( ( function ( _this ) {
return function ( ) {
2019-04-27 17:19:16 +02:00
var id ;
2019-04-17 18:56:19 +02:00
id = message . params [ 0 ] ;
2019-04-27 17:19:16 +02:00
return _this . web _notifications [ id ] . close ( ) ;
2019-04-17 18:56:19 +02:00
} ;
} ) ( this ) ) ;
} ;
2019-04-27 17:19:16 +02:00
Wrapper . prototype . displayWebNotification = function ( message ) {
2019-04-17 11:39:00 +02:00
var id , notification , options , title ;
title = message . params [ 0 ] ;
id = message . params [ 1 ] ;
options = message . params [ 2 ] ;
notification = new Notification ( title , options ) ;
2019-04-27 17:19:16 +02:00
this . web _notifications [ id ] = notification ;
2019-04-17 11:39:00 +02:00
notification . onshow = ( function ( _this ) {
return function ( ) {
return _this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
"result" : "ok"
} ) ;
} ;
} ) ( this ) ;
notification . onclick = ( function ( _this ) {
return function ( e ) {
if ( ! options . focus _tab ) {
e . preventDefault ( ) ;
}
return _this . sendInner ( {
2019-04-27 17:19:16 +02:00
"cmd" : "webNotificationClick" ,
2019-04-17 11:39:00 +02:00
"params" : {
"id" : id
}
} ) ;
} ;
} ) ( this ) ;
return notification . onclose = ( function ( _this ) {
return function ( ) {
2019-04-17 18:56:19 +02:00
_this . sendInner ( {
2019-04-27 17:19:16 +02:00
"cmd" : "webNotificationClose" ,
2019-04-17 11:39:00 +02:00
"params" : {
"id" : id
}
} ) ;
2019-04-27 17:19:16 +02:00
return delete _this . web _notifications [ id ] ;
2019-04-17 11:39:00 +02:00
} ;
} ) ( this ) ;
} ;
2016-08-10 12:28:05 +02:00
Wrapper . prototype . actionPermissionAdd = function ( message ) {
var permission ;
permission = message . params ;
2018-02-21 03:15:04 +01:00
return $ . when ( this . event _site _info ) . done ( ( function ( _this ) {
return function ( ) {
if ( indexOf . call ( _this . site _info . settings . permissions , permission ) >= 0 ) {
return false ;
}
return _this . ws . cmd ( "permissionDetails" , permission , function ( permission _details ) {
return _this . displayConfirm ( "This site requests permission:" + ( " <b>" + ( _this . toHtmlSafe ( permission ) ) + "</b>" ) + ( "<br><small style='color: #4F4F4F'>" + permission _details + "</small>" ) , "Grant" , function ( ) {
return _this . ws . cmd ( "permissionAdd" , permission , function ( res ) {
return _this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
"result" : res
} ) ;
2017-10-17 17:02:56 +02:00
} ) ;
2016-08-10 12:28:05 +02:00
} ) ;
} ) ;
} ;
} ) ( this ) ) ;
} ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
Wrapper . prototype . actionNotification = function ( message ) {
var body ;
message . params = this . toHtmlSafe ( message . params ) ;
body = $ ( "<span class='message'>" + message . params [ 1 ] + "</span>" ) ;
return this . notifications . add ( "notification-" + message . id , message . params [ 0 ] , body , message . params [ 2 ] ) ;
} ;
2018-03-06 12:03:10 +01:00
Wrapper . prototype . displayConfirm = function ( body , captions , cb ) {
var button , buttons , caption , fn , i , j , len ;
body = $ ( "<span class='message-outer'><span class='message'>" + body + "</span></span>" ) ;
2017-05-18 03:05:02 +02:00
buttons = $ ( "<span class='buttons'></span>" ) ;
2017-05-11 17:54:48 +02:00
if ( ! ( captions instanceof Array ) ) {
captions = [ captions ] ;
}
2018-02-21 03:15:04 +01:00
fn = ( function ( _this ) {
return function ( button ) {
return button . on ( "click" , function ( e ) {
_this . verifyEvent ( button , e ) ;
cb ( parseInt ( e . currentTarget . dataset . value ) ) ;
return false ;
} ) ;
} ;
} ) ( this ) ;
2017-05-11 17:54:48 +02:00
for ( i = j = 0 , len = captions . length ; j < len ; i = ++ j ) {
caption = captions [ i ] ;
2018-03-06 12:03:10 +01:00
button = $ ( "<a></a>" , {
href : "#" + caption ,
"class" : "button button-confirm button-" + caption + " button-" + ( i + 1 ) ,
"data-value" : i + 1
} ) ;
button . text ( caption ) ;
2018-02-21 03:15:04 +01:00
fn ( button ) ;
2017-05-18 03:05:02 +02:00
buttons . append ( button ) ;
2017-05-11 17:54:48 +02:00
}
2017-05-18 03:05:02 +02:00
body . append ( buttons ) ;
2015-09-13 12:52:11 +02:00
this . notifications . add ( "notification-" + caption , "ask" , body ) ;
2017-05-18 03:05:02 +02:00
buttons . first ( ) . focus ( ) ;
2015-09-16 00:01:23 +02:00
return $ ( ".notification" ) . scrollLeft ( 0 ) ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
} ;
Wrapper . prototype . actionConfirm = function ( message , cb ) {
2015-02-14 14:05:00 +01:00
var caption ;
if ( cb == null ) {
cb = false ;
}
2015-01-21 12:58:26 +01:00
message . params = this . toHtmlSafe ( message . params ) ;
if ( message . params [ 1 ] ) {
caption = message . params [ 1 ] ;
} else {
caption = "ok" ;
}
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
return this . displayConfirm ( message . params [ 0 ] , caption , ( function ( _this ) {
2017-05-11 17:54:48 +02:00
return function ( res ) {
2015-01-21 12:58:26 +01:00
_this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
2017-05-11 17:54:48 +02:00
"result" : res
2015-01-21 12:58:26 +01:00
} ) ;
return false ;
} ;
} ) ( this ) ) ;
2015-02-14 14:05:00 +01:00
} ;
2017-05-11 17:54:48 +02:00
Wrapper . prototype . displayPrompt = function ( message , type , caption , placeholder , cb ) {
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
var body , button , input ;
2018-03-07 03:10:13 +01:00
body = $ ( "<span class='message'></span>" ) . html ( message ) ;
2019-05-29 16:02:34 +02:00
if ( placeholder == null ) {
2017-11-29 13:48:30 +01:00
placeholder = "" ;
2019-05-29 16:02:34 +02:00
}
2018-03-06 12:03:10 +01:00
input = $ ( "<input/>" , {
type : type ,
"class" : "input button-" + type ,
placeholder : placeholder
} ) ;
2015-01-24 19:14:29 +01:00
input . on ( "keyup" , ( function ( _this ) {
return function ( e ) {
2018-02-21 03:15:04 +01:00
_this . verifyEvent ( input , e ) ;
2015-01-24 19:14:29 +01:00
if ( e . keyCode === 13 ) {
2018-02-21 03:15:04 +01:00
return cb ( input . val ( ) ) ;
2015-01-24 19:14:29 +01:00
}
} ;
} ) ( this ) ) ;
body . append ( input ) ;
2018-03-06 12:03:10 +01:00
button = $ ( "<a></a>" , {
href : "#" + caption ,
"class" : "button button-" + caption
} ) . text ( caption ) ;
2015-01-24 19:14:29 +01:00
button . on ( "click" , ( function ( _this ) {
2018-02-21 03:15:04 +01:00
return function ( e ) {
_this . verifyEvent ( button , e ) ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
cb ( input . val ( ) ) ;
2015-01-24 19:14:29 +01:00
return false ;
} ;
} ) ( this ) ) ;
body . append ( button ) ;
2015-09-13 12:52:11 +02:00
this . notifications . add ( "notification-" + message . id , "ask" , body ) ;
2015-09-16 00:01:23 +02:00
input . focus ( ) ;
return $ ( ".notification" ) . scrollLeft ( 0 ) ;
2015-01-24 19:14:29 +01:00
} ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
Wrapper . prototype . actionPrompt = function ( message ) {
2017-05-11 17:54:48 +02:00
var caption , placeholder , type ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
message . params = this . toHtmlSafe ( message . params ) ;
if ( message . params [ 1 ] ) {
type = message . params [ 1 ] ;
} else {
type = "text" ;
}
2017-05-11 17:54:48 +02:00
caption = message . params [ 2 ] ? message . params [ 2 ] : "OK" ;
2017-05-23 12:42:02 +02:00
if ( message . params [ 3 ] != null ) {
placeholder = message . params [ 3 ] ;
} else {
placeholder = "" ;
}
2017-05-11 17:54:48 +02:00
return this . displayPrompt ( message . params [ 0 ] , type , caption , placeholder , ( function ( _this ) {
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
return function ( res ) {
return _this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
"result" : res
} ) ;
} ;
} ) ( this ) ) ;
} ;
2019-05-29 16:02:34 +02:00
Wrapper . prototype . displayProgress = function ( type , body , percent ) {
var circle , elem , offset , width ;
percent = Math . min ( 100 , percent ) / 100 ;
2017-01-16 13:41:11 +01:00
offset = 75 - ( percent * 75 ) ;
circle = "<div class=\"circle\"><svg class=\"circle-svg\" width=\"30\" height=\"30\" viewport=\"0 0 30 30\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle r=\"12\" cx=\"15\" cy=\"15\" fill=\"transparent\" class=\"circle-bg\"></circle>\n <circle r=\"12\" cx=\"15\" cy=\"15\" fill=\"transparent\" class=\"circle-fg\" style=\"stroke-dashoffset: " + offset + "\"></circle>\n</svg></div>" ;
2019-05-29 16:02:34 +02:00
body = "<span class='message'>" + body + "</span>" + circle ;
elem = $ ( ".notification-" + type ) ;
2017-01-16 13:41:11 +01:00
if ( elem . length ) {
width = $ ( ".body .message" , elem ) . outerWidth ( ) ;
2019-05-29 16:02:34 +02:00
$ ( ".body .message" , elem ) . html ( body ) ;
2017-01-16 13:41:11 +01:00
if ( $ ( ".body .message" , elem ) . css ( "width" ) === "" ) {
$ ( ".body .message" , elem ) . css ( "width" , width ) ;
}
$ ( ".body .circle-fg" , elem ) . css ( "stroke-dashoffset" , offset ) ;
} else {
2019-05-29 16:02:34 +02:00
elem = this . notifications . add ( type , "progress" , $ ( body ) ) ;
2017-01-16 13:41:11 +01:00
}
if ( percent > 0 ) {
$ ( ".body .circle-bg" , elem ) . css ( {
"animation-play-state" : "paused" ,
"stroke-dasharray" : "180px"
} ) ;
}
if ( $ ( ".notification-icon" , elem ) . data ( "done" ) ) {
return false ;
2019-06-04 16:18:02 +02:00
} else if ( percent >= 1 ) {
2017-01-16 13:41:11 +01:00
$ ( ".circle-fg" , elem ) . css ( "transition" , "all 0.3s ease-in-out" ) ;
setTimeout ( ( function ( ) {
$ ( ".notification-icon" , elem ) . css ( {
transform : "scale(1)" ,
opacity : 1
} ) ;
return $ ( ".notification-icon .icon-success" , elem ) . css ( {
transform : "rotate(45deg) scale(1)"
} ) ;
} ) , 300 ) ;
setTimeout ( ( ( function ( _this ) {
return function ( ) {
return _this . notifications . close ( elem ) ;
} ;
} ) ( this ) ) , 3000 ) ;
return $ ( ".notification-icon" , elem ) . data ( "done" , true ) ;
2019-05-29 16:02:34 +02:00
} else if ( percent < 0 ) {
2017-01-16 13:41:11 +01:00
$ ( ".body .circle-fg" , elem ) . css ( "stroke" , "#ec6f47" ) . css ( "transition" , "transition: all 0.3s ease-in-out" ) ;
setTimeout ( ( ( function ( _this ) {
return function ( ) {
$ ( ".notification-icon" , elem ) . css ( {
transform : "scale(1)" ,
opacity : 1
} ) ;
elem . removeClass ( "notification-done" ) . addClass ( "notification-error" ) ;
return $ ( ".notification-icon .icon-success" , elem ) . removeClass ( "icon-success" ) . html ( "!" ) ;
} ;
} ) ( this ) ) , 300 ) ;
return $ ( ".notification-icon" , elem ) . data ( "done" , true ) ;
}
} ;
2019-05-29 16:02:34 +02:00
Wrapper . prototype . actionProgress = function ( message ) {
message . params = this . toHtmlSafe ( message . params ) ;
return this . displayProgress ( message . params [ 0 ] , message . params [ 1 ] , message . params [ 2 ] ) ;
} ;
2015-02-10 00:08:25 +01:00
Wrapper . prototype . actionSetViewport = function ( message ) {
this . log ( "actionSetViewport" , message ) ;
if ( $ ( "#viewport" ) . length > 0 ) {
return $ ( "#viewport" ) . attr ( "content" , this . toHtmlSafe ( message . params ) ) ;
} else {
return $ ( '<meta name="viewport" id="viewport">' ) . attr ( "content" , this . toHtmlSafe ( message . params ) ) . appendTo ( "head" ) ;
}
} ;
2016-08-10 12:28:05 +02:00
Wrapper . prototype . actionReload = function ( message ) {
2018-02-21 03:15:04 +01:00
return this . reload ( message . params [ 0 ] ) ;
2016-08-10 12:28:05 +02:00
} ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
Wrapper . prototype . reload = function ( url _post ) {
2019-10-06 03:20:58 +02:00
var current _url ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
if ( url _post == null ) {
url _post = "" ;
}
2020-01-04 16:54:20 +01:00
this . log ( "Reload" ) ;
2019-10-06 03:20:58 +02:00
current _url = window . location . toString ( ) . replace ( /#.*/g , "" ) ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
if ( url _post ) {
2019-10-06 03:20:58 +02:00
if ( current _url . indexOf ( "?" ) > 0 ) {
return window . location = current _url + "&" + url _post ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
} else {
2019-10-06 03:20:58 +02:00
return window . location = current _url + "?" + url _post ;
version 0.2.7, plugin system, multiuser plugin for zeroproxies, reworked imports, cookie parse, stats moved to plugin, usermanager class, dont generate site auth on listing, multiline notifications, allow server side prompt from user, update script keep plugins disabled status
2015-03-24 01:33:09 +01:00
}
} else {
return window . location . reload ( ) ;
}
} ;
2015-02-17 01:48:15 +01:00
Wrapper . prototype . actionGetLocalStorage = function ( message ) {
version 0.2.8, Namecoin domains using internal resolver site, --disable_zeromq option to skip backward compatiblity layer and save some memory, connectionserver firstchar error fixes, missing unpacker crash fix, sitemanager class to allow extensions, add loaded plugin list to websocket api, faster content publishing, mark updating file as bad, remove coppersurfer tracker add eddie4, internal server error with error displaying, allow site domains in UiRequest, better progress bar, wait for siteinfo before before using localstorage, csslater hide only if opacity is 0
2015-03-30 23:44:29 +02:00
return $ . when ( this . event _site _info ) . done ( ( function ( _this ) {
return function ( ) {
var data ;
Version 0.3.4, Rev656, CryptMessage plugin for AES and ECIES encryption, Added pyelliptic lib for OpenSSSL based encryption methods, Test CryptMessage plugin, Force reload content.json before signing and after write, Escaped Sql IN queries support, Test Sql parameter escaping, ui_websocket Test fixture, Plugin testing support, Always return websocket errors as dict, Wait for file on weboscket fileGet command if its already in bad_files queue, PushState and ReplaceState url manipulation support in wrapper API, Per auth-address localstorage, Longer timeout for udp tracker query
2015-12-10 21:36:20 +01:00
data = localStorage . getItem ( "site." + _this . site _info . address + "." + _this . site _info . auth _address ) ;
if ( ! data ) {
data = localStorage . getItem ( "site." + _this . site _info . address ) ;
if ( data ) {
localStorage . setItem ( "site." + _this . site _info . address + "." + _this . site _info . auth _address , data ) ;
localStorage . removeItem ( "site." + _this . site _info . address ) ;
_this . log ( "Migrated LocalStorage from global to auth_address based" ) ;
}
}
version 0.2.8, Namecoin domains using internal resolver site, --disable_zeromq option to skip backward compatiblity layer and save some memory, connectionserver firstchar error fixes, missing unpacker crash fix, sitemanager class to allow extensions, add loaded plugin list to websocket api, faster content publishing, mark updating file as bad, remove coppersurfer tracker add eddie4, internal server error with error displaying, allow site domains in UiRequest, better progress bar, wait for siteinfo before before using localstorage, csslater hide only if opacity is 0
2015-03-30 23:44:29 +02:00
if ( data ) {
data = JSON . parse ( data ) ;
}
return _this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
"result" : data
} ) ;
} ;
} ) ( this ) ) ;
2015-02-17 01:48:15 +01:00
} ;
Wrapper . prototype . actionSetLocalStorage = function ( message ) {
2018-11-21 03:32:12 +01:00
return $ . when ( this . event _site _info ) . done ( ( function ( _this ) {
return function ( ) {
var back ;
back = localStorage . setItem ( "site." + _this . site _info . address + "." + _this . site _info . auth _address , JSON . stringify ( message . params ) ) ;
return _this . sendInner ( {
"cmd" : "response" ,
"to" : message . id ,
"result" : back
} ) ;
} ;
} ) ( this ) ) ;
2015-02-17 01:48:15 +01:00
} ;
2015-01-13 00:29:40 +01:00
Wrapper . prototype . onOpenWebsocket = function ( e ) {
2018-04-28 22:08:43 +02:00
if ( window . show _loadingscreen ) {
this . ws . cmd ( "channelJoin" , {
"channels" : [ "siteChanged" , "serverChanged" , "announcerChanged" ]
} ) ;
} else {
this . ws . cmd ( "channelJoin" , {
"channels" : [ "siteChanged" , "serverChanged" ]
} ) ;
}
2015-01-13 00:29:40 +01:00
if ( ! this . wrapperWsInited && this . inner _ready ) {
this . sendInner ( {
"cmd" : "wrapperOpenedWebsocket"
} ) ;
this . wrapperWsInited = true ;
}
2018-04-28 22:08:43 +02:00
if ( window . show _loadingscreen ) {
this . ws . cmd ( "serverInfo" , [ ] , ( function ( _this ) {
return function ( server _info ) {
return _this . server _info = server _info ;
} ;
} ) ( this ) ) ;
this . ws . cmd ( "announcerInfo" , [ ] , ( function ( _this ) {
return function ( announcer _info ) {
return _this . setAnnouncerInfo ( announcer _info ) ;
} ;
} ) ( this ) ) ;
}
2015-01-13 00:29:40 +01:00
if ( this . inner _loaded ) {
this . reloadSiteInfo ( ) ;
}
setTimeout ( ( ( function ( _this ) {
return function ( ) {
if ( ! _this . site _info ) {
return _this . reloadSiteInfo ( ) ;
}
} ;
} ) ( this ) ) , 2000 ) ;
if ( this . ws _error ) {
this . notifications . add ( "connection" , "done" , "Connection with <b>UiServer Websocket</b> recovered." , 6000 ) ;
return this . ws _error = null ;
}
} ;
Wrapper . prototype . onCloseWebsocket = function ( e ) {
this . wrapperWsInited = false ;
return setTimeout ( ( ( function ( _this ) {
return function ( ) {
_this . sendInner ( {
"cmd" : "wrapperClosedWebsocket"
} ) ;
2015-02-20 01:37:12 +01:00
if ( e && e . code === 1000 && e . wasClean === false ) {
2015-01-13 00:29:40 +01:00
return _this . ws _error = _this . notifications . add ( "connection" , "error" , "UiServer Websocket error, please reload the page." ) ;
2016-08-27 11:52:44 +02:00
} else if ( e && e . code === 1001 && e . wasClean === true ) {
2015-01-13 00:29:40 +01:00
} else if ( ! _this . ws _error ) {
return _this . ws _error = _this . notifications . add ( "connection" , "error" , "Connection with <b>UiServer Websocket</b> was lost. Reconnecting..." ) ;
}
} ;
2015-02-14 14:05:00 +01:00
} ) ( this ) ) , 1000 ) ;
2015-01-13 00:29:40 +01:00
} ;
2018-02-21 03:15:04 +01:00
Wrapper . prototype . onPageLoad = function ( e ) {
2017-04-12 17:36:50 +02:00
var ref ;
2020-01-04 16:54:20 +01:00
this . log ( "onPageLoad" ) ;
2015-01-13 00:29:40 +01:00
this . inner _loaded = true ;
if ( ! this . inner _ready ) {
this . sendInner ( {
"cmd" : "wrapperReady"
} ) ;
}
if ( this . ws . ws . readyState === 1 && ! this . site _info ) {
return this . reloadSiteInfo ( ) ;
2017-04-12 17:36:50 +02:00
} else if ( this . site _info && ( ( ( ref = this . site _info . content ) != null ? ref . title : void 0 ) != null ) ) {
version 0.2.0, new lib for bitcoin ecc, dont display or track notify errors, dont reload again within 1 sec, null peer ip fix, signingmoved to ContentManager, content.json include support, content.json multisig ready, content.json proper bitcoincore compatible signing, content.json include permissions, multithreaded publish, publish timeout 60s, no exception on invalid bitcoin address, testcase for new lib, bip32 based persite privatekey generation, multiuser ready, simple json database query command, websocket api fileGet, wrapper loading title stuck bugfix
2015-02-09 02:09:02 +01:00
window . document . title = this . site _info . content . title + " - ZeroNet" ;
return this . log ( "Setting title to" , window . document . title ) ;
2015-01-13 00:29:40 +01:00
}
} ;
2018-02-21 03:15:04 +01:00
Wrapper . prototype . onWrapperLoad = function ( ) {
2018-11-26 00:05:17 +01:00
this . script _nonce = window . script _nonce ;
this . wrapper _key = window . wrapper _key ;
2018-02-21 03:15:04 +01:00
delete window . wrapper ;
delete window . wrapper _key ;
2018-11-26 00:05:17 +01:00
delete window . script _nonce ;
2018-02-21 03:15:04 +01:00
return $ ( "#script_init" ) . remove ( ) ;
} ;
2015-01-13 00:29:40 +01:00
Wrapper . prototype . sendInner = function ( message ) {
return this . inner . postMessage ( message , '*' ) ;
} ;
Wrapper . prototype . reloadSiteInfo = function ( ) {
2015-04-20 22:31:29 +02:00
var params ;
if ( this . loading . screen _visible ) {
params = {
"file_status" : window . file _inner _path
} ;
} else {
params = { } ;
}
return this . ws . cmd ( "siteInfo" , params , ( function ( _this ) {
2015-01-13 00:29:40 +01:00
return function ( site _info ) {
2018-10-20 02:22:38 +02:00
var ref ;
version 0.2.8, Namecoin domains using internal resolver site, --disable_zeromq option to skip backward compatiblity layer and save some memory, connectionserver firstchar error fixes, missing unpacker crash fix, sitemanager class to allow extensions, add loaded plugin list to websocket api, faster content publishing, mark updating file as bad, remove coppersurfer tracker add eddie4, internal server error with error displaying, allow site domains in UiRequest, better progress bar, wait for siteinfo before before using localstorage, csslater hide only if opacity is 0
2015-03-30 23:44:29 +02:00
_this . address = site _info . address ;
2015-01-13 00:29:40 +01:00
_this . setSiteInfo ( site _info ) ;
2020-01-04 16:54:20 +01:00
if ( site _info . settings . size > site _info . size _limit * 1024 * 1024 && ! _this . loading . screen _visible ) {
_this . displayConfirm ( "Site is larger than allowed: " + ( ( site _info . settings . size / 1024 / 1024 ) . toFixed ( 1 ) ) + "MB/" + site _info . size _limit + "MB" , "Set limit to " + site _info . next _size _limit + "MB" , function ( ) {
return _this . ws . cmd ( "siteSetLimit" , [ site _info . next _size _limit ] , function ( res ) {
if ( res === "ok" ) {
return _this . notifications . add ( "size_limit" , "done" , "Site storage limit modified!" , 5000 ) ;
}
2015-06-25 20:09:41 +02:00
} ) ;
2020-01-04 16:54:20 +01:00
} ) ;
2015-04-03 14:31:15 +02:00
}
2018-10-20 02:22:38 +02:00
if ( ( ( ref = site _info . content ) != null ? ref . title : void 0 ) != null ) {
2015-04-03 14:31:15 +02:00
window . document . title = site _info . content . title + " - ZeroNet" ;
return _this . log ( "Setting title to" , window . document . title ) ;
}
2015-01-13 00:29:40 +01:00
} ;
} ) ( this ) ) ;
} ;
Wrapper . prototype . setSiteInfo = function ( site _info ) {
2019-02-02 00:12:50 +01:00
var ref , ref1 , ref2 , ref3 ;
2015-01-13 00:29:40 +01:00
if ( site _info . event != null ) {
2015-01-18 22:52:19 +01:00
if ( site _info . event [ 0 ] === "file_added" && site _info . bad _files ) {
2015-01-27 22:37:13 +01:00
this . loading . printLine ( site _info . bad _files + " files needs to be downloaded" ) ;
2015-01-13 00:29:40 +01:00
} else if ( site _info . event [ 0 ] === "file_done" ) {
2015-01-27 22:37:13 +01:00
this . loading . printLine ( site _info . event [ 1 ] + " downloaded" ) ;
2015-04-20 22:31:29 +02:00
if ( site _info . event [ 1 ] === window . file _inner _path ) {
2015-01-13 00:29:40 +01:00
this . loading . hideScreen ( ) ;
2015-01-21 12:58:26 +01:00
if ( ! this . site _info ) {
this . reloadSiteInfo ( ) ;
}
2015-04-03 14:31:15 +02:00
if ( site _info . content ) {
window . document . title = site _info . content . title + " - ZeroNet" ;
2020-01-04 16:54:20 +01:00
this . log ( "Required file " + window . file _inner _path + " done, setting title to" , window . document . title ) ;
2015-04-03 14:31:15 +02:00
}
2017-01-27 12:09:23 +01:00
if ( ! window . show _loadingscreen ) {
2015-01-13 00:29:40 +01:00
this . notifications . add ( "modified" , "info" , "New version of this page has just released.<br>Reload to see the modified content." ) ;
}
}
} else if ( site _info . event [ 0 ] === "file_failed" ) {
this . site _error = site _info . event [ 1 ] ;
2015-02-14 14:05:00 +01:00
if ( site _info . settings . size > site _info . size _limit * 1024 * 1024 ) {
2015-04-03 14:31:15 +02:00
this . loading . showTooLarge ( site _info ) ;
2015-02-14 14:05:00 +01:00
} else {
this . loading . printLine ( site _info . event [ 1 ] + " download failed" , "error" ) ;
}
2015-01-13 00:29:40 +01:00
} else if ( site _info . event [ 0 ] === "peers_added" ) {
this . loading . printLine ( "Peers found: " + site _info . peers ) ;
}
}
if ( this . loading . screen _visible && ! this . site _info ) {
if ( site _info . peers > 1 ) {
this . loading . printLine ( "Peers found: " + site _info . peers ) ;
} else {
this . site _error = "No peers found" ;
this . loading . printLine ( "No peers found" ) ;
}
}
2015-10-17 02:56:39 +02:00
if ( ! this . site _info && ! this . loading . screen _visible && $ ( "#inner-iframe" ) . attr ( "src" ) . replace ( "?wrapper=False" , "" ) . replace ( /\?wrapper_nonce=[A-Za-z0-9]+/ , "" ) . indexOf ( "?" ) === - 1 ) {
2015-06-25 20:09:41 +02:00
if ( site _info . size _limit * 1.1 < site _info . next _size _limit ) {
2015-08-06 00:51:25 +02:00
this . displayConfirm ( "Running out of size limit (" + ( ( site _info . settings . size / 1024 / 1024 ) . toFixed ( 1 ) ) + "MB/" + site _info . size _limit + "MB)" , "Set limit to " + site _info . next _size _limit + "MB" , ( function ( _this ) {
2015-02-14 14:05:00 +01:00
return function ( ) {
_this . ws . cmd ( "siteSetLimit" , [ site _info . next _size _limit ] , function ( res ) {
2017-04-12 17:36:50 +02:00
if ( res === "ok" ) {
return _this . notifications . add ( "size_limit" , "done" , "Site storage limit modified!" , 5000 ) ;
}
2015-02-14 14:05:00 +01:00
} ) ;
return false ;
} ;
} ) ( this ) ) ;
}
}
2015-08-26 02:51:32 +02:00
if ( this . loading . screen _visible && this . inner _loaded && site _info . settings . size < site _info . size _limit * 1024 * 1024 && site _info . settings . size > 0 ) {
2020-01-04 16:54:20 +01:00
this . log ( "Loading screen visible, but inner loaded" ) ;
2015-02-25 03:22:10 +01:00
this . loading . hideScreen ( ) ;
}
2019-02-02 00:12:50 +01:00
if ( ( site _info != null ? ( ref = site _info . settings ) != null ? ref . own : void 0 : void 0 ) && ( site _info != null ? ( ref1 = site _info . settings ) != null ? ref1 . modified : void 0 : void 0 ) !== ( ( ref2 = this . site _info ) != null ? ( ref3 = ref2 . settings ) != null ? ref3 . modified : void 0 : void 0 ) ) {
this . updateModifiedPanel ( ) ;
}
2020-01-04 16:54:20 +01:00
if ( this . loading . screen _visible && site _info . settings . size > site _info . size _limit * 1024 * 1024 ) {
this . log ( "Site too large" ) ;
this . loading . showTooLarge ( site _info ) ;
}
2016-08-10 12:28:05 +02:00
this . site _info = site _info ;
return this . event _site _info . resolve ( ) ;
} ;
2019-02-02 00:12:50 +01:00
Wrapper . prototype . siteSign = function ( inner _path , cb ) {
if ( this . site _info . privatekey ) {
this . infopanel . elem . find ( ".button" ) . addClass ( "loading" ) ;
return this . ws . cmd ( "siteSign" , {
privatekey : "stored" ,
inner _path : inner _path ,
update _changed _files : true
} , ( function ( _this ) {
return function ( res ) {
if ( res === "ok" ) {
if ( typeof cb === "function" ) {
cb ( true ) ;
}
} else {
if ( typeof cb === "function" ) {
cb ( false ) ;
}
}
return _this . infopanel . elem . find ( ".button" ) . removeClass ( "loading" ) ;
} ;
} ) ( this ) ) ;
} else {
return this . displayPrompt ( "Enter your private key:" , "password" , "Sign" , "" , ( function ( _this ) {
return function ( privatekey ) {
_this . infopanel . elem . find ( ".button" ) . addClass ( "loading" ) ;
return _this . ws . cmd ( "siteSign" , {
privatekey : privatekey ,
inner _path : inner _path ,
update _changed _files : true
} , function ( res ) {
if ( res === "ok" ) {
if ( typeof cb === "function" ) {
cb ( true ) ;
}
} else {
if ( typeof cb === "function" ) {
cb ( false ) ;
}
}
return _this . infopanel . elem . find ( ".button" ) . removeClass ( "loading" ) ;
} ) ;
} ;
} ) ( this ) ) ;
}
} ;
Wrapper . prototype . sitePublish = function ( inner _path ) {
return this . ws . cmd ( "sitePublish" , {
"inner_path" : inner _path ,
"sign" : false
} ) ;
} ;
Wrapper . prototype . updateModifiedPanel = function ( ) {
return this . ws . cmd ( "siteListModifiedFiles" , [ ] , ( function ( _this ) {
return function ( res ) {
2020-04-11 13:34:18 +02:00
var closed , num , ref ;
num = ( ref = res . modified _files ) != null ? ref . length : void 0 ;
2019-02-02 00:12:50 +01:00
if ( num > 0 ) {
2019-02-05 15:54:32 +01:00
closed = _this . site _info . settings . modified _files _notification === false ;
_this . infopanel . show ( closed ) ;
2019-02-02 00:12:50 +01:00
} else {
_this . infopanel . hide ( ) ;
}
if ( num > 0 ) {
_this . infopanel . setTitle ( res . modified _files . length + " modified file" + ( num > 1 ? 's' : '' ) , res . modified _files . join ( ", " ) ) ;
2019-02-09 13:56:21 +01:00
_this . infopanel . setClosedNum ( num ) ;
2019-02-02 00:12:50 +01:00
_this . infopanel . setAction ( "Sign & Publish" , function ( ) {
_this . siteSign ( "content.json" , function ( res ) {
if ( res ) {
_this . notifications . add ( "sign" , "done" , "content.json Signed!" , 5000 ) ;
return _this . sitePublish ( "content.json" ) ;
}
} ) ;
return false ;
} ) ;
}
2020-04-11 13:34:18 +02:00
return _this . log ( "siteListModifiedFiles" , num , res ) ;
2019-02-02 00:12:50 +01:00
} ;
} ) ( this ) ) ;
} ;
2018-04-28 22:08:43 +02:00
Wrapper . prototype . setAnnouncerInfo = function ( announcer _info ) {
2018-04-29 13:06:07 +02:00
var key , ref , status _db , status _line , val ;
status _db = {
announcing : [ ] ,
error : [ ] ,
announced : [ ]
} ;
2018-04-28 22:08:43 +02:00
ref = announcer _info . stats ;
for ( key in ref ) {
val = ref [ key ] ;
2018-10-08 15:34:40 +02:00
if ( val . status ) {
status _db [ val . status ] . push ( val ) ;
}
2018-04-28 22:08:43 +02:00
}
2018-04-29 13:06:07 +02:00
status _line = "Trackers announcing: " + status _db . announcing . length + ", error: " + status _db . error . length + ", done: " + status _db . announced . length ;
2018-04-28 22:08:43 +02:00
if ( this . announcer _line ) {
this . announcer _line . text ( status _line ) ;
} else {
this . announcer _line = this . loading . printLine ( status _line ) ;
}
2018-04-29 13:06:07 +02:00
if ( status _db . error . length > ( status _db . announced . length + status _db . announcing . length ) ) {
2018-04-28 22:08:43 +02:00
return this . loading . showTrackerTorBridge ( this . server _info ) ;
}
} ;
2016-08-10 12:28:05 +02:00
Wrapper . prototype . updateProgress = function ( site _info ) {
2015-02-26 01:32:27 +01:00
if ( site _info . tasks > 0 && site _info . started _task _num > 0 ) {
2016-09-04 18:01:48 +02:00
return this . loading . setProgress ( 1 - ( Math . max ( site _info . tasks , site _info . bad _files ) / site _info . started _task _num ) ) ;
2015-02-26 01:32:27 +01:00
} else {
2016-08-10 12:28:05 +02:00
return this . loading . hideProgress ( ) ;
2015-02-26 01:32:27 +01:00
}
2015-01-13 00:29:40 +01:00
} ;
2015-02-10 00:08:25 +01:00
Wrapper . prototype . toHtmlSafe = function ( values ) {
2017-04-12 17:36:50 +02:00
var i , j , len , value ;
2015-02-10 00:08:25 +01:00
if ( ! ( values instanceof Array ) ) {
values = [ values ] ;
}
2017-04-12 17:36:50 +02:00
for ( i = j = 0 , len = values . length ; j < len ; i = ++ j ) {
2015-02-10 00:08:25 +01:00
value = values [ i ] ;
2017-05-11 17:54:48 +02:00
if ( value instanceof Array ) {
value = this . toHtmlSafe ( value ) ;
} else {
2018-03-06 12:03:10 +01:00
value = String ( value ) . replace ( /&/g , '&' ) . replace ( /</g , '<' ) . replace ( />/g , '>' ) . replace ( /"/g , '"' ) . replace ( /'/g , ''' ) ;
2018-02-21 03:15:04 +01:00
value = value . replace ( /<([\/]{0,1}(br|b|u|i|small))>/g , "<$1>" ) ;
2017-05-11 17:54:48 +02:00
}
2015-02-10 00:08:25 +01:00
values [ i ] = value ;
}
return values ;
2015-01-21 12:58:26 +01:00
} ;
2015-02-14 14:05:00 +01:00
Wrapper . prototype . setSizeLimit = function ( size _limit , reload ) {
if ( reload == null ) {
reload = true ;
}
2020-01-04 16:54:20 +01:00
this . log ( "setSizeLimit: " + size _limit + ", reload: " + reload ) ;
this . inner _loaded = false ;
2015-02-14 14:05:00 +01:00
this . ws . cmd ( "siteSetLimit" , [ size _limit ] , ( function ( _this ) {
return function ( res ) {
2017-04-12 17:36:50 +02:00
if ( res !== "ok" ) {
return false ;
}
2015-02-14 14:05:00 +01:00
_this . loading . printLine ( res ) ;
2015-04-03 14:31:15 +02:00
_this . inner _loaded = false ;
2015-02-14 14:05:00 +01:00
if ( reload ) {
2018-04-28 22:08:43 +02:00
return _this . reloadIframe ( ) ;
2015-02-14 14:05:00 +01:00
}
} ;
} ) ( this ) ) ;
return false ;
2018-04-28 22:08:43 +02:00
} ;
Wrapper . prototype . reloadIframe = function ( ) {
var src ;
src = $ ( "iframe" ) . attr ( "src" ) ;
return this . ws . cmd ( "serverGetWrapperNonce" , [ ] , ( function ( _this ) {
return function ( wrapper _nonce ) {
src = src . replace ( /wrapper_nonce=[A-Za-z0-9]+/ , "wrapper_nonce=" + wrapper _nonce ) ;
_this . log ( "Reloading iframe using url" , src ) ;
return $ ( "iframe" ) . attr ( "src" , src ) ;
} ;
} ) ( this ) ) ;
2015-02-14 14:05:00 +01:00
} ;
2015-01-13 00:29:40 +01:00
Wrapper . prototype . log = function ( ) {
var args ;
2017-04-12 17:36:50 +02:00
args = 1 <= arguments . length ? slice . call ( arguments , 0 ) : [ ] ;
return console . log . apply ( console , [ "[Wrapper]" ] . concat ( slice . call ( args ) ) ) ;
2015-01-13 00:29:40 +01:00
} ;
return Wrapper ;
} ) ( ) ;
2016-04-20 23:22:39 +02:00
origin = window . server _url || window . location . href . replace ( /(\:\/\/.*?)\/.*/ , "$1" ) ;
version 0.3.0, rev187, Trusted authorization sites support, --publish option on signing, cryptSign command line option, OpenSSL enabled on OSX, Crypto verify allows list of valid addresses, Option for version 2 json DB tables, DbCursor SELECT parameters bugfix, Add peer to site on ListModified, Download blind includes when new site added, Publish command better messages, Multi-threaded announce, New http Torrent trackers, Wait for dbschema.json on query, Handle json import errors, More compact writeJson storage command, Testcase for signing and verifying, Workaround to make non target=_top links work, More clean UiWebsocket command route, Send cert_user_id on siteinfo, Notify other local clients on local file modify, Option to wait for file download before sql query, File rules websocket API command, Cert add and select, set websocket API command, Put focus on innerframe, innerloaded wrapper api command to add hashtag, Allow more file error on big sites, Keep worker running after stuked on done task, New more stable openSSL layer that works on OSX, Noparallel parameter bugfix, RateLimit allowed again interval bugfix, Updater skips non-writeable files, Try to close openssl dll before update
2015-05-25 01:26:33 +02:00
if ( origin . indexOf ( "https:" ) === 0 ) {
proto = {
ws : 'wss' ,
http : 'https'
} ;
2015-04-20 02:56:33 +02:00
} else {
version 0.3.0, rev187, Trusted authorization sites support, --publish option on signing, cryptSign command line option, OpenSSL enabled on OSX, Crypto verify allows list of valid addresses, Option for version 2 json DB tables, DbCursor SELECT parameters bugfix, Add peer to site on ListModified, Download blind includes when new site added, Publish command better messages, Multi-threaded announce, New http Torrent trackers, Wait for dbschema.json on query, Handle json import errors, More compact writeJson storage command, Testcase for signing and verifying, Workaround to make non target=_top links work, More clean UiWebsocket command route, Send cert_user_id on siteinfo, Notify other local clients on local file modify, Option to wait for file download before sql query, File rules websocket API command, Cert add and select, set websocket API command, Put focus on innerframe, innerloaded wrapper api command to add hashtag, Allow more file error on big sites, Keep worker running after stuked on done task, New more stable openSSL layer that works on OSX, Noparallel parameter bugfix, RateLimit allowed again interval bugfix, Updater skips non-writeable files, Try to close openssl dll before update
2015-05-25 01:26:33 +02:00
proto = {
ws : 'ws' ,
http : 'http'
} ;
2015-04-20 02:56:33 +02:00
}
version 0.3.0, rev187, Trusted authorization sites support, --publish option on signing, cryptSign command line option, OpenSSL enabled on OSX, Crypto verify allows list of valid addresses, Option for version 2 json DB tables, DbCursor SELECT parameters bugfix, Add peer to site on ListModified, Download blind includes when new site added, Publish command better messages, Multi-threaded announce, New http Torrent trackers, Wait for dbschema.json on query, Handle json import errors, More compact writeJson storage command, Testcase for signing and verifying, Workaround to make non target=_top links work, More clean UiWebsocket command route, Send cert_user_id on siteinfo, Notify other local clients on local file modify, Option to wait for file download before sql query, File rules websocket API command, Cert add and select, set websocket API command, Put focus on innerframe, innerloaded wrapper api command to add hashtag, Allow more file error on big sites, Keep worker running after stuked on done task, New more stable openSSL layer that works on OSX, Noparallel parameter bugfix, RateLimit allowed again interval bugfix, Updater skips non-writeable files, Try to close openssl dll before update
2015-05-25 01:26:33 +02:00
2019-04-15 15:44:04 +02:00
ws _url = proto . ws + ":" + origin . replace ( proto . http + ":" , "" ) + "/ZeroNet-Internal/Websocket?wrapper_key=" + window . wrapper _key ;
2015-01-13 00:29:40 +01:00
2016-02-23 01:36:47 +01:00
window . wrapper = new Wrapper ( ws _url ) ;
2015-01-13 00:29:40 +01:00
2017-11-05 23:42:33 +01:00
} ) . call ( this ) ;
2018-02-21 03:15:04 +01:00
2020-01-04 16:54:20 +01:00
2019-10-06 03:20:58 +02:00
/* ---- WrapperZeroFrame.coffee ---- */
2018-02-21 03:15:04 +01:00
( function ( ) {
var WrapperZeroFrame ,
bind = function ( fn , me ) { return function ( ) { return fn . apply ( me , arguments ) ; } ; } ;
WrapperZeroFrame = ( function ( ) {
function WrapperZeroFrame ( wrapper ) {
this . certSelectGotoSite = bind ( this . certSelectGotoSite , this ) ;
this . response = bind ( this . response , this ) ;
this . cmd = bind ( this . cmd , this ) ;
this . wrapperCmd = wrapper . cmd ;
this . wrapperResponse = wrapper . ws . response ;
console . log ( "WrapperZeroFrame" , wrapper ) ;
}
WrapperZeroFrame . prototype . cmd = function ( cmd , params , cb ) {
if ( params == null ) {
params = { } ;
}
if ( cb == null ) {
cb = null ;
}
return this . wrapperCmd ( cmd , params , cb ) ;
} ;
WrapperZeroFrame . prototype . response = function ( to , result ) {
return this . wrapperResponse ( to , result ) ;
} ;
WrapperZeroFrame . prototype . isProxyRequest = function ( ) {
return window . location . pathname === "/" ;
} ;
WrapperZeroFrame . prototype . certSelectGotoSite = function ( elem ) {
var href ;
href = $ ( elem ) . attr ( "href" ) ;
if ( this . isProxyRequest ( ) ) {
return $ ( elem ) . attr ( "href" , "http://zero" + href ) ;
}
} ;
return WrapperZeroFrame ;
} ) ( ) ;
window . zeroframe = new WrapperZeroFrame ( window . wrapper ) ;
2019-04-26 18:23:25 +02:00
} ) . call ( this ) ;
2019-10-06 03:20:58 +02:00
/* ---- ZeroSiteTheme.coffee ---- */
2019-04-26 18:23:25 +02:00
( function ( ) {
2019-07-05 18:43:54 +02:00
var DARK , LIGHT , changeColorScheme , detectColorScheme , displayNotification , mqDark , mqLight ,
indexOf = [ ] . indexOf || function ( item ) { for ( var i = 0 , l = this . length ; i < l ; i ++ ) { if ( i in this && this [ i ] === item ) return i ; } return - 1 ; } ;
2019-04-26 18:23:25 +02:00
DARK = "(prefers-color-scheme: dark)" ;
LIGHT = "(prefers-color-scheme: light)" ;
mqDark = window . matchMedia ( DARK ) ;
mqLight = window . matchMedia ( LIGHT ) ;
changeColorScheme = function ( theme ) {
zeroframe . cmd ( "userGetGlobalSettings" , [ ] , function ( user _settings ) {
if ( user _settings . theme !== theme ) {
user _settings . theme = theme ;
2019-07-05 18:43:54 +02:00
zeroframe . cmd ( "userSetGlobalSettings" , [ user _settings ] , function ( status ) {
if ( status === "ok" ) {
location . reload ( ) ;
}
} ) ;
2019-04-26 18:23:25 +02:00
}
} ) ;
} ;
displayNotification = function ( arg ) {
var matches , media ;
matches = arg . matches , media = arg . media ;
if ( ! matches ) {
return ;
}
2019-07-05 18:43:54 +02:00
zeroframe . cmd ( "siteInfo" , [ ] , function ( site _info ) {
if ( indexOf . call ( site _info . settings . permissions , "ADMIN" ) >= 0 ) {
zeroframe . cmd ( "wrapperNotification" , [ "info" , "Your system's theme has been changed.<br>Please reload site to use it." ] ) ;
} else {
zeroframe . cmd ( "wrapperNotification" , [ "info" , "Your system's theme has been changed.<br>Please open ZeroHello to use it." ] ) ;
}
} ) ;
2019-04-26 18:23:25 +02:00
} ;
detectColorScheme = function ( ) {
if ( mqDark . matches ) {
changeColorScheme ( "dark" ) ;
} else if ( mqLight . matches ) {
changeColorScheme ( "light" ) ;
}
mqDark . addListener ( displayNotification ) ;
mqLight . addListener ( displayNotification ) ;
} ;
zeroframe . cmd ( "userGetGlobalSettings" , [ ] , function ( user _settings ) {
if ( user _settings . use _system _theme === true ) {
detectColorScheme ( ) ;
}
} ) ;
2019-08-02 20:11:00 +02:00
} ) . call ( this ) ;