Skip to content

Commit 0113022

Browse files
committed
stripped out unneeded api endpoints and the web app
1 parent f4312a5 commit 0113022

30 files changed

+1
-12484
lines changed

Server/Controller/Api.py

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@ def error(request, response, s):
7979
response.headers['Access-Control-Allow-Origin'] = '*'
8080
response.write(json.dumps({'success': False, 'result': s}))
8181

82-
def getUser(request, response):
83-
response.headers['Content-Type'] = 'application/json'
84-
response.headers['Access-Control-Allow-Origin'] = '*'
85-
response.write(json.dumps(request.user.__dict__))
86-
87-
def getScan(request, response):
88-
success(request, response, nut.scan())
89-
9082
def getSearch(request, response):
9183
nsp = []
9284
nsx = []
@@ -233,28 +225,6 @@ def getScreenshotImage(request, response):
233225

234226
return Server.Response500(request, response)
235227

236-
def getPreload(request, response):
237-
Titles.queue.add(request.bits[2])
238-
response.headers['Content-Type'] = 'application/json'
239-
response.write(json.dumps({'success': True}))
240-
241-
def getInstall(request, response):
242-
try:
243-
url = ('%s:%s@%s:%d/api/download/%s/title.nsp' % (request.user.id, request.user.password, Config.server.hostname, Config.server.port, request.bits[2]))
244-
Print.info('Installing ' + str(request.bits[2]))
245-
file_list_payloadBytes = url.encode('ascii')
246-
247-
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
248-
sock.connect((request.user.switchHost, request.user.switchPort))
249-
250-
sock.sendall(struct.pack('!L', len(file_list_payloadBytes)) + file_list_payloadBytes)
251-
while len(sock.recv(1)) < 1:
252-
time.sleep(0.05)
253-
sock.close()
254-
response.write(json.dumps({'success': True, 'message': 'install successful'}))
255-
except BaseException as e:
256-
response.write(json.dumps({'success': False, 'message': str(e)}))
257-
258228
def getInfo(request, response):
259229
try:
260230
response.headers['Content-Type'] = 'application/json'
@@ -695,103 +665,3 @@ def getFiles(request, response):
695665
r[title.baseId]['base'].append(nsp.dict())
696666
response.write(json.dumps(r))
697667

698-
def getOrganize(request, response):
699-
nut.organize()
700-
success(request, response, "fin")
701-
702-
def getUpdateDb(request, response):
703-
for url in Config.titleUrls:
704-
nut.updateDb(url)
705-
Titles.loadTxtDatabases()
706-
Titles.save()
707-
return success(request, response, "Fin")
708-
709-
def getExport(request, response):
710-
if len(request.bits) < 3:
711-
return Server.Response500(request, response)
712-
713-
if len(request.bits) == 3:
714-
nut.export(request.bits[2])
715-
else:
716-
nut.export(request.bits[2], request.bits[3:])
717-
718-
return success(request, response, "Fin")
719-
720-
def getImportRegions(request, response):
721-
nut.importRegion(request.bits[2], request.bits[3])
722-
723-
return success(request, response, "Fin")
724-
725-
def getRegions(request, response):
726-
response.headers['Content-Type'] = 'application/json'
727-
response.write(json.dumps(Config.regionLanguages()))
728-
729-
730-
def getUpdateLatest(request, response):
731-
nut.scanLatestTitleUpdates()
732-
return success(request, response, "Fin")
733-
734-
def getUpdateAllVersions(request, response):
735-
if len(request.bits) >= 3 and int(request.bits[2]) > 0:
736-
nut.updateVersions(True)
737-
else:
738-
nut.updateVersions(False)
739-
return success(request, response, "Fin")
740-
741-
def getScrapeShogun(request, response):
742-
nut.scrapeShogun()
743-
return success(request, response, "Fin")
744-
745-
def getSubmitKey(request, response):
746-
titleId = request.bits[2]
747-
titleKey = request.bits[3]
748-
749-
try:
750-
if blockchain.blockchain.suggest(titleId, titleKey):
751-
return success(request, response, "Key successfully added")
752-
else:
753-
return error(request, response, "Key validation failed")
754-
except LookupError as e:
755-
error(request, response, str(e))
756-
except OSError as e:
757-
error(request, response, str(e))
758-
except BaseException as e:
759-
error(request, response, str(e))
760-
761-
762-
def postTinfoilSetInstalledApps(request, response):
763-
try:
764-
if len(request.bits) >= 3:
765-
serial = request.bits[2]
766-
else:
767-
serial = 'incognito'
768-
769-
path = 'switch/' + serial + ''
770-
Print.info('path: ' + path)
771-
os.makedirs(path, exist_ok=True)
772-
773-
with open(path + '/installed.json', 'wb') as f:
774-
f.write(request.post)
775-
776-
return success(request, response, "OK")
777-
except BaseException:
778-
raise
779-
780-
781-
def getSwitchList(request, response):
782-
try:
783-
response.headers['Content-Type'] = 'application/json'
784-
dirs = [f for f in os.listdir('switch/') if os.path.isdir(os.path.join('switch/', f))]
785-
response.write(json.dumps(dirs))
786-
except BaseException as e:
787-
error(request, response, str(e))
788-
789-
def getSwitchInstalled(request, response):
790-
try:
791-
path = 'switch/' + request.bits[2] + '/installed.json'
792-
with open(path, encoding="utf-8-sig") as f:
793-
response.write(f.read())
794-
return
795-
796-
except BaseException as e:
797-
error(request, response, str(e))

public_html/images/close.png

-2.47 KB
Binary file not shown.

public_html/images/download.png

-949 Bytes
Binary file not shown.
-959 Bytes
Binary file not shown.

public_html/images/flags/AU.png

-3.45 KB
Binary file not shown.

public_html/images/flags/CH.png

-2.06 KB
Binary file not shown.

public_html/images/flags/DE.png

-1.4 KB
Binary file not shown.

public_html/images/flags/ES.png

-2.3 KB
Binary file not shown.

public_html/images/flags/EU.png

-2.88 KB
Binary file not shown.

public_html/images/flags/FR.png

-1.53 KB
Binary file not shown.

0 commit comments

Comments
 (0)