Skip to content

Commit

Permalink
Update endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sonsoleslp committed Apr 9, 2022
1 parent eea48c6 commit 07a8606
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ exports.playInterface = async (name, req, res, next) => {
"isStudent": false,
"status": req.turn.status,
"endPoint": name,
"hostName": process.env.APP_NAME ? `https://${process.env.APP_NAME}` : "http://localhost:3000",
token,
"layout": false
});
Expand Down Expand Up @@ -112,7 +113,8 @@ exports.playInterface = async (name, req, res, next) => {
await exports.automaticallySetAttendance(team, req.session.user.id, req.escapeRoom.automaticAttendance);
const hints = await models.requestedHint.findAll({"where": {"teamId": team.id, "success": true}, "include": [{"model": models.hint, "include": [{"model": models.puzzle, "attributes": ["order"]}]}], "order": [["createdAt", "ASC"]]});

res.render("escapeRooms/play/play", {"escapeRoom": req.escapeRoom, cloudinary, "teams": [], team, token, "userId": req.session.user.id, "turnoId": team.turno.id, "teamId": team.id, "isStudent": true, "hints": hints || [], "endPoint": name, "layout": false});

res.render("escapeRooms/play/play", {"escapeRoom": req.escapeRoom, "hostName": process.env.APP_NAME ? `https://${process.env.APP_NAME}` : "http://localhost:3000", cloudinary, "teams": [], team, token, "userId": req.session.user.id, "turnoId": team.turno.id, "teamId": team.id, "isStudent": true, "hints": hints || [], "endPoint": name, "layout": false, });
} catch (err) {
next(err);
}
Expand Down
2 changes: 1 addition & 1 deletion public/js/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ var insertContent = (type, payload, puzzles, index, prevIndex) => {
content = rankingEmptyTemplate();
break;
case "text":
const replacedText = (payload.text || "").toString().replaceAll("__ESCAPP_USER__",encodeURIComponent(username)).replaceAll("__ESCAPP_TOKEN__",token).replaceAll("__ESCAPP_LOCALE__",ER.locale)
const replacedText = (payload.text || "").toString().replaceAll("__ESCAPP_USER__",encodeURIComponent(username)).replaceAll("__ESCAPP_TOKEN__",token).replaceAll("__ESCAPP_LOCALE__",ER.locale).replaceAll("__ESCAPP_ENDPOINT__",ER.escappEndpoint)
content = `<div class="cke_editable" id="block-${index}">${escapeUnsafeHtml(replacedText)}</div>`;
break;
case "progress":
Expand Down
1 change: 1 addition & 0 deletions views/escapeRooms/play/play.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
var token = "<%= token%>";
var ER = {
"locale": "<%=i18n.lang%>",
"escappEndpoint": "<%=hostName + "/escapeRooms/" + escapeRoom.id %>",
"info": {
"escapeRoomPuzzles": <%- JSON.stringify(puzzles)%>,
"totalPuzzles": <%= escapeRoom.puzzles.length %>,
Expand Down

0 comments on commit 07a8606

Please sign in to comment.