Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aac948f

Browse files
limit
1 parent dff02b3 commit aac948f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

‎client/src/NoteComponents/media/media.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@ import NotesContext from "../../Context/NotesContext"
88
import Modal, { ModalProps } from "../../Shared/Components/Modal/Modal"
99
import { downscaleImage } from "../../Shared/downscaleImage"
1010

11-
const MAX_PAYLOAD_SIZE = 100*1024
11+
const MAX_PAYLOAD_SIZE = 1000000
1212

1313
/**
1414
* Сжатие url изображения c проверкой размера
1515
* @param {String} uncompressed
1616
* @param {String} type
1717
*/
1818
async function getCompressed(uncompressed, type) {
19-
if (uncompressed.length < MAX_PAYLOAD_SIZE) return uncompressed
20-
const smallcompressedRes = await downscaleImage(uncompressed, type, 480)
19+
const smallcompressedRes = await downscaleImage(uncompressed, type, 720)
2120
if (smallcompressedRes.length < MAX_PAYLOAD_SIZE) return smallcompressedRes
22-
const mediumcompressedRes = await downscaleImage(uncompressed, type, 360)
21+
const mediumcompressedRes = await downscaleImage(uncompressed, type, 480)
2322
if (mediumcompressedRes.length < MAX_PAYLOAD_SIZE) return mediumcompressedRes
2423
const extracompressedRes = await downscaleImage(uncompressed, type, 240)
2524
if (extracompressedRes.length < MAX_PAYLOAD_SIZE) return extracompressedRes
@@ -105,7 +104,7 @@ function Media({ setNoteMedia, mediaList = [], style, className, disabled, noteI
105104
const src = typeof media === "object" && media && media.data
106105
return (
107106
<div className="card p-1 m-1" key={imgId} style={{ position: "relative" }}>
108-
<img className="img-fluid" style={{ maxWidth: "35em", maxHeight: "15em" }} src={src} alt="note img"></img>
107+
<img className="img-fluid" style={{ maxWidth: "35em", maxHeight: "15em" }} src={src} alt="note img"></img>
109108
<button
110109
style={{ position: "absolute", bottom: "0", right: "0", lineHeight: "1em", padding: "0.05em" }}
111110
className={`btn btn-danger m-1`}

‎server/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const WS_PORT = process.env.WS_PORT || 3030
2020

2121
const app = express()
2222

23-
app.use(express.json({ extended: true }))
23+
app.use(express.json({ extended: true,limit: "1mb" }))
2424

2525
app.get('/getSocketAddress', (req, res) => {
2626
getIp()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /