Remove outdated and not-working Santiago module

This commit is contained in:
Sunil Mohan Adapa 2014-10-01 13:36:26 +05:30
parent ea3d72175d
commit b157c474fe
3 changed files with 0 additions and 150 deletions

View File

@ -46,7 +46,6 @@ specified and linked otherwise.
- plinth/modules/lib/auth.py :: -
- plinth/modules/owncloud/owncloud.py :: -
- plinth/modules/packages/packages.py :: -
- plinth/modules/santiago/santiago.py :: -
- plinth/modules/system/system.py :: -
- plinth/modules/tor/tor.py :: -
- plinth/modules/users/users.py :: -

View File

@ -1,25 +0,0 @@
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Plinth module to configure santiago port
"""
from . import santiago
__all__ = ['santiago']

View File

@ -1,124 +0,0 @@
"""
santiago is the interface that listens over a tor hidden service. It
accepts json requests and responds with json data structures filled
with information. There is authentication involved, although I
haven't figured that one all the way through yet.
"""
import os, sys
import cherrypy
from gettext import gettext as _
from plugin_mount import PagePlugin
from modules.auth import require
import cfg
import util as u
santiago_port = 52854
#import gnupg
#def check_sig(query, sig):
# "Verify that the sig and the query match"
# gpg = gnupg.GPG(gnupghome='/home/james/')
# return True
class Santiago(PagePlugin):
order = 90 # order of running init in PagePlugins
def __init__(self):
super(Santiago, self).__init__()
self.register_page("santiago")
self.santiago_address = self.get_santiago_address() #TODO: multiple santiago ports
#set a listener on the santiago address
def get_santiago_address(self):
if 'santiago' in cfg.users['admin'] and 'address' in cfg.users['admin']['santiago']:
return cfg.users['admin']['santiago']['address']
else:
admin = cfg.users['admin']
admin['santiago'] = {}
with open ("/etc/tor/torrc", 'r') as INF:
rc = INF.read()
self.santiago_dir = os.path.join(cfg.file_root, "data", "santiago", "tor")
self.tor_dir = os.path.join(self.santiago_dir, "general")
os.mkdirs(self.santiago_dir)
os.system( 'chmod a+w %s' % self.santiago_dir)
hidden_service_config = "HiddenServiceDir %s\nHiddenServicePort 80 127.0.0.1:%d" % (self.tor_dir, santiago_port)
if hidden_service_config in rc:
## get info from dir (but how? we need perms)
## just fake it for now
admin['santiago']['address'] = "b5wycujkfh2jxfdo.onion"
cfg.users['admin'] = admin
return cfg.users['admin']['santiago']['address']
print("Need to add these two lines to /etc/torrc:\n%s" % hidden_service_config)
return ""
def check_for_hidden_service(self):
pass
@cherrypy.expose
def index(self, *args, **kw):
"""
A request is a dict with some required keys:
req - this is the request. It is a dict that has keys of use to serving the request.
version - the version number of this description (currently 1)
entropy - a random string of at least 256 bytes.
signature - an optional signature
"""
if (cherrypy.request.local.port != santiago_port
#or not check_sig(kw['q'], kw['sig'])
#or cherrypy.request.method.upper() != "POST"
):
raise cherrypy.HTTPError(404)
return kw['q']
from pprint import pformat
#return str(cherrypy.request.params)
return '''
<html><head><title>CP Info</title></head>
<body><pre>%s</pre></body></html>
''' % pformat({
'args': args,
'kw': kw,
'request': dict([(k, getattr(cherrypy.request, k))
for k in dir(cherrypy.request)
if not k.startswith('_')]),
})
#try:
# query = json.loads(q)
#except:
# raise cherrypy.HTTPError(404)
## client requests proxy methods
## we send back a list of proxy methods (complete with routes/IP addresses to connect to)
return str(cherrypy.request.local.port)
a = "<br />".join(dir(cherrypy.request))
a += cherrypy.request.query_string + "!!!!!!!!!!!!"
a += str(cherrypy.request.local.port)
return a
return "test " + cherrypy.request.method.upper() + " "+t
## Plinth page to config santiago
class santiago(PagePlugin):
def __init__(self):
super(Santiago, self).__init__(self)
self.menu = cfg.html_root.privacy.menu.add_item("Santiago", "icon-leaf", "/privacy/santiago", 10)
self.register_page("privacy.santiago")
@cherrypy.expose
@require()
def index(self):
return "Santiago's config goes here."