-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
150 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,60 @@ | ||
#!/usr/bin/env python | ||
|
||
import web | ||
import web, cgi, re | ||
from google.appengine.api import urlfetch | ||
|
||
urls = ( | ||
'/', 'index' | ||
'/', 'index', | ||
'/(.*)', 'check' | ||
) | ||
|
||
render = web.template.render('templates/') | ||
|
||
HTTPRE = re.compile('http:\/\/') | ||
DOWNRE = re.compile('downforeveryoneorjustme\.com') | ||
|
||
def cleanurl(domain): | ||
domain = cgi.escape(domain) | ||
domain.encode("utf-8") | ||
|
||
if HTTPRE.match(domain): | ||
domain = 'http://' + domain | ||
|
||
return domain | ||
|
||
class index: | ||
def GET(self): | ||
return render.index() | ||
title = 'Down for everyone or just me?' | ||
output = render.index() | ||
return render.layout(output, title) | ||
|
||
class check: | ||
def GET(self, domain): | ||
domain = cleanurl(domain) | ||
|
||
if DOWNRE.match(domain): | ||
title = "It's just you." | ||
output = render.hurr() | ||
return render.layout(output, title) | ||
|
||
try: | ||
response = urlfetch.fetch(domain, method='HEAD') | ||
except: | ||
title = "Huh?" | ||
output = render.error() | ||
return render.layout(output, title) | ||
else: | ||
status = response.status_code | ||
|
||
if (status == 200) or (status == 301) or (status == 302): | ||
title = "It's just you." | ||
output = render.up(domain) | ||
else: | ||
title = "It's not just you!" | ||
output = render.down(domain) | ||
|
||
return render.layout(output, title) | ||
|
||
|
||
app = web.application(urls, globals()) | ||
main = app.cgirun() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$def with (domain) | ||
It's not just you! <a href="http://$domain" class="domain">$domain</a> looks down from here. | ||
<p><a href="/">Check another site?</a></p> | ||
<script type="text/javascript"> | ||
<!-- | ||
google_ad_client = "pub-7099521943661584"; | ||
/* 468x60, created 3/13/08 */ | ||
google_ad_slot = "0281650900"; | ||
google_ad_width = 468; | ||
google_ad_height = 60; | ||
//--> | ||
</script> | ||
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Huh? That doesn't look like a site on the interwho. | ||
<p><a href="/">Try again?</a></p> | ||
<script type="text/javascript"> | ||
<!-- | ||
google_ad_client = "pub-7099521943661584"; | ||
/* 468x60, created 3/13/08 */ | ||
google_ad_slot = "0281650900"; | ||
google_ad_width = 468; | ||
google_ad_height = 60; | ||
//--> | ||
</script> | ||
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
If you can see this page and still think we're down, it's just you. | ||
<p><a href="/">Check another site?</a></p> | ||
<script type="text/javascript"> | ||
<!-- | ||
google_ad_client = "pub-7099521943661584"; | ||
/* 468x60, created 3/13/08 */ | ||
google_ad_slot = "0281650900"; | ||
google_ad_width = 468; | ||
google_ad_height = 60; | ||
//--> | ||
</script> | ||
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,7 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> | ||
<link rel="shortcut icon" href="http://static.al3x.net/down_favicon.ico" type="image/x-icon" /> | ||
<!--tipjoy:al3x--> | ||
<title>Down for everyone or just me?</title> | ||
<style type="text/css"> | ||
body{background-color:#fff;color:#333;font-family:Arial,Verdana,sans-serif;font-size:62.5%;margin:10% 5% 0 5%;text-align:center;} | ||
a,a:visited,a:active{color:#0080ff;text-decoration:underline;} | ||
a:hover{text-decoration:none;} | ||
input[type=text]{border:1px solid #ccc;color:#ccc;font-size:1em;padding:4px 6px 4px 6px;} | ||
.domain{font-weight:bold;} | ||
#container{clear:both;font-size:3em;margin:auto;} | ||
#domain_input{width:250px;} | ||
</style> | ||
<script type="text/javascript"> | ||
function clearDomainInput(e) { | ||
if (e.cleared) { return; } | ||
e.cleared = true; | ||
e.value = ''; | ||
e.style.color = '#000'; | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
Back soon. | ||
</div> | ||
<script type="text/javascript"> | ||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | ||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | ||
</script> | ||
<script type="text/javascript"> | ||
var pageTracker = _gat._getTracker("UA-853305-3"); | ||
pageTracker._initData(); | ||
pageTracker._trackPageview(); | ||
</script> | ||
</body> | ||
</html> | ||
<form method="get" name="downform" action="/q" onsubmit="return formSubmit()"> | ||
Is | ||
<input type="text" name="domain" id="domain_input" value="google.com" onclick="clearDomainInput(this);" /> | ||
down for everyone | ||
<a href="#" onclick="formSubmit();">or just me?</a> | ||
<input type="submit" style="display: none;" /> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
$def with (content_for_layout, title) | ||
<html> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> | ||
<link rel="shortcut icon" href="http://static.al3x.net/down_favicon.ico" type="image/x-icon" /> | ||
<!--tipjoy:al3x--> | ||
<title>$title</title> | ||
<style type="text/css"> | ||
body{background-color:#fff;color:#333;font-family:Arial,Verdana,sans-serif;font-size:62.5%;margin:10% 5% 0 5%;text-align:center;} | ||
a,a:visited,a:active{color:#0080ff;text-decoration:underline;} | ||
a:hover{text-decoration:none;} | ||
input[type=text]{border:1px solid #ccc;color:#ccc;font-size:1em;padding:4px 6px 4px 6px;} | ||
.domain{font-weight:bold;} | ||
#container{clear:both;font-size:3em;margin:auto;} | ||
#domain_input{width:250px;} | ||
</style> | ||
<script type="text/javascript"> | ||
function clearDomainInput(e) { | ||
if (e.cleared) { return; } | ||
e.cleared = true; | ||
e.value = ''; | ||
e.style.color = '#000'; | ||
} | ||
|
||
function formSubmit() { | ||
domain = document.getElementById('domain_input').value; | ||
window.location = '/' + domain; | ||
return false; | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
$:content_for_layout | ||
</div> | ||
<script type="text/javascript"> | ||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | ||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | ||
</script> | ||
<script type="text/javascript"> | ||
var pageTracker = _gat._getTracker("UA-853305-3"); | ||
pageTracker._initData(); | ||
pageTracker._trackPageview(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$def with (domain) | ||
It's just you. <a href="http://$domain" class="domain">$domain</a></span> is up. | ||
<p><a href="/">Check another site?</a></p> | ||
<script type="text/javascript"> | ||
<!-- | ||
google_ad_client = "pub-7099521943661584"; | ||
/* 468x60, created 3/13/08 */ | ||
google_ad_slot = "0281650900"; | ||
google_ad_width = 468; | ||
google_ad_height = 60; | ||
//--> | ||
</script> | ||
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> |