Move html

This commit is contained in:
blitzmann
2015-10-25 17:55:39 -04:00
parent 9d7a3605dc
commit 6eb6925606
2 changed files with 27 additions and 31 deletions

View File

@@ -1,28 +0,0 @@
# HTML is stored here as frankly I'm not sure how loading a file would work with
# our current zipfile packaging (and I'm too lazy to find out)
HTML = '''
<!DOCTYPE html>
<html>
<body>
Done. Please close this window.
<script type="text/javascript">
function extractFromHash(name, hash) {
var match = hash.match(new RegExp(name + "=([^&]+)"));
return !!match && match[1];
}
var hash = window.location.hash;
var token = extractFromHash("access_token", hash);
if (token){
var redirect = window.location.origin.concat('/?', window.location.hash.substr(1));
window.location = redirect;
}
else {
console.log("do nothing");
}
</script>
</body>
</html>
'''

View File

@@ -1,4 +1,4 @@
import SimpleHTTPServer, BaseHTTPServer
import BaseHTTPServer
import urlparse
import socket
import thread
@@ -7,12 +7,36 @@ import wx
from wx.lib.pubsub import setupkwargs
from wx.lib.pubsub import pub
from html import HTML
import logging
logger = logging.getLogger(__name__)
HTML = '''
<!DOCTYPE html>
<html>
<body>
Done. Please close this window.
<script type="text/javascript">
function extractFromHash(name, hash) {
var match = hash.match(new RegExp(name + "=([^&]+)"));
return !!match && match[1];
}
var hash = window.location.hash;
var token = extractFromHash("access_token", hash);
if (token){
var redirect = window.location.origin.concat('/?', window.location.hash.substr(1));
window.location = redirect;
}
else {
console.log("do nothing");
}
</script>
</body>
</html>
'''
# https://github.com/fuzzysteve/CREST-Market-Downloader/
class AuthHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):