Export Web/SCORM : port complet du runtime jouable côté navigateur
Phase 1.2 de la feuille de route produit — un paquet SCORM tourne seul dans le LMS du client, sans serveur Forge Engine disponible. Ajoute static/js/play/offline/ (miroir JS de screens/rendering/ et data_actions/, sous window.FORGE_OFFLINE) pour que variables, score, données d'objet, répéteurs et conditions de visibilité fonctionnent entièrement en mémoire côté navigateur ; branche actions.js et bindings.js dessus au lieu d'un fetch() serveur. Ajoute publish/build_scorm_package.py (paquet statique + imsmanifest.xml SCORM 1.2 + wrapper API SCORM) et le bouton "Exporter (Web/SCORM)". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
9776fbc057
commit
f3b72d73c9
@@ -18,6 +18,7 @@ def game_play(slug):
|
||||
payload = screens.full_game_payload(slug)
|
||||
return render_template(
|
||||
"play.html", game=game, screens_data=payload["screens"], payload_json=json.dumps(payload),
|
||||
asset_url=lambda filename: url_for("static", filename=filename),
|
||||
runtime_payload_url=url_for("runtime_payload", slug=slug),
|
||||
flow_node_run_data_url=url_for("flow_node_run_data", slug=slug, node_id=999999),
|
||||
flow_node_run_variable_url=url_for("flow_node_run_variable", slug=slug, node_id=999999),
|
||||
|
||||
@@ -26,6 +26,7 @@ def game_play_public(slug):
|
||||
resp = app.make_response(
|
||||
render_template(
|
||||
"play.html", game=game, screens_data=payload["screens"], payload_json=json.dumps(payload),
|
||||
asset_url=lambda filename: url_for("static", filename=filename),
|
||||
runtime_payload_url=url_for("runtime_payload_public", slug=slug),
|
||||
flow_node_run_data_url=url_for("flow_node_run_data_public", slug=slug, node_id=999999),
|
||||
flow_node_run_variable_url=url_for("flow_node_run_variable_public", slug=slug, node_id=999999),
|
||||
|
||||
@@ -1 +1 @@
|
||||
from . import publish_game
|
||||
from . import publish_game, export_scorm
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import os
|
||||
|
||||
from flask import after_this_request, send_file
|
||||
|
||||
import db
|
||||
from publish.build_scorm_package import build_scorm_zip
|
||||
|
||||
from core.flask_app import app
|
||||
|
||||
|
||||
@app.route("/game/<slug>/export-scorm", methods=["POST"])
|
||||
def export_scorm(slug):
|
||||
"""Construit et renvoie le paquet Web/SCORM autonome du jeu (voir
|
||||
publish/build_scorm_package.py) — même garde d'accès que
|
||||
/game/<slug>/publish (core/auth_guard.py)."""
|
||||
zip_path, game_name = build_scorm_zip(slug)
|
||||
|
||||
@after_this_request
|
||||
def _cleanup(response):
|
||||
try:
|
||||
os.remove(zip_path)
|
||||
except OSError:
|
||||
pass
|
||||
return response
|
||||
|
||||
download_name = f"{db.slugify(game_name)}-scorm.zip"
|
||||
return send_file(zip_path, as_attachment=True, download_name=download_name, mimetype="application/zip")
|
||||
Reference in New Issue
Block a user