r&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>q&&(b[2].x+=1));n=0;for(p=this.vertices.length;n
c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();
-THREE.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,a,1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};
-THREE.BoxHelper=function(a){var b=new THREE.BufferGeometry;b.addAttribute("position",new THREE.BufferAttribute(new Float32Array(72),3));THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);void 0!==a&&this.update(a)};THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype);
-THREE.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox();var c=b.boundingBox.min,b=b.boundingBox.max,d=this.geometry.attributes.position.array;d[0]=b.x;d[1]=b.y;d[2]=b.z;d[3]=c.x;d[4]=b.y;d[5]=b.z;d[6]=c.x;d[7]=b.y;d[8]=b.z;d[9]=c.x;d[10]=c.y;d[11]=b.z;d[12]=c.x;d[13]=c.y;d[14]=b.z;d[15]=b.x;d[16]=c.y;d[17]=b.z;d[18]=b.x;d[19]=c.y;d[20]=b.z;d[21]=b.x;d[22]=b.y;d[23]=b.z;d[24]=b.x;d[25]=b.y;d[26]=c.z;d[27]=c.x;d[28]=b.y;d[29]=c.z;d[30]=c.x;d[31]=b.y;
-d[32]=c.z;d[33]=c.x;d[34]=c.y;d[35]=c.z;d[36]=c.x;d[37]=c.y;d[38]=c.z;d[39]=b.x;d[40]=c.y;d[41]=c.z;d[42]=b.x;d[43]=c.y;d[44]=c.z;d[45]=b.x;d[46]=b.y;d[47]=c.z;d[48]=b.x;d[49]=b.y;d[50]=b.z;d[51]=b.x;d[52]=b.y;d[53]=c.z;d[54]=c.x;d[55]=b.y;d[56]=b.z;d[57]=c.x;d[58]=b.y;d[59]=c.z;d[60]=c.x;d[61]=c.y;d[62]=b.z;d[63]=c.x;d[64]=c.y;d[65]=c.z;d[66]=b.x;d[67]=c.y;d[68]=b.z;d[69]=b.x;d[70]=c.y;d[71]=c.z;this.geometry.attributes.position.needsUpdate=!0;this.geometry.computeBoundingSphere();this.matrix=a.matrixWorld;
-this.matrixAutoUpdate=!1};THREE.BoundingBoxHelper=function(a,b){var c=void 0!==b?b:8947848;this.object=a;this.box=new THREE.Box3;THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:c,wireframe:!0}))};THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object);this.box.size(this.scale);this.box.center(this.position)};
-THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new THREE.Vector3);d.colors.push(new THREE.Color(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}var d=new THREE.Geometry,e=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);
-b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);THREE.Line.call(this,d,e,THREE.LinePieces);this.camera=a;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()};
-THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);
-THREE.CameraHelper.prototype.update=function(){var a,b,c=new THREE.Vector3,d=new THREE.Camera,e=function(e,g,h,k){c.set(g,h,k).unproject(d);e=b[e];if(void 0!==e)for(g=0,h=e.length;g r&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>q&&(b[2].x+=1));n=0;for(p=this.vertices.length;n c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();
-THREE.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,a,1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};
-THREE.BoxHelper=function(a){var b=new THREE.BufferGeometry;b.addAttribute("position",new THREE.BufferAttribute(new Float32Array(72),3));THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);void 0!==a&&this.update(a)};THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype);
-THREE.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox();var c=b.boundingBox.min,b=b.boundingBox.max,d=this.geometry.attributes.position.array;d[0]=b.x;d[1]=b.y;d[2]=b.z;d[3]=c.x;d[4]=b.y;d[5]=b.z;d[6]=c.x;d[7]=b.y;d[8]=b.z;d[9]=c.x;d[10]=c.y;d[11]=b.z;d[12]=c.x;d[13]=c.y;d[14]=b.z;d[15]=b.x;d[16]=c.y;d[17]=b.z;d[18]=b.x;d[19]=c.y;d[20]=b.z;d[21]=b.x;d[22]=b.y;d[23]=b.z;d[24]=b.x;d[25]=b.y;d[26]=c.z;d[27]=c.x;d[28]=b.y;d[29]=c.z;d[30]=c.x;d[31]=b.y;
-d[32]=c.z;d[33]=c.x;d[34]=c.y;d[35]=c.z;d[36]=c.x;d[37]=c.y;d[38]=c.z;d[39]=b.x;d[40]=c.y;d[41]=c.z;d[42]=b.x;d[43]=c.y;d[44]=c.z;d[45]=b.x;d[46]=b.y;d[47]=c.z;d[48]=b.x;d[49]=b.y;d[50]=b.z;d[51]=b.x;d[52]=b.y;d[53]=c.z;d[54]=c.x;d[55]=b.y;d[56]=b.z;d[57]=c.x;d[58]=b.y;d[59]=c.z;d[60]=c.x;d[61]=c.y;d[62]=b.z;d[63]=c.x;d[64]=c.y;d[65]=c.z;d[66]=b.x;d[67]=c.y;d[68]=b.z;d[69]=b.x;d[70]=c.y;d[71]=c.z;this.geometry.attributes.position.needsUpdate=!0;this.geometry.computeBoundingSphere();this.matrix=a.matrixWorld;
-this.matrixAutoUpdate=!1};THREE.BoundingBoxHelper=function(a,b){var c=void 0!==b?b:8947848;this.object=a;this.box=new THREE.Box3;THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:c,wireframe:!0}))};THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object);this.box.size(this.scale);this.box.center(this.position)};
-THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new THREE.Vector3);d.colors.push(new THREE.Color(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}var d=new THREE.Geometry,e=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);
-b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);THREE.Line.call(this,d,e,THREE.LinePieces);this.camera=a;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()};
-THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);
-THREE.CameraHelper.prototype.update=function(){var a,b,c=new THREE.Vector3,d=new THREE.Camera,e=function(e,g,h,k){c.set(g,h,k).unproject(d);e=b[e];if(void 0!==e)for(g=0,h=e.length;gp;p+=2)t=q[p],s=q[p+1],-1===s&&(s=g++),m[t]=s,r[s]=t,e[f++]=s-k.index,k.count++}this.reorderBuffers(e,r,g);return this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;ea&&(this.currentTime%=a);this.currentTime=Math.min(this.currentTime,a);a=0;for(var b=this.hierarchy.length;af.index;)f=g,g=e[f.index+1];d.prevKey=
-f;d.nextKey=g}g.time>=this.currentTime?f.interpolate(g,this.currentTime):f.interpolate(g,g.time);this.data.hierarchy[a].node.updateMatrix();c.matrixWorldNeedsUpdate=!0}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c%s " % formatted)
- return "%s " % (class_name, "".join(back))
-
- def getObjSize(self, obj, hpy=None):
- if hpy:
- return float(hpy.iso(obj).domisize) / 1024
- else:
- return 0
-
- # /Stats entry point
- def actionStats(self):
- import gc
- import sys
- from Ui import UiRequest
- from Db import Db
- from Crypt import CryptConnection
-
- hpy = None
- if self.get.get("size") == "1": # Calc obj size
- try:
- import guppy
- hpy = guppy.hpy()
- except:
- pass
- self.sendHeader()
-
- if "Multiuser" in PluginManager.plugin_manager.plugin_names and not config.multiuser_local:
- yield "This function is disabled on this proxy"
- raise StopIteration
-
- s = time.time()
- main = sys.modules["main"]
-
- # Style
- yield """
-
- """
-
- # Memory
- try:
- yield "rev%s | " % config.rev
- yield "%s | " % config.ip_external
- yield "Opened: %s | " % main.file_server.port_opened
- yield "Crypt: %s | " % CryptConnection.manager.crypt_supported
- yield "In: %.2fMB, Out: %.2fMB | " % (
- float(main.file_server.bytes_recv) / 1024 / 1024,
- float(main.file_server.bytes_sent) / 1024 / 1024
- )
- yield "Peerid: %s | " % main.file_server.peer_id
- import psutil
- process = psutil.Process(os.getpid())
- mem = process.get_memory_info()[0] / float(2 ** 20)
- yield "Mem: %.2fMB | " % mem
- yield "Threads: %s | " % len(process.threads())
- yield "CPU: usr %.2fs sys %.2fs | " % process.cpu_times()
- yield "Files: %s | " % len(process.open_files())
- yield "Sockets: %s | " % len(process.connections())
- yield "Calc size on off"
- except Exception:
- pass
- yield "
"
-
- # Connections
- yield "Connections (%s, total made: %s):
" % (
- len(main.file_server.connections), main.file_server.last_connection_id
- )
- yield "
"
-
- # Tor hidden services
- yield " "
- for connection in main.file_server.connections:
- if "cipher" in dir(connection.sock):
- cipher = connection.sock.cipher()[0]
- else:
- cipher = connection.crypt
- yield self.formatTableRow([
- ("%3d", connection.id),
- ("%s", connection.type),
- ("%s:%s", (connection.ip, connection.port)),
- ("%s", connection.handshake.get("port_opened")),
- ("%s", (connection.crypt, cipher)),
- ("%6.3f", connection.last_ping_delay),
- ("%s", connection.incomplete_buff_recv),
- ("%s", connection.bad_actions),
- ("since", max(connection.last_send_time, connection.last_recv_time)),
- ("since", connection.start_time),
- ("%.3f", connection.last_sent_time - connection.last_send_time),
- ("%.3f", connection.cpu_time),
- ("%.0fkB", connection.bytes_sent / 1024),
- ("%.0fkB", connection.bytes_recv / 1024),
- ("%s", connection.last_cmd),
- ("%s", connection.waiting_requests.keys()),
- ("%s r%s", (connection.handshake.get("version"), connection.handshake.get("rev", "?"))),
- ("%s", connection.sites)
- ])
- yield "id type ip open crypt ping "
- yield "buff bad idle open delay cpu out in last sent "
- yield "wait version sites
Tor hidden services (status: %s):
" % main.file_server.tor_manager.status
- for site_address, onion in main.file_server.tor_manager.site_onions.items():
- yield "- %-34s: %s
" % (site_address, onion)
-
- # Db
- yield "
Db:
"
- for db in sys.modules["Db.Db"].opened_dbs:
- yield "- %.3fs: %s
" % (time.time() - db.last_query_time, db.db_path.encode("utf8"))
-
- # Sites
- yield "
Sites:"
- yield ""
- yield "
"
-
- # No more if not in debug mode
- if not config.debug:
- raise StopIteration
-
- # Object types
-
- obj_count = {}
- for obj in gc.get_objects():
- obj_type = str(type(obj))
- if obj_type not in obj_count:
- obj_count[obj_type] = [0, 0]
- obj_count[obj_type][0] += 1 # Count
- obj_count[obj_type][1] += float(sys.getsizeof(obj)) / 1024 # Size
-
- yield " "
- for site in sorted(self.server.sites.values(), lambda a, b: cmp(a.address,b.address)):
- yield self.formatTableRow([
- (
- """%s""",
- (site.address, site.address)
- ),
- ("%s", [peer.connection.id for peer in site.peers.values() if peer.connection and peer.connection.connected]),
- ("%s/%s/%s", (
- len([peer for peer in site.peers.values() if peer.connection and peer.connection.connected]),
- len(site.getConnectablePeers(100)),
- len(site.peers)
- )),
- ("%s (loaded: %s)", (
- len(site.content_manager.contents),
- len([key for key, val in dict(site.content_manager.contents).iteritems() if val])
- )),
- ("%.0fkB", site.settings.get("bytes_sent", 0) / 1024),
- ("%.0fkB", site.settings.get("bytes_recv", 0) / 1024),
- ], "serving-%s" % site.settings["serving"])
- yield "address connected peers content.json out in "
- yield "
Objects in memory (types: %s, total: %s, %.2fkb):
" % (
- len(obj_count),
- sum([stat[0] for stat in obj_count.values()]),
- sum([stat[1] for stat in obj_count.values()])
- )
-
- for obj, stat in sorted(obj_count.items(), key=lambda x: x[1][0], reverse=True): # Sorted by count
- yield " - %.1fkb = %s x %s
" % (stat[1], stat[0], obj, cgi.escape(obj))
-
- # Classes
-
- class_count = {}
- for obj in gc.get_objects():
- obj_type = str(type(obj))
- if obj_type != "
Classes in memory (types: %s, total: %s, %.2fkb):
" % (
- len(class_count),
- sum([stat[0] for stat in class_count.values()]),
- sum([stat[1] for stat in class_count.values()])
- )
-
- for obj, stat in sorted(class_count.items(), key=lambda x: x[1][0], reverse=True): # Sorted by count
- yield " - %.1fkb = %s x %s
" % (stat[1], stat[0], obj, cgi.escape(obj))
-
- from greenlet import greenlet
- objs = [obj for obj in gc.get_objects() if isinstance(obj, greenlet)]
- yield "
Greenlets (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj).encode("utf8")))
-
- from Worker import Worker
- objs = [obj for obj in gc.get_objects() if isinstance(obj, Worker)]
- yield "
Workers (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj)))
-
- from Connection import Connection
- objs = [obj for obj in gc.get_objects() if isinstance(obj, Connection)]
- yield "
Connections (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj)))
-
- from socket import socket
- objs = [obj for obj in gc.get_objects() if isinstance(obj, socket)]
- yield "
Sockets (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj)))
-
- from msgpack import Unpacker
- objs = [obj for obj in gc.get_objects() if isinstance(obj, Unpacker)]
- yield "
Msgpack unpacker (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj)))
-
- from Site import Site
- objs = [obj for obj in gc.get_objects() if isinstance(obj, Site)]
- yield "
Sites (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj)))
-
- objs = [obj for obj in gc.get_objects() if isinstance(obj, self.server.log.__class__)]
- yield "
Loggers (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj.name)))
-
- objs = [obj for obj in gc.get_objects() if isinstance(obj, UiRequest)]
- yield "
UiRequests (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj)))
-
- from Peer import Peer
- objs = [obj for obj in gc.get_objects() if isinstance(obj, Peer)]
- yield "
Peers (%s):
" % len(objs)
- for obj in objs:
- yield " - %.1fkb: %s
" % (self.getObjSize(obj, hpy), cgi.escape(repr(obj)))
-
- objs = [(key, val) for key, val in sys.modules.iteritems() if val is not None]
- objs.sort()
- yield "
Modules (%s):
" % len(objs)
- for module_name, module in objs:
- yield " - %.3fkb: %s %s
" % (self.getObjSize(module, hpy), module_name, cgi.escape(repr(module)))
-
- gc.collect() # Implicit grabage collection
- yield "Done in %.1f" % (time.time() - s)
-
- def actionDumpobj(self):
-
- import gc
- import sys
-
- self.sendHeader()
-
- if "Multiuser" in PluginManager.plugin_manager.plugin_names and not config.multiuser_local:
- yield "This function is disabled on this proxy"
- raise StopIteration
-
- # No more if not in debug mode
- if not config.debug:
- yield "Not in debug mode"
- raise StopIteration
-
- class_filter = self.get.get("class")
-
- yield """
-
- """
-
- objs = gc.get_objects()
- for obj in objs:
- obj_type = str(type(obj))
- if obj_type != "
" % (attr, cgi.escape(str(getattr(obj, attr))))
- yield "
"
-
- gc.collect() # Implicit grabage collection
-
- def actionListobj(self):
-
- import gc
- import sys
-
- self.sendHeader()
-
- if "Multiuser" in PluginManager.plugin_manager.plugin_names and not config.multiuser_local:
- yield "This function is disabled on this proxy"
- raise StopIteration
-
- # No more if not in debug mode
- if not config.debug:
- yield "Not in debug mode"
- raise StopIteration
-
- type_filter = self.get.get("type")
-
- yield """
-
- """
-
- yield "Listing all %s objects in memory...
" % cgi.escape(type_filter)
-
- ref_count = {}
- objs = gc.get_objects()
- for obj in objs:
- obj_type = str(type(obj))
- if obj_type != type_filter:
- continue
- refs = [
- ref for ref in gc.get_referrers(obj)
- if hasattr(ref, "__class__") and
- ref.__class__.__name__ not in ["list", "dict", "function", "type", "frame", "WeakSet", "tuple"]
- ]
- if not refs:
- continue
- try:
- yield "%.1fkb %s... " % (
- float(sys.getsizeof(obj)) / 1024, cgi.escape(str(obj)), cgi.escape(str(obj)[0:100].ljust(100))
- )
- except:
- continue
- for ref in refs:
- yield " ["
- if "object at" in str(ref) or len(str(ref)) > 100:
- yield str(ref.__class__.__name__)
- else:
- yield str(ref.__class__.__name__) + ":" + cgi.escape(str(ref))
- yield "] "
- ref_type = ref.__class__.__name__
- if ref_type not in ref_count:
- ref_count[ref_type] = [0, 0]
- ref_count[ref_type][0] += 1 # Count
- ref_count[ref_type][1] += float(sys.getsizeof(obj)) / 1024 # Size
- yield "
"
-
- yield "
Object referrer (total: %s, %.2fkb):
" % (len(ref_count), sum([stat[1] for stat in ref_count.values()]))
-
- for obj, stat in sorted(ref_count.items(), key=lambda x: x[1][0], reverse=True)[0:30]: # Sorted by count
- yield " - %.1fkb = %s x %s
" % (stat[1], stat[0], cgi.escape(str(obj)))
-
- gc.collect() # Implicit grabage collection
-
- def actionBenchmark(self):
- import sys
- import gc
- from contextlib import contextmanager
-
- output = self.sendHeader()
-
- if "Multiuser" in PluginManager.plugin_manager.plugin_names and not config.multiuser_local:
- yield "This function is disabled on this proxy"
- raise StopIteration
-
- @contextmanager
- def benchmark(name, standard):
- s = time.time()
- output("- %s" % name)
- try:
- yield 1
- except Exception, err:
- output("
! Error: %s
" % err)
- taken = time.time() - s
- if taken > 0:
- multipler = standard / taken
- else:
- multipler = 99
- if multipler < 0.3:
- speed = "Sloooow"
- elif multipler < 0.5:
- speed = "Ehh"
- elif multipler < 0.8:
- speed = "Goodish"
- elif multipler < 1.2:
- speed = "OK"
- elif multipler < 1.7:
- speed = "Fine"
- elif multipler < 2.5:
- speed = "Fast"
- elif multipler < 3.5:
- speed = "WOW"
- else:
- speed = "Insane!!"
- output("%.3fs [x%.2f: %s]
" % (taken, multipler, speed))
- time.sleep(0.01)
-
- yield """
-
- """
-
- yield "Benchmarking ZeroNet %s (rev%s) Python %s on: %s...
" % (config.version, config.rev, sys.version, sys.platform)
-
- t = time.time()
-
- # CryptBitcoin
- yield "
CryptBitcoin:
"
- from Crypt import CryptBitcoin
-
- # seed = CryptBitcoin.newSeed()
- # yield "- Seed: %s
" % seed
- seed = "e180efa477c63b0f2757eac7b1cce781877177fe0966be62754ffd4c8592ce38"
-
- with benchmark("hdPrivatekey x 10", 0.7):
- for i in range(10):
- privatekey = CryptBitcoin.hdPrivatekey(seed, i * 10)
- yield "."
- valid = "5JsunC55XGVqFQj5kPGK4MWgTL26jKbnPhjnmchSNPo75XXCwtk"
- assert privatekey == valid, "%s != %s" % (privatekey, valid)
-
- data = "Hello" * 1024 # 5k
- with benchmark("sign x 10", 0.35):
- for i in range(10):
- yield "."
- sign = CryptBitcoin.sign(data, privatekey)
- valid = "G1GXaDauZ8vX/N9Jn+MRiGm9h+I94zUhDnNYFaqMGuOiBHB+kp4cRPZOL7l1yqK5BHa6J+W97bMjvTXtxzljp6w="
- assert sign == valid, "%s != %s" % (sign, valid)
-
- address = CryptBitcoin.privatekeyToAddress(privatekey)
- if CryptBitcoin.opensslVerify: # Openssl avalible
- with benchmark("openssl verify x 100", 0.37):
- for i in range(100):
- if i % 10 == 0:
- yield "."
- ok = CryptBitcoin.verify(data, address, sign)
- assert ok, "does not verify from %s" % address
- else:
- yield " - openssl verify x 100...not avalible :(
"
-
- openssl_verify_bk = CryptBitcoin.opensslVerify # Emulate openssl not found in any way
- CryptBitcoin.opensslVerify = None
- with benchmark("pure-python verify x 10", 1.6):
- for i in range(10):
- yield "."
- ok = CryptBitcoin.verify(data, address, sign)
- assert ok, "does not verify from %s" % address
- CryptBitcoin.opensslVerify = openssl_verify_bk
-
- # CryptHash
- yield "
CryptHash:
"
- from Crypt import CryptHash
- from cStringIO import StringIO
-
- data = StringIO("Hello" * 1024 * 1024) # 5m
- with benchmark("sha256 5M x 10", 0.6):
- for i in range(10):
- data.seek(0)
- hash = CryptHash.sha256sum(data)
- yield "."
- valid = "8cd629d9d6aff6590da8b80782a5046d2673d5917b99d5603c3dcb4005c45ffa"
- assert hash == valid, "%s != %s" % (hash, valid)
-
- data = StringIO("Hello" * 1024 * 1024) # 5m
- with benchmark("sha512 5M x 10", 0.6):
- for i in range(10):
- data.seek(0)
- hash = CryptHash.sha512sum(data)
- yield "."
- valid = "9ca7e855d430964d5b55b114e95c6bbb114a6d478f6485df93044d87b108904d"
- assert hash == valid, "%s != %s" % (hash, valid)
-
- with benchmark("os.urandom(256) x 1000", 0.0065):
- for i in range(10):
- for y in range(100):
- data = os.urandom(256)
- yield "."
-
- # Msgpack
- import msgpack
- yield "
Msgpack: (version: %s)
" % ".".join(map(str, msgpack.version))
- binary = 'fqv\xf0\x1a"e\x10,\xbe\x9cT\x9e(\xa5]u\x072C\x8c\x15\xa2\xa8\x93Sw)\x19\x02\xdd\t\xfb\xf67\x88\xd9\xee\x86\xa1\xe4\xb6,\xc6\x14\xbb\xd7$z\x1d\xb2\xda\x85\xf5\xa0\x97^\x01*\xaf\xd3\xb0!\xb7\x9d\xea\x89\xbbh8\xa1"\xa7]e(@\xa2\xa5g\xb7[\xae\x8eE\xc2\x9fL\xb6s\x19\x19\r\xc8\x04S\xd0N\xe4]?/\x01\xea\xf6\xec\xd1\xb3\xc2\x91\x86\xd7\xf4K\xdf\xc2lV\xf4\xe8\x80\xfc\x8ep\xbb\x82\xb3\x86\x98F\x1c\xecS\xc8\x15\xcf\xdc\xf1\xed\xfc\xd8\x18r\xf9\x80\x0f\xfa\x8cO\x97(\x0b]\xf1\xdd\r\xe7\xbf\xed\x06\xbd\x1b?\xc5\xa0\xd7a\x82\xf3\xa8\xe6@\xf3\ri\xa1\xb10\xf6\xd4W\xbc\x86\x1a\xbb\xfd\x94!bS\xdb\xaeM\x92\x00#\x0b\xf7\xad\xe9\xc2\x8e\x86\xbfi![%\xd31]\xc6\xfc2\xc9\xda\xc6v\x82P\xcc\xa9\xea\xb9\xff\xf6\xc8\x17iD\xcf\xf3\xeeI\x04\xe9\xa1\x19\xbb\x01\x92\xf5nn4K\xf8\xbb\xc6\x17e>\xa7 \xbbv'
- data = {"int": 1024*1024*1024, "float": 12345.67890, "text": "hello"*1024, "binary": binary}
- with benchmark("pack 5K x 10 000", 0.78):
- for i in range(10):
- for y in range(1000):
- data_packed = msgpack.packb(data)
- yield "."
- valid = """\x84\xa3int\xce@\x00\x00\x00\xa4text\xda\x14\x00hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello\xa5float\xcb@\xc8\x1c\xd6\xe61\xf8\xa1\xa6binary\xda\x01\x00fqv\xf0\x1a"e\x10,\xbe\x9cT\x9e(\xa5]u\x072C\x8c\x15\xa2\xa8\x93Sw)\x19\x02\xdd\t\xfb\xf67\x88\xd9\xee\x86\xa1\xe4\xb6,\xc6\x14\xbb\xd7$z\x1d\xb2\xda\x85\xf5\xa0\x97^\x01*\xaf\xd3\xb0!\xb7\x9d\xea\x89\xbbh8\xa1"\xa7]e(@\xa2\xa5g\xb7[\xae\x8eE\xc2\x9fL\xb6s\x19\x19\r\xc8\x04S\xd0N\xe4]?/\x01\xea\xf6\xec\xd1\xb3\xc2\x91\x86\xd7\xf4K\xdf\xc2lV\xf4\xe8\x80\xfc\x8ep\xbb\x82\xb3\x86\x98F\x1c\xecS\xc8\x15\xcf\xdc\xf1\xed\xfc\xd8\x18r\xf9\x80\x0f\xfa\x8cO\x97(\x0b]\xf1\xdd\r\xe7\xbf\xed\x06\xbd\x1b?\xc5\xa0\xd7a\x82\xf3\xa8\xe6@\xf3\ri\xa1\xb10\xf6\xd4W\xbc\x86\x1a\xbb\xfd\x94!bS\xdb\xaeM\x92\x00#\x0b\xf7\xad\xe9\xc2\x8e\x86\xbfi![%\xd31]\xc6\xfc2\xc9\xda\xc6v\x82P\xcc\xa9\xea\xb9\xff\xf6\xc8\x17iD\xcf\xf3\xeeI\x04\xe9\xa1\x19\xbb\x01\x92\xf5nn4K\xf8\xbb\xc6\x17e>\xa7 \xbbv"""
- assert data_packed == valid, "%s
!=
%s" % (repr(data_packed), repr(valid))
-
- with benchmark("unpack 5K x 10 000", 1.2):
- for i in range(10):
- for y in range(1000):
- data_unpacked = msgpack.unpackb(data_packed)
- yield "."
- assert data == data_unpacked, "%s != %s" % (data_unpack, data)
-
- with benchmark("streaming unpack 5K x 10 000", 1.4):
- for i in range(10):
- unpacker = msgpack.Unpacker()
- for y in range(1000):
- unpacker.feed(data_packed)
- for data_unpacked in unpacker:
- pass
- yield "."
- assert data == data_unpacked, "%s != %s" % (data_unpack, data)
-
- # Db
- from Db import Db
- import sqlite3
- yield "
Db: (version: %s, API: %s)
" % (sqlite3.sqlite_version, sqlite3.version)
-
- schema = {
- "db_name": "TestDb",
- "db_file": "%s/benchmark.db" % config.data_dir,
- "maps": {
- ".*": {
- "to_table": {
- "test": "test"
- }
- }
- },
- "tables": {
- "test": {
- "cols": [
- ["test_id", "INTEGER"],
- ["title", "TEXT"],
- ["json_id", "INTEGER REFERENCES json (json_id)"]
- ],
- "indexes": ["CREATE UNIQUE INDEX test_key ON test(test_id, json_id)"],
- "schema_changed": 1426195822
- }
- }
- }
-
- if os.path.isfile("%s/benchmark.db" % config.data_dir):
- os.unlink("%s/benchmark.db" % config.data_dir)
-
- with benchmark("Open x 10", 0.13):
- for i in range(10):
- db = Db(schema, "%s/benchmark.db" % config.data_dir)
- db.checkTables()
- db.close()
- yield "."
-
- db = Db(schema, "%s/benchmark.db" % config.data_dir)
- db.checkTables()
- import json
-
- with benchmark("Insert x 10 x 1000", 1.0):
- for u in range(10): # 10 user
- data = {"test": []}
- for i in range(1000): # 1000 line of data
- data["test"].append({"test_id": i, "title": "Testdata for %s message %s" % (u, i)})
- json.dump(data, open("%s/test_%s.json" % (config.data_dir, u), "w"))
- db.updateJson("%s/test_%s.json" % (config.data_dir, u))
- os.unlink("%s/test_%s.json" % (config.data_dir, u))
- yield "."
-
- with benchmark("Buffered insert x 100 x 100", 1.3):
- cur = db.getCursor()
- cur.execute("BEGIN")
- cur.logging = False
- for u in range(100, 200): # 100 user
- data = {"test": []}
- for i in range(100): # 1000 line of data
- data["test"].append({"test_id": i, "title": "Testdata for %s message %s" % (u, i)})
- json.dump(data, open("%s/test_%s.json" % (config.data_dir, u), "w"))
- db.updateJson("%s/test_%s.json" % (config.data_dir, u), cur=cur)
- os.unlink("%s/test_%s.json" % (config.data_dir, u))
- if u % 10 == 0:
- yield "."
- cur.execute("COMMIT")
-
- yield " - Total rows in db: %s
" % db.execute("SELECT COUNT(*) AS num FROM test").fetchone()[0]
-
- with benchmark("Indexed query x 1000", 0.25):
- found = 0
- cur = db.getCursor()
- cur.logging = False
- for i in range(1000): # 1000x by test_id
- res = cur.execute("SELECT * FROM test WHERE test_id = %s" % i)
- for row in res:
- found += 1
- if i % 100 == 0:
- yield "."
-
- assert found == 20000, "Found: %s != 20000" % found
-
- with benchmark("Not indexed query x 100", 0.6):
- found = 0
- cur = db.getCursor()
- cur.logging = False
- for i in range(100): # 1000x by test_id
- res = cur.execute("SELECT * FROM test WHERE json_id = %s" % i)
- for row in res:
- found += 1
- if i % 10 == 0:
- yield "."
-
- assert found == 18900, "Found: %s != 18900" % found
-
- with benchmark("Like query x 100", 1.8):
- found = 0
- cur = db.getCursor()
- cur.logging = False
- for i in range(100): # 1000x by test_id
- res = cur.execute("SELECT * FROM test WHERE title LIKE '%%message %s%%'" % i)
- for row in res:
- found += 1
- if i % 10 == 0:
- yield "."
-
- assert found == 38900, "Found: %s != 11000" % found
-
- db.close()
- if os.path.isfile("%s/benchmark.db" % config.data_dir):
- os.unlink("%s/benchmark.db" % config.data_dir)
-
- gc.collect() # Implicit grabage collection
-
- # Zip
- yield "
Compression:
"
- import zipfile
- test_data = "Test" * 1024
- file_name = "\xc3\x81rv\xc3\xadzt\xc5\xb0r\xc5\x91t\xc3\xbck\xc3\xb6r\xc3\xb3g\xc3\xa9p\xe4\xb8\xad\xe5\x8d\x8e%s.txt"
-
- with benchmark("Zip pack x 10", 0.12):
- for i in range(10):
- with zipfile.ZipFile('%s/test.zip' % config.data_dir, 'w') as archive:
- for y in range(100):
- zip_info = zipfile.ZipInfo(file_name % y, (1980,1,1,0,0,0))
- zip_info.compress_type = zipfile.ZIP_DEFLATED
- zip_info.create_system = 3
- archive.writestr(zip_info, test_data)
- yield "."
-
- hash = CryptHash.sha512sum(open("%s/test.zip" % config.data_dir, "rb"))
- valid = "f6ef623e6653883a1758db14aa593350e26c9dc53a8406d6e6defd6029dbd483"
- assert hash == valid, "Invalid hash: %s != %s
" % (hash, valid)
-
- with benchmark("Zip unpack x 10", 0.2):
- for i in range(10):
- with zipfile.ZipFile('%s/test.zip' % config.data_dir) as archive:
- for y in range(100):
- assert archive.read(file_name % y) == test_data
- yield "."
-
- if os.path.isfile("%s/test.zip" % config.data_dir):
- os.unlink("%s/test.zip" % config.data_dir)
-
- # Tar.gz
- import tarfile
- import struct
-
- # Monkey patch _init_write_gz to use fixed date in order to keep the hash independent from datetime
- def nodate_write_gzip_header(self):
- self.mtime = 0
- original_write_gzip_header(self)
-
- import gzip
- original_write_gzip_header = gzip.GzipFile._write_gzip_header
- gzip.GzipFile._write_gzip_header = nodate_write_gzip_header
-
- test_data_io = StringIO("Test" * 1024)
- with benchmark("Tar.gz pack x 10", 0.3):
- for i in range(10):
- with tarfile.open('%s/test.tar.gz' % config.data_dir, 'w:gz') as archive:
- for y in range(100):
- test_data_io.seek(0)
- tar_info = tarfile.TarInfo(file_name % y)
- tar_info.size = 4 * 1024
- archive.addfile(tar_info, test_data_io)
- yield "."
-
- hash = CryptHash.sha512sum(open("%s/test.tar.gz" % config.data_dir, "rb"))
- valid = "4704ebd8c987ed6f833059f1de9c475d443b0539b8d4c4cb8b49b26f7bbf2d19"
- assert hash == valid, "Invalid hash: %s != %s
" % (hash, valid)
-
- with benchmark("Tar.gz unpack x 10", 0.2):
- for i in range(10):
- with tarfile.open('%s/test.tar.gz' % config.data_dir, 'r:gz') as archive:
- for y in range(100):
- assert archive.extractfile(file_name % y).read() == test_data
- yield "."
-
- if os.path.isfile("%s/test.tar.gz" % config.data_dir):
- os.unlink("%s/test.tar.gz" % config.data_dir)
-
- # Tar.bz2
- import tarfile
- test_data_io = StringIO("Test" * 1024)
- with benchmark("Tar.bz2 pack x 10", 2.0):
- for i in range(10):
- with tarfile.open('%s/test.tar.bz2' % config.data_dir, 'w:bz2') as archive:
- for y in range(100):
- test_data_io.seek(0)
- tar_info = tarfile.TarInfo(file_name % y)
- tar_info.size = 4 * 1024
- archive.addfile(tar_info, test_data_io)
- yield "."
-
- hash = CryptHash.sha512sum(open("%s/test.tar.bz2" % config.data_dir, "rb"))
- valid = "90cba0b4d9abaa37b830bf37e4adba93bfd183e095b489ebee62aaa94339f3b5"
- assert hash == valid, "Invalid hash: %s != %s
" % (hash, valid)
-
- with benchmark("Tar.bz2 unpack x 10", 0.5):
- for i in range(10):
- with tarfile.open('%s/test.tar.bz2' % config.data_dir, 'r:bz2') as archive:
- for y in range(100):
- assert archive.extractfile(file_name % y).read() == test_data
- yield "."
-
- if os.path.isfile("%s/test.tar.bz2" % config.data_dir):
- os.unlink("%s/test.tar.bz2" % config.data_dir)
-
-
- yield "
Done. Total: %.2fs" % (time.time() - t)
-
- def actionGcCollect(self):
- import gc
- self.sendHeader()
- yield str(gc.collect())
diff --git a/plugins/Stats/__init__.py b/plugins/Stats/__init__.py
deleted file mode 100644
index 90bd9d6e..00000000
--- a/plugins/Stats/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import StatsPlugin
\ No newline at end of file
diff --git a/plugins/TranslateSite/TranslateSitePlugin.py b/plugins/TranslateSite/TranslateSitePlugin.py
deleted file mode 100644
index f0112c11..00000000
--- a/plugins/TranslateSite/TranslateSitePlugin.py
+++ /dev/null
@@ -1,67 +0,0 @@
-import time
-
-from Plugin import PluginManager
-from Translate import translate
-
-
-@PluginManager.registerTo("UiRequest")
-class UiRequestPlugin(object):
- def actionSiteMedia(self, path, header_length=True):
- file_name = path.split("/")[-1]
- if not file_name: # Path ends with /
- file_name = "index.html"
- extension = file_name.split(".")[-1]
- if translate.lang != "en" and extension in ["js", "html"]:
- path_parts = self.parsePath(path)
- file_generator = super(UiRequestPlugin, self).actionSiteMedia(path, header_length=False)
- if "next" in dir(file_generator): # File found and generator returned
- site = self.server.sites.get(path_parts["address"])
- return self.actionPatchFile(site, path_parts["inner_path"], file_generator)
- else:
- return file_generator
-
- else:
- return super(UiRequestPlugin, self).actionSiteMedia(path)
-
- def actionUiMedia(self, path):
- file_generator = super(UiRequestPlugin, self).actionUiMedia(path)
- if translate.lang != "en" and path.endswith(".js"):
- s = time.time()
- data = "".join(list(file_generator))
- data = translate.translateData(data)
- self.log.debug("Patched %s (%s bytes) in %.3fs" % (path, len(data), time.time() - s))
- return iter([data])
- else:
- return file_generator
-
- def actionPatchFile(self, site, inner_path, file_generator):
- content_json = site.content_manager.contents["content.json"]
- lang_file = "languages/%s.json" % translate.lang
- lang_file_exist = False
- if site.settings.get("own"): # My site, check if the file is exist (allow to add new lang without signing)
- if site.storage.isFile(lang_file):
- lang_file_exist = True
- else: # Not my site the reference in content.json is enough (will wait for download later)
- if lang_file in content_json.get("files", {}):
- lang_file_exist = True
-
- if not lang_file_exist or inner_path not in content_json.get("translate", []):
- for part in file_generator:
- if inner_path.endswith(".html"):
- yield part.replace("lang={lang}", "lang=" + str(translate.lang)) # lang get parameter to .js file to avoid cache
- else:
- yield part
- else:
- s = time.time()
- data = "".join(list(file_generator))
-
- # if site.content_manager.contents["content.json"]["files"].get(lang_file):
- site.needFile(lang_file, priority=10)
- if inner_path.endswith("js"):
- data = translate.translateData(data, site.storage.loadJson(lang_file), "js")
- else:
- data = translate.translateData(data, site.storage.loadJson(lang_file), "html")
- data = data.replace("lang={lang}", "lang=" + str(translate.lang)) # lang get parameter to .js file to avoid cache
-
- self.log.debug("Patched %s (%s bytes) in %.3fs" % (inner_path, len(data), time.time() - s))
- yield data
diff --git a/plugins/TranslateSite/__init__.py b/plugins/TranslateSite/__init__.py
deleted file mode 100644
index 0b50ddc8..00000000
--- a/plugins/TranslateSite/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import TranslateSitePlugin
diff --git a/plugins/Trayicon/TrayiconPlugin.py b/plugins/Trayicon/TrayiconPlugin.py
deleted file mode 100644
index dc5da3f6..00000000
--- a/plugins/Trayicon/TrayiconPlugin.py
+++ /dev/null
@@ -1,163 +0,0 @@
-import os
-import sys
-import atexit
-
-from Plugin import PluginManager
-from Config import config
-from Translate import Translate
-
-allow_reload = False # No source reload supported in this plugin
-
-if "_" not in locals():
- _ = Translate("plugins/Trayicon/languages/")
-
-
-@PluginManager.registerTo("Actions")
-class ActionsPlugin(object):
-
- def main(self):
- global notificationicon, winfolders
- from lib import notificationicon, winfolders
- import gevent.threadpool
-
- self.main = sys.modules["main"]
-
- fs_encoding = sys.getfilesystemencoding()
-
- icon = notificationicon.NotificationIcon(
- os.path.join(os.path.dirname(os.path.abspath(__file__).decode(fs_encoding)), 'trayicon.ico'),
- "ZeroNet %s" % config.version
- )
- self.icon = icon
-
- if not config.debug: # Hide console if not in debug mode
- notificationicon.hideConsole()
- self.console = False
- else:
- self.console = True
-
- @atexit.register
- def hideIcon():
- icon.die()
-
- ui_ip = config.ui_ip if config.ui_ip != "*" else "127.0.0.1"
-
- icon.items = [
- (self.titleIp, False),
- (self.titleConnections, False),
- (self.titleTransfer, False),
- (self.titleConsole, self.toggleConsole),
- (self.titleAutorun, self.toggleAutorun),
- "--",
- (_["ZeroNet Twitter"], lambda: self.opensite("https://twitter.com/HelloZeroNet")),
- (_["ZeroNet Reddit"], lambda: self.opensite("http://www.reddit.com/r/zeronet/")),
- (_["ZeroNet Github"], lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet")),
- (_["Report bug/request feature"], lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet/issues")),
- "--",
- (_["!Open ZeroNet"], lambda: self.opensite("http://%s:%s/%s" % (ui_ip, config.ui_port, config.homepage))),
- "--",
- (_["Quit"], self.quit),
- ]
-
- if not notificationicon.hasConsole():
- del icon.items[3]
-
- icon.clicked = lambda: self.opensite("http://%s:%s/%s" % (ui_ip, config.ui_port, config.homepage))
- self.quit_servers_event = gevent.threadpool.ThreadResult(
- lambda res: gevent.spawn_later(0.1, self.quitServers)
- ) # Fix gevent thread switch error
- gevent.threadpool.start_new_thread(icon._run, ()) # Start in real thread (not gevent compatible)
- super(ActionsPlugin, self).main()
- icon._die = True
-
- def quit(self):
- self.icon.die()
- self.quit_servers_event.set(True)
-
- def quitServers(self):
- self.main.ui_server.stop()
- self.main.file_server.stop()
-
- def opensite(self, url):
- import webbrowser
- webbrowser.open(url, new=0)
-
- def titleIp(self):
- title = "!IP: %s " % config.ip_external
- if self.main.file_server.port_opened:
- title += _["(active)"]
- else:
- title += _["(passive)"]
- return title
-
- def titleConnections(self):
- title = _["Connections: %s"] % len(self.main.file_server.connections)
- return title
-
- def titleTransfer(self):
- title = _["Received: %.2f MB | Sent: %.2f MB"] % (
- float(self.main.file_server.bytes_recv) / 1024 / 1024,
- float(self.main.file_server.bytes_sent) / 1024 / 1024
- )
- return title
-
- def titleConsole(self):
- translate = _["Show console window"]
- if self.console:
- return "+" + translate
- else:
- return translate
-
- def toggleConsole(self):
- if self.console:
- notificationicon.hideConsole()
- self.console = False
- else:
- notificationicon.showConsole()
- self.console = True
-
- def getAutorunPath(self):
- return "%s\\zeronet.cmd" % winfolders.get(winfolders.STARTUP)
-
- def formatAutorun(self):
- args = sys.argv[:]
-
- if not getattr(sys, 'frozen', False): # Not frozen
- args.insert(0, sys.executable)
- cwd = os.getcwd().decode(sys.getfilesystemencoding())
- else:
- cwd = os.path.dirname(sys.executable).decode(sys.getfilesystemencoding())
-
- if sys.platform == 'win32':
- args = ['"%s"' % arg for arg in args if arg]
- cmd = " ".join(args)
-
- # Dont open browser on autorun
- cmd = cmd.replace("start.py", "zeronet.py").replace('"--open_browser"', "").replace('"default_browser"', "").strip()
- cmd += ' --open_browser ""'
- cmd = cmd.decode(sys.getfilesystemencoding())
-
- return u"""
- @echo off
- chcp 65001 > nul
- set PYTHONIOENCODING=utf-8
- cd /D \"%s\"
- start "" %s
- """ % (cwd, cmd)
-
- def isAutorunEnabled(self):
- path = self.getAutorunPath()
- return os.path.isfile(path) and open(path).read().decode("utf8") == self.formatAutorun()
-
- def titleAutorun(self):
- translate = _["Start ZeroNet when Windows starts"]
- if self.isAutorunEnabled():
- return "+" + translate
- else:
- return translate
-
- def toggleAutorun(self):
- if self.isAutorunEnabled():
- os.unlink(self.getAutorunPath())
- else:
- open(self.getAutorunPath(), "w").write(self.formatAutorun().encode("utf8"))
diff --git a/plugins/Trayicon/__init__.py b/plugins/Trayicon/__init__.py
deleted file mode 100644
index 5b584962..00000000
--- a/plugins/Trayicon/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-import sys
-
-if sys.platform == 'win32':
- import TrayiconPlugin
\ No newline at end of file
diff --git a/plugins/Trayicon/languages/fr.json b/plugins/Trayicon/languages/fr.json
deleted file mode 100644
index ec335318..00000000
--- a/plugins/Trayicon/languages/fr.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "ZeroNet Twitter": "ZeroNet Twitter",
- "ZeroNet Reddit": "ZeroNet Reddit",
- "ZeroNet Github": "ZeroNet Github",
- "Report bug/request feature": "Rapport d'erreur/Demanger une fonctionnalité",
- "!Open ZeroNet": "!Ouvrir ZeroNet",
- "Quit": "Quitter",
- "(active)": "(actif)",
- "(passive)": "(passif)",
- "Connections: %s": "Connexions: %s",
- "Received: %.2f MB | Sent: %.2f MB": "Reçu: %.2f MB | Envoyé: %.2f MB",
- "Show console window": "Afficher la console",
- "Start ZeroNet when Windows starts": "Lancer ZeroNet au démarrage de Windows"
-}
diff --git a/plugins/Trayicon/languages/hu.json b/plugins/Trayicon/languages/hu.json
deleted file mode 100644
index 56fef23a..00000000
--- a/plugins/Trayicon/languages/hu.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "ZeroNet Twitter": "ZeroNet Twitter",
- "ZeroNet Reddit": "ZeroNet Reddit",
- "ZeroNet Github": "ZeroNet Github",
- "Report bug/request feature": "Hiba bejelentés/ötletek",
- "!Open ZeroNet": "!ZeroNet megnyitása",
- "Quit": "Kilépés",
- "(active)": "(aktív)",
- "(passive)": "(passive)",
- "Connections: %s": "Kapcsolatok: %s",
- "Received: %.2f MB | Sent: %.2f MB": "Fogadott: %.2f MB | Küldött: %.2f MB",
- "Show console window": "Parancssor mutatása",
- "Start ZeroNet when Windows starts": "ZeroNet indítása a Windows-al együtt"
-}
diff --git a/plugins/Trayicon/languages/it.json b/plugins/Trayicon/languages/it.json
deleted file mode 100644
index efbd6cfa..00000000
--- a/plugins/Trayicon/languages/it.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "ZeroNet Twitter": "ZeroNet Twitter",
- "ZeroNet Reddit": "ZeroNet Reddit",
- "ZeroNet Github": "ZeroNet Github",
- "Report bug/request feature": "Segnala bug/richiesta di una funzione",
- "!Open ZeroNet": "!Apri ZeroNet",
- "Quit": "Chiudi",
- "(active)": "(attivo)",
- "(passive)": "(passivo)",
- "Connections: %s": "Connessioni: %s",
- "Received: %.2f MB | Sent: %.2f MB": "Ricevuto: %.2f MB | Inviato: %.2f MB",
- "Show console window": "Mostra finestra console",
- "Start ZeroNet when Windows starts": "Avvia ZeroNet all'avvio di Windows"
-}
diff --git a/plugins/Trayicon/languages/pt-br.json b/plugins/Trayicon/languages/pt-br.json
deleted file mode 100644
index 5e86493a..00000000
--- a/plugins/Trayicon/languages/pt-br.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "ZeroNet Twitter": "ZeroNet Twitter",
- "ZeroNet Reddit": "ZeroNet Reddit",
- "ZeroNet Github": "ZeroNet Github",
- "Report bug/request feature": "Reportar bug/sugerir recurso",
- "!Open ZeroNet": "!Abrir ZeroNet",
- "Quit": "Sair",
- "(active)": "(ativo)",
- "(passive)": "(passivo)",
- "Connections: %s": "Conexões: %s",
- "Received: %.2f MB | Sent: %.2f MB": "Recebido: %.2f MB | Enviado: %.2f MB",
- "Show console window": "Mostrar console",
- "Start ZeroNet when Windows starts": "Iniciar o ZeroNet quando o Windows for iniciado"
-}
diff --git a/plugins/Trayicon/languages/tr.json b/plugins/Trayicon/languages/tr.json
deleted file mode 100644
index 077b8ddd..00000000
--- a/plugins/Trayicon/languages/tr.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "ZeroNet Twitter": "ZeroNet Twitter",
- "ZeroNet Reddit": "ZeroNet Reddit",
- "ZeroNet Github": "ZeroNet Github",
- "Report bug/request feature": "Hata bildir/geliştirme taleb et",
- "!Open ZeroNet": "!ZeroNet'i Aç",
- "Quit": "Kapat",
- "(active)": "(aktif)",
- "(passive)": "(pasif)",
- "Connections: %s": "Bağlantı sayısı: %s",
- "Received: %.2f MB | Sent: %.2f MB": "Gelen: %.2f MB | Gönderilen: %.2f MB",
- "Show console window": "Konsolu aç",
- "Start ZeroNet when Windows starts": "ZeroNet'i açılışta otomatik başlat"
-}
diff --git a/plugins/Trayicon/languages/zh-tw.json b/plugins/Trayicon/languages/zh-tw.json
deleted file mode 100644
index 2189033e..00000000
--- a/plugins/Trayicon/languages/zh-tw.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "ZeroNet Twitter": "ZeroNet Twitter",
- "ZeroNet Reddit": "ZeroNet Reddit",
- "ZeroNet Github": "ZeroNet Github",
- "Report bug/request feature": "回饋问题/請求功能",
- "!Open ZeroNet": "!開啟 ZeroNet",
- "Quit": "退出",
- "(active)": "(主動模式)",
- "(passive)": "(被動模式)",
- "Connections: %s": "連線數: %s",
- "Received: %.2f MB | Sent: %.2f MB": "已收到: %.2f MB | 已傳送: %.2f MB",
- "Show console window": "顯示控制臺窗體",
- "Start ZeroNet when Windows starts": "在 Windows 啟動時執行 ZeroNet"
-}
diff --git a/plugins/Trayicon/languages/zh.json b/plugins/Trayicon/languages/zh.json
deleted file mode 100644
index 29b73305..00000000
--- a/plugins/Trayicon/languages/zh.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "ZeroNet Twitter": "ZeroNet Twitter",
- "ZeroNet Reddit": "ZeroNet Reddit",
- "ZeroNet Github": "ZeroNet Github",
- "Report bug/request feature": "反馈问题/请求功能",
- "!Open ZeroNet": "!打开 ZeroNet",
- "Quit": "退出",
- "(active)": "(主动模式)",
- "(passive)": "(被动模式)",
- "Connections: %s": "连接数: %s",
- "Received: %.2f MB | Sent: %.2f MB": "已接收: %.2f MB | 已发送: %.2f MB",
- "Show console window": "显示控制台窗口",
- "Start ZeroNet when Windows starts": "在 Windows 启动时运行 ZeroNet"
-}
diff --git a/plugins/Trayicon/lib/__init__.py b/plugins/Trayicon/lib/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/plugins/Trayicon/lib/notificationicon.py b/plugins/Trayicon/lib/notificationicon.py
deleted file mode 100644
index bc7e2175..00000000
--- a/plugins/Trayicon/lib/notificationicon.py
+++ /dev/null
@@ -1,724 +0,0 @@
-# Pure ctypes windows taskbar notification icon
-# via https://gist.github.com/jasonbot/5759510
-# Modified for ZeroNet
-
-import ctypes
-import ctypes.wintypes
-import os
-import uuid
-import time
-import gevent
-
-__all__ = ['NotificationIcon']
-
-# Create popup menu
-
-CreatePopupMenu = ctypes.windll.user32.CreatePopupMenu
-CreatePopupMenu.restype = ctypes.wintypes.HMENU
-CreatePopupMenu.argtypes = []
-
-MF_BYCOMMAND = 0x0
-MF_BYPOSITION = 0x400
-
-MF_BITMAP = 0x4
-MF_CHECKED = 0x8
-MF_DISABLED = 0x2
-MF_ENABLED = 0x0
-MF_GRAYED = 0x1
-MF_MENUBARBREAK = 0x20
-MF_MENUBREAK = 0x40
-MF_OWNERDRAW = 0x100
-MF_POPUP = 0x10
-MF_SEPARATOR = 0x800
-MF_STRING = 0x0
-MF_UNCHECKED = 0x0
-
-InsertMenu = ctypes.windll.user32.InsertMenuW
-InsertMenu.restype = ctypes.wintypes.BOOL
-InsertMenu.argtypes = [ctypes.wintypes.HMENU, ctypes.wintypes.UINT, ctypes.wintypes.UINT, ctypes.wintypes.UINT, ctypes.wintypes.LPCWSTR]
-
-AppendMenu = ctypes.windll.user32.AppendMenuW
-AppendMenu.restype = ctypes.wintypes.BOOL
-AppendMenu.argtypes = [ctypes.wintypes.HMENU, ctypes.wintypes.UINT, ctypes.wintypes.UINT, ctypes.wintypes.LPCWSTR]
-
-SetMenuDefaultItem = ctypes.windll.user32.SetMenuDefaultItem
-SetMenuDefaultItem.restype = ctypes.wintypes.BOOL
-SetMenuDefaultItem.argtypes = [ctypes.wintypes.HMENU, ctypes.wintypes.UINT, ctypes.wintypes.UINT]
-
-class POINT(ctypes.Structure):
- _fields_ = [ ('x', ctypes.wintypes.LONG),
- ('y', ctypes.wintypes.LONG)]
-
-GetCursorPos = ctypes.windll.user32.GetCursorPos
-GetCursorPos.argtypes = [ctypes.POINTER(POINT)]
-
-SetForegroundWindow = ctypes.windll.user32.SetForegroundWindow
-SetForegroundWindow.argtypes = [ctypes.wintypes.HWND]
-
-TPM_LEFTALIGN = 0x0
-TPM_CENTERALIGN = 0x4
-TPM_RIGHTALIGN = 0x8
-
-TPM_TOPALIGN = 0x0
-TPM_VCENTERALIGN = 0x10
-TPM_BOTTOMALIGN = 0x20
-
-TPM_NONOTIFY = 0x80
-TPM_RETURNCMD = 0x100
-
-TPM_LEFTBUTTON = 0x0
-TPM_RIGHTBUTTON = 0x2
-
-TPM_HORNEGANIMATION = 0x800
-TPM_HORPOSANIMATION = 0x400
-TPM_NOANIMATION = 0x4000
-TPM_VERNEGANIMATION = 0x2000
-TPM_VERPOSANIMATION = 0x1000
-
-TrackPopupMenu = ctypes.windll.user32.TrackPopupMenu
-TrackPopupMenu.restype = ctypes.wintypes.BOOL
-TrackPopupMenu.argtypes = [ctypes.wintypes.HMENU, ctypes.wintypes.UINT, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.wintypes.HWND, ctypes.c_void_p]
-
-PostMessage = ctypes.windll.user32.PostMessageW
-PostMessage.restype = ctypes.wintypes.BOOL
-PostMessage.argtypes = [ctypes.wintypes.HWND, ctypes.wintypes.UINT, ctypes.wintypes.WPARAM, ctypes.wintypes.LPARAM]
-
-DestroyMenu = ctypes.windll.user32.DestroyMenu
-DestroyMenu.restype = ctypes.wintypes.BOOL
-DestroyMenu.argtypes = [ctypes.wintypes.HMENU]
-
-# Create notification icon
-
-GUID = ctypes.c_ubyte * 16
-
-class TimeoutVersionUnion(ctypes.Union):
- _fields_ = [('uTimeout', ctypes.wintypes.UINT),
- ('uVersion', ctypes.wintypes.UINT),]
-
-NIS_HIDDEN = 0x1
-NIS_SHAREDICON = 0x2
-
-class NOTIFYICONDATA(ctypes.Structure):
- def __init__(self, *args, **kwargs):
- super(NOTIFYICONDATA, self).__init__(*args, **kwargs)
- self.cbSize = ctypes.sizeof(self)
- _fields_ = [
- ('cbSize', ctypes.wintypes.DWORD),
- ('hWnd', ctypes.wintypes.HWND),
- ('uID', ctypes.wintypes.UINT),
- ('uFlags', ctypes.wintypes.UINT),
- ('uCallbackMessage', ctypes.wintypes.UINT),
- ('hIcon', ctypes.wintypes.HICON),
- ('szTip', ctypes.wintypes.WCHAR * 64),
- ('dwState', ctypes.wintypes.DWORD),
- ('dwStateMask', ctypes.wintypes.DWORD),
- ('szInfo', ctypes.wintypes.WCHAR * 256),
- ('union', TimeoutVersionUnion),
- ('szInfoTitle', ctypes.wintypes.WCHAR * 64),
- ('dwInfoFlags', ctypes.wintypes.DWORD),
- ('guidItem', GUID),
- ('hBalloonIcon', ctypes.wintypes.HICON),
- ]
-
-NIM_ADD = 0
-NIM_MODIFY = 1
-NIM_DELETE = 2
-NIM_SETFOCUS = 3
-NIM_SETVERSION = 4
-
-NIF_MESSAGE = 1
-NIF_ICON = 2
-NIF_TIP = 4
-NIF_STATE = 8
-NIF_INFO = 16
-NIF_GUID = 32
-NIF_REALTIME = 64
-NIF_SHOWTIP = 128
-
-NIIF_NONE = 0
-NIIF_INFO = 1
-NIIF_WARNING = 2
-NIIF_ERROR = 3
-NIIF_USER = 4
-
-NOTIFYICON_VERSION = 3
-NOTIFYICON_VERSION_4 = 4
-
-Shell_NotifyIcon = ctypes.windll.shell32.Shell_NotifyIconW
-Shell_NotifyIcon.restype = ctypes.wintypes.BOOL
-Shell_NotifyIcon.argtypes = [ctypes.wintypes.DWORD, ctypes.POINTER(NOTIFYICONDATA)]
-
-# Load icon/image
-
-IMAGE_BITMAP = 0
-IMAGE_ICON = 1
-IMAGE_CURSOR = 2
-
-LR_CREATEDIBSECTION = 0x00002000
-LR_DEFAULTCOLOR = 0x00000000
-LR_DEFAULTSIZE = 0x00000040
-LR_LOADFROMFILE = 0x00000010
-LR_LOADMAP3DCOLORS = 0x00001000
-LR_LOADTRANSPARENT = 0x00000020
-LR_MONOCHROME = 0x00000001
-LR_SHARED = 0x00008000
-LR_VGACOLOR = 0x00000080
-
-OIC_SAMPLE = 32512
-OIC_HAND = 32513
-OIC_QUES = 32514
-OIC_BANG = 32515
-OIC_NOTE = 32516
-OIC_WINLOGO = 32517
-OIC_WARNING = OIC_BANG
-OIC_ERROR = OIC_HAND
-OIC_INFORMATION = OIC_NOTE
-
-LoadImage = ctypes.windll.user32.LoadImageW
-LoadImage.restype = ctypes.wintypes.HANDLE
-LoadImage.argtypes = [ctypes.wintypes.HINSTANCE, ctypes.wintypes.LPCWSTR, ctypes.wintypes.UINT, ctypes.c_int, ctypes.c_int, ctypes.wintypes.UINT]
-
-# CreateWindow call
-
-WNDPROC = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.wintypes.HWND, ctypes.c_uint, ctypes.wintypes.WPARAM, ctypes.wintypes.LPARAM)
-DefWindowProc = ctypes.windll.user32.DefWindowProcW
-DefWindowProc.restype = ctypes.c_int
-DefWindowProc.argtypes = [ctypes.wintypes.HWND, ctypes.c_uint, ctypes.wintypes.WPARAM, ctypes.wintypes.LPARAM]
-
-WS_OVERLAPPED = 0x00000000L
-WS_POPUP = 0x80000000L
-WS_CHILD = 0x40000000L
-WS_MINIMIZE = 0x20000000L
-WS_VISIBLE = 0x10000000L
-WS_DISABLED = 0x08000000L
-WS_CLIPSIBLINGS = 0x04000000L
-WS_CLIPCHILDREN = 0x02000000L
-WS_MAXIMIZE = 0x01000000L
-WS_CAPTION = 0x00C00000L
-WS_BORDER = 0x00800000L
-WS_DLGFRAME = 0x00400000L
-WS_VSCROLL = 0x00200000L
-WS_HSCROLL = 0x00100000L
-WS_SYSMENU = 0x00080000L
-WS_THICKFRAME = 0x00040000L
-WS_GROUP = 0x00020000L
-WS_TABSTOP = 0x00010000L
-
-WS_MINIMIZEBOX = 0x00020000L
-WS_MAXIMIZEBOX = 0x00010000L
-
-WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED |
- WS_CAPTION |
- WS_SYSMENU |
- WS_THICKFRAME |
- WS_MINIMIZEBOX |
- WS_MAXIMIZEBOX)
-
-SM_XVIRTUALSCREEN = 76
-SM_YVIRTUALSCREEN = 77
-SM_CXVIRTUALSCREEN = 78
-SM_CYVIRTUALSCREEN = 79
-SM_CMONITORS = 80
-SM_SAMEDISPLAYFORMAT = 81
-
-WM_NULL = 0x0000
-WM_CREATE = 0x0001
-WM_DESTROY = 0x0002
-WM_MOVE = 0x0003
-WM_SIZE = 0x0005
-WM_ACTIVATE = 0x0006
-WM_SETFOCUS = 0x0007
-WM_KILLFOCUS = 0x0008
-WM_ENABLE = 0x000A
-WM_SETREDRAW = 0x000B
-WM_SETTEXT = 0x000C
-WM_GETTEXT = 0x000D
-WM_GETTEXTLENGTH = 0x000E
-WM_PAINT = 0x000F
-WM_CLOSE = 0x0010
-WM_QUERYENDSESSION = 0x0011
-WM_QUIT = 0x0012
-WM_QUERYOPEN = 0x0013
-WM_ERASEBKGND = 0x0014
-WM_SYSCOLORCHANGE = 0x0015
-WM_ENDSESSION = 0x0016
-WM_SHOWWINDOW = 0x0018
-WM_CTLCOLOR = 0x0019
-WM_WININICHANGE = 0x001A
-WM_SETTINGCHANGE = 0x001A
-WM_DEVMODECHANGE = 0x001B
-WM_ACTIVATEAPP = 0x001C
-WM_FONTCHANGE = 0x001D
-WM_TIMECHANGE = 0x001E
-WM_CANCELMODE = 0x001F
-WM_SETCURSOR = 0x0020
-WM_MOUSEACTIVATE = 0x0021
-WM_CHILDACTIVATE = 0x0022
-WM_QUEUESYNC = 0x0023
-WM_GETMINMAXINFO = 0x0024
-WM_PAINTICON = 0x0026
-WM_ICONERASEBKGND = 0x0027
-WM_NEXTDLGCTL = 0x0028
-WM_SPOOLERSTATUS = 0x002A
-WM_DRAWITEM = 0x002B
-WM_MEASUREITEM = 0x002C
-WM_DELETEITEM = 0x002D
-WM_VKEYTOITEM = 0x002E
-WM_CHARTOITEM = 0x002F
-WM_SETFONT = 0x0030
-WM_GETFONT = 0x0031
-WM_SETHOTKEY = 0x0032
-WM_GETHOTKEY = 0x0033
-WM_QUERYDRAGICON = 0x0037
-WM_COMPAREITEM = 0x0039
-WM_GETOBJECT = 0x003D
-WM_COMPACTING = 0x0041
-WM_COMMNOTIFY = 0x0044
-WM_WINDOWPOSCHANGING = 0x0046
-WM_WINDOWPOSCHANGED = 0x0047
-WM_POWER = 0x0048
-WM_COPYDATA = 0x004A
-WM_CANCELJOURNAL = 0x004B
-WM_NOTIFY = 0x004E
-WM_INPUTLANGCHANGEREQUEST = 0x0050
-WM_INPUTLANGCHANGE = 0x0051
-WM_TCARD = 0x0052
-WM_HELP = 0x0053
-WM_USERCHANGED = 0x0054
-WM_NOTIFYFORMAT = 0x0055
-WM_CONTEXTMENU = 0x007B
-WM_STYLECHANGING = 0x007C
-WM_STYLECHANGED = 0x007D
-WM_DISPLAYCHANGE = 0x007E
-WM_GETICON = 0x007F
-WM_SETICON = 0x0080
-WM_NCCREATE = 0x0081
-WM_NCDESTROY = 0x0082
-WM_NCCALCSIZE = 0x0083
-WM_NCHITTEST = 0x0084
-WM_NCPAINT = 0x0085
-WM_NCACTIVATE = 0x0086
-WM_GETDLGCODE = 0x0087
-WM_SYNCPAINT = 0x0088
-WM_NCMOUSEMOVE = 0x00A0
-WM_NCLBUTTONDOWN = 0x00A1
-WM_NCLBUTTONUP = 0x00A2
-WM_NCLBUTTONDBLCLK = 0x00A3
-WM_NCRBUTTONDOWN = 0x00A4
-WM_NCRBUTTONUP = 0x00A5
-WM_NCRBUTTONDBLCLK = 0x00A6
-WM_NCMBUTTONDOWN = 0x00A7
-WM_NCMBUTTONUP = 0x00A8
-WM_NCMBUTTONDBLCLK = 0x00A9
-WM_KEYDOWN = 0x0100
-WM_KEYUP = 0x0101
-WM_CHAR = 0x0102
-WM_DEADCHAR = 0x0103
-WM_SYSKEYDOWN = 0x0104
-WM_SYSKEYUP = 0x0105
-WM_SYSCHAR = 0x0106
-WM_SYSDEADCHAR = 0x0107
-WM_KEYLAST = 0x0108
-WM_IME_STARTCOMPOSITION = 0x010D
-WM_IME_ENDCOMPOSITION = 0x010E
-WM_IME_COMPOSITION = 0x010F
-WM_IME_KEYLAST = 0x010F
-WM_INITDIALOG = 0x0110
-WM_COMMAND = 0x0111
-WM_SYSCOMMAND = 0x0112
-WM_TIMER = 0x0113
-WM_HSCROLL = 0x0114
-WM_VSCROLL = 0x0115
-WM_INITMENU = 0x0116
-WM_INITMENUPOPUP = 0x0117
-WM_MENUSELECT = 0x011F
-WM_MENUCHAR = 0x0120
-WM_ENTERIDLE = 0x0121
-WM_MENURBUTTONUP = 0x0122
-WM_MENUDRAG = 0x0123
-WM_MENUGETOBJECT = 0x0124
-WM_UNINITMENUPOPUP = 0x0125
-WM_MENUCOMMAND = 0x0126
-WM_CTLCOLORMSGBOX = 0x0132
-WM_CTLCOLOREDIT = 0x0133
-WM_CTLCOLORLISTBOX = 0x0134
-WM_CTLCOLORBTN = 0x0135
-WM_CTLCOLORDLG = 0x0136
-WM_CTLCOLORSCROLLBAR = 0x0137
-WM_CTLCOLORSTATIC = 0x0138
-WM_MOUSEMOVE = 0x0200
-WM_LBUTTONDOWN = 0x0201
-WM_LBUTTONUP = 0x0202
-WM_LBUTTONDBLCLK = 0x0203
-WM_RBUTTONDOWN = 0x0204
-WM_RBUTTONUP = 0x0205
-WM_RBUTTONDBLCLK = 0x0206
-WM_MBUTTONDOWN = 0x0207
-WM_MBUTTONUP = 0x0208
-WM_MBUTTONDBLCLK = 0x0209
-WM_MOUSEWHEEL = 0x020A
-WM_PARENTNOTIFY = 0x0210
-WM_ENTERMENULOOP = 0x0211
-WM_EXITMENULOOP = 0x0212
-WM_NEXTMENU = 0x0213
-WM_SIZING = 0x0214
-WM_CAPTURECHANGED = 0x0215
-WM_MOVING = 0x0216
-WM_DEVICECHANGE = 0x0219
-WM_MDICREATE = 0x0220
-WM_MDIDESTROY = 0x0221
-WM_MDIACTIVATE = 0x0222
-WM_MDIRESTORE = 0x0223
-WM_MDINEXT = 0x0224
-WM_MDIMAXIMIZE = 0x0225
-WM_MDITILE = 0x0226
-WM_MDICASCADE = 0x0227
-WM_MDIICONARRANGE = 0x0228
-WM_MDIGETACTIVE = 0x0229
-WM_MDISETMENU = 0x0230
-WM_ENTERSIZEMOVE = 0x0231
-WM_EXITSIZEMOVE = 0x0232
-WM_DROPFILES = 0x0233
-WM_MDIREFRESHMENU = 0x0234
-WM_IME_SETCONTEXT = 0x0281
-WM_IME_NOTIFY = 0x0282
-WM_IME_CONTROL = 0x0283
-WM_IME_COMPOSITIONFULL = 0x0284
-WM_IME_SELECT = 0x0285
-WM_IME_CHAR = 0x0286
-WM_IME_REQUEST = 0x0288
-WM_IME_KEYDOWN = 0x0290
-WM_IME_KEYUP = 0x0291
-WM_MOUSEHOVER = 0x02A1
-WM_MOUSELEAVE = 0x02A3
-WM_CUT = 0x0300
-WM_COPY = 0x0301
-WM_PASTE = 0x0302
-WM_CLEAR = 0x0303
-WM_UNDO = 0x0304
-WM_RENDERFORMAT = 0x0305
-WM_RENDERALLFORMATS = 0x0306
-WM_DESTROYCLIPBOARD = 0x0307
-WM_DRAWCLIPBOARD = 0x0308
-WM_PAINTCLIPBOARD = 0x0309
-WM_VSCROLLCLIPBOARD = 0x030A
-WM_SIZECLIPBOARD = 0x030B
-WM_ASKCBFORMATNAME = 0x030C
-WM_CHANGECBCHAIN = 0x030D
-WM_HSCROLLCLIPBOARD = 0x030E
-WM_QUERYNEWPALETTE = 0x030F
-WM_PALETTEISCHANGING = 0x0310
-WM_PALETTECHANGED = 0x0311
-WM_HOTKEY = 0x0312
-WM_PRINT = 0x0317
-WM_PRINTCLIENT = 0x0318
-WM_HANDHELDFIRST = 0x0358
-WM_HANDHELDLAST = 0x035F
-WM_AFXFIRST = 0x0360
-WM_AFXLAST = 0x037F
-WM_PENWINFIRST = 0x0380
-WM_PENWINLAST = 0x038F
-WM_APP = 0x8000
-WM_USER = 0x0400
-WM_REFLECT = WM_USER + 0x1c00
-
-class WNDCLASSEX(ctypes.Structure):
- def __init__(self, *args, **kwargs):
- super(WNDCLASSEX, self).__init__(*args, **kwargs)
- self.cbSize = ctypes.sizeof(self)
- _fields_ = [("cbSize", ctypes.c_uint),
- ("style", ctypes.c_uint),
- ("lpfnWndProc", WNDPROC),
- ("cbClsExtra", ctypes.c_int),
- ("cbWndExtra", ctypes.c_int),
- ("hInstance", ctypes.wintypes.HANDLE),
- ("hIcon", ctypes.wintypes.HANDLE),
- ("hCursor", ctypes.wintypes.HANDLE),
- ("hBrush", ctypes.wintypes.HANDLE),
- ("lpszMenuName", ctypes.wintypes.LPCWSTR),
- ("lpszClassName", ctypes.wintypes.LPCWSTR),
- ("hIconSm", ctypes.wintypes.HANDLE)]
-
-ShowWindow = ctypes.windll.user32.ShowWindow
-ShowWindow.argtypes = [ctypes.wintypes.HWND, ctypes.c_int]
-
-def GenerateDummyWindow(callback, uid):
- newclass = WNDCLASSEX()
- newclass.lpfnWndProc = callback
- newclass.lpszClassName = uid.replace("-", "")
- ATOM = ctypes.windll.user32.RegisterClassExW(ctypes.byref(newclass))
- hwnd = ctypes.windll.user32.CreateWindowExW(0, newclass.lpszClassName, None, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0)
- return hwnd
-
-# Message loop calls
-
-TIMERCALLBACK = ctypes.WINFUNCTYPE(None,
- ctypes.wintypes.HWND,
- ctypes.wintypes.UINT,
- ctypes.POINTER(ctypes.wintypes.UINT),
- ctypes.wintypes.DWORD)
-
-SetTimer = ctypes.windll.user32.SetTimer
-SetTimer.restype = ctypes.POINTER(ctypes.wintypes.UINT)
-SetTimer.argtypes = [ctypes.wintypes.HWND,
- ctypes.POINTER(ctypes.wintypes.UINT),
- ctypes.wintypes.UINT,
- TIMERCALLBACK]
-
-KillTimer = ctypes.windll.user32.KillTimer
-KillTimer.restype = ctypes.wintypes.BOOL
-KillTimer.argtypes = [ctypes.wintypes.HWND,
- ctypes.POINTER(ctypes.wintypes.UINT)]
-
-class MSG(ctypes.Structure):
- _fields_ = [ ('HWND', ctypes.wintypes.HWND),
- ('message', ctypes.wintypes.UINT),
- ('wParam', ctypes.wintypes.WPARAM),
- ('lParam', ctypes.wintypes.LPARAM),
- ('time', ctypes.wintypes.DWORD),
- ('pt', POINT)]
-
-GetMessage = ctypes.windll.user32.GetMessageW
-GetMessage.restype = ctypes.wintypes.BOOL
-GetMessage.argtypes = [ctypes.POINTER(MSG), ctypes.wintypes.HWND, ctypes.wintypes.UINT, ctypes.wintypes.UINT]
-
-TranslateMessage = ctypes.windll.user32.TranslateMessage
-TranslateMessage.restype = ctypes.wintypes.ULONG
-TranslateMessage.argtypes = [ctypes.POINTER(MSG)]
-
-DispatchMessage = ctypes.windll.user32.DispatchMessageW
-DispatchMessage.restype = ctypes.wintypes.ULONG
-DispatchMessage.argtypes = [ctypes.POINTER(MSG)]
-
-def LoadIcon(iconfilename, small=False):
- return LoadImage(0,
- unicode(iconfilename),
- IMAGE_ICON,
- 16 if small else 0,
- 16 if small else 0,
- LR_LOADFROMFILE)
-
-
-class NotificationIcon(object):
- def __init__(self, iconfilename, tooltip=None):
- assert os.path.isfile(unicode(iconfilename)), "{} doesn't exist".format(iconfilename)
- self._iconfile = unicode(iconfilename)
- self._hicon = LoadIcon(self._iconfile, True)
- assert self._hicon, "Failed to load {}".format(iconfilename)
- #self._pumpqueue = Queue.Queue()
- self._die = False
- self._timerid = None
- self._uid = uuid.uuid4()
- self._tooltip = unicode(tooltip) if tooltip else u''
- #self._thread = threading.Thread(target=self._run)
- #self._thread.start()
- self._info_bubble = None
- self.items = []
-
-
- def _bubble(self, iconinfo):
- if self._info_bubble:
- info_bubble = self._info_bubble
- self._info_bubble = None
- message = unicode(self._info_bubble)
- iconinfo.uFlags |= NIF_INFO
- iconinfo.szInfo = message
- iconinfo.szInfoTitle = message
- iconinfo.dwInfoFlags = NIIF_INFO
- iconinfo.union.uTimeout = 10000
- Shell_NotifyIcon(NIM_MODIFY, ctypes.pointer(iconinfo))
-
-
- def _run(self):
- self.WM_TASKBARCREATED = ctypes.windll.user32.RegisterWindowMessageW(u'TaskbarCreated')
-
- self._windowproc = WNDPROC(self._callback)
- self._hwnd = GenerateDummyWindow(self._windowproc, str(self._uid))
-
- iconinfo = NOTIFYICONDATA()
- iconinfo.hWnd = self._hwnd
- iconinfo.uID = 100
- iconinfo.uFlags = NIF_ICON | NIF_SHOWTIP | NIF_MESSAGE | (NIF_TIP if self._tooltip else 0)
- iconinfo.uCallbackMessage = WM_MENUCOMMAND
- iconinfo.hIcon = self._hicon
- iconinfo.szTip = self._tooltip
-
- Shell_NotifyIcon(NIM_ADD, ctypes.pointer(iconinfo))
-
- self.iconinfo = iconinfo
-
- PostMessage(self._hwnd, WM_NULL, 0, 0)
-
- message = MSG()
- last_time = -1
- ret = None
- while not self._die:
- try:
- ret = GetMessage(ctypes.pointer(message), 0, 0, 0)
- TranslateMessage(ctypes.pointer(message))
- DispatchMessage(ctypes.pointer(message))
- except Exception, err:
- # print "NotificationIcon error", err, message
- message = MSG()
- time.sleep(0.125)
- print "Icon thread stopped, removing icon..."
-
- Shell_NotifyIcon(NIM_DELETE, ctypes.cast(ctypes.pointer(iconinfo), ctypes.POINTER(NOTIFYICONDATA)))
- ctypes.windll.user32.DestroyWindow(self._hwnd)
- ctypes.windll.user32.DestroyIcon(self._hicon)
-
-
- def _menu(self):
- if not hasattr(self, 'items'):
- return
-
- menu = CreatePopupMenu()
- func = None
-
- try:
- iidx = 1000
- defaultitem = -1
- item_map = {}
- for fs in self.items:
- iidx += 1
- if isinstance(fs, basestring):
- if fs and not fs.strip('-_='):
- AppendMenu(menu, MF_SEPARATOR, iidx, fs)
- else:
- AppendMenu(menu, MF_STRING | MF_GRAYED, iidx, fs)
- elif isinstance(fs, tuple):
- if callable(fs[0]):
- itemstring = fs[0]()
- else:
- itemstring = unicode(fs[0])
- flags = MF_STRING
- if itemstring.startswith("!"):
- itemstring = itemstring[1:]
- defaultitem = iidx
- if itemstring.startswith("+"):
- itemstring = itemstring[1:]
- flags = flags | MF_CHECKED
- itemcallable = fs[1]
- item_map[iidx] = itemcallable
- if itemcallable is False:
- flags = flags | MF_DISABLED
- elif not callable(itemcallable):
- flags = flags | MF_GRAYED
- AppendMenu(menu, flags, iidx, itemstring)
-
- if defaultitem != -1:
- SetMenuDefaultItem(menu, defaultitem, 0)
-
- pos = POINT()
- GetCursorPos(ctypes.pointer(pos))
-
- PostMessage(self._hwnd, WM_NULL, 0, 0)
-
- SetForegroundWindow(self._hwnd)
-
- ti = TrackPopupMenu(menu, TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, pos.x, pos.y, 0, self._hwnd, None)
-
- if ti in item_map:
- func = item_map[ti]
-
- PostMessage(self._hwnd, WM_NULL, 0, 0)
- finally:
- DestroyMenu(menu)
- if func: func()
-
-
- def clicked(self):
- self._menu()
-
-
-
- def _callback(self, hWnd, msg, wParam, lParam):
- # Check if the main thread is still alive
- if msg == WM_TIMER:
- if not any(thread.getName() == 'MainThread' and thread.isAlive()
- for thread in threading.enumerate()):
- self._die = True
- elif msg == WM_MENUCOMMAND and lParam == WM_LBUTTONUP:
- self.clicked()
- elif msg == WM_MENUCOMMAND and lParam == WM_RBUTTONUP:
- self._menu()
- elif msg == self.WM_TASKBARCREATED: # Explorer restarted, add the icon again.
- Shell_NotifyIcon(NIM_ADD, ctypes.pointer(self.iconinfo))
- else:
- return DefWindowProc(hWnd, msg, wParam, lParam)
- return 1
-
-
- def die(self):
- self._die = True
- PostMessage(self._hwnd, WM_NULL, 0, 0)
- time.sleep(0.2)
- try:
- Shell_NotifyIcon(NIM_DELETE, self.iconinfo)
- except Exception, err:
- print "Icon remove error", err
- ctypes.windll.user32.DestroyWindow(self._hwnd)
- ctypes.windll.user32.DestroyIcon(self._hicon)
-
-
- def pump(self):
- try:
- while not self._pumpqueue.empty():
- callable = self._pumpqueue.get(False)
- callable()
- except Queue.Empty:
- pass
-
-
- def announce(self, text):
- self._info_bubble = text
-
-
-def hideConsole():
- ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
-
-def showConsole():
- ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 1)
-
-def hasConsole():
- return ctypes.windll.kernel32.GetConsoleWindow() != 0
-
-if __name__ == "__main__":
- import time
-
- def greet():
- ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
- print "Hello"
-
- def quit():
- ni._die = True
-
- def announce():
- ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 1)
- ni.announce("Hello there")
-
- def clicked():
- ni.announce("Hello")
-
- def dynamicTitle():
- return "!The time is: %s" % time.time()
-
- ni = NotificationIcon(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../trayicon.ico'), "ZeroNet 0.2.9")
- ni.items = [
- (dynamicTitle, False),
- ('Hello', greet),
- ('Title', False),
- ('!Default', greet),
- ('+Popup bubble', announce),
- 'Nothing',
- '--',
- ('Quit', quit)
- ]
- ni.clicked = clicked
- import atexit
-
- @atexit.register
- def goodbye():
- print "You are now leaving the Python sector."
-
- ni._run()
\ No newline at end of file
diff --git a/plugins/Trayicon/lib/winfolders.py b/plugins/Trayicon/lib/winfolders.py
deleted file mode 100644
index d28efc1a..00000000
--- a/plugins/Trayicon/lib/winfolders.py
+++ /dev/null
@@ -1,53 +0,0 @@
-''' Get windows special folders without pythonwin
- Example:
- import specialfolders
- start_programs = specialfolders.get(specialfolders.PROGRAMS)
-
-Code is public domain, do with it what you will.
-
-Luke Pinner - Environment.gov.au, 2010 February 10
-'''
-
-#Imports use _syntax to mask them from autocomplete IDE's
-import ctypes as _ctypes
-from ctypes.wintypes import HWND as _HWND, HANDLE as _HANDLE,DWORD as _DWORD,LPCWSTR as _LPCWSTR,MAX_PATH as _MAX_PATH, create_unicode_buffer as _cub
-_SHGetFolderPath = _ctypes.windll.shell32.SHGetFolderPathW
-
-#public special folder constants
-DESKTOP= 0
-PROGRAMS= 2
-MYDOCUMENTS= 5
-FAVORITES= 6
-STARTUP= 7
-RECENT= 8
-SENDTO= 9
-STARTMENU= 11
-MYMUSIC= 13
-MYVIDEOS= 14
-NETHOOD= 19
-FONTS= 20
-TEMPLATES= 21
-ALLUSERSSTARTMENU= 22
-ALLUSERSPROGRAMS= 23
-ALLUSERSSTARTUP= 24
-ALLUSERSDESKTOP= 25
-APPLICATIONDATA= 26
-PRINTHOOD= 27
-LOCALSETTINGSAPPLICATIONDATA= 28
-ALLUSERSFAVORITES= 31
-LOCALSETTINGSTEMPORARYINTERNETFILES=32
-COOKIES= 33
-LOCALSETTINGSHISTORY= 34
-ALLUSERSAPPLICATIONDATA= 35
-
-def get(intFolder):
- _SHGetFolderPath.argtypes = [_HWND, _ctypes.c_int, _HANDLE, _DWORD, _LPCWSTR]
- auPathBuffer = _cub(_MAX_PATH)
- exit_code=_SHGetFolderPath(0, intFolder, 0, 0, auPathBuffer)
- return auPathBuffer.value
-
-
-if __name__ == "__main__":
- import os
- print get(STARTUP)
- open(get(STARTUP)+"\\zeronet.cmd", "w").write("cd /D %s\r\nzeronet.py" % os.getcwd())
\ No newline at end of file
diff --git a/plugins/Trayicon/trayicon.ico b/plugins/Trayicon/trayicon.ico
deleted file mode 100644
index 08617225..00000000
Binary files a/plugins/Trayicon/trayicon.ico and /dev/null differ
diff --git a/plugins/Zeroname/SiteManagerPlugin.py b/plugins/Zeroname/SiteManagerPlugin.py
deleted file mode 100644
index 2d1979d8..00000000
--- a/plugins/Zeroname/SiteManagerPlugin.py
+++ /dev/null
@@ -1,83 +0,0 @@
-import logging
-import re
-import time
-
-from Config import config
-from Plugin import PluginManager
-
-allow_reload = False # No reload supported
-
-log = logging.getLogger("ZeronamePlugin")
-
-
-@PluginManager.registerTo("SiteManager")
-class SiteManagerPlugin(object):
- site_zeroname = None
- db_domains = None
- db_domains_modified = None
-
- def load(self, *args, **kwargs):
- super(SiteManagerPlugin, self).load(*args, **kwargs)
- if not self.get(config.bit_resolver):
- self.need(config.bit_resolver) # Need ZeroName site
-
- # Checks if its a valid address
- def isAddress(self, address):
- if self.isDomain(address):
- return True
- else:
- return super(SiteManagerPlugin, self).isAddress(address)
-
- # Return: True if the address is domain
- def isDomain(self, address):
- return re.match("(.*?)([A-Za-z0-9_-]+\.[A-Za-z0-9]+)$", address)
-
- # Resolve domain
- # Return: The address or None
- def resolveDomain(self, domain):
- domain = domain.lower()
- if not self.site_zeroname:
- self.site_zeroname = self.need(config.bit_resolver)
-
- site_zeroname_modified = self.site_zeroname.content_manager.contents.get("content.json", {}).get("modified", 0)
- if not self.db_domains or self.db_domains_modified != site_zeroname_modified:
- self.site_zeroname.needFile("data/names.json", priority=10)
- s = time.time()
- self.db_domains = self.site_zeroname.storage.loadJson("data/names.json")
- log.debug(
- "Domain db with %s entries loaded in %.3fs (modification: %s -> %s)" %
- (len(self.db_domains), time.time() - s, self.db_domains_modified, site_zeroname_modified)
- )
- self.db_domains_modified = site_zeroname_modified
- return self.db_domains.get(domain)
-
- # Return or create site and start download site files
- # Return: Site or None if dns resolve failed
- def need(self, address, all_file=True):
- if self.isDomain(address): # Its looks like a domain
- address_resolved = self.resolveDomain(address)
- if address_resolved:
- address = address_resolved
- else:
- return None
-
- return super(SiteManagerPlugin, self).need(address, all_file)
-
- # Return: Site object or None if not found
- def get(self, address):
- if self.sites is None: # Not loaded yet
- self.load()
- if self.isDomain(address): # Its looks like a domain
- address_resolved = self.resolveDomain(address)
- if address_resolved: # Domain found
- site = self.sites.get(address_resolved)
- if site:
- site_domain = site.settings.get("domain")
- if site_domain != address:
- site.settings["domain"] = address
- else: # Domain not found
- site = self.sites.get(address)
-
- else: # Access by site address
- site = self.sites.get(address)
- return site
diff --git a/plugins/Zeroname/UiRequestPlugin.py b/plugins/Zeroname/UiRequestPlugin.py
deleted file mode 100644
index ea9bfcbe..00000000
--- a/plugins/Zeroname/UiRequestPlugin.py
+++ /dev/null
@@ -1,61 +0,0 @@
-import re
-
-from Plugin import PluginManager
-
-
-@PluginManager.registerTo("UiRequest")
-class UiRequestPlugin(object):
-
- def __init__(self, *args, **kwargs):
- from Site import SiteManager
- self.site_manager = SiteManager.site_manager
- super(UiRequestPlugin, self).__init__(*args, **kwargs)
-
- # Media request
- def actionSiteMedia(self, path, header_length=True):
- match = re.match("/media/(?P[A-Za-z0-9-]+\.[A-Za-z0-9\.-]+)(?P