Skip to content

Commit

Permalink
v0.9.2: PR #33
Browse files Browse the repository at this point in the history
  • Loading branch information
Alanimdeo authored Aug 10, 2023
2 parents 01d98f6 + cffa303 commit c95477e
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 3 deletions.
4 changes: 3 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@conveyor/backend",
"version": "0.9.1",
"version": "0.9.2",
"author": "Alanimdeo <[email protected]>",
"license": "MIT",
"private": false,
Expand All @@ -23,6 +23,7 @@
"express-rate-limit": "^6.9.0",
"express-session": "^1.17.3",
"http-errors": "^2.0.0",
"lusca": "^1.7.0",
"luxon": "^3.3.0",
"memorystore": "^1.6.7",
"morgan": "~1.10.0",
Expand All @@ -35,6 +36,7 @@
"@types/express": "^4.17.17",
"@types/express-session": "^1.17.7",
"@types/http-errors": "^2.0.1",
"@types/lusca": "^1.7.1",
"@types/luxon": "^3.3.0",
"@types/morgan": "^1.9.4",
"@types/node": "^20.2.5",
Expand Down
9 changes: 9 additions & 0 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dotenv from "dotenv";
import express from "express";
import session from "express-session";
import rateLimit from "express-rate-limit";
import { csrf } from "lusca";
import createError from "http-errors";
import createMemoryStore from "memorystore";
import logger from "morgan";
Expand Down Expand Up @@ -46,6 +47,14 @@ async function main() {
})
);

server.use(
csrf({
cookie: {
name: "_csrf",
},
})
);

const rateLimiter = rateLimit({
windowMs: 60 * 1000,
max: 100,
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@conveyor/frontend",
"version": "0.9.1",
"version": "0.9.2",
"author": "Alanimdeo <[email protected]>",
"license": "MIT",
"private": false,
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ fetchInterceptor.register({
config.headers = {};
}
config.headers["Cookie"] = document.cookie;
if (config.method !== "GET" && config.headers["Content-Type"] === "application/json") {
const body = JSON.parse(config.body);
const cookie = decodeURIComponent(document.cookie);
const csrfToken = cookie.replace(/.*_csrf=(.{38})(;.*|$)/, "$1");
body["_csrf"] = csrfToken;
document.cookie = "_csrf=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
config.body = JSON.stringify(body);
}
return [url, config];
},
response(response) {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/PresetDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
{{ preset.name || "이름 없는 프리셋 " + preset.id }}
</ElButton>
</div>

<ElEmpty v-if="presets.length === 0" description="프리셋이 없습니다. 프리셋 탭에서 추가해 보세요!" />

<div class="end">
<ElButton @click="opened = false">취소</ElButton>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "conveyor",
"version": "0.9.1",
"version": "0.9.2",
"author": "Alanimdeo <[email protected]>",
"private": true,
"license": "MIT",
Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,13 @@
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.196.tgz#a7c3d6fc52d8d71328b764e28e080b4169ec7a95"
integrity sha512-22y3o88f4a94mKljsZcanlNWPzO0uBsBdzLAngf2tp533LzZcQzb6+eZPJ+vCTt+bqF2XnvT9gejTLsAcJAJyQ==

"@types/lusca@^1.7.1":
version "1.7.1"
resolved "https://registry.yarnpkg.com/@types/lusca/-/lusca-1.7.1.tgz#63ac2df1d169994e4ca2b73cb523143eb5bef038"
integrity sha512-tBm6OaEVK/DHxVPfwe7PsZv0zVyOB7bPTdn3FKFRSBZ6NY5Tqis4fLfYHxgsbMO5TvTG2XrGnboIleW11tOzkw==
dependencies:
"@types/express" "*"

"@types/luxon@^3.3.0":
version "3.3.1"
resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-3.3.1.tgz#08727da7d81ee6a6c702b9dc6c8f86be010eb4dc"
Expand Down Expand Up @@ -2896,6 +2903,13 @@ lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1:
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.0.tgz#b9e2a6a72a129d81ab317202d93c7691df727e61"
integrity sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==

lusca@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/lusca/-/lusca-1.7.0.tgz#a5d979f1b51776e60d41e0ca98f886f1b8b95502"
integrity sha512-msnrplCfY7zaqlZBDEloCIKld+RUeMZVeWzSPaGUKeRXFlruNSdKg2XxCyR+zj6BqzcXhXlRnvcvx6rAGgsvMA==
dependencies:
tsscmp "^1.0.5"

luxon@^3.3.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.4.0.tgz#17cb754efecbf76994f05b2a3f1f91fad7ddfde7"
Expand Down Expand Up @@ -4418,6 +4432,11 @@ tsconfig-paths@^4.2.0:
minimist "^1.2.6"
strip-bom "^3.0.0"

tsscmp@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/tsscmp/-/tsscmp-1.0.6.tgz#85b99583ac3589ec4bfef825b5000aa911d605eb"
integrity sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==

tuf-js@^1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/tuf-js/-/tuf-js-1.1.7.tgz#21b7ae92a9373015be77dfe0cb282a80ec3bbe43"
Expand Down

0 comments on commit c95477e

Please sign in to comment.