Compare commits

..

No commits in common. "a603946868597b9dd176f2fb5f96e6288e85f3b1" and "f400bbe251de8ad1128a93e6e65976a945d5a78b" have entirely different histories.

4 changed files with 16 additions and 23 deletions

View File

@ -19,8 +19,6 @@ const md = require("markdown-it")()
}),
});
/* global Buffer */
let settings = {
SETUP_COMPLETE: false,
ACCOUNT_REGISTRATION: false,
@ -395,10 +393,10 @@ async function updateBiography({ requester_id, author_id, biography_content }) {
return _r(true);
}
async function uploadMedia({ parent_id, parent_type, file_buffer, content_type }, { resolution_override }) {
async function uploadMedia({ parent_id, parent_type, file_buffer, content_type }) {
if (!use_s3_storage) return null;
const content_name = crypto.randomUUID();
let maximum_image_resolution = resolution_override || { width: 1920, height: 1080 };
let maximum_image_resolution = { width: 1920, height: 1080 };
// Images
const compressed_image = await sharp(Buffer.from(file_buffer.split(",")[1], "base64"), { animated: true })

View File

@ -47,10 +47,7 @@ async function postImage(request, response) {
// TODO: Permissions for uploading images
// TODO: Verification for image uploading
// FIXME: Naming
let resolution_override;
if (request.body.parent_type === "user") resolution_override = { width: 500, height: 500 };
return response.json(await core.uploadMedia({ parent_id: request.body.post_id || request.body.parent_id, parent_type: request.body.parent_type, file_buffer: request.body.buffer, content_type: request.body.content_type }, { resolution_override: resolution_override }));
return response.json(await core.uploadMedia({ parent_id: request.body.post_id || request.body.parent_id, parent_type: request.body.parent_type, file_buffer: request.body.buffer, content_type: request.body.content_type }));
}
async function deleteImage(req, res) {
// TODO: Permissions for deleting image

View File

@ -82,18 +82,3 @@ function _readFile(file) {
reader.readAsDataURL(file);
});
}
async function updateBiography() {
let form_data = {
media: media,
content: qs("#post-content").value,
id: window.location.href.split("/")[4],
};
const post_response = await request("/api/web/biography", "PATCH", form_data);
if (post_response.body.success) {
window.location.href = `/post/${post_response.body.post_id}`;
}
}

View File

@ -86,3 +86,16 @@ function _readFile(file) {
});
}
async function updateBiography() {
let form_data = {
media: media,
content: qs("#post-content").value,
id: window.location.href.split("/")[4],
};
const post_response = await request("/api/web/biography", "PATCH", form_data);
if (post_response.body.success) {
window.location.href = `/post/${post_response.body.post_id}`;
}
}