|
@ -168,12 +168,20 @@ def show( request, server ): |
|
|
regformname = "MumbleUserForm" |
|
|
regformname = "MumbleUserForm" |
|
|
EXT_FORMS_PROVIDER.register_form( MumbleUserForm ) |
|
|
EXT_FORMS_PROVIDER.register_form( MumbleUserForm ) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
import qrencode |
|
|
|
|
|
except ImportError: |
|
|
|
|
|
qravail = False |
|
|
|
|
|
else: |
|
|
|
|
|
qravail = True |
|
|
|
|
|
|
|
|
return render_to_response( 'mumble/mumble.html', { |
|
|
return render_to_response( 'mumble/mumble.html', { |
|
|
'MumbleServer': srv, |
|
|
'MumbleServer': srv, |
|
|
'ServerDict': simplejson.dumps(serverinfo(request, server)), |
|
|
'ServerDict': simplejson.dumps(serverinfo(request, server)), |
|
|
'RegForm': regformname, |
|
|
'RegForm': regformname, |
|
|
'MumbleActive': True, |
|
|
'MumbleActive': True, |
|
|
'MumbleAccount':user, |
|
|
'MumbleAccount':user, |
|
|
|
|
|
'QRAvailable': qravail, |
|
|
'IsAdmin': isAdmin, |
|
|
'IsAdmin': isAdmin, |
|
|
}, context_instance = RequestContext(request) ) |
|
|
}, context_instance = RequestContext(request) ) |
|
|
|
|
|
|
|
@ -230,6 +238,24 @@ def showTexture( request, server, userid ): |
|
|
img.save( buf, "PNG" ) |
|
|
img.save( buf, "PNG" ) |
|
|
return HttpResponse( buf.getvalue(), "image/png" ) |
|
|
return HttpResponse( buf.getvalue(), "image/png" ) |
|
|
|
|
|
|
|
|
|
|
|
def qrcode( request, server ): |
|
|
|
|
|
""" Show a QR Coce image that links to the server's embedded page. """ |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
import qrencode |
|
|
|
|
|
except ImportError: |
|
|
|
|
|
return HttpResponse( "oh noez" ) |
|
|
|
|
|
else: |
|
|
|
|
|
from django.contrib.sites.models import Site |
|
|
|
|
|
version, size, img = qrencode.encode_scaled( "%s://%s%s" % ( |
|
|
|
|
|
{ False: "http", True: "https" }[request.is_secure()], |
|
|
|
|
|
Site.objects.get_current().domain, |
|
|
|
|
|
reverse( embed, kwargs={ 'server': server } ) |
|
|
|
|
|
), 100 ) |
|
|
|
|
|
buf = StringIO() |
|
|
|
|
|
img.save( buf, "PNG" ) |
|
|
|
|
|
return HttpResponse( buf.getvalue(), "image/png" ) |
|
|
|
|
|
|
|
|
@EXT_DIRECT_PROVIDER.register_method( "Mumble" ) |
|
|
@EXT_DIRECT_PROVIDER.register_method( "Mumble" ) |
|
|
def get_admin( request, server ): |
|
|
def get_admin( request, server ): |
|
|
srv = get_object_or_404( Mumble, id=int(server) ) |
|
|
srv = get_object_or_404( Mumble, id=int(server) ) |
|
|