From 0440af3ba0eb5a0134a58b7adb6eab52467fd5d5 Mon Sep 17 00:00:00 2001 From: pbsds Date: Tue, 28 Jan 2014 16:06:03 +0100 Subject: [PATCH] Made flipnote downloads work, made connectivity test work and minor cleanup --- .gitignore | 5 +- hatena.py | 16 +- .../ds/v2-xx/frontpage/likedmovies.ugo.py | 4 +- hatenadir/ds/v2-xx/movie.py | 20 +- logs/.placeholder | 0 logs/2014/January/26 January activity.log | 222 ------------------ logs/2014/January/26 January error.log | 14 -- 7 files changed, 34 insertions(+), 247 deletions(-) create mode 100644 logs/.placeholder delete mode 100644 logs/2014/January/26 January activity.log delete mode 100644 logs/2014/January/26 January error.log diff --git a/.gitignore b/.gitignore index ae7c061..52572fa 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,13 @@ *.pyo *.lnk +#is emberrasing... :3 +todo.txt + #Don't need all of these on github logs -#not yet ready, this wil be put up on the wiki section later +#not for the public eye, this will be put up on the wiki section as i clean it up. documentation #temp file diff --git a/hatena.py b/hatena.py index 876cee3..da189a8 100644 --- a/hatena.py +++ b/hatena.py @@ -6,7 +6,7 @@ from Hatenatools import *#UGO, PPM, TMB and NTFT ServerLog = None#Is set to the log class by server.py Silent = False -def Log(request, path=None): +def Log(request, path=None, silent=Silent): if not path: path = "\"%s\"" % request.path ServerLog.write("%s requested %s" % (request.getClientIP(), path), Silent) @@ -30,6 +30,15 @@ class NotFound(resource.Resource): request.setResponseCode(404) return "404 - Not Found\nThis proxy is only for Flipnote Hatena for the DSi." NotFound = NotFound() +class ConnectionTest(resource.Resource):#used for people setting up the proxy in their DSi. It's nice to see it's actually working. + #http://conntest.nintendowifi.net/ + isLeaf = True + def render(self, request): + ServerLog.write("%s performed a connection test" % request.getClientIP(), True) + request.responseHeaders.setRawHeaders('X-Organization', ['Nintendo'])#i hope this isn't illegal... + return 'HTML PageThis is test.html page' +ConnectionTest = ConnectionTest() + #Root structure: class Root(resource.Resource):#filters out non-hantena clients @@ -42,6 +51,9 @@ class Root(resource.Resource):#filters out non-hantena clients self.imagesResource = static.File("hatenadir/images/") def getChild(self, name, request): if "x-dsi-sid" not in request.getAllHeaders(): + if "host" in request.getAllHeaders(): + if request.getAllHeaders()["host"] == "conntest.nintendowifi.net": + return ConnectionTest return AccessDenied if name == "ds": @@ -56,6 +68,8 @@ class Root(resource.Resource):#filters out non-hantena clients #return NotFound return self def render(self, request): + if request.getHost() == "conntest.nintendowifi.net": + return ConnectionTest Log(request, "root") return "Welcome to hatena.pbsds.net!\nThis is in early stages, so please don't expect too much." class ds(resource.Resource):#child of Root diff --git a/hatenadir/ds/v2-xx/frontpage/likedmovies.ugo.py b/hatenadir/ds/v2-xx/frontpage/likedmovies.ugo.py index 3544ac2..86ada92 100644 --- a/hatenadir/ds/v2-xx/frontpage/likedmovies.ugo.py +++ b/hatenadir/ds/v2-xx/frontpage/likedmovies.ugo.py @@ -13,7 +13,7 @@ class PyResource(resource.Resource): self.pages = []#10 first pages self.newestview = None - self.Update() + reactor.callLater(2, self.Update)#or it'll clash with hotmovies.ugo def render(self, request): page = int(request.args["page"][0]) if "page" in request.args else 1 @@ -49,7 +49,7 @@ class PyResource(resource.Resource): pages.append(self.MakePage(flipnotes[i*50:i*50+50], i+1, i