Your ROOT_URL in app.ini is unix://git.lalonde.me:3000/ but you are visiting https://git.lalonde.me/matth/subgraph-gnome-shell-extension-tor/commit/0fa48c8b7863d870c71304e0f60274b579d0326f?style=unified&whitespace=show-all
You should set ROOT_URL correctly, otherwise the web may not work correctly.
3 changed files with
28 additions and
11 deletions
@ -68,8 +68,11 @@ const TorControlClient = new Lang.Class({
closeConnection : function ( reason ) {
if ( this . _connection && this . _connection . is _connected ( ) ) {
this . _connection . close ( null ) ;
this . emit ( 'changed-connection-state' , 'closed' , reason ) ;
}
this . _connection = null ;
this . emit ( 'changed-connection-state' , 'closed' , reason ) ;
} ,
switchIdentity : function ( ) {
@ -167,8 +170,11 @@ const TorControlClient = new Lang.Class({
do {
let line = this . _readLine ( ) ;
if ( line === null )
return { replyLines : [ 'Lost connection to Tor server' ] } ;
if ( line === null ) {
let reason = 'Lost connection to Tor server' ;
this . closeConnection ( reason ) ;
return { replyLines : [ reason ] } ;
}
var reply = this . _parseLine ( line ) ;
statusCode = reply . statusCode ;
@ -55,7 +55,7 @@ const TorButton = new Lang.Class({
this . actor . add _child ( this . _icon ) ;
this . _showDisconnectedMenu ( ) ;
this . _showDisconnectedMenu ( 'Haven’ t tried to connect yet' ) ;
} ,
_bindEvents : function ( ) {
@ -76,6 +76,10 @@ const TorButton = new Lang.Class({
} ,
_showConnectedMenu : function ( ) {
if ( this . _menu instanceof TorConnectedIcon ) {
return ;
}
this . _icon . icon _name = TorConnectedIcon ;
this . _menu = new TorPopupMenu ( this . actor , this . _torControlClient ) ;
this . setMenu ( this . _menu ) ;
@ -83,6 +87,11 @@ const TorButton = new Lang.Class({
} ,
_showDisconnectedMenu : function ( reason ) {
if ( this . _menu instanceof TorDisconnectedMenu ) {
this . _menu . setReason ( reason ) ;
return ;
}
this . _icon . icon _name = TorDisconnectedIcon ;
this . _menu = new TorDisconnectedMenu ( this . actor , this . _torControlClient , reason ) ;
this . setMenu ( this . _menu ) ;
@ -94,7 +103,7 @@ const TorButton = new Lang.Class({
} ,
_onProtocolError : function ( source , message , statusCode ) {
Main . notifyError ( 'Tor: ' + message ) ;
log( 'Tor control procotol error (status code ' + statusCode + '): ' + reason )
var msg = 'Tor control protocol error: ' + message + ' (status code' + statusCode + ')' ;
Main. notifyError ( msg ) ;
}
} ) ;
@ -29,29 +29,31 @@ const TorDisconnectedMenu = new Lang.Class({
_init : function ( actor , torControlClient , reason ) {
this . _torControlClient = torControlClient ;
this . _reason = reason ;
this . parent ( actor , 0.25 , St . Side . TOP ) ;
this . _addActions ( ) ;
this . setReason ( reason ) ;
} ,
destroy : function ( ) {
this . parent ( arguments ) ;
} ,
setReason : function ( reason ) {
this . _msgLabel . set _text ( 'No connection. ' + reason ) ;
} ,
_addActions : function ( ) {
var errorMessageMenuItem = new PopupMenu . PopupBaseMenuItem ( { reactive : false } ) ;
errorMessageMenuItem . setSensitive ( false ) ;
errorMessageMenuItem . actor . add _actor ( new St . Label ( {
text : 'No connection. Reason: ' + this . _reason
} ) ) ;
this . _msgLabel = new St . Label ( ) ;
errorMessageMenuItem . actor . add _actor ( this . _msgLabel ) ;
this . addMenuItem ( errorMessageMenuItem ) ;
this . addAction ( 'Reconnect' , Lang . bind ( this , this . _reconnect ) ) ;
} ,
_reconnect : function ( ) {
this . _torControlClient . connect ( 'changed-connection-state' , function ( ) { } )
this . _torControlClient . openConnection ( ) ;
}
} ) ;