Skip to content
timlegrand edited this page Jun 12, 2014 · 3 revisions

Main features

To have a look on how it works and renders, just open the index.html file locally in your web browser. For example:

file:///Users/tim/src/StandaLock/index.html

decryptUrl feature

There's a server.js script to demonstrate the decryptUrl feature. In order to use it, just run

node server.js

Network testing

If you want to try it through the network, you're free to create a web server running on a LAN IP just for the standalock.js and index.html files. Here is mine I use frequently on my Mac, using my mobile as the client:

#!/usr/bin/python
# -*-coding:UTF-8 -*
import urllib
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer

class MyHandler(BaseHTTPRequestHandler):
  
  def do_GET(self):
          
          path = urllib.unquote(self.path[1:]).decode('utf8')
          content_type = "text/html"
          
          ### Handle different request types
          if path == "favicon.ico":
              return
          if path == "/" or path ==  "":
              path = "index.html"

          if path[-4:] == ".html":
              content_type = "text/html"
          elif path[-3:] == ".js":
              content_type = "text/javascript"
          elif path[-4:] == ".css":
          
          ### Open request file
          response_code = 404
          response_text = ""
          try:
              with open(path, "rb") as f:
                  response_code = 200
                  response_text = f.read()
          except:
              print "Error: no such file " + path
          
          ### Send response
          self.send_response(response_code)
          self.send_header("Content-Type", content_type)
          self.end_headers()
          self.wfile.write(response_text)

if __name__ == "__main__":
  
  try:
      server = HTTPServer(('192.168.0.15', 8080), MyHandler)
      server.serve_forever()
  
  except KeyboardInterrupt:
      print('Received keyboard interrupt, shutting down server.')
      server.socket.close()

of course, address and port might be replaced by yours.

Clone this wiki locally