Compare commits

..

24 Commits

Author SHA1 Message Date
katboi01 a51c8117d0 undo downloader changes 2025-03-17 00:14:07 +01:00
katboi01 b5d63d1d00 moved archive to a separate repo 2025-03-15 20:02:36 +01:00
katboi01 11edbf3abf removed ArchiveOld, added more data to posts, added DMM proxy endpoint 2025-01-27 12:00:15 +01:00
katboi01 3f8f9f708f added new endpoint 2025-01-23 02:12:04 +01:00
katboi01 18aa1843cd proxy test 2025-01-21 13:54:11 +01:00
katboi01 8733294f13 constrained download mode for accounts list 2025-01-18 13:16:52 +01:00
katboi01 fee0ecfe75 added commands 2025-01-17 12:10:15 +01:00
katboi01 fb4ad30d03 added commands (test) 2025-01-17 12:03:00 +01:00
katboi01 2623106212 queries updated to use dictionaries 2025-01-15 21:42:59 +01:00
katboi01 16c7792b7f Added old archive endpoints 2025-01-15 13:56:06 +01:00
katboi01 2a852388bf sql command file load 2025-01-13 01:20:39 +01:00
katboi01 50559223ed added account post count endpoint 2025-01-12 10:31:25 +01:00
katboi01 6b0de05a80 added post order modes 2025-01-11 18:46:01 +01:00
katboi01 155394ab75 added GetPosts/Count endpoint 2025-01-11 17:54:42 +01:00
katboi01 794bf9d30b updated filter 2025-01-05 18:49:14 +01:00
katboi01 6157eb1e40 added artist filter 2025-01-02 23:21:56 +01:00
katboi01 db728f21ba added filter by account rating 2025-01-02 22:21:58 +01:00
katboi01 cbe0074c70 fixes 2025-01-02 13:39:42 +01:00
katboi01 3a247d6ce1 additional archive endpoints 2025-01-02 12:51:52 +01:00
katboi01 e7d21a90bb added hidden posts to filter. added date 2024-12-31 16:01:51 +01:00
katboi01 8b12ca9dae added get_posts endpoint 2024-12-31 12:35:31 +01:00
katboi01 76b6c6cb79 fix 2024-12-26 16:40:22 +01:00
katboi01 2b121be258 Added archive module 2024-12-26 15:54:55 +01:00
katboi01 eefb47476a fix 2024-12-26 15:27:03 +01:00
7 changed files with 52 additions and 89 deletions

6
app.py
View File

@ -3,7 +3,7 @@ from flask_restful import Api
from modules.KF3.database import Database as KF3DB from modules.KF3.database import Database as KF3DB
from modules.Kingdom.database import Database as KFKDB from modules.Kingdom.database import Database as KFKDB
from modules.JapariSling.database import Database as KFSL from modules.proxy import AgreementProxy, LaunchProxy, UpdateProxy
app = Flask(__name__) app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False app.config['JSON_AS_ASCII'] = False
@ -11,9 +11,11 @@ app.databases = {}
api = Api(app) api = Api(app)
api.add_resource(LaunchProxy, "/DMM/launch")
api.add_resource(UpdateProxy, "/DMM/filelist", "/DMM/update")
api.add_resource(AgreementProxy, "/DMM/agreement")
KF3DB(api) KF3DB(api)
KFKDB(api) KFKDB(api)
KFSL(api)
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='127.0.0.1', port=8080, debug=True) app.run(host='127.0.0.1', port=8080, debug=True)

View File

@ -1,7 +0,0 @@
from typing import List
from .construct_serialized import ConstructSerialized
class ConstructLevel:
Name : str
Description : str
Objects : List[ConstructSerialized]

View File

@ -1,13 +0,0 @@
class SVector3:
x : float
y : float
z : float
class ConstructSerialized:
Id : int
Variant : int
Position : SVector3
Rotation : SVector3
Width : float
Height : float
Properties : int

View File

@ -1,15 +0,0 @@
from .endpoints.get import Get
from .endpoints.upload import Upload
class Database:
def __init__(self, api) -> None:
app = api.app
if "JapariSling" in app.databases:
del app.databases["JapariSling"]
app.databases["JapariSling"] = self
api.add_resource(Upload, "/JapariSling/Upload")
api.add_resource(Get, "/JapariSling/Get")

View File

@ -1,23 +0,0 @@
import os
import json
from flask_restful import Resource
from flask import abort, request, current_app as app
class Get(Resource):
def get(self):
dir_name = os.path.join(app.root_path, 'data', 'JapariSling')
files = [json.loads(read_file(os.path.join(dir_name, f))) for f in os.listdir(dir_name) if os.path.isfile(os.path.join(dir_name, f))]
files = files[:10]
files = {"levels": files}
response = app.response_class(
response = json.dumps(files),
status=200,
mimetype='application/json'
)
response.headers.add("Access-Control-Allow-Origin", "*")
return response
def read_file(path):
with open(path, 'r') as f:
return f.read()

View File

@ -1,29 +0,0 @@
import os
import json
from flask_restful import Resource
from ..classes.construct_level import ConstructLevel
from flask import abort, request, current_app as app
class Upload(Resource):
def post(self):
cl = request.content_length
if cl is not None and cl > 1024:
abort(413)
content = request.json
if "Name" not in content:
abort(400)
filename = os.path.join(app.root_path, 'data', 'JapariSling', content["Name"] + '.json')
with open(filename, "wt") as text_file:
text_file.write(json.dumps(content, ensure_ascii=False, indent=1))
response = app.response_class(
response="level uploaded",
status=200,
mimetype='text/plain'
)
response.headers.add("Access-Control-Allow-Origin", "*")
return response

48
modules/proxy.py Normal file
View File

@ -0,0 +1,48 @@
from flask_restful import Resource
from flask import current_app as app, request, Request
import requests
def relayRequest(user_request : Request, url, headers):
with requests.Session() as session:
requests.utils.add_dict_to_cookiejar(session.cookies, user_request.cookies)
response = session.post(url, headers=headers, data=request.data)
result = app.response_class(
response=response.text,
status=200,
mimetype='application/json'
)
result.headers.add("Access-Control-Allow-Origin", "*")
return result
class LaunchProxy(Resource):
def post(self):
url = "https://apidgp-gameplayer.games.dmm.com/v5/launch/cl"
headers = {"User-Agent": "DMMGamePlayer5-Win/5.3.12 Electron/32.1.0",
"Client-App": "DMMGamePlayer5",
"Client-version": "5.3.12",
"Content-Type": "application/json"}
return relayRequest(request, url, headers)
class UpdateProxy(Resource):
def post(self):
url = "https://apidgp-gameplayer.games.dmm.com/v5/r2/launch/cl"
headers = {"User-Agent": "DMMGamePlayer5-Win/5.3.12 Electron/32.1.0",
"Client-App": "DMMGamePlayer5",
"Client-version": "5.3.12",
"Content-Type": "application/json"}
return relayRequest(request, url, headers)
class AgreementProxy(Resource):
def post(self):
url = "https://apidgp-gameplayer.games.dmm.com/v5/agreement/confirm/client"
headers = {"User-Agent": "DMMGamePlayer5-Win/5.3.12 Electron/32.1.0",
"Client-App": "DMMGamePlayer5",
"Client-version": "5.3.12",
"Content-Type": "application/json"}
return relayRequest(request, url, headers)