4 changed files with 79 additions and 4 deletions
@ -0,0 +1,65 @@ |
|||||
|
from fastapi import FastAPI |
||||
|
from fastapi.middleware.cors import CORSMiddleware |
||||
|
from pydantic import BaseModel |
||||
|
|
||||
|
import uvicorn |
||||
|
|
||||
|
from time import time |
||||
|
|
||||
|
app = FastAPI() |
||||
|
|
||||
|
main_req = "/apipanda/v2/game/755/tele2-panda-kombat/config" |
||||
|
|
||||
|
@app.get(main_req) |
||||
|
async def root(): |
||||
|
return { |
||||
|
"canPlay": True, |
||||
|
"serverTime": int(time()), |
||||
|
"errorCode": 0, |
||||
|
"errorMessage": None, |
||||
|
"tryAvailable": 1, |
||||
|
"nextFreeTryAt": int(time()) + 86400 |
||||
|
} |
||||
|
|
||||
|
@app.options(main_req) |
||||
|
async def opt(): |
||||
|
return None |
||||
|
|
||||
|
@app.post("/apipanda/v2/game/755/tele2-panda-kombat/game/start") |
||||
|
async def start(): |
||||
|
return {"gameSessionId":"1234567890"} |
||||
|
|
||||
|
@app.options("/apipanda/v2/game/755/tele2-panda-kombat/game/start") |
||||
|
async def start_opt(): |
||||
|
return None |
||||
|
|
||||
|
class GameEnd(BaseModel): |
||||
|
gameSessionId: str |
||||
|
duration: int |
||||
|
score: int |
||||
|
|
||||
|
@app.post("/apipanda/v2/game/755/tele2-panda-kombat/game/end") |
||||
|
async def end(gameEnd: GameEnd): |
||||
|
return {"win": 1} ## 0 если вебал |
||||
|
|
||||
|
@app.options("/apipanda/v2/game/755/tele2-panda-kombat/game/end") |
||||
|
async def end_opt(): |
||||
|
return None |
||||
|
|
||||
|
origins = [ |
||||
|
"http://localhost:5500", |
||||
|
"http://localhost:8000", |
||||
|
"http://127.0.0.1:5500", |
||||
|
"http://127.0.0.1:8000" |
||||
|
] |
||||
|
|
||||
|
app.add_middleware( |
||||
|
CORSMiddleware, |
||||
|
allow_origins=origins, |
||||
|
allow_credentials=True, |
||||
|
allow_methods=["*"], |
||||
|
allow_headers=["*"], |
||||
|
) |
||||
|
|
||||
|
if __name__ == "__main__": |
||||
|
uvicorn.run(app, host="0.0.0.0", port=8000) |
@ -1,7 +1,16 @@ |
|||||
function run() { |
function run() { |
||||
var code = `window.gameReader = (function(){var self = window.gameReader || {};self._e = self._e || [];self.ready = self.ready || function (f) {self._e.push(f);};return self;})();window.gameReader.ready(function(){window.initGame({"gameInstanceId":755,"gameResources":{"fonts":{"InternalPrimaryFontNormalNormal":"swyswxm5x1jvdj6eoupayes7kh.ttf","InternalPrimaryFontBoldNormal":"jy4gofnzg95z4mzh1mfk8dnfqn.ttf"},"assets":[]},"storyId":null,"elementId":null,"projectSlug":"tele2-app","demoMode":false,"projectEnv":"prod","verbose":false,"gameDomain":"https://games.inappstory.com/tele2-panda-kombat/1.0.9/build/","gameSlug":"tele2-panda-kombat","gameVersion":"1.0.9","clientConfig":"{{%sdkConfig}}"});});`; |
let sdkConfiggg = JSON.stringify({ |
||||
|
"apiBaseUrl":"http://127.0.0.1:8000/apipanda", |
||||
|
"appPackageId":228, |
||||
|
"userAgent":"abama", |
||||
|
"userId":1477, |
||||
|
"deviceId":1488, |
||||
|
"sessionId":"qwerty", |
||||
|
"apiKey":"gesgesg", |
||||
|
"placeholders":"aboba"}); |
||||
|
var code = `window.gameReader = (function(){var self = window.gameReader || {};self._e = self._e || [];self.ready = self.ready || function (f) {self._e.push(f);};return self;})();window.gameReader.ready(function(){window.initGame({"gameInstanceId":755,"gameResources":{"fonts":{"InternalPrimaryFontNormalNormal":"swyswxm5x1jvdj6eoupayes7kh.ttf","InternalPrimaryFontBoldNormal":"jy4gofnzg95z4mzh1mfk8dnfqn.ttf"},"assets":[]},"storyId":null,"elementId":null,"projectSlug":"tele2-app","demoMode":false,"projectEnv":"prod","verbose":false,"gameDomain":"https://games.inappstory.com/tele2-panda-kombat/1.0.9/build/","gameSlug":"tele2-panda-kombat","gameVersion":"1.0.9","clientConfig":${sdkConfiggg}});});`; |
||||
var onLoad = function() { try{ eval(code); } catch (e) { window.gameLoadingInfo && (window.gameLoadingInfo.error = e.message); window.gameLoadFailed && window.gameLoadFailed(window.gameLoadingInfo.error, false); console.error(e); window._sendErrorLog && window._sendErrorLog({message: e.message, code: code}); }}; |
var onLoad = function() { try{ eval(code); } catch (e) { window.gameLoadingInfo && (window.gameLoadingInfo.error = e.message); window.gameLoadFailed && window.gameLoadFailed(window.gameLoadingInfo.error, false); console.error(e); window._sendErrorLog && window._sendErrorLog({message: e.message, code: code}); }}; |
||||
if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", onLoad);} else { onLoad();}if (window.Android && window.sessionStorage != null) { window.sessionStorage.setItem("_initQueue", JSON.stringify([`window.initGame({"gameInstanceId":755,"gameResources":{"fonts":{"InternalPrimaryFontNormalNormal":"swyswxm5x1jvdj6eoupayes7kh.ttf","InternalPrimaryFontBoldNormal":"jy4gofnzg95z4mzh1mfk8dnfqn.ttf"},"assets":[]},"storyId":null,"elementId":null,"projectSlug":"tele2-app","demoMode":false,"projectEnv":"prod","verbose":false,"gameDomain":"https://games.inappstory.com/tele2-panda-kombat/1.0.9/build/","gameSlug":"tele2-panda-kombat","gameVersion":"1.0.9","clientConfig":"{{%sdkConfig}}"})`]));} |
if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", onLoad);} else { onLoad();}if (window.Android && window.sessionStorage != null) { window.sessionStorage.setItem("_initQueue", JSON.stringify([`window.initGame({"gameInstanceId":755,"gameResources":{"fonts":{"InternalPrimaryFontNormalNormal":"swyswxm5x1jvdj6eoupayes7kh.ttf","InternalPrimaryFontBoldNormal":"jy4gofnzg95z4mzh1mfk8dnfqn.ttf"},"assets":[]},"storyId":null,"elementId":null,"projectSlug":"tele2-app","demoMode":false,"projectEnv":"prod","verbose":false,"gameDomain":"https://games.inappstory.com/tele2-panda-kombat/1.0.9/build/","gameSlug":"tele2-panda-kombat","gameVersion":"1.0.9","clientConfig":${sdkConfiggg}})`]));} |
||||
} |
} |
||||
|
|
||||
window.onload = run(); |
window.onload = run(); |
Loading…
Reference in new issue