#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
| #!/usr/bin/env python | |
| """ | |
| urlnorm.py - URL normalisation routines | |
| urlnorm normalises a URL by; | |
| * lowercasing the scheme and hostname | |
| * taking out default port if present (e.g., http://www.foo.com:80/) | |
| * collapsing the path (./, ../, etc) | |
| * removing the last character in the hostname if it is '.' |
| from django.db import models | |
| class AuthorManager(models.Manager): | |
| def get_by_natural_key(self, first_name, last_name) | |
| return self.get(first_name=first_name, last_name=last_name) | |
| class Author(models.Model): | |
| first_name = models.CharField(max_length=50) | |
| last_name = models.CharField(max_length=50) |
| # ... | |
| class Category(Base): | |
| slug = models.SlugField(_(u'slug'), max_length=100, unique=True) | |
| title = models.CharField(_(u'title'), max_length=250) | |
| parent = models.ForeignKey('self', blank=True, null=True, related_name='child') | |
| class Meta: | |
| verbose_name_plural = 'Categories' |
| <!DOCTYPE html> | |
| <head> | |
| <title>Stay Standalone</title> | |
| <meta name="apple-mobile-web-app-capable" content="yes"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
| <script src="stay_standalone.js" type="text/javascript"></script> | |
| </head> | |
| <body> | |
| <ul> | |
| <li><a href="http://google.com/">Remote Link (Google)</a></li> |
#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
| upstream uwsgi { | |
| ip_hash; | |
| server 127.0.0.1:40000; | |
| } | |
| server { | |
| listen 80; | |
| server_name www.domain.com; | |
| root /sites/mysite/; | |
| access_log /sites/mysite/log/nginx/access.log; |
| .idea/* | |
| *.pyc |
| ############################################################################# | |
| # Documentation # | |
| ############################################################################# | |
| # Author: Todd Whiteman | |
| # Date: 16th March, 2009 | |
| # Verion: 2.0.0 | |
| # License: Public Domain - free to do as you wish | |
| # Homepage: http://twhiteman.netfirms.com/des.html | |
| # |
| import ldap | |
| def check_credentials(username, password): | |
| """Verifies credentials for username and password. | |
| Returns None on success or a string describing the error on failure | |
| # Adapt to your needs | |
| """ | |
| LDAP_SERVER = 'ldap://xxx' | |
| # fully qualified AD user name | |
| LDAP_USERNAME = '%s@xxx.xx' % username |
| ############################################################################# | |
| # Original code ported from the Java reference code by Bram Cohen, April 2001, | |
| # with the following statement: | |
| # | |
| # this code is public domain, unless someone makes | |
| # an intellectual property claim against the reference | |
| # code, in which case it can be made public domain by | |
| # deleting all the comments and renaming all the variables | |
| # | |
| class Rijndael(object): |