diff --git a/README.md b/README.md index 312d72d..a204668 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,9 @@ See a blog post (along with multiple screenshots) describing the project [here.] **The user interface** 1. **Important**. As a one-time setup, copy over the example settings file to your own copy: `$ cp render/render_settings_example.js render/render_settings.js` to create your own `render_settings.js` settings file. In this file modify everything to your own preferences. Follow the provided example to specify title mappings: A raw window title comes in, and we match it against regular expressions to determine what type of activity it is. For example, the code would convert "Google Chrome - some cool website" into just "Google Chrome". Follow the provided example and read the comments for all settings in the file. -2. Once that's set up, start the web server viewer: `$ python ulogme_serve.py`, and go to to the provided address) for example `http://localhost:8123`) in your browser. Hit the refresh button on top right every time you'd like to refresh the results based on most recently recorded activity -3. If your data isn't loading, try to explicitly run `python export_events.py` and then hit refresh. This should only be an issue the very first time you run ulogme. +2. The file `allowed_ip.txt` contains the list of IP addresses which are allowed to view our data. By default, only local host (i.e. our machine) can view. If you want other users in local network to view, explicitly add their IP addresses to this file. One IP address is in one line. +3. Once that's set up, start the web server viewer: `$ python ulogme_serve.py`, and go to to the provided address) for example `http://localhost:8123`) in your browser. Hit the refresh button on top right every time you'd like to refresh the results based on most recently recorded activity +4. If your data isn't loading, try to explicitly run `python export_events.py` and then hit refresh. This should only be an issue the very first time you run ulogme. ## User Interface diff --git a/allowed_ip.txt b/allowed_ip.txt new file mode 100644 index 0000000..7b9ad53 --- /dev/null +++ b/allowed_ip.txt @@ -0,0 +1 @@ +127.0.0.1 diff --git a/logactivewin.sh b/logactivewin.sh index 68408b1..2cfc0cb 100755 --- a/logactivewin.sh +++ b/logactivewin.sh @@ -24,7 +24,7 @@ do # Assume XFCE folks use xscreensaver (the default). screensaverstate=$(xscreensaver-command -time | cut -f2 -d: | cut -f2-3 -d' ') if [[ $screensaverstate =~ "screen non-blanked" ]]; then islocked=false; fi - elif [[ $GDMSESSION == 'ubuntu' || $GDMSESSION == 'ubuntu-2d' || $GDMSESSION == 'gnome-shell' || $GDMSESSION == 'gnome-classic' || $GDMSESSION == 'gnome-fallback' || $GDMSESSION == 'cinnamon' ]]; then + elif [[ $GDMSESSION == 'ubuntu' || $GDMSESSION == 'ubuntu-2d' || $GDMSESSION == 'gnome-shell' || $GDMSESSION == 'gnome-classic' || $GDMSESSION == 'gnome-fallback' || $GDMSESSION == 'cinnamon' || $GDMSESSION == 'gnome-flashback-metacity' ]]; then # Assume the GNOME/Ubuntu/cinnamon folks are using gnome-screensaver. screensaverstate=$(gnome-screensaver-command -q 2>&1 /dev/null) if [[ $screensaverstate =~ .*inactive.* ]]; then islocked=false; fi diff --git a/ulogme_serve.py b/ulogme_serve.py index cbdba9f..b153f9a 100644 --- a/ulogme_serve.py +++ b/ulogme_serve.py @@ -21,6 +21,12 @@ # Custom handler class CustomHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): + ip = self.client_address[0] + if not ip in listOfIP: + # only IP address in the list are allowed to view data + # it protects the privacy + print ip + ' is trying to view our data but is blocked' + return # default behavior SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) @@ -67,6 +73,10 @@ def do_POST(self): self.end_headers() self.wfile.write(result) +f = open('../allowed_ip.txt', 'r') +listOfIP = [i.strip('\n') for i in f.readlines()] +f.close() + httpd = SocketServer.ThreadingTCPServer((IP, PORT), CustomHandler) print 'Serving ulogme, see it on http://localhost:' + `PORT`