import React, { Component } from "react"; import { Image, Icon, Modal, Comment, Flag, Embed, Form, Button, Confirm } from "semantic-ui-react"; import Moment from "react-moment"; import "moment/locale/es"; import { avatars } from "./Quotes"; import ReplyForm from "./ReplyForm"; const ImageModal = ({ href, trigger }) => ( ); const ReportModal = ({ trigger, threadId, postId, dir }) => ( Reportar

Para pedir que el post #{postId} sea eliminado, indica una razón y presiona el botón Reportar.

Normalmente eliminamos los mensajes que son considerados spam o flood.
Si deseas pedir la prohibición de acceso a algún usuario persistente, te recomendamos hacerlo en la sección /bai/.

); const QuickReplyModal = ({ trigger, currentBoard, id, locked, replyIndex }) => ( Respuesta rápida. ); class Post extends Component { constructor(props) { super(props); this.state = { deleteDialog: false }; this.showDialog = this.showDialog.bind(this); this.handleCancel = this.handleCancel.bind(this); this.handleConfirm = this.handleConfirm.bind(this); } showDialog() { this.setState({ deleteDialog: true }); } handleCancel() { this.setState({ deleteDialog: false }); } handleConfirm() { this.setState({ deleteDialog: false }); const { post, currentBoard } = this.props; let password = JSON.parse(localStorage.getItem("settings")).postPassword; fetch( `https://bienvenidoainternet.org/cgi/api/delete?dir=${currentBoard.dir}&id=${post.id}&password=${password}` ) .then(response => { return response.json(); }) .then(resource => { // TODO: Reportar resultado }); } render() { const { index, post, locked, threadId, currentBoard, nightMode, totalReplies } = this.props; const filesize = require("filesize"); // Manejo de posts eliminados if (post.IS_DELETED > 0) { return ( #{currentBoard.board_type === 0 ? post.id : index + 1}
Eliminado por el {post.IS_DELETED === 1 ? "usuario." : "Staff."}
); } // Obtener un avatar aleatorio basado en ID let userID = post.timestamp_formatted.split(" ID:")[1]; if (userID === undefined) { userID = ""; } const seedrandom = require("seedrandom"); const rng = seedrandom(threadId + index); const idRng = seedrandom(userID); let idColor = "rgb(" + Math.round(idRng() * 255) + ", " + Math.round(idRng() * 200) + ", " + Math.round(idRng() * 200) + ")"; let rndAvatar, hue; if (userID !== "") { let i = Math.round(idRng() * (avatars.length - 1)); rndAvatar = avatars[i]; hue = Math.round(idRng() * 360); } else { let i = Math.round(rng() * (avatars.length - 1)); rndAvatar = avatars[i]; hue = Math.round(rng() * 360); } // Obetener bandera del pais (para /world) let flag; if (currentBoard.dir === "world") { flag = post.name.match("[A-Z][A-Z]"); if (flag !== null) { flag = flag[0].toLowerCase(); } else { flag = "kp"; // heh } } // Fix: imagenes en dominio incorrecto post.message = post.message.replace( ' { if (reply.thread_id === post.parentid) { if (reply.reply_id === post.id) { isMine = true; } } }); } } let iconColor = "grey"; let icon = "user"; let settingBrowserId = JSON.parse(localStorage.getItem("settings")) .browserId; if (userID.length > 8 && settingBrowserId) { let sufix = userID.substr(8, 1); const browser = { F: "firefox", C: "chrome", s: "safari", S: "SeaMonkey", o: "opera", I: "internet explorer", E: "microsoft edge", a: "android" }; if (Object.keys(browser).includes(sufix)) { icon = browser[sufix]; } } if (userID === "CAP_USER*") { iconColor = "blue"; icon = "check circle"; userID = "Usuario verificado"; } else if (isMine) { iconColor = "olive"; } else if (userID.startsWith("???")) { icon = "user secret"; } if (post.name === "Renard ★") { iconColor = "yellow"; icon = "chess queen"; userID = "Bai-Client Dev"; idColor = "#FBBD08"; } if (post.name === "TOW ★") { iconColor = "pink"; icon = "chess queen"; userID = "Weabot Dev"; idColor = "#e03997"; } if (post.name === "Staff ★") { userID = "Staff de BaI"; idColor = "rgba(255, 255, 255, 0.7);"; } let hasVideo = post.file.endsWith(".webm"); let hasAudio = post.file.endsWith(".mp3") || post.file.endsWith(".opus") || post.file.endsWith(".ogg"); let isMime = post.file.endsWith(".epub") || post.file.endsWith(".mod") || post.file.endsWith(".pdf") || post.file.endsWith(".s3m") || post.file.endsWith(".swf") || post.file.endsWith(".torrent") || post.file.endsWith(".xm"); let isDeleteable = true; // No se pueden eliminar hilos con más de 5 respuestas if (index === 0 && totalReplies > 5) { isDeleteable = false; } // No se pueden eliminar hilos/post de /cero/ if (currentBoard.dir === "0") { isDeleteable = false; } // No se pueden eliminar post con una antiguedad superior a 24 horas if (Date.now() / 1000 - post.timestamp > 86400) { isDeleteable = false; } let settingRenderAvatar = JSON.parse(localStorage.getItem("settings")) .showAvatars; let settingEmbedYoutube = JSON.parse(localStorage.getItem("settings")) .embedYoutube; let settingColorifyIDs = JSON.parse(localStorage.getItem("settings")) .colorifyIDs; return ( {settingRenderAvatar && ( )} #{currentBoard.board_type === 0 ? post.id : index + 1}{" "} {currentBoard.dir === "world" ? post.name.split("")[0] : post.name}{" "} {currentBoard.dir === "world" ? : null} {post.tripcode}
{settingColorifyIDs ? ( {userID} ) : ( userID )} {isMine ? " (Tú)" : null}
{post.file !== "" ? (
{hasVideo && ( // eslint-disable-next-line jsx-a11y/media-has-caption
) : null} {youtubeVideos !== null && settingEmbedYoutube ? youtubeVideos.map((url, i) => { let id = url.split("?v=")[1]; return (
); }) : null}
{locked ? null : ( Responder} currentBoard={currentBoard} id={threadId} locked={locked} replyIndex={currentBoard.board_type === 0 ? post.id : index + 1} /> )} Reportar} postId={post.id} /> {isDeleteable && ( Eliminar )} ); } } export default Post;