All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+### [0.2.12](https://git.xangelo.ca/?p=risinglegends.git;a=commitdiff;h=v0.2.12;hp=v0.2.11;ds=sidebyside) (2023-08-21)
+
+
+### Features
+
+* return to town button while travelling fd070de
+
+
+### Bug Fixes
+
+* xss chat input 943cbc3
+
### [0.2.11](https://git.xangelo.ca/?p=risinglegends.git;a=commitdiff;h=v0.2.11;hp=v0.2.10;ds=sidebyside) (2023-08-21)
{
"name": "rising-legends",
- "version": "0.2.11",
+ "version": "0.2.12",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "rising-legends",
- "version": "0.2.11",
+ "version": "0.2.12",
"dependencies": {
"@honeycombio/opentelemetry-node": "^0.4.0",
"@opentelemetry/auto-instrumentations-node": "^0.37.0",
"socket.io-client": "^4.6.1",
"uuid": "^9.0.0",
"webpack": "^5.84.1",
- "webpack-cli": "^5.1.1"
+ "webpack-cli": "^5.1.1",
+ "xss": "^1.0.14"
},
"devDependencies": {
"@commitlint/cli": "^17.6.6",
"node": ">= 8"
}
},
+ "node_modules/cssfilter": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz",
+ "integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw=="
+ },
"node_modules/csv-parse": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.4.0.tgz",
"resolved": "https://registry.npmjs.org/xorshift/-/xorshift-1.2.0.tgz",
"integrity": "sha512-iYgNnGyeeJ4t6U11NpA/QiKy+PXn5Aa3Azg5qkwIFz1tBLllQrjjsk9yzD7IAK0naNU4JxdeDgqW9ov4u/hc4g=="
},
+ "node_modules/xss": {
+ "version": "1.0.14",
+ "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz",
+ "integrity": "sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw==",
+ "dependencies": {
+ "commander": "^2.20.3",
+ "cssfilter": "0.0.10"
+ },
+ "bin": {
+ "xss": "bin/xss"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ }
+ },
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"which": "^2.0.1"
}
},
+ "cssfilter": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz",
+ "integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw=="
+ },
"csv-parse": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.4.0.tgz",
"resolved": "https://registry.npmjs.org/xorshift/-/xorshift-1.2.0.tgz",
"integrity": "sha512-iYgNnGyeeJ4t6U11NpA/QiKy+PXn5Aa3Azg5qkwIFz1tBLllQrjjsk9yzD7IAK0naNU4JxdeDgqW9ov4u/hc4g=="
},
+ "xss": {
+ "version": "1.0.14",
+ "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz",
+ "integrity": "sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw==",
+ "requires": {
+ "commander": "^2.20.3",
+ "cssfilter": "0.0.10"
+ }
+ },
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
{
"name": "rising-legends",
"private": true,
- "version": "0.2.11",
+ "version": "0.2.12",
"scripts": {
"up": "npx prisma migrate dev --name \"init\"",
"start": "pm2 start dist/server/api.js",
"socket.io-client": "^4.6.1",
"uuid": "^9.0.0",
"webpack": "^5.84.1",
- "webpack-cli": "^5.1.1"
+ "webpack-cli": "^5.1.1",
+ "xss": "^1.0.14"
},
"nodemonConfig": {
"ignore": [
}
#travelling {
- padding-top: 2rem;
+ padding: 2rem;
}
#travelling-actions {
display: flex;
import { join } from 'path';
import express, {Request, Response} from 'express';
import bodyParser from 'body-parser';
+import xss from 'xss';
import http from 'http';
import { Server, Socket } from 'socket.io';
}
}
else {
- message = broadcastMessage(req.player.username, msg);
+ message = broadcastMessage(req.player.username, xss(msg));
chatHistory.push(message);
chatHistory.slice(-10);
}
}
});
+app.post('/travel/return-to-source', authEndpoint, async (req: AuthRequest, res: Response) => {
+ // puts the player back in their starting town
+ // doesn't matter if they don't have one
+ // redirect them!
+ await clearTravelPlan(req.player.id);
+ const equippedItems = await getEquippedItems(req.player.id);
+
+ const fight = await loadMonsterFromFight(req.player.id);
+ if(fight) {
+ // go to the fight screen
+ const data: MonsterForFight = {
+ id: fight.id,
+ hp: fight.hp,
+ maxHp: fight.maxHp,
+ name: fight.name,
+ level: fight.level,
+ fight_trigger: fight.fight_trigger
+ };
+ const location = await getMonsterLocation(fight.ref_id);
+
+ res.send(renderPlayerBar(req.player, equippedItems) + renderFightPreRound(data, true, location, req.player.city_id));
+ }
+ else {
+ const [city, locations, paths] = await Promise.all([
+ getCityDetails(req.player.city_id),
+ getAllServices(req.player.city_id),
+ getAllPaths(req.player.city_id)
+ ]);
+
+ res.send(renderPlayerBar(req.player, equippedItems) + await renderMap({city, locations, paths}, req.player.city_id));
+
+ }
+
+});
+
app.post('/travel/:destination_id', authEndpoint, async (req: AuthRequest, res: Response) => {
- if(req.player.hp <= 0) {
+if(req.player.hp <= 0) {
logger.log(`Player didn\'t have enough hp`);
res.send(Alert.ErrorAlert('Sorry, you need some HP to start travelling.'));
return;
let promptText = data.walkingText;
const blockTime = data.nextAction || 0;
- /*
- if(blockTime) {
- updateStepButton();
- }
- */
-
let html = `<section id="explore" class="tab active" hx-swap-oob="true" style="background-image: url('/assets/img/map/${data.closestTown}.jpeg')">
<div id="travelling" class="city-details">`;
html += '</div>';
html += `<p>${promptText}</p>`;
+ html += `<p align="right"><a href="#" hx-post="/travel/return-to-source">Return to ${data.travelPlan.source_city_name}</a></p>`;
+
html += '</div></section>';
return html;